Skip to content

Commit 0b0b8c5

Browse files
feat(qwik-nx): add "excludeProjects.keepUnrelatedProjects" option for the qwikNxVite plugin (#137)
1 parent 596b919 commit 0b0b8c5

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

packages/qwik-nx/src/plugins/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from './qwik-nx-vite.plugin';
22
export type {
33
ProjectFilter,
4+
ExcludeProjectFilter,
45
QwikNxVitePluginOptions,
56
} from './models/qwik-nx-vite';

packages/qwik-nx/src/plugins/models/qwik-nx-vite.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ export interface ProjectFilter {
77
customFilter?: (project: ProjectConfiguration) => boolean;
88
}
99

10+
export interface ExcludeProjectFilter extends ProjectFilter {
11+
/**
12+
* Set to "true" to keep projects, that are not dependant on the current app according to Nx project graph.
13+
* By default only related projects are included.
14+
*/
15+
keepUnrelatedProjects?: boolean;
16+
}
17+
1018
export interface QwikNxVitePluginOptions {
1119
/**
1220
* Name of the project, with which plugin is used. By default it will be resolved using the path of the `rootDir` from the Vite environment.
@@ -20,7 +28,7 @@ export interface QwikNxVitePluginOptions {
2028
/**
2129
* Projects to be excluded from the list of resolved vendor roots.
2230
*/
23-
excludeProjects?: ProjectFilter;
31+
excludeProjects?: ExcludeProjectFilter;
2432
debug?: boolean;
2533
}
2634

packages/qwik-nx/src/plugins/qwik-nx-vite.plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { getVendorRoots } from './utils/get-vendor-roots';
1010
* At this point its main purpose is to provide Nx libraries as vendor roots for the Qwik.
1111
* This is required in order for the optimizer to be able to work with entities imported from those libs.
1212
*
13-
* If `options.includeProjects` is not provided, `qwikNxVite` plugin will provide Qwik with paths of Nx projects,
13+
* By default `qwikNxVite` plugin will provide Qwik with paths of Nx projects,
1414
* that are recognized as dependencies of the current one and are specified in the tsconfig.base.json.
15-
* this behavior is customizable: you can exclude additional projects by providing `options.excludeProjects`
15+
* this behavior is customizable: you can exclude additional projects by providing `options.excludeProjects.keepUnrelatedProjects`,
1616
* or completely control what's included by using `options.includeProjects`
1717
*/
1818
export function qwikNxVite(options?: QwikNxVitePluginOptions): Plugin {

packages/qwik-nx/src/plugins/utils/get-vendor-roots.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export async function getVendorRoots(
4646

4747
projects = projects.filter((p) => p.name !== currentProjectName);
4848

49-
if (!options?.includeProjects) {
49+
if (!options?.excludeProjects?.keepUnrelatedProjects) {
5050
// by default including only project dependencies
5151
const dependencies = await getProjectDependencies(currentProjectName);
5252
projects = projects.filter((p) => dependencies.has(p.name!));

0 commit comments

Comments
 (0)