@o3r/schematics 10.0.0-next.0 → 10.0.0-next.7
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +28 -28
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +8 -6
- package/schematics/ng-add/index.js.map +1 -1
- package/src/interfaces/angular-workspace.d.ts +8 -1
- package/src/interfaces/angular-workspace.d.ts.map +1 -1
- package/src/rule-factories/get-test-frameworks/index.d.ts +10 -0
- package/src/rule-factories/get-test-frameworks/index.d.ts.map +1 -0
- package/src/rule-factories/get-test-frameworks/index.js +35 -0
- package/src/rule-factories/get-test-frameworks/index.js.map +1 -0
- package/src/rule-factories/index.d.ts +1 -0
- package/src/rule-factories/index.d.ts.map +1 -1
- package/src/rule-factories/index.js +1 -0
- package/src/rule-factories/index.js.map +1 -1
- package/src/rule-factories/ng-add/index.d.ts +3 -1
- package/src/rule-factories/ng-add/index.d.ts.map +1 -1
- package/src/rule-factories/ng-add/index.js +82 -59
- package/src/rule-factories/ng-add/index.js.map +1 -1
- package/src/tasks/ng-add/index.d.ts +2 -0
- package/src/tasks/ng-add/index.d.ts.map +1 -1
- package/src/tasks/ng-add/index.js.map +1 -1
- package/src/utility/file-info.d.ts +2 -1
- package/src/utility/file-info.d.ts.map +1 -1
- package/src/utility/file-info.js +3 -2
- package/src/utility/file-info.js.map +1 -1
- package/src/utility/loaders.d.ts +7 -0
- package/src/utility/loaders.d.ts.map +1 -1
- package/src/utility/loaders.js +15 -2
- package/src/utility/loaders.js.map +1 -1
- package/src/utility/modules.d.ts +7 -2
- package/src/utility/modules.d.ts.map +1 -1
- package/src/utility/modules.js +16 -7
- package/src/utility/modules.js.map +1 -1
- package/src/utility/monorepo.d.ts +6 -0
- package/src/utility/monorepo.d.ts.map +1 -1
- package/src/utility/monorepo.js +12 -1
- package/src/utility/monorepo.js.map +1 -1
package/package.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "@o3r/schematics",
|
3
|
-
"version": "10.0.0-next.
|
3
|
+
"version": "10.0.0-next.7",
|
4
4
|
"description": "Schematics module of the Otter framework",
|
5
|
-
"main": "./src/
|
5
|
+
"main": "./src/public_api.js",
|
6
6
|
"keywords": [
|
7
7
|
"schematics",
|
8
8
|
"otter"
|
@@ -17,11 +17,11 @@
|
|
17
17
|
"build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest"
|
18
18
|
},
|
19
19
|
"peerDependencies": {
|
20
|
-
"@angular-devkit/architect": "~0.
|
21
|
-
"@angular-devkit/core": "~16.
|
22
|
-
"@angular-devkit/schematics": "~16.
|
23
|
-
"@angular/cli": "~16.
|
24
|
-
"@schematics/angular": "~16.
|
20
|
+
"@angular-devkit/architect": "~0.1602.0",
|
21
|
+
"@angular-devkit/core": "~16.2.0",
|
22
|
+
"@angular-devkit/schematics": "~16.2.0",
|
23
|
+
"@angular/cli": "~16.2.0",
|
24
|
+
"@schematics/angular": "~16.2.0",
|
25
25
|
"rxjs": "^7.8.1",
|
26
26
|
"typescript": "~5.1.6"
|
27
27
|
},
|
@@ -41,27 +41,27 @@
|
|
41
41
|
"tslib": "^2.5.3"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
|
-
"@angular-devkit/build-angular": "~16.
|
45
|
-
"@angular-devkit/core": "~16.
|
46
|
-
"@angular-devkit/schematics": "~16.
|
44
|
+
"@angular-devkit/build-angular": "~16.2.0",
|
45
|
+
"@angular-devkit/core": "~16.2.0",
|
46
|
+
"@angular-devkit/schematics": "~16.2.0",
|
47
47
|
"@angular-eslint/eslint-plugin": "~16.1.0",
|
48
|
-
"@angular/cli": "~16.
|
49
|
-
"@angular/common": "~16.
|
50
|
-
"@angular/compiler": "~16.
|
51
|
-
"@angular/compiler-cli": "~16.
|
52
|
-
"@angular/core": "~16.
|
53
|
-
"@angular/platform-browser": "~16.
|
54
|
-
"@angular/platform-browser-dynamic": "~16.
|
48
|
+
"@angular/cli": "~16.2.0",
|
49
|
+
"@angular/common": "~16.2.0",
|
50
|
+
"@angular/compiler": "~16.2.0",
|
51
|
+
"@angular/compiler-cli": "~16.2.0",
|
52
|
+
"@angular/core": "~16.2.0",
|
53
|
+
"@angular/platform-browser": "~16.2.0",
|
54
|
+
"@angular/platform-browser-dynamic": "~16.2.0",
|
55
55
|
"@babel/core": "~7.22.0",
|
56
56
|
"@babel/preset-typescript": "~7.22.0",
|
57
57
|
"@compodoc/compodoc": "^1.1.19",
|
58
|
-
"@nx/jest": "~16.
|
59
|
-
"@nx/js": "~16.
|
60
|
-
"@nx/linter": "~16.
|
61
|
-
"@o3r/build-helpers": "^10.0.0-next.
|
62
|
-
"@o3r/dev-tools": "^10.0.0-next.
|
63
|
-
"@o3r/eslint-plugin": "^10.0.0-next.
|
64
|
-
"@schematics/angular": "~16.
|
58
|
+
"@nx/jest": "~16.8.0",
|
59
|
+
"@nx/js": "~16.8.0",
|
60
|
+
"@nx/linter": "~16.8.0",
|
61
|
+
"@o3r/build-helpers": "^10.0.0-next.7",
|
62
|
+
"@o3r/dev-tools": "^10.0.0-next.7",
|
63
|
+
"@o3r/eslint-plugin": "^10.0.0-next.7",
|
64
|
+
"@schematics/angular": "~16.2.0",
|
65
65
|
"@types/jest": "~29.5.2",
|
66
66
|
"@types/node": "^18.0.0",
|
67
67
|
"@types/semver": "^7.3.13",
|
@@ -71,13 +71,13 @@
|
|
71
71
|
"eslint": "^8.42.0",
|
72
72
|
"eslint-import-resolver-node": "^0.3.4",
|
73
73
|
"eslint-plugin-jest": "~27.2.3",
|
74
|
-
"eslint-plugin-jsdoc": "~46.
|
74
|
+
"eslint-plugin-jsdoc": "~46.8.0",
|
75
75
|
"eslint-plugin-prefer-arrow": "~1.2.3",
|
76
76
|
"eslint-plugin-unicorn": "^47.0.0",
|
77
|
-
"jest": "~29.
|
77
|
+
"jest": "~29.7.0",
|
78
78
|
"jest-junit": "~16.0.0",
|
79
79
|
"jsonschema": "~1.4.1",
|
80
|
-
"nx": "~16.
|
80
|
+
"nx": "~16.8.0",
|
81
81
|
"rxjs": "^7.8.1",
|
82
82
|
"ts-jest": "~29.1.1",
|
83
83
|
"type-fest": "^3.12.0",
|
@@ -88,7 +88,7 @@
|
|
88
88
|
"node": ">=16.0.0"
|
89
89
|
},
|
90
90
|
"schematics": "./collection.json",
|
91
|
-
"
|
91
|
+
"type": "commonjs",
|
92
92
|
"contributors": [
|
93
93
|
{
|
94
94
|
"name": "Yannick Adam",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAO/E;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAO/E;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAwB5B"}
|
@@ -16,17 +16,19 @@ function ngAdd() {
|
|
16
16
|
const treePackageJson = tree.readJson('./package.json');
|
17
17
|
const packageJsonContent = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
|
18
18
|
const getDependencyVersion = (dependency) => packageJsonContent?.dependencies?.[dependency] || packageJsonContent?.peerDependencies?.[dependency];
|
19
|
+
let packageName = '';
|
19
20
|
for (const dependency of schematicsDependencies) {
|
20
21
|
const version = getDependencyVersion(dependency);
|
21
22
|
context.logger.info(`Installing ${dependency}${version || ''}`);
|
22
23
|
treePackageJson.devDependencies = { ...treePackageJson.devDependencies, [dependency]: version };
|
23
|
-
|
24
|
-
hideOutput: false,
|
25
|
-
packageName: `${dependency}${version ? '@' + version : ''}`,
|
26
|
-
quiet: false
|
27
|
-
}));
|
28
|
-
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
24
|
+
packageName = `${packageName} ${dependency}${version ? '@' + version : ''}`;
|
29
25
|
}
|
26
|
+
context.addTask(new schematics_1.AddDevInstall({
|
27
|
+
hideOutput: false,
|
28
|
+
packageName,
|
29
|
+
quiet: false
|
30
|
+
}));
|
31
|
+
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
30
32
|
tree.overwrite('./package.json', JSON.stringify(treePackageJson));
|
31
33
|
return () => tree;
|
32
34
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AACA,8BAA8B;AAC9B,kCAAkC;AAClC,+BAAqC;AAErC,gDAAgD;AAEhD;;GAEG;AACH,SAAgB,KAAK;IACnB,MAAM,sBAAsB,GAAG,CAAC,2BAA2B,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IACpJ,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACrD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC5E,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAgB,CAAC;QACvE,MAAM,kBAAkB,GAAgB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;QAC1G,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,kBAAkB,EAAE,YAAY,EAAE,CAAC,UAAU,CAAC,IAAI,kBAAkB,EAAE,gBAAgB,EAAE,CAAC,UAAU,CAAC,CAAC;QAC1J,KAAK,MAAM,UAAU,IAAI,sBAAsB,EAAE;YAC/C,MAAM,OAAO,GAAG,oBAAoB,CAAC,UAA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,CAAC;YACjD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,UAAU,GAAG,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC;YAChE,eAAe,CAAC,eAAe,GAAG,EAAC,GAAG,eAAe,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,EAAC,CAAC;YAC9F,WAAW,GAAG,GAAG,WAAW,IAAI,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;SAC7E;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,0BAAa,CAAC;YAChC,UAAU,EAAE,KAAK;YACjB,WAAW;YACX,KAAK,EAAE,KAAK;SACN,CAAC,CAAC,CAAC;QACX,MAAM,IAAA,oBAAa,EAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;QAClE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAxBD,sBAwBC"}
|
@@ -1,4 +1,8 @@
|
|
1
1
|
import type { Projects as NgWorkspaceProject, Schema as NgWorkspaceSchema, SchematicOptions } from '@angular/cli/lib/config/workspace-schema';
|
2
|
+
/**
|
3
|
+
* Type representing supported testing frameworks: 'jest' or 'jasmine'.
|
4
|
+
*/
|
5
|
+
export type AvailableTestFrameworks = 'jest' | 'jasmine';
|
2
6
|
export interface WorkspaceProjectI18n {
|
3
7
|
locales: Record<string, string>;
|
4
8
|
sourceLocale?: string;
|
@@ -49,7 +53,10 @@ export interface WorkspaceSchematics extends SchematicOptions {
|
|
49
53
|
'*:ng-add'?: {
|
50
54
|
enableMetadataExtract?: boolean;
|
51
55
|
};
|
52
|
-
'*:*'?: WorkspaceLayout
|
56
|
+
'*:*'?: WorkspaceLayout & {
|
57
|
+
/** in adition to the WorkspaceLayout, an optional testFramework attribute is available */
|
58
|
+
testFramework?: AvailableTestFrameworks;
|
59
|
+
};
|
53
60
|
}
|
54
61
|
export interface WorkspaceProject extends NgWorkspaceProject {
|
55
62
|
architect?: WorkspaceTool;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"angular-workspace.d.ts","sourceRoot":"","sources":["../../../src/interfaces/angular-workspace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,IAAI,kBAAkB,EAC9B,MAAM,IAAI,iBAAiB,EAC3B,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD,MAAM,WAAW,aAAa;IAC5B,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,kBAAkB;IAClB,6BAA6B,CAAC,EAAE;QAC9B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB;IAClB,2BAA2B,CAAC,EAAE;QAC5B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB;IAClB,yBAAyB,CAAC,EAAE;QAC1B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB;IAClB,uBAAuB,CAAC,EAAE;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB;IAClB,4BAA4B,CAAC,EAAE;QAC7B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,2BAA2B,CAAC,EAAE;QAC5B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,uBAAuB,CAAC,EAAE;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB,CAAC,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,sBAAsB,CAAC,EAAE;QACvB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,UAAU,CAAC,EAAE;QACX,qBAAqB,CAAC,EAAE,OAAO,CAAC;KACjC,CAAC;IACF,KAAK,CAAC,EAAE,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"angular-workspace.d.ts","sourceRoot":"","sources":["../../../src/interfaces/angular-workspace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,IAAI,kBAAkB,EAC9B,MAAM,IAAI,iBAAiB,EAC3B,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD,MAAM,WAAW,aAAa;IAC5B,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,kBAAkB;IAClB,6BAA6B,CAAC,EAAE;QAC9B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB;IAClB,2BAA2B,CAAC,EAAE;QAC5B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB;IAClB,yBAAyB,CAAC,EAAE;QAC1B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB;IAClB,uBAAuB,CAAC,EAAE;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB;IAClB,4BAA4B,CAAC,EAAE;QAC7B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,2BAA2B,CAAC,EAAE;QAC5B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,uBAAuB,CAAC,EAAE;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB,CAAC,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,sBAAsB,CAAC,EAAE;QACvB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,UAAU,CAAC,EAAE;QACX,qBAAqB,CAAC,EAAE,OAAO,CAAC;KACjC,CAAC;IACF,KAAK,CAAC,EAAE,eAAe,GAAG;QACxB,0FAA0F;QAC1F,aAAa,CAAC,EAAE,uBAAuB,CAAC;KACzC,CAAC;CACH;AACD,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,aAAa,GAAG,SAAS,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,QAAQ,EAAE;QACN,CAAC,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;KACjC,CAAC;IACF,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAClC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { SchematicContext } from '@angular-devkit/schematics';
|
2
|
+
import type { AvailableTestFrameworks, WorkspaceSchema } from '../../interfaces';
|
3
|
+
/**
|
4
|
+
* Get the test framework
|
5
|
+
*
|
6
|
+
* @param workspaceOptions the workspace options
|
7
|
+
* @param context
|
8
|
+
*/
|
9
|
+
export declare function getTestFramework(workspaceOptions: WorkspaceSchema | null, context: SchematicContext): AvailableTestFrameworks | undefined;
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/get-test-frameworks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASjF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,eAAe,GAAG,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,uBAAuB,GAAG,SAAS,CAiBzI"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getTestFramework = void 0;
|
4
|
+
const utility_1 = require("../../utility");
|
5
|
+
const testPackageMaps = {
|
6
|
+
'jest': ['jest'],
|
7
|
+
'jasmine': ['jasmine-core']
|
8
|
+
};
|
9
|
+
/**
|
10
|
+
* Get the test framework
|
11
|
+
*
|
12
|
+
* @param workspaceOptions the workspace options
|
13
|
+
* @param context
|
14
|
+
*/
|
15
|
+
function getTestFramework(workspaceOptions, context) {
|
16
|
+
if (workspaceOptions) {
|
17
|
+
const testFramework = (0, utility_1.getSchematicOptions)(workspaceOptions, context)?.testFramework;
|
18
|
+
if (testFramework) {
|
19
|
+
return testFramework;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
return Object.entries(testPackageMaps)
|
23
|
+
.find(([_, deps]) => {
|
24
|
+
return deps.some((dep) => {
|
25
|
+
try {
|
26
|
+
return !!require.resolve(`${dep}/package.json`);
|
27
|
+
}
|
28
|
+
catch {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
});
|
32
|
+
})?.[0];
|
33
|
+
}
|
34
|
+
exports.getTestFramework = getTestFramework;
|
35
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/get-test-frameworks/index.ts"],"names":[],"mappings":";;;AAEA,2CAAoD;AAGpD,MAAM,eAAe,GAA8C;IACjE,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE,CAAC,cAAc,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,gBAAwC,EAAE,OAAyB;IAClG,IAAI,gBAAgB,EAAE;QACpB,MAAM,aAAa,GAAG,IAAA,6BAAmB,EAAC,gBAAgB,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC;QACpF,IAAI,aAAa,EAAE;YACjB,OAAO,aAAa,CAAC;SACtB;KACF;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;SACnC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACvB,IAAI;gBACF,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,eAAe,CAAC,CAAC;aACjD;YAAC,MAAM;gBACN,OAAO,KAAK,CAAC;aACd;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,EAAE,CAAC,CAAC,CAA4B,CAAC;AACvC,CAAC;AAjBD,4CAiBC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export * from './add-imports/index';
|
2
2
|
export * from './eslint-fix/index';
|
3
3
|
export * from './interfaces';
|
4
|
+
export * from './get-test-frameworks/index';
|
4
5
|
export * from './check-packages-peers/index';
|
5
6
|
export * from './ng-add/index';
|
6
7
|
export * from './remove-packages/index';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
|
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./add-imports/index"), exports);
|
5
5
|
tslib_1.__exportStar(require("./eslint-fix/index"), exports);
|
6
6
|
tslib_1.__exportStar(require("./interfaces"), exports);
|
7
|
+
tslib_1.__exportStar(require("./get-test-frameworks/index"), exports);
|
7
8
|
tslib_1.__exportStar(require("./check-packages-peers/index"), exports);
|
8
9
|
tslib_1.__exportStar(require("./ng-add/index"), exports);
|
9
10
|
tslib_1.__exportStar(require("./remove-packages/index"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,6DAAmC;AACnC,uDAA6B;AAC7B,uEAA6C;AAC7C,yDAA+B;AAC/B,kEAAwC;AACxC,iEAAuC;AACvC,oEAA0C"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,6DAAmC;AACnC,uDAA6B;AAC7B,sEAA4C;AAC5C,uEAA6C;AAC7C,yDAA+B;AAC/B,kEAAwC;AACxC,iEAAuC;AACvC,oEAA0C"}
|
@@ -10,7 +10,9 @@ import type { NgAddPackageOptions } from '../../tasks/index';
|
|
10
10
|
* @param options install options
|
11
11
|
* @param packageJsonPath path of the package json of the project where they will be installed
|
12
12
|
*/
|
13
|
-
export declare function ngAddPackages(packages: string[], options?: NgAddPackageOptions,
|
13
|
+
export declare function ngAddPackages(packages: string[], options?: Omit<NgAddPackageOptions, 'version'> & {
|
14
|
+
version?: string | (string | undefined)[];
|
15
|
+
}, packageJsonPath?: string): Rule;
|
14
16
|
/**
|
15
17
|
* Look for the peer dependencies and run ng add on the package requested version
|
16
18
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,IAAI,EAAqC,MAAM,4BAA4B,CAAC;AAGrH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAK7D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAA;CAAE,EAAE,eAAe,SAAkB,GAAG,IAAI,CA8GzL;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,gCAAiD,EAC5I,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,EAAE,MAAM,QAgBzD;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAQ5G;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAsB3I"}
|
@@ -6,6 +6,8 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
6
6
|
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
7
7
|
const rxjs_1 = require("rxjs");
|
8
8
|
const index_1 = require("../../utility/index");
|
9
|
+
const node_fs_1 = require("node:fs");
|
10
|
+
const path = require("node:path");
|
9
11
|
/**
|
10
12
|
* Install via `ng add` a list of npm packages.
|
11
13
|
*
|
@@ -14,9 +16,28 @@ const index_1 = require("../../utility/index");
|
|
14
16
|
* @param packageJsonPath path of the package json of the project where they will be installed
|
15
17
|
*/
|
16
18
|
function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
|
17
|
-
|
19
|
+
if (!packages.length) {
|
20
|
+
return schematics_1.noop;
|
21
|
+
}
|
22
|
+
const cwd = process.cwd().replace(/[\\/]+/g, '/');
|
23
|
+
// FileSystem working directory might be different than Tree working directory (when using `yarn workspace` for example)
|
24
|
+
const fsWorkingDirectory = (options?.workingDirectory && !cwd.endsWith(options.workingDirectory)) ? options.workingDirectory : '.';
|
25
|
+
const versions = Object.fromEntries(packages.map((packageName, index) => [packageName, typeof options?.version === 'object' ? options.version[index] : options?.version]));
|
26
|
+
if (options?.workingDirectory && !packageJsonPath.startsWith(options.workingDirectory)) {
|
27
|
+
packageJsonPath = path.join(options.workingDirectory, packageJsonPath);
|
28
|
+
}
|
29
|
+
const getInstalledVersion = (packageName) => {
|
18
30
|
try {
|
19
|
-
|
31
|
+
const fileSystemPackageJson = JSON.parse((0, node_fs_1.readFileSync)(path.join(fsWorkingDirectory, 'package.json'), { encoding: 'utf8' }));
|
32
|
+
if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
|
33
|
+
return fileSystemPackageJson.devDependencies[packageName];
|
34
|
+
}
|
35
|
+
else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
|
36
|
+
return fileSystemPackageJson.peerDependencies[packageName];
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
return fileSystemPackageJson.dependencies[packageName];
|
40
|
+
}
|
20
41
|
}
|
21
42
|
catch (e) {
|
22
43
|
return;
|
@@ -41,11 +62,39 @@ function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
|
|
41
62
|
return accOptions;
|
42
63
|
}, {});
|
43
64
|
};
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
65
|
+
return async (tree, context) => {
|
66
|
+
const installedVersions = packages.map((packageName) => getInstalledVersion(packageName));
|
67
|
+
const packageManager = (0, index_1.getPackageManager)();
|
68
|
+
let installOptions = '';
|
69
|
+
if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev && packageManager === 'yarn') {
|
70
|
+
installOptions = ' --prefer-dev';
|
71
|
+
}
|
72
|
+
else if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
|
73
|
+
installOptions = ' -D';
|
74
|
+
}
|
75
|
+
else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
|
76
|
+
installOptions = ' -P';
|
77
|
+
}
|
78
|
+
const packagesToInstall = packages.filter((packageName, index) => !installedVersions[index] || installedVersions[index] !== versions[packageName]);
|
79
|
+
if (packagesToInstall.length < 1) {
|
80
|
+
return schematics_1.noop;
|
81
|
+
}
|
82
|
+
const packagesInput = packagesToInstall
|
83
|
+
.map((packageName) => `${packageName}${versions[packageName] ? `@${versions[packageName]}` : ''}`)
|
84
|
+
.join(' ');
|
85
|
+
const workingDirectory = options?.workingDirectory || path.dirname(packageJsonPath);
|
86
|
+
context.addTask(new tasks_1.NodePackageInstallTask({
|
87
|
+
packageManager: packageManager,
|
88
|
+
packageName: `${packagesInput}${installOptions}`,
|
89
|
+
workingDirectory,
|
90
|
+
hideOutput: false,
|
91
|
+
quiet: false
|
92
|
+
}));
|
93
|
+
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
94
|
+
// We need to update manually the package json in the tree as the tree will overwrite the project at the end of the ng add @o3r/core
|
95
|
+
const latestInstalledVersions = packagesToInstall.map((packageName) => [packageName, getInstalledVersion(packageName)]);
|
96
|
+
const packageJson = tree.readJson(packageJsonPath);
|
97
|
+
latestInstalledVersions.forEach(([packageName, latestInstalledVersion]) => {
|
49
98
|
if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
|
50
99
|
packageJson.devDependencies = { ...packageJson.devDependencies, [packageName]: latestInstalledVersion };
|
51
100
|
}
|
@@ -55,51 +104,24 @@ function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
|
|
55
104
|
else {
|
56
105
|
packageJson.dependencies = { ...packageJson.dependencies, [packageName]: latestInstalledVersion };
|
57
106
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev && packageManager === 'yarn') {
|
71
|
-
installOptions = ' --prefer-dev';
|
72
|
-
}
|
73
|
-
else if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
|
74
|
-
installOptions = ' -D';
|
75
|
-
}
|
76
|
-
else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
|
77
|
-
installOptions = ' -P';
|
78
|
-
}
|
79
|
-
context.addTask(new tasks_1.NodePackageInstallTask({
|
80
|
-
packageManager: packageManager,
|
81
|
-
packageName: packageName + (version ? `@${version}` : '') + installOptions,
|
82
|
-
hideOutput: false,
|
83
|
-
quiet: false
|
84
|
-
}));
|
85
|
-
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
86
|
-
const ngAddCollection = getNgAddSchema(packageName, context);
|
87
|
-
if (ngAddCollection) {
|
88
|
-
const ngAddOptions = getOptions(ngAddCollection);
|
89
|
-
return () => (0, schematics_1.externalSchematic)(packageName, 'ng-add', ngAddOptions)(tree, context);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
context.logger.info(`Skipping ng add for: ${packageName}${options?.version ? ' with version: ' + options.version : ''}`);
|
107
|
+
});
|
108
|
+
tree.overwrite(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
109
|
+
if (options?.skipNgAddSchematicRun) {
|
110
|
+
context.logger.info(`Package(s) '${packagesToInstall.join(', ')}' was(were) installed.
|
111
|
+
The run of 'ng-add' schematics for the package(s) is intentionally skipped. You can do the run standalone, later.`);
|
112
|
+
return schematics_1.noop;
|
113
|
+
}
|
114
|
+
const ngAddsToApply = packagesToInstall
|
115
|
+
.map((packageName) => ({ packageName, ngAddCollection: getNgAddSchema(packageName, context) }))
|
116
|
+
.filter(({ packageName, ngAddCollection }) => {
|
117
|
+
if (!ngAddCollection) {
|
118
|
+
context.logger.info(`No ng-add schematic found for: '${packageName}'. Skipping ng add for: ${packageName}${versions[packageName] ? ' with version: ' + versions[packageName] : ''}`);
|
94
119
|
}
|
95
|
-
return
|
96
|
-
}
|
120
|
+
return !!ngAddCollection;
|
121
|
+
})
|
122
|
+
.map(({ packageName, ngAddCollection }) => (0, schematics_1.externalSchematic)(packageName, 'ng-add', getOptions(ngAddCollection)));
|
123
|
+
return (0, schematics_1.chain)(ngAddsToApply);
|
97
124
|
};
|
98
|
-
const ngAddRulesToRun = (packages || []).map((packageName) => (0, schematics_1.chain)([
|
99
|
-
ngAddSinglePackage({ packageName, version: options?.version }),
|
100
|
-
checkTreePackageJsonConsistency(packageName)
|
101
|
-
]));
|
102
|
-
return (0, schematics_1.chain)(ngAddRulesToRun);
|
103
125
|
}
|
104
126
|
exports.ngAddPackages = ngAddPackages;
|
105
127
|
/**
|
@@ -112,17 +134,18 @@ exports.ngAddPackages = ngAddPackages;
|
|
112
134
|
* @param parentPackageInfo for logging purposes
|
113
135
|
*/
|
114
136
|
function ngAddPeerDependencyPackages(packages, packageJsonPath, type = dependencies_1.NodeDependencyType.Default, options, parentPackageInfo) {
|
137
|
+
if (!packages.length) {
|
138
|
+
return schematics_1.noop;
|
139
|
+
}
|
115
140
|
const dependencies = (0, index_1.getNodeDependencyList)((0, index_1.getExternalDependenciesVersionRange)(packages, packageJsonPath), type);
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
});
|
141
|
+
return ngAddPackages(dependencies.map(({ name }) => name), {
|
142
|
+
...options,
|
143
|
+
skipConfirmation: true,
|
144
|
+
version: dependencies.map(({ version }) => version),
|
145
|
+
parentPackageInfo,
|
146
|
+
dependencyType: type,
|
147
|
+
workingDirectory: options.workingDirectory
|
124
148
|
});
|
125
|
-
return (0, schematics_1.chain)(externalPeerDepsRules);
|
126
149
|
}
|
127
150
|
exports.ngAddPeerDependencyPackages = ngAddPeerDependencyPackages;
|
128
151
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAqH;AACrH,4DAA0E;AAE1E,2EAA8E;AAC9E,+BAAqC;AAIrC,+CAAqL;AACrL,qCAAuC;AACvC,kCAAkC;AAElC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C,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACpD,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,EAAE;gBACjF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,EAAE;oBACvC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG;wBAClC,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;wBACpC,GAAG,aAAa;qBACjB,CAAC;iBACH;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,IAAA,wBAAgB,EAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC;AAtBD,oEAsBC"}
|
@@ -19,6 +19,8 @@ export interface NgAddPackageOptions {
|
|
19
19
|
* Type of dependency to install
|
20
20
|
*/
|
21
21
|
dependencyType?: NodeDependencyType;
|
22
|
+
/** Flag to skip the execution of ng add and only install the package. Used mostly for external packages */
|
23
|
+
skipNgAddSchematicRun?: boolean;
|
22
24
|
}
|
23
25
|
export declare class NodePackageNgAddTask implements TaskConfigurationGenerator<NodePackageTaskOptions> {
|
24
26
|
packageName: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tasks/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAmB,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AACnH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAGnF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,kBAAkB;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tasks/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAmB,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AACnH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAGnF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,kBAAkB;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAEpC,2GAA2G;IAC3G,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,qBAAa,oBAAqB,YAAW,0BAA0B,CAAC,sBAAsB,CAAC;IAG1E,WAAW,EAAE,MAAM;IAAS,OAAO,CAAC;IAFhD,KAAK,UAAS;gBAEF,WAAW,EAAE,MAAM,EAAS,OAAO,CAAC,iCAAqB;IAErE,eAAe,IAAI,iBAAiB,CAAC,sBAAsB,CAAC;CAgBpE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tasks/ng-add/index.ts"],"names":[],"mappings":";;;AACA,sFAAmH;AAEnH,iFAAyE;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tasks/ng-add/index.ts"],"names":[],"mappings":";;;AACA,sFAAmH;AAEnH,iFAAyE;AA8BzE,MAAa,oBAAoB;IAG/B,YAAmB,WAAmB,EAAS,OAA6B;QAAzD,gBAAW,GAAX,WAAW,CAAQ;QAAS,YAAO,GAAP,OAAO,CAAsB;QAFrE,UAAK,GAAG,KAAK,CAAC;IAE0D,CAAC;IAEzE,eAAe;QACpB,MAAM,YAAY,GAAG;YACnB,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE;YAC3D,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;SAC7E,CAAC;QACF,OAAO;YACL,IAAI,EAAE,yBAAe;YACrB,OAAO,EAAE;gBACP,OAAO,EAAE,QAAQ;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,gBAAgB,EAAE,IAAI,CAAC,OAAO,EAAE,gBAAgB;gBAChD,WAAW,EAAE,UAAU,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAC7H,cAAc,EAAE,IAAA,0CAAiB,GAAE;aACpC;SAC2C,CAAC;IACjD,CAAC;CACF;AArBD,oDAqBC"}
|
@@ -18,6 +18,7 @@ export interface FileInfo {
|
|
18
18
|
*
|
19
19
|
* @param tree
|
20
20
|
* @param context
|
21
|
+
* @param projectName
|
21
22
|
*/
|
22
|
-
export declare function getFileInfo(tree: Tree, context: SchematicContext): FileInfo;
|
23
|
+
export declare function getFileInfo(tree: Tree, context: SchematicContext, projectName?: string | undefined): FileInfo;
|
23
24
|
//# sourceMappingURL=file-info.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-info.d.ts","sourceRoot":"","sources":["../../../src/utility/file-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,IAAI,EAAC,MAAM,4BAA4B,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC,4CAA4C;IAC5C,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC;IAEtC,8CAA8C;IAC9C,iBAAiB,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC;IAEzC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED
|
1
|
+
{"version":3,"file":"file-info.d.ts","sourceRoot":"","sources":["../../../src/utility/file-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,IAAI,EAAC,MAAM,4BAA4B,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC,4CAA4C;IAC5C,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC;IAEtC,8CAA8C;IAC9C,iBAAiB,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC;IAEzC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,YA8BlG"}
|
package/src/utility/file-info.js
CHANGED
@@ -9,15 +9,16 @@ const modules_1 = require("./modules");
|
|
9
9
|
*
|
10
10
|
* @param tree
|
11
11
|
* @param context
|
12
|
+
* @param projectName
|
12
13
|
*/
|
13
|
-
function getFileInfo(tree, context) {
|
14
|
+
function getFileInfo(tree, context, projectName) {
|
14
15
|
const fileInfo = {
|
15
16
|
moduleFilePath: undefined,
|
16
17
|
sourceFile: undefined,
|
17
18
|
ngModulesMetadata: undefined,
|
18
19
|
appModuleFile: undefined
|
19
20
|
};
|
20
|
-
const moduleFilePath = (0, modules_1.getAppModuleFilePath)(tree, context);
|
21
|
+
const moduleFilePath = (0, modules_1.getAppModuleFilePath)(tree, context, projectName);
|
21
22
|
if (!moduleFilePath) {
|
22
23
|
return fileInfo;
|
23
24
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-info.js","sourceRoot":"","sources":["../../../src/utility/file-info.ts"],"names":[],"mappings":";;;AACA,qEAA2E;AAC3E,iCAAiC;AACjC,uCAA+C;AAmB/C
|
1
|
+
{"version":3,"file":"file-info.js","sourceRoot":"","sources":["../../../src/utility/file-info.ts"],"names":[],"mappings":";;;AACA,qEAA2E;AAC3E,iCAAiC;AACjC,uCAA+C;AAmB/C;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAAyB,EAAE,WAAgC;IACjG,MAAM,QAAQ,GAAa;QACzB,cAAc,EAAE,SAAS;QACzB,UAAU,EAAE,SAAS;QACrB,iBAAiB,EAAE,SAAS;QAC5B,aAAa,EAAE,SAAS;KACzB,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,8BAAoB,EAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IACxE,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,QAAQ,CAAC;KACjB;IACD,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;IAEzC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;QAChC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,cAAc,8CAA8C,CAAC,CAAC;QACrG,OAAO,QAAQ,CAAC;KACjB;IAED,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,cAAc,EACd,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,EAAE,EACrC,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;IACF,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;IAEjC,QAAQ,CAAC,iBAAiB,GAAG,IAAA,gCAAoB,EAAC,UAAU,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC3F,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,EAAE,CAAC;IAE/D,OAAO,QAAQ,CAAC;AAClB,CAAC;AA9BD,kCA8BC"}
|
package/src/utility/loaders.d.ts
CHANGED
@@ -45,6 +45,13 @@ export declare function readPackageJson(tree: Tree, workspaceProject: WorkspaceP
|
|
45
45
|
export declare function getProjectFromTree(tree: Tree, projectName?: string | null, projectType?: 'application' | 'library'): WorkspaceProject & {
|
46
46
|
name: string;
|
47
47
|
} | undefined;
|
48
|
+
/**
|
49
|
+
* Returns the root directory of a project with the given name ( a relative path from the project root)
|
50
|
+
*
|
51
|
+
* @param tree Files tree
|
52
|
+
* @param projectName Name of the project inside the workspace
|
53
|
+
*/
|
54
|
+
export declare function getProjectRootDir(tree: Tree, projectName?: string | null): string | undefined;
|
48
55
|
/**
|
49
56
|
* Return the type of install to run depending on the project type (Peer or default)
|
50
57
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../../src/utility/loaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,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gB,qCAAqC,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAS3G;AAED;;;;;;GAMG;AACH,wBAAgB,2CAA2C,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAOjH;AAGD;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAK1E;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAEhF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAE1E;AAGD;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,IAAI,YAE7D"}
|
package/src/utility/loaders.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getSourceFilesFromWorkspaceProjects = exports.getFilesFromWorkspaceProjects = exports.getFilesFromRootOfWorkspaceProjects = exports.getFilesWithExtensionFromTree = exports.getFilesInFolderFromWorkspaceProjectsInTree = exports.getFilesInFolderFromWorkspaceProjects = exports.getAllFilesInTree = exports.getTemplateFolder = exports.getDefaultProjectName = exports.getProjectDepType = exports.getProjectFromTree = exports.readPackageJson = exports.writeAngularJson = exports.getWorkspaceConfig = exports.readAngularJson = void 0;
|
3
|
+
exports.getSourceFilesFromWorkspaceProjects = exports.getFilesFromWorkspaceProjects = exports.getFilesFromRootOfWorkspaceProjects = exports.getFilesWithExtensionFromTree = exports.getFilesInFolderFromWorkspaceProjectsInTree = exports.getFilesInFolderFromWorkspaceProjects = exports.getAllFilesInTree = exports.getTemplateFolder = exports.getDefaultProjectName = exports.getProjectDepType = exports.getProjectRootDir = exports.getProjectFromTree = exports.readPackageJson = exports.writeAngularJson = exports.getWorkspaceConfig = exports.readAngularJson = void 0;
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
5
5
|
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
6
6
|
const globby_1 = require("globby");
|
@@ -72,7 +72,10 @@ exports.readPackageJson = readPackageJson;
|
|
72
72
|
* @param projectType
|
73
73
|
*/
|
74
74
|
function getProjectFromTree(tree, projectName, projectType) {
|
75
|
-
const workspace =
|
75
|
+
const workspace = getWorkspaceConfig(tree);
|
76
|
+
if (!workspace) {
|
77
|
+
return undefined;
|
78
|
+
}
|
76
79
|
const projectGuessedName = projectName || Object.keys(workspace.projects)[0];
|
77
80
|
// eslint-disable-next-line max-len
|
78
81
|
let workspaceProject = projectGuessedName && workspace.projects[projectGuessedName] && (!projectType || workspace.projects[projectGuessedName]?.projectType === projectType) ?
|
@@ -90,6 +93,16 @@ function getProjectFromTree(tree, projectName, projectType) {
|
|
90
93
|
return workspaceProject;
|
91
94
|
}
|
92
95
|
exports.getProjectFromTree = getProjectFromTree;
|
96
|
+
/**
|
97
|
+
* Returns the root directory of a project with the given name ( a relative path from the project root)
|
98
|
+
*
|
99
|
+
* @param tree Files tree
|
100
|
+
* @param projectName Name of the project inside the workspace
|
101
|
+
*/
|
102
|
+
function getProjectRootDir(tree, projectName) {
|
103
|
+
return getProjectFromTree(tree, projectName)?.root;
|
104
|
+
}
|
105
|
+
exports.getProjectRootDir = getProjectRootDir;
|
93
106
|
/**
|
94
107
|
* Return the type of install to run depending on the project type (Peer or default)
|
95
108
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../src/utility/loaders.ts"],"names":[],"mappings":";;;AAAA,2DAAuE;AACvE,2EAA8E;AAC9E,mCAA4C;AAC5C,yCAAsC;AACtC,kCAAkC;AAIlC;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,IAAU,EAAE,eAAe,GAAG,eAAe;IAC3E,IAAI,CAAC,I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C,IAAU,EAAE,SAAiB;IACzE,OAAO,2CAA2C,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAC7E,CAAC;AAFD,sEAEC;AAGD;;;;GAIG;AACH,SAAgB,mCAAmC,CAAC,IAAU;IAC5D,OAAO,6BAA6B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACnD,CAAC;AAFD,kFAEC"}
|
package/src/utility/modules.d.ts
CHANGED
@@ -5,8 +5,9 @@ import * as ts from 'typescript';
|
|
5
5
|
*
|
6
6
|
* @param tree File tree
|
7
7
|
* @param context Context of the rule
|
8
|
+
* @param projectName The name of the project where to search for an app module file
|
8
9
|
*/
|
9
|
-
export declare function getAppModuleFilePath(tree: Tree, context: SchematicContext): string | undefined;
|
10
|
+
export declare function getAppModuleFilePath(tree: Tree, context: SchematicContext, projectName?: string | null): string | undefined;
|
10
11
|
/**
|
11
12
|
* Get the path to the main.ts
|
12
13
|
*
|
@@ -19,8 +20,12 @@ export declare function getMainFilePath(tree: Tree, context: SchematicContext):
|
|
19
20
|
* one of its modules.
|
20
21
|
*
|
21
22
|
* @param tree
|
23
|
+
* @param options @see RuleFactory.options
|
24
|
+
* @param options.projectName
|
22
25
|
*/
|
23
|
-
export declare function isApplicationThatUsesRouterModule(tree: Tree
|
26
|
+
export declare function isApplicationThatUsesRouterModule(tree: Tree, options: {
|
27
|
+
projectName?: string | undefined;
|
28
|
+
}): boolean | "" | undefined;
|
24
29
|
/**
|
25
30
|
* Add import to the main module
|
26
31
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../../src/utility/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAuB,IAAI,EAAE,cAAc,EAAC,MAAM,4BAA4B,CAAC;AACvG,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAejC
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../../src/utility/modules.ts"],"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E,QAAQ,EAAE,cAAc,EACrI,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,kBAY3G;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAK3G"}
|
package/src/utility/modules.js
CHANGED
@@ -15,12 +15,13 @@ const loaders_1 = require("./loaders");
|
|
15
15
|
*
|
16
16
|
* @param tree File tree
|
17
17
|
* @param context Context of the rule
|
18
|
+
* @param projectName The name of the project where to search for an app module file
|
18
19
|
*/
|
19
|
-
function getAppModuleFilePath(tree, context) {
|
20
|
-
const workspaceProject = (0, loaders_1.getProjectFromTree)(tree,
|
20
|
+
function getAppModuleFilePath(tree, context, projectName) {
|
21
|
+
const workspaceProject = (0, loaders_1.getProjectFromTree)(tree, projectName, 'application');
|
21
22
|
// exit if not an application
|
22
23
|
if (!workspaceProject) {
|
23
|
-
context.logger.debug('
|
24
|
+
context.logger.debug('Aborted. App module file path will be searched only in application project.');
|
24
25
|
return undefined;
|
25
26
|
}
|
26
27
|
const mainFilePath = workspaceProject.architect.build.options.main;
|
@@ -85,12 +86,20 @@ exports.getMainFilePath = getMainFilePath;
|
|
85
86
|
* one of its modules.
|
86
87
|
*
|
87
88
|
* @param tree
|
89
|
+
* @param options @see RuleFactory.options
|
90
|
+
* @param options.projectName
|
88
91
|
*/
|
89
|
-
function isApplicationThatUsesRouterModule(tree) {
|
90
|
-
const workspaceProject = (0, loaders_1.getProjectFromTree)(tree,
|
92
|
+
function isApplicationThatUsesRouterModule(tree, options) {
|
93
|
+
const workspaceProject = (0, loaders_1.getProjectFromTree)(tree, options.projectName, 'application');
|
94
|
+
const cwd = process.cwd().replace(/[\\/]+/g, '/');
|
95
|
+
const root = (workspaceProject?.root && cwd.endsWith(workspaceProject.root)) ? workspaceProject.root.replace(/[^\\/]+/g, '..') : '.';
|
91
96
|
return workspaceProject?.sourceRoot &&
|
92
|
-
(0, globby_1.sync)(path.posix.join(workspaceProject.sourceRoot, '**', '*.ts')).some((filePath) => {
|
93
|
-
const
|
97
|
+
(0, globby_1.sync)(path.posix.join(root, workspaceProject.sourceRoot, '**', '*.ts')).some((filePath) => {
|
98
|
+
const fileContent = fs.readFileSync(filePath).toString();
|
99
|
+
if (!/RouterModule/.test(fileContent)) {
|
100
|
+
return false;
|
101
|
+
}
|
102
|
+
const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.ES2015, true);
|
94
103
|
try {
|
95
104
|
return !!(0, ast_utils_1.getRouterModuleDeclaration)(sourceFile);
|
96
105
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../src/utility/modules.ts"],"names":[],"mappings":";;;AAAA,2DAAuG;AACvG,iCAAiC;AACjC,qEAK+C;AAC/C,+DAAgE;AAChE,8BAA8B;AAC9B,mCAA0C;AAC1C,kCAAkC;AAClC,+BAAiD;AACjD,uCAA6C;AAG7C
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../src/utility/modules.ts"],"names":[],"mappings":";;;AAAA,2DAAuG;AACvG,iCAAiC;AACjC,qEAK+C;AAC/C,+DAAgE;AAChE,8BAA8B;AAC9B,mCAA0C;AAC1C,kCAAkC;AAClC,+BAAiD;AACjD,uCAA6C;AAG7C;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,IAAU,EAAE,OAAyB,EAAE,WAA2B;IACrG,MAAM,gBAAgB,GAAG,IAAA,4BAAkB,EAAC,IAAI,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;IAC9E,6BAA6B;IAC7B,IAAI,CAAC,gBAAgB,EAAE;QACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAC;QACpG,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,YAAY,GAAW,gBAAgB,CAA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MAAM,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACpJ;IACH,CAAC,CAAC,CAAC;IACL,OAAO,QAAQ,CAAC;AAClB,CAAC;AAbD,0DAaC;AAED;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,IAAY,EAAE,IAAY,EAAE,QAAwB,EAAE,WAAmB;IAC1G,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE;QACtD,OAAO,QAAQ,CAAC,UAAU,CAAC,WAAW,GAAG,CAAC,EAAE,GAAG,IAAI,MAAM,CAAC,CAAC;KAC5D;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AALD,gDAKC"}
|
@@ -15,6 +15,12 @@ export declare function findConfigFileRelativePath(tree: Tree, files: string[],
|
|
15
15
|
* @param tree
|
16
16
|
*/
|
17
17
|
export declare function isNxContext(tree: Tree): boolean;
|
18
|
+
/**
|
19
|
+
* Determine if a repository is standalone (not part of a monorepo)
|
20
|
+
*
|
21
|
+
* @param tree
|
22
|
+
*/
|
23
|
+
export declare function isStandaloneRepository(tree: Tree): boolean | null;
|
18
24
|
/**
|
19
25
|
* Determine if we are in a project with multi packages
|
20
26
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"monorepo.d.ts","sourceRoot":"","sources":["../../../src/utility/monorepo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"monorepo.d.ts","sourceRoot":"","sources":["../../../src/utility/monorepo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKnF;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,UAOzF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,WAErC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,kBAGhD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,WAEhD;AAED,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,sFAAsF;AACtF,eAAO,MAAM,wBAAwB,SAAS,CAAC;AAE/C,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,EAAE,eAGlC,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM,eAAe,CAGhG,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,OAQtJ"}
|
package/src/utility/monorepo.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getPackagesBaseRootFolder = exports.BASE_ROOT_FOLDERS_MAP = exports.DEFAULT_ROOT_FOLDERS = exports.APPLICATIONS_FOLDER_NAME = exports.LIBRARIES_FOLDER_NAME = exports.isMultipackagesContext = exports.isNxContext = exports.findConfigFileRelativePath = void 0;
|
3
|
+
exports.getPackagesBaseRootFolder = exports.BASE_ROOT_FOLDERS_MAP = exports.DEFAULT_ROOT_FOLDERS = exports.APPLICATIONS_FOLDER_NAME = exports.LIBRARIES_FOLDER_NAME = exports.isMultipackagesContext = exports.isStandaloneRepository = exports.isNxContext = exports.findConfigFileRelativePath = void 0;
|
4
4
|
const path = require("node:path");
|
5
5
|
const collection_1 = require("./collection");
|
6
|
+
const loaders_1 = require("./loaders");
|
6
7
|
/**
|
7
8
|
* Find the relative path to a configuration file at the monorepo root
|
8
9
|
*
|
@@ -28,6 +29,16 @@ function isNxContext(tree) {
|
|
28
29
|
return tree.exists('/nx.json');
|
29
30
|
}
|
30
31
|
exports.isNxContext = isNxContext;
|
32
|
+
/**
|
33
|
+
* Determine if a repository is standalone (not part of a monorepo)
|
34
|
+
*
|
35
|
+
* @param tree
|
36
|
+
*/
|
37
|
+
function isStandaloneRepository(tree) {
|
38
|
+
const workspaceConfig = (0, loaders_1.getWorkspaceConfig)(tree);
|
39
|
+
return workspaceConfig && Object.keys(workspaceConfig.projects || {}).length === 1 && Object.values(workspaceConfig.projects)[0].root === '';
|
40
|
+
}
|
41
|
+
exports.isStandaloneRepository = isStandaloneRepository;
|
31
42
|
/**
|
32
43
|
* Determine if we are in a project with multi packages
|
33
44
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"monorepo.js","sourceRoot":"","sources":["../../../src/utility/monorepo.ts"],"names":[],"mappings":";;;AACA,kCAAkC;AAElC,6CAAmD;
|
1
|
+
{"version":3,"file":"monorepo.js","sourceRoot":"","sources":["../../../src/utility/monorepo.ts"],"names":[],"mappings":";;;AACA,kCAAkC;AAElC,6CAAmD;AAEnD,uCAA+C;AAE/C;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CAAC,IAAU,EAAE,KAAe,EAAE,UAAkB;IACxF,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,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