@o3r/schematics 10.0.0-next.9 → 11.0.0-next.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/package.json +51 -41
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +3 -2
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.json +2 -2
- package/src/cli/environment.d.ts +2 -0
- package/src/cli/environment.d.ts.map +1 -0
- package/src/cli/environment.js +5 -0
- package/src/cli/environment.js.map +1 -0
- package/src/interfaces/angular-workspace.d.ts +11 -29
- package/src/interfaces/angular-workspace.d.ts.map +1 -1
- package/src/modules/index.d.ts +1 -0
- package/src/modules/index.d.ts.map +1 -1
- package/src/modules/index.js +1 -0
- package/src/modules/index.js.map +1 -1
- package/src/modules/modules.constants.d.ts +6 -2
- package/src/modules/modules.constants.d.ts.map +1 -1
- package/src/modules/modules.constants.js +5 -3
- package/src/modules/modules.constants.js.map +1 -1
- package/src/modules/modules.display.rule.d.ts +26 -0
- package/src/modules/modules.display.rule.d.ts.map +1 -0
- package/src/modules/modules.display.rule.js +45 -0
- package/src/modules/modules.display.rule.js.map +1 -0
- package/src/modules/modules.helpers.d.ts +2 -9
- package/src/modules/modules.helpers.d.ts.map +1 -1
- package/src/modules/modules.helpers.js +1 -6
- package/src/modules/modules.helpers.js.map +1 -1
- package/src/rule-factories/add-imports/index.d.ts +0 -1
- package/src/rule-factories/add-imports/index.d.ts.map +1 -1
- package/src/rule-factories/add-imports/index.js +0 -1
- package/src/rule-factories/add-imports/index.js.map +1 -1
- package/src/rule-factories/check-packages-peers/index.d.ts +0 -1
- package/src/rule-factories/check-packages-peers/index.d.ts.map +1 -1
- package/src/rule-factories/check-packages-peers/index.js +4 -7
- package/src/rule-factories/check-packages-peers/index.js.map +1 -1
- package/src/rule-factories/dev-tools/devtools-registration.d.ts +25 -0
- package/src/rule-factories/dev-tools/devtools-registration.d.ts.map +1 -0
- package/src/rule-factories/dev-tools/devtools-registration.js +89 -0
- package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -0
- package/src/rule-factories/dev-tools/index.d.ts +2 -0
- package/src/rule-factories/dev-tools/index.d.ts.map +1 -0
- package/src/rule-factories/dev-tools/index.js +5 -0
- package/src/rule-factories/dev-tools/index.js.map +1 -0
- package/src/rule-factories/eslint-fix/index.d.ts +1 -18
- package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
- package/src/rule-factories/eslint-fix/index.js +17 -26
- package/src/rule-factories/eslint-fix/index.js.map +1 -1
- package/src/rule-factories/get-test-frameworks/index.d.ts +0 -1
- package/src/rule-factories/get-test-frameworks/index.d.ts.map +1 -1
- package/src/rule-factories/get-test-frameworks/index.js +0 -1
- package/src/rule-factories/get-test-frameworks/index.js.map +1 -1
- 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 +2 -5
- package/src/rule-factories/ng-add/index.d.ts.map +1 -1
- package/src/rule-factories/ng-add/index.js +107 -83
- package/src/rule-factories/ng-add/index.js.map +1 -1
- package/src/rule-factories/remove-packages/index.d.ts +0 -1
- package/src/rule-factories/remove-packages/index.d.ts.map +1 -1
- package/src/rule-factories/remove-packages/index.js +0 -1
- package/src/rule-factories/remove-packages/index.js.map +1 -1
- package/src/rule-factories/update-imports/list-of-vars.d.ts +1 -2
- package/src/rule-factories/update-imports/list-of-vars.d.ts.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 +0 -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 +0 -1
- 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 +0 -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 +0 -1
- package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -1
- package/src/rule-factories/update-imports/v7-to-v8-map-object.js +1 -1
- package/src/rule-factories/update-imports/v7-to-v8-map-object.js.map +1 -1
- package/src/rule-factories/vscode-extensions/index.d.ts +0 -1
- package/src/rule-factories/vscode-extensions/index.d.ts.map +1 -1
- package/src/rule-factories/vscode-extensions/index.js +0 -1
- package/src/rule-factories/vscode-extensions/index.js.map +1 -1
- package/src/rules/install.d.ts +0 -1
- package/src/rules/install.d.ts.map +1 -1
- package/src/rules/install.js +0 -1
- package/src/rules/install.js.map +1 -1
- package/src/tasks/eslint/index.d.ts +17 -1
- package/src/tasks/eslint/index.d.ts.map +1 -1
- package/src/tasks/eslint/index.js +15 -6
- package/src/tasks/eslint/index.js.map +1 -1
- package/src/tasks/package-manager/add-dev-dependency.d.ts +1 -0
- package/src/tasks/package-manager/add-dev-dependency.d.ts.map +1 -1
- package/src/tasks/package-manager/add-dev-dependency.js +3 -1
- package/src/tasks/package-manager/add-dev-dependency.js.map +1 -1
- package/src/tasks/package-manager/interfaces.d.ts +9 -0
- package/src/tasks/package-manager/interfaces.d.ts.map +1 -1
- package/src/tasks/package-manager/npm-install.d.ts +2 -1
- package/src/tasks/package-manager/npm-install.d.ts.map +1 -1
- package/src/tasks/package-manager/npm-install.js +3 -1
- package/src/tasks/package-manager/npm-install.js.map +1 -1
- package/src/utility/ast.d.ts +4 -20
- package/src/utility/ast.d.ts.map +1 -1
- package/src/utility/ast.js +0 -18
- package/src/utility/ast.js.map +1 -1
- package/src/utility/builder.d.ts +11 -0
- package/src/utility/builder.d.ts.map +1 -0
- package/src/utility/builder.js +21 -0
- package/src/utility/builder.js.map +1 -0
- package/src/utility/collection.d.ts +2 -5
- package/src/utility/collection.d.ts.map +1 -1
- package/src/utility/collection.js +11 -9
- package/src/utility/collection.js.map +1 -1
- package/src/utility/component.d.ts +0 -6
- package/src/utility/component.d.ts.map +1 -1
- package/src/utility/component.js +4 -9
- package/src/utility/component.js.map +1 -1
- package/src/utility/dependencies.d.ts +0 -2
- package/src/utility/dependencies.d.ts.map +1 -1
- package/src/utility/dependencies.js +0 -2
- package/src/utility/dependencies.js.map +1 -1
- package/src/utility/environment.d.ts +27 -0
- package/src/utility/environment.d.ts.map +1 -0
- package/src/utility/environment.js +51 -0
- package/src/utility/environment.js.map +1 -0
- package/src/utility/error.d.ts +7 -0
- package/src/utility/error.d.ts.map +1 -0
- package/src/utility/error.js +17 -0
- package/src/utility/error.js.map +1 -0
- package/src/utility/file-info.d.ts +11 -1
- package/src/utility/file-info.d.ts.map +1 -1
- package/src/utility/file-info.js +46 -4
- package/src/utility/file-info.js.map +1 -1
- package/src/utility/generation.d.ts +0 -1
- package/src/utility/generation.d.ts.map +1 -1
- package/src/utility/generation.js +7 -11
- package/src/utility/generation.js.map +1 -1
- package/src/utility/gitignore.d.ts +0 -1
- package/src/utility/gitignore.d.ts.map +1 -1
- package/src/utility/gitignore.js +0 -1
- package/src/utility/gitignore.js.map +1 -1
- package/src/utility/index.d.ts +10 -7
- package/src/utility/index.d.ts.map +1 -1
- package/src/utility/index.js +10 -7
- package/src/utility/index.js.map +1 -1
- package/src/utility/loaders.d.ts +12 -50
- package/src/utility/loaders.d.ts.map +1 -1
- package/src/utility/loaders.js +34 -97
- package/src/utility/loaders.js.map +1 -1
- package/src/utility/logo.d.ts +0 -1
- package/src/utility/logo.d.ts.map +1 -1
- package/src/utility/logo.js +0 -1
- package/src/utility/logo.js.map +1 -1
- package/src/utility/matching-peers.d.ts +11 -3
- package/src/utility/matching-peers.d.ts.map +1 -1
- package/src/utility/matching-peers.js +26 -5
- package/src/utility/matching-peers.js.map +1 -1
- package/src/utility/modules.d.ts +4 -9
- package/src/utility/modules.d.ts.map +1 -1
- package/src/utility/modules.js +17 -22
- package/src/utility/modules.js.map +1 -1
- package/src/utility/monorepo.d.ts +0 -5
- package/src/utility/monorepo.d.ts.map +1 -1
- package/src/utility/monorepo.js +0 -5
- package/src/utility/monorepo.js.map +1 -1
- package/src/utility/package-manager-runner.d.ts +24 -7
- package/src/utility/package-manager-runner.d.ts.map +1 -1
- package/src/utility/package-manager-runner.js +70 -10
- package/src/utility/package-manager-runner.js.map +1 -1
- package/src/utility/package-version.d.ts +0 -2
- package/src/utility/package-version.d.ts.map +1 -1
- package/src/utility/package-version.js +0 -2
- package/src/utility/package-version.js.map +1 -1
- package/src/utility/question.d.ts +0 -1
- package/src/utility/question.d.ts.map +1 -1
- package/src/utility/question.js +0 -1
- package/src/utility/question.js.map +1 -1
- package/src/utility/routes.d.ts +0 -3
- package/src/utility/routes.d.ts.map +1 -1
- package/src/utility/routes.js +0 -5
- package/src/utility/routes.js.map +1 -1
- package/src/utility/sub-entry.d.ts +0 -2
- package/src/utility/sub-entry.d.ts.map +1 -1
- package/src/utility/sub-entry.js +0 -2
- package/src/utility/sub-entry.js.map +1 -1
- package/src/utility/template-property.helper.d.ts +0 -15
- package/src/utility/template-property.helper.d.ts.map +1 -1
- package/src/utility/template-property.helper.js +0 -16
- package/src/utility/template-property.helper.js.map +1 -1
- package/src/utility/update-imports.d.ts +0 -1
- package/src/utility/update-imports.d.ts.map +1 -1
- package/src/utility/update-imports.js +0 -1
- package/src/utility/update-imports.js.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/add-imports/index.ts"],"names":[],"mappings":";;;AACA,qEAAqE;AACrE,+DAAmF;AACnF,iCAAiC;AAEjC
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/add-imports/index.ts"],"names":[],"mappings":";;;AACA,qEAAqE;AACrE,+DAAmF;AACnF,iCAAiC;AAEjC;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAC5B,QAAgB,EAChB,OAGG,EACG,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;IAC3B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC1B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,QAAQ,kBAAkB,CAAC,CAAC;QACrF,OAAO;KACR;IACD,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,QAAQ,EACR,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACvB,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAa,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CACjF,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAA,wBAAY,EAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CACtF,EAAE,EAAE,CAAC,CAAC;IACP,IAAA,8BAAqB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAxBW,QAAA,cAAc,kBAwBzB"}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { SchematicContext, Tree } from '@angular-devkit/schematics';
|
2
2
|
/**
|
3
3
|
* List peer deps packages of the given package, display a warning if version mismatch, error if peer dep is missing
|
4
|
-
*
|
5
4
|
* @param packageName The package to check peer deps for
|
6
5
|
*/
|
7
6
|
export declare function checkPackagesRule(packageName: string): (tree: Tree, context: SchematicContext) => import("@angular-devkit/schematics/src/tree/interface").Tree;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/check-packages-peers/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/check-packages-peers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AA4FpE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,UACrC,IAAI,6FAKnB"}
|
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkPackagesRule = void 0;
|
4
4
|
const path = require("node:path");
|
5
5
|
const semver_1 = require("semver");
|
6
|
-
const
|
6
|
+
const index_1 = require("../../utility/index");
|
7
7
|
/**
|
8
8
|
* Check if the first level of peer deps of a given package are installed.
|
9
9
|
* List all not installed packages or packages with version mismatch
|
10
|
-
*
|
11
10
|
* @param packageName
|
12
11
|
*/
|
13
12
|
function getPackagesToInstallOrUpdate(packageName) {
|
@@ -16,7 +15,7 @@ function getPackagesToInstallOrUpdate(packageName) {
|
|
16
15
|
installedPackage = require(`${packageName}${path.posix.sep}package.json`);
|
17
16
|
}
|
18
17
|
catch (err) {
|
19
|
-
throw new
|
18
|
+
throw new index_1.O3rCliError(`The provided package is not installed: ${packageName}`);
|
20
19
|
}
|
21
20
|
const packagesToInstall = [];
|
22
21
|
const packagesWrongVersion = [];
|
@@ -46,13 +45,12 @@ function getPackagesToInstallOrUpdate(packageName) {
|
|
46
45
|
}
|
47
46
|
/**
|
48
47
|
* Log an instruction with the packages to install or update to match a package peer dependencies
|
49
|
-
*
|
50
48
|
* @param packageName
|
51
49
|
* @param angularJsonString
|
52
50
|
* @param logger
|
53
51
|
*/
|
54
52
|
function checkPackagesToInstallOrUpdate(packageName, logger, angularJsonString) {
|
55
|
-
const packageManager = (0,
|
53
|
+
const packageManager = (0, index_1.getPackageManager)({ workspaceConfig: angularJsonString });
|
56
54
|
const { packagesToInstall, packagesWrongVersion } = getPackagesToInstallOrUpdate(packageName);
|
57
55
|
if (packagesWrongVersion.length) {
|
58
56
|
logger.warn('');
|
@@ -68,7 +66,7 @@ function checkPackagesToInstallOrUpdate(packageName, logger, angularJsonString)
|
|
68
66
|
logger.error('');
|
69
67
|
logger.error(`The following packages need to be installed to have "${packageName}" working. Run the commands one by one:`);
|
70
68
|
packagesToInstall.forEach((dep) => logger.error(`${packageManager} run ng add ${dep.packageName}@${dep.version}`));
|
71
|
-
throw new
|
69
|
+
throw new index_1.O3rCliError('Missing peer dependencies');
|
72
70
|
}
|
73
71
|
if (!packagesToInstall.length && !packagesWrongVersion.length) {
|
74
72
|
logger.info(`The package ${packageName} has all peer deps installed.\n`);
|
@@ -76,7 +74,6 @@ function checkPackagesToInstallOrUpdate(packageName, logger, angularJsonString)
|
|
76
74
|
}
|
77
75
|
/**
|
78
76
|
* List peer deps packages of the given package, display a warning if version mismatch, error if peer dep is missing
|
79
|
-
*
|
80
77
|
* @param packageName The package to check peer deps for
|
81
78
|
*/
|
82
79
|
function checkPackagesRule(packageName) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/check-packages-peers/index.ts"],"names":[],"mappings":";;;AAEA,kCAAkC;AAClC,mCAAmC;AAEnC
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/check-packages-peers/index.ts"],"names":[],"mappings":";;;AAEA,kCAAkC;AAClC,mCAAmC;AAEnC,+CAAqE;AAarE;;;;GAIG;AACH,SAAS,4BAA4B,CAAC,WAAmB;IACvD,IAAI,gBAA6B,CAAC;IAClC,IAAI;QACF,gBAAgB,GAAG,OAAO,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,CAAC;KAC3E;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAI,mBAAW,CAAC,0CAA0C,WAAW,EAAE,CAAC,CAAC;KAChF;IAED,MAAM,iBAAiB,GAAqB,EAAE,CAAC;IAC/C,MAAM,oBAAoB,GAAqB,EAAE,CAAC;IAElD,MAAM,gBAAgB,GA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AAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACnH,MAAM,IAAI,mBAAW,CAAC,2BAA2B,CAAC,CAAC;KACpD;IAED,IAAI,CAAC,iBAAiB,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE;QAC7D,MAAM,CAAC,IAAI,CAAC,eAAe,WAAW,iCAAiC,CAAC,CAAC;KAC1E;AAEH,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,WAAmB;IACnD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/C,8BAA8B,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAND,8CAMC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
2
|
+
/** Options for the devtools register rule factory */
|
3
|
+
export interface DevtoolRegisterOptions {
|
4
|
+
/** Name of the devtool module */
|
5
|
+
moduleName: string;
|
6
|
+
/** Package name from which the devtools is exposed */
|
7
|
+
packageName: string;
|
8
|
+
/** Name of the workspace project name */
|
9
|
+
projectName?: string;
|
10
|
+
/** Name of the devtools service (if available) */
|
11
|
+
serviceName?: string;
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* Rule to inject a service after `bootstrapModule` or `bootstrapApplication`
|
15
|
+
* @param options
|
16
|
+
*/
|
17
|
+
export declare const injectServiceInMain: (options: DevtoolRegisterOptions) => Rule;
|
18
|
+
/**
|
19
|
+
* Register Devtools to the application
|
20
|
+
* @param tree
|
21
|
+
* @param context
|
22
|
+
* @param options
|
23
|
+
*/
|
24
|
+
export declare const registerDevtoolsToApplication: (options: DevtoolRegisterOptions) => Rule;
|
25
|
+
//# sourceMappingURL=devtools-registration.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/devtools-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAQzD,qDAAqD;AACrD,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAoCD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,YAAa,sBAAsB,KAAG,IAoDrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAAa,sBAAsB,KAAG,IAsB/E,CAAC"}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.registerDevtoolsToApplication = exports.injectServiceInMain = void 0;
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
5
|
+
const ts = require("typescript");
|
6
|
+
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
7
|
+
const utility_1 = require("../../utility");
|
8
|
+
const utility_2 = require("../../utility");
|
9
|
+
const change_1 = require("@schematics/angular/utility/change");
|
10
|
+
const registerModule = (options) => (tree, context) => {
|
11
|
+
const moduleFilePath = (0, utility_1.getAppModuleFilePath)(tree, context, options.projectName);
|
12
|
+
if (!moduleFilePath) {
|
13
|
+
return tree;
|
14
|
+
}
|
15
|
+
const sourceFileContent = tree.read(moduleFilePath).toString();
|
16
|
+
const sourceFile = ts.createSourceFile(moduleFilePath, sourceFileContent, ts.ScriptTarget.ES2015, true);
|
17
|
+
if ((0, ast_utils_1.isImported)(sourceFile, options.moduleName, options.packageName)) {
|
18
|
+
return tree;
|
19
|
+
}
|
20
|
+
let recorder = tree.beginUpdate(moduleFilePath);
|
21
|
+
const { moduleIndex } = (0, utility_1.getModuleIndex)(sourceFile, sourceFileContent);
|
22
|
+
const addImportToModuleFile = (name, file, moduleFunction) => recorder = (0, utility_2.addImportToModuleFile)(name, file, sourceFile, sourceFileContent, context, recorder, moduleFilePath, moduleIndex, moduleFunction);
|
23
|
+
addImportToModuleFile(options.moduleName, options.packageName, '.instrument({isActivatedOnBootstrap: true})');
|
24
|
+
tree.commitUpdate(recorder);
|
25
|
+
return tree;
|
26
|
+
};
|
27
|
+
/**
|
28
|
+
* Rule to inject a service after `bootstrapModule` or `bootstrapApplication`
|
29
|
+
* @param options
|
30
|
+
*/
|
31
|
+
const injectServiceInMain = (options) => (tree, context) => {
|
32
|
+
if (!options.serviceName) {
|
33
|
+
return tree;
|
34
|
+
}
|
35
|
+
const mainFilePath = (0, utility_1.getMainFilePath)(tree, context, options.projectName);
|
36
|
+
if (!mainFilePath || !tree.exists(mainFilePath)) {
|
37
|
+
return tree;
|
38
|
+
}
|
39
|
+
const content = tree.readText(mainFilePath);
|
40
|
+
if (content.includes(`inject(${options.serviceName})`)) {
|
41
|
+
return tree;
|
42
|
+
}
|
43
|
+
const match = /bootstrap(Module|Application)\([^)]*\)/.exec(content);
|
44
|
+
if (!match) {
|
45
|
+
return tree;
|
46
|
+
}
|
47
|
+
const sourceFile = ts.createSourceFile(mainFilePath, content, ts.ScriptTarget.ES2015, true);
|
48
|
+
const recorder = tree.beginUpdate(mainFilePath);
|
49
|
+
const changes = [];
|
50
|
+
if (!(0, ast_utils_1.isImported)(sourceFile, options.serviceName, options.packageName)) {
|
51
|
+
changes.push((0, ast_utils_1.insertImport)(sourceFile, mainFilePath, options.serviceName, options.packageName));
|
52
|
+
}
|
53
|
+
if (!(0, ast_utils_1.isImported)(sourceFile, 'inject', '@angular/core')) {
|
54
|
+
changes.push((0, ast_utils_1.insertImport)(sourceFile, mainFilePath, 'inject', '@angular/core'));
|
55
|
+
}
|
56
|
+
if (!(0, ast_utils_1.isImported)(sourceFile, 'runInInjectionContext', '@angular/core')) {
|
57
|
+
changes.push((0, ast_utils_1.insertImport)(sourceFile, mainFilePath, 'runInInjectionContext', '@angular/core'));
|
58
|
+
}
|
59
|
+
changes.push(new change_1.InsertChange(mainFilePath, match.index + match[0].length, `\n .then((m) => { runInInjectionContext(m.injector, () => { inject(${options.serviceName}); }); return m; })`));
|
60
|
+
(0, change_1.applyToUpdateRecorder)(recorder, changes);
|
61
|
+
tree.commitUpdate(recorder);
|
62
|
+
return tree;
|
63
|
+
};
|
64
|
+
exports.injectServiceInMain = injectServiceInMain;
|
65
|
+
/**
|
66
|
+
* Register Devtools to the application
|
67
|
+
* @param tree
|
68
|
+
* @param context
|
69
|
+
* @param options
|
70
|
+
*/
|
71
|
+
const registerDevtoolsToApplication = (options) => (tree, context) => {
|
72
|
+
const workspace = (0, utility_1.getWorkspaceConfig)(tree);
|
73
|
+
const project = options.projectName ? workspace?.projects[options.projectName] : undefined;
|
74
|
+
if (!workspace || !project || project.projectType !== 'application') {
|
75
|
+
context.logger.warn(`Failed to determine the application to update, the devtool modules ${options.moduleName}.`);
|
76
|
+
return tree;
|
77
|
+
}
|
78
|
+
const schematicConfig = (0, utility_1.getDefaultOptionsForSchematic)(workspace, options.packageName, 'ng-add', options);
|
79
|
+
if (!schematicConfig?.registerDevtool) {
|
80
|
+
return tree;
|
81
|
+
}
|
82
|
+
return (0, schematics_1.chain)([
|
83
|
+
registerModule(options),
|
84
|
+
(0, exports.injectServiceInMain)(options),
|
85
|
+
(_, ctx) => ctx.logger.info(`The devtools module ${options.moduleName} has been registered and automatically activated${options.serviceName ? ', its activation can be driven via ' + options.serviceName : ''}.`)
|
86
|
+
])(tree, context);
|
87
|
+
};
|
88
|
+
exports.registerDevtoolsToApplication = registerDevtoolsToApplication;
|
89
|
+
//# sourceMappingURL=devtools-registration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"devtools-registration.js","sourceRoot":"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AC,CAAC;QACjH,OAAO,IAAI,CAAC;KACb;IAED,MAAM,eAAe,GAAG,IAAA,uCAA6B,EAAkC,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE1I,IAAI,CAAC,eAAe,EAAE,eAAe,EAAE;QACrC,OAAO,IAAI,CAAC;KACb;IAED,OAAO,IAAA,kBAAK,EAAC;QACX,cAAc,CAAC,OAAO,CAAC;QACvB,IAAA,2BAAmB,EAAC,OAAO,CAAC;QAC5B,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CACzB,uBAAuB,OAAO,CAAC,UAAU,mDAAmD,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,qCAAqC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,CACtL;KACF,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACpB,CAAC,CAAC;AAtBW,QAAA,6BAA6B,iCAsBxC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC"}
|
@@ -1,24 +1,7 @@
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
2
|
-
|
3
|
-
* Linter options
|
4
|
-
*/
|
5
|
-
export interface LinterOptions {
|
6
|
-
/**
|
7
|
-
* Indicates if the linter process should succeed even if there are lint errors remaining
|
8
|
-
*
|
9
|
-
* @default true
|
10
|
-
*/
|
11
|
-
force?: boolean;
|
12
|
-
/**
|
13
|
-
* If enabled, only errors are reported (--quiet option of ESLint CLI)
|
14
|
-
*
|
15
|
-
* @default true
|
16
|
-
*/
|
17
|
-
hideWarnings?: boolean;
|
18
|
-
}
|
2
|
+
import { LinterOptions } from '../../tasks';
|
19
3
|
/**
|
20
4
|
* Apply EsLint fix
|
21
|
-
*
|
22
5
|
* @param prootPath Root path
|
23
6
|
* @param _prootPath
|
24
7
|
* @param extension List of file extensions to lint
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAM,EAAE,SAAS,GAAE,MAAM,EAAW,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAkE5G"}
|
@@ -1,28 +1,34 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.applyEsLintFix = void 0;
|
4
|
-
const
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
5
5
|
const node_path_1 = require("node:path");
|
6
|
-
const
|
6
|
+
const tasks_1 = require("../../tasks");
|
7
7
|
/**
|
8
8
|
* Apply EsLint fix
|
9
|
-
*
|
10
9
|
* @param prootPath Root path
|
11
10
|
* @param _prootPath
|
12
11
|
* @param extension List of file extensions to lint
|
13
12
|
* @param options Linter options
|
14
13
|
*/
|
15
14
|
function applyEsLintFix(_prootPath = '/', extension = ['ts'], options) {
|
15
|
+
try {
|
16
|
+
require.resolve('eslint/package.json');
|
17
|
+
}
|
18
|
+
catch {
|
19
|
+
return (0, schematics_1.noop)();
|
20
|
+
}
|
16
21
|
const linterOptions = {
|
17
|
-
|
22
|
+
continueOnError: true,
|
18
23
|
hideWarnings: true,
|
19
24
|
...options
|
20
25
|
};
|
21
26
|
return (tree, context) => {
|
27
|
+
const filesToBeLint = tree.actions
|
28
|
+
.filter((a) => a.kind !== 'd')
|
29
|
+
.map((action) => action.path.substring(1));
|
22
30
|
// directory of the deepest file
|
23
|
-
let dir = tree.getDir((0, node_path_1.dirname)(
|
24
|
-
.map((action) => action.path.substr(1))
|
25
|
-
.reduce((acc, path) => {
|
31
|
+
let dir = tree.getDir((0, node_path_1.dirname)(filesToBeLint.reduce((acc, path) => {
|
26
32
|
const level = path.split('/').length;
|
27
33
|
if (acc.level < level) {
|
28
34
|
return { level, path };
|
@@ -33,7 +39,7 @@ function applyEsLintFix(_prootPath = '/', extension = ['ts'], options) {
|
|
33
39
|
do {
|
34
40
|
eslintFile = dir.subfiles.find((f) => f.startsWith('.eslintrc'));
|
35
41
|
if (eslintFile) {
|
36
|
-
eslintFile = (0, node_path_1.join)(dir.path.
|
42
|
+
eslintFile = (0, node_path_1.join)(dir.path.substring(1), eslintFile);
|
37
43
|
break;
|
38
44
|
}
|
39
45
|
dir = dir.parent;
|
@@ -42,28 +48,13 @@ function applyEsLintFix(_prootPath = '/', extension = ['ts'], options) {
|
|
42
48
|
context.logger.warn(`Asked to run lint fixes, but could not find a eslintrc config file.
|
43
49
|
You can consider to run later the following command to add otter linter rules: ng add @o3r/eslint-config-otter`);
|
44
50
|
}
|
45
|
-
const files =
|
46
|
-
|
47
|
-
if (extension.some((ext) => filePath.endsWith(`.${ext}`)) && dir && action.path.startsWith(dir.path)) {
|
51
|
+
const files = filesToBeLint.reduce((acc, filePath) => {
|
52
|
+
if (extension.some((ext) => filePath.endsWith(`.${ext}`)) && dir && filePath.startsWith(dir.path)) {
|
48
53
|
acc.add(filePath);
|
49
54
|
}
|
50
55
|
return acc;
|
51
56
|
}, new Set());
|
52
|
-
|
53
|
-
(0, node_child_process_1.exec)(`${(0, package_manager_runner_1.getPackageManagerExecutor)()} eslint ` +
|
54
|
-
Array.from(files).map((file) => `"${file}"`).join(' ') +
|
55
|
-
' --fix --color' +
|
56
|
-
(linterOptions.hideWarnings ? ' --quiet' : '') +
|
57
|
-
(eslintFile ? ` --config ${eslintFile} --parser-options=tsconfigRootDir:${(0, node_path_1.resolve)(process.cwd(), (0, node_path_1.dirname)(eslintFile))}` : ''), (_error, stdout, stderr) => {
|
58
|
-
context.logger.info(stdout);
|
59
|
-
if (!linterOptions.force) {
|
60
|
-
context.logger.error(stderr);
|
61
|
-
}
|
62
|
-
});
|
63
|
-
}
|
64
|
-
catch {
|
65
|
-
context.logger.error('Could not run eslint');
|
66
|
-
}
|
57
|
+
context.addTask(new tasks_1.EslintFixTask(Array.from(files), undefined, eslintFile, linterOptions));
|
67
58
|
return tree;
|
68
59
|
};
|
69
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":";;;AAAA,2DAA0F;AAC1F,yCAA0C;AAC1C,uCAA2D;AAE3D;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,UAAU,GAAG,GAAG,EAAE,YAAsB,CAAC,IAAI,CAAC,EAAE,OAAuB;IACpG,IAAI;QACF,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;KACxC;IAAC,MAAM;QACN,OAAO,IAAA,iBAAI,GAAE,CAAC;KACf;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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AE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;gBACjG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;aACnB;YAED,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,IAAI,GAAG,EAAU,CAAC,CAAC;QAEtB,OAAO,CAAC,OAAO,CACb,IAAI,qBAAa,CACf,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EACjB,SAAS,EACT,UAAU,EACV,aAAa,CACd,CACF,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAlED,wCAkEC"}
|
@@ -1 +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
|
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;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,eAAe,GAAG,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,uBAAuB,GAAG,SAAS,CAiBzI"}
|
@@ -1 +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
|
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;;;;GAIG;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 +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,6BAA6B,CAAC;AAC5C,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;AAC1C,cAAc,mBAAmB,CAAC"}
|
@@ -10,4 +10,5 @@ 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);
|
13
14
|
//# 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,uDAA6B;AAC7B,sEAA4C;AAC5C,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;AAC1C,4DAAkC"}
|
@@ -5,7 +5,6 @@ import { SchematicOptionObject } from '../../interfaces';
|
|
5
5
|
import type { NgAddPackageOptions } from '../../tasks/index';
|
6
6
|
/**
|
7
7
|
* Install via `ng add` a list of npm packages.
|
8
|
-
*
|
9
8
|
* @param packages List of packages to be installed via `ng add`
|
10
9
|
* @param options install options
|
11
10
|
* @param packageJsonPath path of the package json of the project where they will be installed
|
@@ -15,7 +14,6 @@ export declare function ngAddPackages(packages: string[], options?: Omit<NgAddPa
|
|
15
14
|
}, packageJsonPath?: string): Rule;
|
16
15
|
/**
|
17
16
|
* Look for the peer dependencies and run ng add on the package requested version
|
18
|
-
*
|
19
17
|
* @param packages list of the name of the packages needed
|
20
18
|
* @param packageJsonPath path to package json that needs the peer to be resolved
|
21
19
|
* @param type how to install the dependency (dev, peer for a library or default for an application)
|
@@ -25,16 +23,15 @@ export declare function ngAddPackages(packages: string[], options?: Omit<NgAddPa
|
|
25
23
|
export declare function ngAddPeerDependencyPackages(packages: string[], packageJsonPath: string, type: NodeDependencyType | undefined, options: NgAddPackageOptions, parentPackageInfo?: string): Rule;
|
26
24
|
/**
|
27
25
|
* Register the given package in the Angular CLI schematics
|
28
|
-
*
|
29
26
|
* @param packageJson PackageJson of the project containing the collection to add to the project
|
30
27
|
* @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
|
31
28
|
*/
|
32
29
|
export declare function registerPackageCollectionSchematics(packageJson: PackageJson, angularJsonFile?: string): Rule;
|
33
30
|
/**
|
34
31
|
* Setup schematics default params in angular.json
|
35
|
-
*
|
36
32
|
* @param schematicsDefaultParams default params to setup by schematic
|
33
|
+
* @param overrideValue Define if the given value should override the one already defined in the workspace
|
37
34
|
* @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
|
38
35
|
*/
|
39
|
-
export declare function setupSchematicsDefaultParams(schematicsDefaultParams: Record<string, SchematicOptionObject>, angularJsonFile?: string): Rule;
|
36
|
+
export declare function setupSchematicsDefaultParams(schematicsDefaultParams: Record<string, SchematicOptionObject>, overrideValue?: boolean, angularJsonFile?: string): Rule;
|
40
37
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,IAAI,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,IAAI,EAA+B,MAAM,4BAA4B,CAAC;AAG/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAI9E,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;AAG7D;;;;;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,CA0HzL;AAED;;;;;;;GAOG;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;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAY5G;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,aAAa,UAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAgClK"}
|