@o3r/schematics 11.6.0-prerelease.7 → 11.6.0-prerelease.8
Sign up to get free protection for your applications and to get access to all the features.
- package/cli/environment.js +1 -0
- package/package.json +19 -14
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +6 -6
- package/schematics/ng-add/schema.d.ts.map +1 -1
- package/src/interfaces/angular-workspace.d.ts.map +1 -1
- package/src/interfaces/index.d.ts +1 -1
- package/src/interfaces/index.d.ts.map +1 -1
- package/src/interfaces/index.js +1 -1
- package/src/interfaces/index.js.map +1 -1
- package/src/interfaces/rule-factories.d.ts.map +1 -1
- package/src/interfaces/schematic-option.d.ts.map +1 -1
- package/src/modules/index.d.ts +1 -1
- package/src/modules/index.d.ts.map +1 -1
- package/src/modules/index.js +1 -1
- package/src/modules/index.js.map +1 -1
- package/src/modules/modules.constants.d.ts.map +1 -1
- package/src/modules/modules.constants.js.map +1 -1
- package/src/modules/modules.display.rule.d.ts.map +1 -1
- package/src/modules/modules.display.rule.js +1 -2
- package/src/modules/modules.display.rule.js.map +1 -1
- package/src/modules/modules.helpers.d.ts +1 -1
- package/src/modules/modules.helpers.d.ts.map +1 -1
- package/src/modules/modules.helpers.js +5 -6
- package/src/modules/modules.helpers.js.map +1 -1
- package/src/public_api.d.ts +1 -1
- package/src/public_api.d.ts.map +1 -1
- package/src/public_api.js +1 -1
- package/src/public_api.js.map +1 -1
- package/src/rule-factories/add-imports/index.d.ts.map +1 -1
- package/src/rule-factories/add-imports/index.js +9 -5
- package/src/rule-factories/add-imports/index.js.map +1 -1
- package/src/rule-factories/check-packages-peers/index.d.ts.map +1 -1
- package/src/rule-factories/check-packages-peers/index.js +13 -12
- package/src/rule-factories/check-packages-peers/index.js.map +1 -1
- package/src/rule-factories/dev-tools/devtools-registration.d.ts +0 -2
- package/src/rule-factories/dev-tools/devtools-registration.d.ts.map +1 -1
- package/src/rule-factories/dev-tools/devtools-registration.js +34 -19
- package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -1
- package/src/rule-factories/eslint-fix/index.d.ts +1 -2
- package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
- package/src/rule-factories/eslint-fix/index.js +17 -18
- package/src/rule-factories/eslint-fix/index.js.map +1 -1
- package/src/rule-factories/get-test-frameworks/index.d.ts.map +1 -1
- package/src/rule-factories/get-test-frameworks/index.js +2 -2
- package/src/rule-factories/get-test-frameworks/index.js.map +1 -1
- package/src/rule-factories/index.d.ts +2 -3
- package/src/rule-factories/index.d.ts.map +1 -1
- package/src/rule-factories/index.js +2 -3
- package/src/rule-factories/index.js.map +1 -1
- package/src/rule-factories/ng-add/dependencies.d.ts +1 -1
- package/src/rule-factories/ng-add/dependencies.d.ts.map +1 -1
- package/src/rule-factories/ng-add/dependencies.js +19 -16
- package/src/rule-factories/ng-add/dependencies.js.map +1 -1
- package/src/rule-factories/ng-add/index.d.ts +1 -1
- package/src/rule-factories/ng-add/index.d.ts.map +1 -1
- package/src/rule-factories/ng-add/index.js +1 -1
- package/src/rule-factories/ng-add/index.js.map +1 -1
- package/src/rule-factories/ng-add/ng-add.helpers.d.ts.map +1 -1
- package/src/rule-factories/ng-add/ng-add.helpers.js +21 -21
- package/src/rule-factories/ng-add/ng-add.helpers.js.map +1 -1
- package/src/rule-factories/ng-add/schematics-register.d.ts.map +1 -1
- package/src/rule-factories/ng-add/schematics-register.js +36 -28
- package/src/rule-factories/ng-add/schematics-register.js.map +1 -1
- package/src/rule-factories/remove-packages/index.d.ts.map +1 -1
- package/src/rule-factories/remove-packages/index.js +9 -9
- package/src/rule-factories/remove-packages/index.js.map +1 -1
- package/src/rule-factories/update-imports/list-of-vars.js.map +1 -1
- package/src/rule-factories/update-imports/update-imports-with-scope.d.ts.map +1 -1
- package/src/rule-factories/update-imports/update-imports-with-scope.js +3 -2
- package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -1
- package/src/rule-factories/update-imports/update-ts-imports.d.ts.map +1 -1
- package/src/rule-factories/update-imports/update-ts-imports.js +3 -3
- package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -1
- package/src/rule-factories/vscode-extensions/index.d.ts.map +1 -1
- package/src/rule-factories/vscode-extensions/index.js +5 -5
- package/src/rule-factories/vscode-extensions/index.js.map +1 -1
- package/src/tasks/eslint/index.d.ts +1 -1
- package/src/tasks/eslint/index.d.ts.map +1 -1
- package/src/tasks/eslint/index.js +2 -2
- package/src/tasks/eslint/index.js.map +1 -1
- package/src/tasks/link/index.d.ts.map +1 -1
- package/src/tasks/link/index.js.map +1 -1
- package/src/tasks/ng-add/index.d.ts.map +1 -1
- package/src/tasks/package-manager/interfaces.d.ts.map +1 -1
- package/src/tasks/package-manager/npm-exec.d.ts.map +1 -1
- package/src/tasks/package-manager/npm-exec.js.map +1 -1
- package/src/tasks/package-manager/npm-install.d.ts.map +1 -1
- package/src/tasks/package-manager/npm-install.js +1 -1
- package/src/tasks/package-manager/npm-install.js.map +1 -1
- package/src/tasks/package-manager/npm-run.d.ts.map +1 -1
- package/src/tasks/package-manager/npm-run.js.map +1 -1
- package/src/utility/ast.d.ts.map +1 -1
- package/src/utility/ast.js +12 -15
- package/src/utility/ast.js.map +1 -1
- package/src/utility/builder.d.ts.map +1 -1
- package/src/utility/builder.js.map +1 -1
- package/src/utility/collection.d.ts.map +1 -1
- package/src/utility/collection.js +2 -3
- package/src/utility/collection.js.map +1 -1
- package/src/utility/component.d.ts.map +1 -1
- package/src/utility/component.js +2 -2
- package/src/utility/component.js.map +1 -1
- package/src/utility/dependencies.d.ts +1 -1
- package/src/utility/dependencies.d.ts.map +1 -1
- package/src/utility/dependencies.js +4 -5
- package/src/utility/dependencies.js.map +1 -1
- package/src/utility/environment.d.ts.map +1 -1
- package/src/utility/environment.js.map +1 -1
- package/src/utility/error.d.ts.map +1 -1
- package/src/utility/error.js.map +1 -1
- package/src/utility/file-info.d.ts +1 -1
- package/src/utility/file-info.d.ts.map +1 -1
- package/src/utility/file-info.js +1 -1
- package/src/utility/file-info.js.map +1 -1
- package/src/utility/generation.d.ts.map +1 -1
- package/src/utility/generation.js +2 -15
- package/src/utility/generation.js.map +1 -1
- package/src/utility/gitignore.d.ts.map +1 -1
- package/src/utility/gitignore.js +2 -2
- package/src/utility/gitignore.js.map +1 -1
- package/src/utility/index.d.ts +2 -2
- package/src/utility/index.d.ts.map +1 -1
- package/src/utility/index.js +2 -2
- package/src/utility/index.js.map +1 -1
- package/src/utility/loaders.d.ts +1 -1
- package/src/utility/loaders.d.ts.map +1 -1
- package/src/utility/loaders.js +6 -6
- package/src/utility/loaders.js.map +1 -1
- package/src/utility/logo.d.ts.map +1 -1
- package/src/utility/logo.js.map +1 -1
- package/src/utility/matching-peers.d.ts.map +1 -1
- package/src/utility/matching-peers.js +3 -3
- package/src/utility/matching-peers.js.map +1 -1
- package/src/utility/migration/migration.d.ts.map +1 -1
- package/src/utility/migration/migration.js +3 -3
- package/src/utility/migration/migration.js.map +1 -1
- package/src/utility/modules.d.ts +1 -1
- package/src/utility/modules.d.ts.map +1 -1
- package/src/utility/modules.js +16 -16
- package/src/utility/modules.js.map +1 -1
- package/src/utility/monorepo.d.ts +0 -1
- package/src/utility/monorepo.d.ts.map +1 -1
- package/src/utility/monorepo.js +0 -2
- package/src/utility/monorepo.js.map +1 -1
- package/src/utility/package-manager-runner.d.ts +2 -3
- package/src/utility/package-manager-runner.d.ts.map +1 -1
- package/src/utility/package-manager-runner.js +1 -4
- package/src/utility/package-manager-runner.js.map +1 -1
- package/src/utility/package-version.d.ts +0 -1
- package/src/utility/package-version.d.ts.map +1 -1
- package/src/utility/package-version.js +3 -4
- package/src/utility/package-version.js.map +1 -1
- package/src/utility/question.d.ts.map +1 -1
- package/src/utility/question.js.map +1 -1
- package/src/utility/routes.d.ts.map +1 -1
- package/src/utility/routes.js +6 -6
- package/src/utility/routes.js.map +1 -1
- package/src/utility/sub-entry.d.ts.map +1 -1
- package/src/utility/sub-entry.js.map +1 -1
- package/src/utility/template-property.helper.d.ts.map +1 -1
- package/src/utility/template-property.helper.js +2 -2
- package/src/utility/template-property.helper.js.map +1 -1
- package/src/utility/update-imports.d.ts +1 -1
- package/src/utility/update-imports.d.ts.map +1 -1
- package/src/utility/update-imports.js +10 -14
- package/src/utility/update-imports.js.map +1 -1
- package/src/utility/update-pipes.d.ts.map +1 -1
- package/src/utility/update-pipes.js +5 -5
- package/src/utility/update-pipes.js.map +1 -1
- package/src/utility/wrapper.d.ts.map +1 -1
- package/src/utility/wrapper.js +12 -11
- package/src/utility/wrapper.js.map +1 -1
@@ -2,13 +2,16 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.registerDevtoolsToApplication = exports.injectServiceInMain = void 0;
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
5
|
-
const ts = require("typescript");
|
6
5
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
7
|
-
const index_1 = require("../../utility/index");
|
8
|
-
const utility_1 = require("../../utility");
|
9
6
|
const change_1 = require("@schematics/angular/utility/change");
|
7
|
+
const ts = require("typescript");
|
8
|
+
const collection_1 = require("../../utility/collection");
|
9
|
+
const file_info_1 = require("../../utility/file-info");
|
10
|
+
const loaders_1 = require("../../utility/loaders");
|
11
|
+
const modules_1 = require("../../utility/modules");
|
12
|
+
const add_imports_1 = require("../add-imports");
|
10
13
|
const registerModule = (options) => (tree, context) => {
|
11
|
-
const moduleFilePath = (0,
|
14
|
+
const moduleFilePath = (0, modules_1.getAppModuleFilePath)(tree, context, options.projectName);
|
12
15
|
if (!moduleFilePath) {
|
13
16
|
return tree;
|
14
17
|
}
|
@@ -18,8 +21,8 @@ const registerModule = (options) => (tree, context) => {
|
|
18
21
|
return tree;
|
19
22
|
}
|
20
23
|
let recorder = tree.beginUpdate(moduleFilePath);
|
21
|
-
const { moduleIndex } = (0,
|
22
|
-
const addImportToModuleFile = (name, file, moduleFunction) => recorder = (0,
|
24
|
+
const { moduleIndex } = (0, file_info_1.getModuleIndex)(sourceFile, sourceFileContent);
|
25
|
+
const addImportToModuleFile = (name, file, moduleFunction) => recorder = (0, modules_1.addImportToModuleFile)(name, file, sourceFile, sourceFileContent, context, recorder, moduleFilePath, moduleIndex, moduleFunction);
|
23
26
|
addImportToModuleFile(options.moduleName, options.packageName, '.instrument({isActivatedOnBootstrap: true})');
|
24
27
|
tree.commitUpdate(recorder);
|
25
28
|
return tree;
|
@@ -32,7 +35,7 @@ const injectServiceInMain = (options) => (tree, context) => {
|
|
32
35
|
if (!options.serviceName) {
|
33
36
|
return tree;
|
34
37
|
}
|
35
|
-
const mainFilePath = (0,
|
38
|
+
const mainFilePath = (0, modules_1.getMainFilePath)(tree, context, options.projectName);
|
36
39
|
if (!mainFilePath || !tree.exists(mainFilePath)) {
|
37
40
|
return tree;
|
38
41
|
}
|
@@ -44,38 +47,50 @@ const injectServiceInMain = (options) => (tree, context) => {
|
|
44
47
|
if (!match) {
|
45
48
|
return tree;
|
46
49
|
}
|
47
|
-
const sourceFile = ts.createSourceFile(mainFilePath, content, ts.ScriptTarget.ES2015, true);
|
48
50
|
const recorder = tree.beginUpdate(mainFilePath);
|
49
51
|
const changes = [];
|
52
|
+
changes.push(new change_1.InsertChange(mainFilePath, match.index + match[0].length, `
|
53
|
+
.then((m) => {
|
54
|
+
runInInjectionContext(m.injector, () => {
|
55
|
+
inject(${options.serviceName});
|
56
|
+
});
|
57
|
+
return m;
|
58
|
+
})`));
|
59
|
+
(0, change_1.applyToUpdateRecorder)(recorder, changes);
|
60
|
+
tree.commitUpdate(recorder);
|
61
|
+
const sourceFile = ts.createSourceFile(mainFilePath, content, ts.ScriptTarget.ES2015, true);
|
62
|
+
const importsToAdd = new Map();
|
50
63
|
if (!(0, ast_utils_1.isImported)(sourceFile, options.serviceName, options.packageName)) {
|
51
|
-
|
64
|
+
importsToAdd.set(options.packageName, [options.serviceName]);
|
52
65
|
}
|
53
66
|
if (!(0, ast_utils_1.isImported)(sourceFile, 'inject', '@angular/core')) {
|
54
|
-
|
67
|
+
importsToAdd.set('@angular/core', ['inject']);
|
55
68
|
}
|
56
69
|
if (!(0, ast_utils_1.isImported)(sourceFile, 'runInInjectionContext', '@angular/core')) {
|
57
|
-
|
70
|
+
const angularCoreImportsToAdd = importsToAdd.get('@angular/core');
|
71
|
+
if (angularCoreImportsToAdd) {
|
72
|
+
angularCoreImportsToAdd.push('runInInjectionContext');
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
importsToAdd.set('@angular/core', ['runInInjectionContext']);
|
76
|
+
}
|
58
77
|
}
|
59
|
-
|
60
|
-
|
61
|
-
tree.commitUpdate(recorder);
|
62
|
-
return tree;
|
78
|
+
return (0, add_imports_1.addImportsRule)(mainFilePath, [...importsToAdd.entries()]
|
79
|
+
.map(([from, importNames]) => ({ from, importNames })))(tree, context);
|
63
80
|
};
|
64
81
|
exports.injectServiceInMain = injectServiceInMain;
|
65
82
|
/**
|
66
83
|
* Register Devtools to the application
|
67
|
-
* @param tree
|
68
|
-
* @param context
|
69
84
|
* @param options
|
70
85
|
*/
|
71
86
|
const registerDevtoolsToApplication = (options) => (tree, context) => {
|
72
|
-
const workspace = (0,
|
87
|
+
const workspace = (0, loaders_1.getWorkspaceConfig)(tree);
|
73
88
|
const project = options.projectName ? workspace?.projects[options.projectName] : undefined;
|
74
89
|
if (!workspace || !project || project.projectType !== 'application') {
|
75
90
|
context.logger.warn(`Failed to determine the application to update, the devtool modules ${options.moduleName}.`);
|
76
91
|
return tree;
|
77
92
|
}
|
78
|
-
const schematicConfig = (0,
|
93
|
+
const schematicConfig = (0, collection_1.getDefaultOptionsForSchematic)(workspace, options.packageName, 'ng-add', options);
|
79
94
|
if (!schematicConfig?.registerDevtool) {
|
80
95
|
return tree;
|
81
96
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"devtools-registration.js","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/devtools-registration.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"devtools-registration.js","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/devtools-registration.ts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Lint fix
|
9
|
-
* @param
|
10
|
-
* @param _prootPath
|
9
|
+
* @param _prootPath Root path
|
11
10
|
* @param extension List of file extensions to lint
|
12
11
|
* @param options Linter options
|
13
12
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,IAAI,EAET,KAAK,MAAM,EAEZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B,UAAU,oBAAqB,SAAQ,aAAa;IAClD,6CAA6C;IAC7C,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAM,EAAE,SAAS,GAAE,MAAM,EAAW,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CA+EnH"}
|
@@ -1,13 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.applyEsLintFix = applyEsLintFix;
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
5
4
|
const node_path_1 = require("node:path");
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
6
6
|
const index_1 = require("../../tasks/index");
|
7
7
|
/**
|
8
8
|
* Apply EsLint fix
|
9
|
-
* @param
|
10
|
-
* @param _prootPath
|
9
|
+
* @param _prootPath Root path
|
11
10
|
* @param extension List of file extensions to lint
|
12
11
|
* @param options Linter options
|
13
12
|
*/
|
@@ -25,8 +24,12 @@ function applyEsLintFix(_prootPath = '/', extension = ['ts'], options) {
|
|
25
24
|
};
|
26
25
|
return (tree, context) => {
|
27
26
|
const filesToBeLint = tree.actions
|
28
|
-
.filter((a) => a.kind !== 'd')
|
27
|
+
.filter((a) => a.kind !== 'd' && extension.includes((0, node_path_1.extname)(a.path)))
|
29
28
|
.map((action) => action.path.substring(1));
|
29
|
+
if (tree.root.subfiles.some((f) => /eslint\.config\.{m,c,}[jt]s/.test(f))) {
|
30
|
+
context.addTask(new index_1.EslintFixTask(Array.from(filesToBeLint), undefined, undefined, linterOptions), options?.dependencyTaskIds);
|
31
|
+
return tree;
|
32
|
+
}
|
30
33
|
// directory of the deepest file
|
31
34
|
let dir = tree.getDir((0, node_path_1.dirname)(filesToBeLint.reduce((acc, path) => {
|
32
35
|
const level = path.split('/').length;
|
@@ -35,27 +38,23 @@ function applyEsLintFix(_prootPath = '/', extension = ['ts'], options) {
|
|
35
38
|
}
|
36
39
|
return acc;
|
37
40
|
}, { level: 0, path: '' }).path));
|
38
|
-
let
|
41
|
+
let eslintRcFile;
|
39
42
|
do {
|
40
|
-
|
41
|
-
if (
|
42
|
-
|
43
|
+
eslintRcFile = dir.subfiles.find((f) => f.startsWith('.eslintrc'));
|
44
|
+
if (eslintRcFile) {
|
45
|
+
eslintRcFile = (0, node_path_1.join)(dir.path.substring(1), eslintRcFile);
|
43
46
|
break;
|
44
47
|
}
|
45
48
|
dir = dir.parent;
|
46
49
|
} while (dir !== null);
|
47
|
-
if (dir === null || !
|
50
|
+
if (dir === null || !eslintRcFile) {
|
48
51
|
context.logger.warn(`Asked to run lint fixes, but could not find a eslintrc config file.
|
49
|
-
You can consider to run later the following command to add otter linter rules: ng add @o3r/eslint-config
|
52
|
+
You can consider to run later the following command to add otter linter rules: ng add @o3r/eslint-config`);
|
53
|
+
return tree;
|
50
54
|
}
|
51
|
-
const files = filesToBeLint.
|
52
|
-
|
53
|
-
|
54
|
-
}
|
55
|
-
return acc;
|
56
|
-
}, new Set());
|
57
|
-
if (files.size) {
|
58
|
-
context.addTask(new index_1.EslintFixTask(Array.from(files), undefined, eslintFile, linterOptions), options?.dependencyTaskIds);
|
55
|
+
const files = new Set(filesToBeLint.filter((filePath) => filePath.startsWith(dir.path.substring(1))));
|
56
|
+
if (files.size > 0) {
|
57
|
+
context.addTask(new index_1.EslintFixTask(Array.from(files), undefined, eslintRcFile, linterOptions), options?.dependencyTaskIds);
|
59
58
|
}
|
60
59
|
return tree;
|
61
60
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":";;AA6BA,wCA+EC;AA5GD,yCAImB;AACnB,2DAOoC;AACpC,6CAG2B;AAO3B;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,UAAU,GAAG,GAAG,EAAE,YAAsB,CAAC,IAAI,CAAC,EAAE,OAA8B;IAC3G,IAAI,CAAC;QACH,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAA,iBAAI,GAAE,CAAC;IAChB,CAAC;IAED,MAAM,aAAa,GAAkB;QACnC,eAAe,EAAE,IAAI;QACrB,YAAY,EAAE,IAAI;QAClB,GAAG,OAAO;KACX,CAAC;IAEF,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO;aAC/B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAA,mBAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;aACpE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAE7C,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE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MAAM,CAAC,IAAI,CAAC;yGAC+E,CAAC,CAAC;YACrG,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,GAAG,CACnB,aAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/E,CAAC;QAEF,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,CAAC,OAAO,CACb,IAAI,qBAAa,CACf,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EACjB,SAAS,EACT,YAAY,EACZ,aAAa,CACd,EACD,OAAO,EAAE,iBAAiB,CAC3B,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/get-test-frameworks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/get-test-frameworks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,uBAAuB,EACvB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAU1B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,eAAe,GAAG,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,uBAAuB,GAAG,SAAS,CAiBzI"}
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTestFramework = getTestFramework;
|
4
4
|
const index_1 = require("../../utility/index");
|
5
5
|
const testPackageMaps = {
|
6
|
-
|
7
|
-
|
6
|
+
jest: ['jest'],
|
7
|
+
jasmine: ['jasmine-core']
|
8
8
|
};
|
9
9
|
/**
|
10
10
|
* Get the test framework
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/get-test-frameworks/index.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/get-test-frameworks/index.ts"],"names":[],"mappings":";;AAqBA,4CAiBC;AA/BD,+CAE6B;AAE7B,MAAM,eAAe,GAA8C;IACjE,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,cAAc,CAAC;CAC1B,CAAC;AAEF;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,gBAAwC,EAAE,OAAyB;IAClG,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,aAAa,GAAG,IAAA,2BAAmB,EAAC,gBAAgB,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC;QACpF,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,aAAa,CAAC;QACvB,CAAC;IACH,CAAC;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,CAAC;gBACH,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,eAAe,CAAC,CAAC;YAClD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,EAAE,CAAC,CAAC,CAA4B,CAAC;AACvC,CAAC"}
|
@@ -1,11 +1,10 @@
|
|
1
1
|
export * from './add-imports/index';
|
2
|
+
export * from './check-packages-peers/index';
|
3
|
+
export * from './dev-tools/index';
|
2
4
|
export * from './eslint-fix/index';
|
3
|
-
export * from '../interfaces/rule-factories';
|
4
5
|
export * from './get-test-frameworks/index';
|
5
|
-
export * from './check-packages-peers/index';
|
6
6
|
export * from './ng-add/index';
|
7
7
|
export * from './remove-packages/index';
|
8
8
|
export * from './update-imports/index';
|
9
9
|
export * from './vscode-extensions/index';
|
10
|
-
export * from './dev-tools/index';
|
11
10
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
|
@@ -2,13 +2,12 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
tslib_1.__exportStar(require("./add-imports/index"), exports);
|
5
|
+
tslib_1.__exportStar(require("./check-packages-peers/index"), exports);
|
6
|
+
tslib_1.__exportStar(require("./dev-tools/index"), exports);
|
5
7
|
tslib_1.__exportStar(require("./eslint-fix/index"), exports);
|
6
|
-
tslib_1.__exportStar(require("../interfaces/rule-factories"), exports);
|
7
8
|
tslib_1.__exportStar(require("./get-test-frameworks/index"), exports);
|
8
|
-
tslib_1.__exportStar(require("./check-packages-peers/index"), exports);
|
9
9
|
tslib_1.__exportStar(require("./ng-add/index"), exports);
|
10
10
|
tslib_1.__exportStar(require("./remove-packages/index"), exports);
|
11
11
|
tslib_1.__exportStar(require("./update-imports/index"), exports);
|
12
12
|
tslib_1.__exportStar(require("./vscode-extensions/index"), exports);
|
13
|
-
tslib_1.__exportStar(require("./dev-tools/index"), exports);
|
14
13
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,6DAAmC;AACnC,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,uEAA6C;AAC7C,4DAAkC;AAClC,6DAAmC;AACnC,sEAA4C;AAC5C,yDAA+B;AAC/B,kEAAwC;AACxC,iEAAuC;AACvC,oEAA0C"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Rule, type SchematicContext, type TaskId, Tree } from '@angular-devkit/schematics';
|
2
2
|
import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
|
3
|
-
import { SupportedPackageManagers } from '../../utility';
|
3
|
+
import type { SupportedPackageManagers } from '../../utility';
|
4
4
|
/**
|
5
5
|
* Options to be passed to the ng add task
|
6
6
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/dependencies.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/dependencies.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,IAAI,EAEJ,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACX,IAAI,EACL,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EACL,kBAAkB,EACnB,MAAM,0CAA0C,CAAC;AAKlD,OAAO,KAAK,EACV,wBAAwB,EACzB,MAAM,eAAe,CAAC;AASvB;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5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B;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,YAAa,gBAAgB,KAAG,OAAO,IAAI,gBAAgB,GAAG;IAAE,iBAAiB,EAAE,uBAAuB,CAAA;CAEzI,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,oBAAqB,MAAM,QAAQ,IAAI,gBAAgB,MAAM,sBAAsB,OAAO,oBAAoB,OAAO,KAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAiBzL,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,YAAa,wBAAwB,KAAG,IAoIrE,CAAC"}
|
@@ -1,13 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.setupDependencies = exports.getPackageInstallConfig = exports.hasSetupInformation = void 0;
|
4
|
+
const node_fs_1 = require("node:fs");
|
5
|
+
const path = require("node:path");
|
4
6
|
const schematics_1 = require("@angular-devkit/schematics");
|
7
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
5
8
|
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
6
|
-
const path = require("node:path");
|
7
9
|
const semver = require("semver");
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const node_fs_1 = require("node:fs");
|
10
|
+
const loaders_1 = require("../../utility/loaders");
|
11
|
+
const package_manager_runner_1 = require("../../utility/package-manager-runner");
|
11
12
|
/**
|
12
13
|
* Determine if the context has information regarding the setup dependencies process
|
13
14
|
* @param context Schematic context
|
@@ -30,12 +31,12 @@ const getPackageInstallConfig = (packageJsonPath, tree, projectName, devDependen
|
|
30
31
|
return {};
|
31
32
|
}
|
32
33
|
const packageJson = JSON.parse((0, node_fs_1.readFileSync)(packageJsonPath, { encoding: 'utf8' }));
|
33
|
-
const workspaceProject = projectName ? (0,
|
34
|
+
const workspaceProject = projectName ? (0, loaders_1.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
|
34
35
|
return {
|
35
36
|
[packageJson.name]: {
|
36
37
|
inManifest: [{
|
37
38
|
range: `${exactO3rVersion ? '' : '~'}${packageJson.version}`,
|
38
|
-
types: devDependencyOnly ? [dependencies_1.NodeDependencyType.Dev] : (0,
|
39
|
+
types: devDependencyOnly ? [dependencies_1.NodeDependencyType.Dev] : (0, loaders_1.getProjectNewDependenciesTypes)(workspaceProject)
|
39
40
|
}],
|
40
41
|
requireInstall: true,
|
41
42
|
ngAddOptions: { exactO3rVersion: exactO3rVersion }
|
@@ -53,7 +54,7 @@ const setupDependencies = (options) => {
|
|
53
54
|
const ngAddToRun = new Set(Object.keys(options.dependencies)
|
54
55
|
.filter((dep) => options.ngAddToRun?.some((pattern) => typeof pattern === 'string' ? pattern === dep : pattern.test(dep))));
|
55
56
|
const requiringInstallList = new Set(Object.entries(options.dependencies).filter(([, { requireInstall }]) => requireInstall).map(([dep]) => dep));
|
56
|
-
const isInstallNeeded = () => options.skipInstall
|
57
|
+
const isInstallNeeded = () => options.skipInstall === undefined ? (ngAddToRun.size > 0 || requiringInstallList.size > 0) : !options.skipInstall;
|
57
58
|
const editPackageJson = (packageJsonPath, packageToInstall, dependency, updateLists) => {
|
58
59
|
return (tree, context) => {
|
59
60
|
if (!tree.exists(packageJsonPath)) {
|
@@ -85,8 +86,8 @@ const setupDependencies = (options) => {
|
|
85
86
|
ngAddToRun.delete(packageToInstall);
|
86
87
|
requiringInstallList.delete(packageToInstall);
|
87
88
|
}
|
88
|
-
context.logger.warn(`The dependency ${packageToInstall} (${depType}) will not added `
|
89
|
-
`because there is already this dependency with a defined range (${packageJsonContent[depType][packageToInstall]}) in targeted ${packageJsonPath}`);
|
89
|
+
context.logger.warn(`The dependency ${packageToInstall} (${depType}) will not added `
|
90
|
+
+ `because there is already this dependency with a defined range (${packageJsonContent[depType][packageToInstall]}) in targeted ${packageJsonPath}`);
|
90
91
|
}
|
91
92
|
}
|
92
93
|
else {
|
@@ -108,8 +109,8 @@ const setupDependencies = (options) => {
|
|
108
109
|
};
|
109
110
|
};
|
110
111
|
const addDependencies = (tree) => {
|
111
|
-
const workspaceConfig = (0,
|
112
|
-
const workspaceProject = options.projectName && workspaceConfig?.projects?.[options.projectName] || undefined;
|
112
|
+
const workspaceConfig = (0, loaders_1.getWorkspaceConfig)(tree);
|
113
|
+
const workspaceProject = (options.projectName && workspaceConfig?.projects?.[options.projectName]) || undefined;
|
113
114
|
const projectDirectory = workspaceProject?.root;
|
114
115
|
return (0, schematics_1.chain)(Object.entries(options.dependencies)
|
115
116
|
.map(([packageName, dependencyDetails]) => {
|
@@ -125,12 +126,14 @@ const setupDependencies = (options) => {
|
|
125
126
|
}));
|
126
127
|
};
|
127
128
|
const runNgAddSchematics = (_, context) => {
|
128
|
-
const packageManager = options.packageManager || (0,
|
129
|
-
const installId = isInstallNeeded()
|
130
|
-
|
131
|
-
|
129
|
+
const packageManager = options.packageManager || (0, package_manager_runner_1.getPackageManager)();
|
130
|
+
const installId = isInstallNeeded()
|
131
|
+
? [
|
132
|
+
context.addTask(new tasks_1.NodePackageInstallTask({ packageManager, quiet: true, workingDirectory: options.workingDirectory }), options.runAfterTasks)
|
133
|
+
]
|
134
|
+
: undefined;
|
132
135
|
if (installId !== undefined) {
|
133
|
-
context.logger.debug(`Schedule the installation of the workspace (${ngAddToRun.size > 0 ? 'for: ' + [...ngAddToRun].join(', ') : options.skipInstall ? 'skipped' : 'forced'})`);
|
136
|
+
context.logger.debug(`Schedule the installation of the workspace (${ngAddToRun.size > 0 ? 'for: ' + [...ngAddToRun].join(', ') : (options.skipInstall ? 'skipped' : 'forced')})`);
|
134
137
|
}
|
135
138
|
const getOptions = (packageName, schema) => {
|
136
139
|
const schemaOptions = schema?.description.schemaJson?.properties;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/dependencies.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/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CAAC;QAEF,OAAO,IAAA,kBAAK,EAAC;YACX,eAAe;YACf,kBAAkB;SACnB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AApIW,QAAA,iBAAiB,qBAoI5B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const tslib_1 = require("tslib");
|
4
|
-
tslib_1.__exportStar(require("./schematics-register"), exports);
|
5
4
|
tslib_1.__exportStar(require("./dependencies"), exports);
|
6
5
|
tslib_1.__exportStar(require("./ng-add.helpers"), exports);
|
6
|
+
tslib_1.__exportStar(require("./schematics-register"), exports);
|
7
7
|
//# sourceMappingURL=index.js.map
|
@@ -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,yDAA+B;AAC/B,2DAAiC;AACjC,gEAAsC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ng-add.helpers.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/ng-add.helpers.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"ng-add.helpers.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/ng-add.helpers.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAapC,OAAO,KAAK,EACV,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAqB3B;;;;;GAKG;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,CA2GzL"}
|
@@ -1,13 +1,28 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ngAddPackages = ngAddPackages;
|
4
|
+
const node_fs_1 = require("node:fs");
|
5
|
+
const path = require("node:path");
|
4
6
|
const schematics_1 = require("@angular-devkit/schematics");
|
5
7
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
6
8
|
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
7
|
-
const node_fs_1 = require("node:fs");
|
8
|
-
const path = require("node:path");
|
9
9
|
const rxjs_1 = require("rxjs");
|
10
10
|
const index_1 = require("../../utility/index");
|
11
|
+
const getNgAddSchema = (packageName, context) => {
|
12
|
+
try {
|
13
|
+
const collection = context.engine.createCollection(packageName);
|
14
|
+
return collection.createSchematic('ng-add');
|
15
|
+
}
|
16
|
+
catch {
|
17
|
+
context.logger.warn(`No ng-add found for ${packageName}`);
|
18
|
+
return undefined;
|
19
|
+
}
|
20
|
+
};
|
21
|
+
const sortDependencies = (packageJson, depType) => {
|
22
|
+
packageJson[depType] = packageJson[depType]
|
23
|
+
? Object.fromEntries(Object.entries(packageJson[depType] || {}).sort(([key1, _val1], [key2, _val2]) => key1.localeCompare(key2)))
|
24
|
+
: undefined;
|
25
|
+
};
|
11
26
|
/**
|
12
27
|
* Install via `ng add` a list of npm packages.
|
13
28
|
* @param packages List of packages to be installed via `ng add`
|
@@ -15,10 +30,10 @@ const index_1 = require("../../utility/index");
|
|
15
30
|
* @param packageJsonPath path of the package json of the project where they will be installed
|
16
31
|
*/
|
17
32
|
function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
|
18
|
-
if (
|
33
|
+
if (packages.length === 0) {
|
19
34
|
return schematics_1.noop;
|
20
35
|
}
|
21
|
-
const cwd = process.cwd().replace(/[
|
36
|
+
const cwd = process.cwd().replace(/[/\\]+/g, '/');
|
22
37
|
// FileSystem working directory might be different from Tree working directory (when using `yarn workspace` for example)
|
23
38
|
const fsWorkingDirectory = (options?.workingDirectory && !cwd.endsWith(options.workingDirectory)) ? options.workingDirectory : '.';
|
24
39
|
const versions = Object.fromEntries(packages.map((packageName, index) => [packageName, typeof options?.version === 'object' ? options.version[index] : options?.version]));
|
@@ -46,22 +61,12 @@ function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
|
|
46
61
|
}
|
47
62
|
versionFound = version;
|
48
63
|
}
|
49
|
-
catch
|
64
|
+
catch {
|
50
65
|
return;
|
51
66
|
}
|
52
67
|
}
|
53
68
|
return versionFound;
|
54
69
|
};
|
55
|
-
const getNgAddSchema = (packageName, context) => {
|
56
|
-
try {
|
57
|
-
const collection = context.engine.createCollection(packageName);
|
58
|
-
return collection.createSchematic('ng-add');
|
59
|
-
}
|
60
|
-
catch {
|
61
|
-
context.logger.warn(`No ng-add found for ${packageName}`);
|
62
|
-
return undefined;
|
63
|
-
}
|
64
|
-
};
|
65
70
|
const getOptions = (schema) => {
|
66
71
|
const schemaOptions = schema.description.schemaJson?.properties || {};
|
67
72
|
return Object.entries(options || {}).reduce((accOptions, [key, value]) => {
|
@@ -74,17 +79,12 @@ function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
|
|
74
79
|
const installedVersions = packages.map((packageName) => getInstalledVersion(packageName));
|
75
80
|
const packageManager = (0, index_1.getPackageManager)();
|
76
81
|
const packagesToInstall = packages.filter((packageName, index) => !installedVersions[index] || installedVersions[index] !== versions[packageName]);
|
77
|
-
if (packagesToInstall.length
|
82
|
+
if (packagesToInstall.length === 0) {
|
78
83
|
return schematics_1.noop;
|
79
84
|
}
|
80
85
|
return (0, schematics_1.chain)([
|
81
86
|
// Update package.json in tree
|
82
87
|
(tree) => {
|
83
|
-
const sortDependencies = (packageJson, depType) => {
|
84
|
-
packageJson[depType] = packageJson[depType] ?
|
85
|
-
Object.fromEntries(Object.entries(packageJson[depType] || {}).sort(([key1, _val1], [key2, _val2]) => key1.localeCompare(key2))) :
|
86
|
-
undefined;
|
87
|
-
};
|
88
88
|
for (const filePath of new Set([packageJsonPath, './package.json'])) {
|
89
89
|
const packageJson = tree.readJson(filePath);
|
90
90
|
packages.forEach((packageName) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ng-add.helpers.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/ng-add.helpers.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"ng-add.helpers.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/ng-add.helpers.ts"],"names":[],"mappings":";;AAuDA,sCA2GC;AAlKD,qCAIiB;AACjB,kCAAkC;AAClC,2DAOoC;AACpC,4DAE0C;AAC1C,2EAEkD;AAClD,+BAEc;AAOd,+CAE6B;AAE7B,MAAM,cAAc,GAAG,CAAC,WAAmB,EAAE,OAAyB,EAAE,EAAE;IACxE,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAChE,OAAO,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,WAAW,EAAE,CAAC,CAAC;QAC1D,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,WAAwB,EAAE,OAAgE,EAAE,EAAE;IACtH,WAAW,CAAC,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,OAAO,IAAA,kBAAK,EAAC,aAAa,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schematics-register.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/schematics-register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"schematics-register.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/schematics-register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAOhC;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAY5G;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,aAAa,UAAQ,GAAG,IAAI,CAuCjK;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,aAAa,UAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAoClK"}
|