@abp/ng.schematics 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/collection.json +29 -29
- package/commands/api/files-enum/proxy/__namespace@dir__/__name@kebab__.enum.ts.template +8 -8
- package/commands/api/files-model/proxy/__namespace@dir__/models.ts.template +9 -9
- package/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template +25 -25
- package/commands/api/index.d.ts +2 -2
- package/commands/api/index.js +112 -112
- package/commands/api/schema.json +45 -45
- package/commands/proxy-add/index.d.ts +2 -2
- package/commands/proxy-add/index.js +41 -41
- package/commands/proxy-add/schema.json +45 -45
- package/commands/proxy-index/index.d.ts +4 -4
- package/commands/proxy-index/index.js +14 -14
- package/commands/proxy-index/schema.json +18 -18
- package/commands/proxy-refresh/index.d.ts +3 -3
- package/commands/proxy-refresh/index.js +27 -27
- package/commands/proxy-refresh/schema.json +45 -45
- package/commands/proxy-remove/index.d.ts +3 -3
- package/commands/proxy-remove/index.js +33 -33
- package/commands/proxy-remove/schema.json +45 -45
- package/constants/api.d.ts +1 -1
- package/constants/api.js +4 -4
- package/constants/index.d.ts +4 -4
- package/constants/index.js +16 -16
- package/constants/proxy.d.ts +4 -4
- package/constants/proxy.js +24 -24
- package/constants/system-types.d.ts +1 -1
- package/constants/system-types.js +27 -27
- package/constants/volo.d.ts +1 -1
- package/constants/volo.js +4 -4
- package/enums/binding-source-id.d.ts +6 -6
- package/enums/binding-source-id.js +10 -10
- package/enums/exception.d.ts +16 -16
- package/enums/exception.js +2 -2
- package/enums/import-keyword.d.ts +4 -4
- package/enums/import-keyword.js +8 -8
- package/enums/index.d.ts +4 -4
- package/enums/index.js +16 -16
- package/enums/method-modifier.d.ts +6 -6
- package/enums/method-modifier.js +10 -10
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/models/api-definition.d.ts +72 -72
- package/models/api-definition.js +2 -2
- package/models/generate-proxy-schema.d.ts +18 -18
- package/models/generate-proxy-schema.js +2 -2
- package/models/import.d.ts +11 -11
- package/models/import.js +13 -13
- package/models/index.d.ts +10 -10
- package/models/index.js +22 -22
- package/models/method.d.ts +31 -31
- package/models/method.js +61 -61
- package/models/model.d.ts +48 -48
- package/models/model.js +71 -71
- package/models/project.d.ts +5 -5
- package/models/project.js +2 -2
- package/models/proxy-config.d.ts +4 -4
- package/models/proxy-config.js +2 -2
- package/models/service.d.ts +21 -21
- package/models/service.js +11 -11
- package/models/tree.d.ts +1 -1
- package/models/tree.js +2 -2
- package/models/util.d.ts +7 -7
- package/models/util.js +2 -2
- package/package.json +1 -1
- package/test-setup.d.ts +1 -1
- package/test-setup.js +3 -3
- package/utils/angular/ast-utils.d.ts +115 -115
- package/utils/angular/ast-utils.js +598 -598
- package/utils/angular/change.d.ts +66 -66
- package/utils/angular/change.js +96 -96
- package/utils/angular/config.d.ts +455 -455
- package/utils/angular/config.js +70 -70
- package/utils/angular/dependencies.d.ts +23 -23
- package/utils/angular/dependencies.js +58 -58
- package/utils/angular/find-module.d.ts +35 -35
- package/utils/angular/find-module.js +105 -105
- package/utils/angular/index.d.ts +17 -17
- package/utils/angular/index.js +29 -29
- package/utils/angular/json-file.d.ts +23 -23
- package/utils/angular/json-file.js +61 -61
- package/utils/angular/json-utils.d.ts +14 -14
- package/utils/angular/json-utils.js +158 -158
- package/utils/angular/latest-versions.d.ts +18 -18
- package/utils/angular/latest-versions.js +26 -26
- package/utils/angular/lint-fix.d.ts +9 -9
- package/utils/angular/lint-fix.js +41 -41
- package/utils/angular/ng-ast-utils.d.ts +5 -5
- package/utils/angular/ng-ast-utils.js +75 -75
- package/utils/angular/parse-name.d.ts +13 -13
- package/utils/angular/parse-name.js +21 -21
- package/utils/angular/paths.d.ts +8 -8
- package/utils/angular/paths.js +21 -21
- package/utils/angular/project-targets.d.ts +9 -9
- package/utils/angular/project-targets.js +15 -15
- package/utils/angular/tsconfig.d.ts +16 -16
- package/utils/angular/tsconfig.js +62 -62
- package/utils/angular/validation.d.ts +4 -4
- package/utils/angular/validation.js +73 -73
- package/utils/angular/workspace-models.d.ts +159 -159
- package/utils/angular/workspace-models.js +29 -29
- package/utils/angular/workspace.d.ts +18 -18
- package/utils/angular/workspace.js +75 -75
- package/utils/api.d.ts +2 -2
- package/utils/api.js +8 -8
- package/utils/ast.d.ts +4 -4
- package/utils/ast.js +23 -23
- package/utils/barrel.d.ts +4 -4
- package/utils/barrel.js +92 -92
- package/utils/common.d.ts +6 -6
- package/utils/common.js +33 -33
- package/utils/enum.d.ts +18 -18
- package/utils/enum.js +40 -40
- package/utils/file.d.ts +2 -2
- package/utils/file.js +9 -9
- package/utils/generics.d.ts +24 -24
- package/utils/generics.js +87 -87
- package/utils/import.d.ts +3 -3
- package/utils/import.js +11 -11
- package/utils/index.d.ts +19 -19
- package/utils/index.js +31 -31
- package/utils/model.d.ts +11 -11
- package/utils/model.js +141 -141
- package/utils/namespace.d.ts +1 -1
- package/utils/namespace.js +18 -18
- package/utils/path.d.ts +2 -2
- package/utils/path.js +36 -36
- package/utils/rule.d.ts +4 -4
- package/utils/rule.js +27 -27
- package/utils/service.d.ts +6 -6
- package/utils/service.js +82 -82
- package/utils/source.d.ts +13 -13
- package/utils/source.js +162 -162
- package/utils/text.d.ts +9 -9
- package/utils/text.js +46 -46
- package/utils/tree.d.ts +13 -13
- package/utils/tree.js +56 -56
- package/utils/type.d.ts +12 -12
- package/utils/type.js +102 -102
- package/utils/workspace.d.ts +8 -8
- package/utils/workspace.js +66 -66
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.io/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.verifyBaseTsConfigExists = exports.addTsConfigProjectReferences = void 0;
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
-
const json_utils_1 = require("./json-utils");
|
|
14
|
-
const SOLUTION_TSCONFIG_PATH = 'tsconfig.json';
|
|
15
|
-
/**
|
|
16
|
-
* Add project references in "Solution Style" tsconfig.
|
|
17
|
-
*/
|
|
18
|
-
function addTsConfigProjectReferences(paths) {
|
|
19
|
-
return (host, context) => {
|
|
20
|
-
const logger = context.logger;
|
|
21
|
-
// We need to read after each write to avoid missing `,` when appending multiple items.
|
|
22
|
-
for (const path of paths) {
|
|
23
|
-
const source = host.read(SOLUTION_TSCONFIG_PATH);
|
|
24
|
-
if (!source) {
|
|
25
|
-
// Solution tsconfig doesn't exist.
|
|
26
|
-
logger.warn(`Cannot add reference '${path}' in '${SOLUTION_TSCONFIG_PATH}'. File doesn't exists.`);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const jsonAst = core_1.parseJsonAst(source.toString(), core_1.JsonParseMode.Loose);
|
|
30
|
-
if ((jsonAst === null || jsonAst === void 0 ? void 0 : jsonAst.kind) !== 'object') {
|
|
31
|
-
// Invalid JSON
|
|
32
|
-
throw new schematics_1.SchematicsException(`Invalid JSON AST Object '${SOLUTION_TSCONFIG_PATH}'.`);
|
|
33
|
-
}
|
|
34
|
-
// Solutions style tsconfig can contain 2 properties:
|
|
35
|
-
// - 'files' with a value of empty array
|
|
36
|
-
// - 'references'
|
|
37
|
-
const filesAst = json_utils_1.findPropertyInAstObject(jsonAst, 'files');
|
|
38
|
-
const referencesAst = json_utils_1.findPropertyInAstObject(jsonAst, 'references');
|
|
39
|
-
if ((filesAst === null || filesAst === void 0 ? void 0 : filesAst.kind) !== 'array' ||
|
|
40
|
-
filesAst.elements.length !== 0 ||
|
|
41
|
-
(referencesAst === null || referencesAst === void 0 ? void 0 : referencesAst.kind) !== 'array') {
|
|
42
|
-
logger.warn(`Cannot add reference '${path}' in '${SOLUTION_TSCONFIG_PATH}'. It appears to be an invalid solution style tsconfig.`);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
// Append new paths
|
|
46
|
-
const recorder = host.beginUpdate(SOLUTION_TSCONFIG_PATH);
|
|
47
|
-
json_utils_1.appendValueInAstArray(recorder, referencesAst, { path: `./${path}` }, 4);
|
|
48
|
-
host.commitUpdate(recorder);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
exports.addTsConfigProjectReferences = addTsConfigProjectReferences;
|
|
53
|
-
/**
|
|
54
|
-
* Throws an exception when the base tsconfig doesn't exists.
|
|
55
|
-
*/
|
|
56
|
-
function verifyBaseTsConfigExists(host) {
|
|
57
|
-
if (host.exists('tsconfig.json')) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
throw new schematics_1.SchematicsException(`Cannot find base TypeScript configuration file 'tsconfig.json'.`);
|
|
61
|
-
}
|
|
62
|
-
exports.verifyBaseTsConfigExists = verifyBaseTsConfigExists;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.verifyBaseTsConfigExists = exports.addTsConfigProjectReferences = void 0;
|
|
11
|
+
const core_1 = require("@angular-devkit/core");
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const json_utils_1 = require("./json-utils");
|
|
14
|
+
const SOLUTION_TSCONFIG_PATH = 'tsconfig.json';
|
|
15
|
+
/**
|
|
16
|
+
* Add project references in "Solution Style" tsconfig.
|
|
17
|
+
*/
|
|
18
|
+
function addTsConfigProjectReferences(paths) {
|
|
19
|
+
return (host, context) => {
|
|
20
|
+
const logger = context.logger;
|
|
21
|
+
// We need to read after each write to avoid missing `,` when appending multiple items.
|
|
22
|
+
for (const path of paths) {
|
|
23
|
+
const source = host.read(SOLUTION_TSCONFIG_PATH);
|
|
24
|
+
if (!source) {
|
|
25
|
+
// Solution tsconfig doesn't exist.
|
|
26
|
+
logger.warn(`Cannot add reference '${path}' in '${SOLUTION_TSCONFIG_PATH}'. File doesn't exists.`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const jsonAst = core_1.parseJsonAst(source.toString(), core_1.JsonParseMode.Loose);
|
|
30
|
+
if ((jsonAst === null || jsonAst === void 0 ? void 0 : jsonAst.kind) !== 'object') {
|
|
31
|
+
// Invalid JSON
|
|
32
|
+
throw new schematics_1.SchematicsException(`Invalid JSON AST Object '${SOLUTION_TSCONFIG_PATH}'.`);
|
|
33
|
+
}
|
|
34
|
+
// Solutions style tsconfig can contain 2 properties:
|
|
35
|
+
// - 'files' with a value of empty array
|
|
36
|
+
// - 'references'
|
|
37
|
+
const filesAst = json_utils_1.findPropertyInAstObject(jsonAst, 'files');
|
|
38
|
+
const referencesAst = json_utils_1.findPropertyInAstObject(jsonAst, 'references');
|
|
39
|
+
if ((filesAst === null || filesAst === void 0 ? void 0 : filesAst.kind) !== 'array' ||
|
|
40
|
+
filesAst.elements.length !== 0 ||
|
|
41
|
+
(referencesAst === null || referencesAst === void 0 ? void 0 : referencesAst.kind) !== 'array') {
|
|
42
|
+
logger.warn(`Cannot add reference '${path}' in '${SOLUTION_TSCONFIG_PATH}'. It appears to be an invalid solution style tsconfig.`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Append new paths
|
|
46
|
+
const recorder = host.beginUpdate(SOLUTION_TSCONFIG_PATH);
|
|
47
|
+
json_utils_1.appendValueInAstArray(recorder, referencesAst, { path: `./${path}` }, 4);
|
|
48
|
+
host.commitUpdate(recorder);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
exports.addTsConfigProjectReferences = addTsConfigProjectReferences;
|
|
53
|
+
/**
|
|
54
|
+
* Throws an exception when the base tsconfig doesn't exists.
|
|
55
|
+
*/
|
|
56
|
+
function verifyBaseTsConfigExists(host) {
|
|
57
|
+
if (host.exists('tsconfig.json')) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
throw new schematics_1.SchematicsException(`Cannot find base TypeScript configuration file 'tsconfig.json'.`);
|
|
61
|
+
}
|
|
62
|
+
exports.verifyBaseTsConfigExists = verifyBaseTsConfigExists;
|
|
63
63
|
//# sourceMappingURL=tsconfig.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function validateName(name: string): void;
|
|
2
|
-
export declare const htmlSelectorRe: RegExp;
|
|
3
|
-
export declare function validateHtmlSelector(selector: string): void;
|
|
4
|
-
export declare function validateProjectName(projectName: string): void;
|
|
1
|
+
export declare function validateName(name: string): void;
|
|
2
|
+
export declare const htmlSelectorRe: RegExp;
|
|
3
|
+
export declare function validateHtmlSelector(selector: string): void;
|
|
4
|
+
export declare function validateProjectName(projectName: string): void;
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateProjectName = exports.validateHtmlSelector = exports.htmlSelectorRe = exports.validateName = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10
|
-
*/
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
-
function validateName(name) {
|
|
14
|
-
if (name && /^\d/.test(name)) {
|
|
15
|
-
throw new schematics_1.SchematicsException(core_1.tags.oneLine `name (${name})
|
|
16
|
-
can not start with a digit.`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.validateName = validateName;
|
|
20
|
-
// Must start with a letter, and must contain only alphanumeric characters or dashes.
|
|
21
|
-
// When adding a dash the segment after the dash must also start with a letter.
|
|
22
|
-
exports.htmlSelectorRe = /^[a-zA-Z][.0-9a-zA-Z]*(:?-[a-zA-Z][.0-9a-zA-Z]*)*$/;
|
|
23
|
-
function validateHtmlSelector(selector) {
|
|
24
|
-
if (selector && !exports.htmlSelectorRe.test(selector)) {
|
|
25
|
-
throw new schematics_1.SchematicsException(core_1.tags.oneLine `Selector (${selector})
|
|
26
|
-
is invalid.`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.validateHtmlSelector = validateHtmlSelector;
|
|
30
|
-
function validateProjectName(projectName) {
|
|
31
|
-
const errorIndex = getRegExpFailPosition(projectName);
|
|
32
|
-
const unsupportedProjectNames = [];
|
|
33
|
-
const packageNameRegex = /^(?:@[a-zA-Z0-9_-]+\/)?[a-zA-Z0-9_-]+$/;
|
|
34
|
-
if (errorIndex !== null) {
|
|
35
|
-
const firstMessage = core_1.tags.oneLine `
|
|
36
|
-
Project name "${projectName}" is not valid. New project names must
|
|
37
|
-
start with a letter, and must contain only alphanumeric characters or dashes.
|
|
38
|
-
When adding a dash the segment after the dash must also start with a letter.
|
|
39
|
-
`;
|
|
40
|
-
const msg = core_1.tags.stripIndent `
|
|
41
|
-
${firstMessage}
|
|
42
|
-
${projectName}
|
|
43
|
-
${Array(errorIndex + 1).join(' ') + '^'}
|
|
44
|
-
`;
|
|
45
|
-
throw new schematics_1.SchematicsException(msg);
|
|
46
|
-
}
|
|
47
|
-
else if (unsupportedProjectNames.indexOf(projectName) !== -1) {
|
|
48
|
-
throw new schematics_1.SchematicsException(`Project name ${JSON.stringify(projectName)} is not a supported name.`);
|
|
49
|
-
}
|
|
50
|
-
else if (!packageNameRegex.test(projectName)) {
|
|
51
|
-
throw new schematics_1.SchematicsException(`Project name ${JSON.stringify(projectName)} is invalid.`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.validateProjectName = validateProjectName;
|
|
55
|
-
function getRegExpFailPosition(str) {
|
|
56
|
-
const isScope = /^@.*\/.*/.test(str);
|
|
57
|
-
if (isScope) {
|
|
58
|
-
// Remove starting @
|
|
59
|
-
str = str.replace(/^@/, '');
|
|
60
|
-
// Change / to - for validation
|
|
61
|
-
str = str.replace(/\//g, '-');
|
|
62
|
-
}
|
|
63
|
-
const parts = str.indexOf('-') >= 0 ? str.split('-') : [str];
|
|
64
|
-
const matched = [];
|
|
65
|
-
const projectNameRegexp = /^[a-zA-Z][.0-9a-zA-Z]*(-[.0-9a-zA-Z]*)*$/;
|
|
66
|
-
parts.forEach(part => {
|
|
67
|
-
if (part.match(projectNameRegexp)) {
|
|
68
|
-
matched.push(part);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
const compare = matched.join('-');
|
|
72
|
-
return str !== compare ? compare.length : null;
|
|
73
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateProjectName = exports.validateHtmlSelector = exports.htmlSelectorRe = exports.validateName = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10
|
+
*/
|
|
11
|
+
const core_1 = require("@angular-devkit/core");
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
function validateName(name) {
|
|
14
|
+
if (name && /^\d/.test(name)) {
|
|
15
|
+
throw new schematics_1.SchematicsException(core_1.tags.oneLine `name (${name})
|
|
16
|
+
can not start with a digit.`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.validateName = validateName;
|
|
20
|
+
// Must start with a letter, and must contain only alphanumeric characters or dashes.
|
|
21
|
+
// When adding a dash the segment after the dash must also start with a letter.
|
|
22
|
+
exports.htmlSelectorRe = /^[a-zA-Z][.0-9a-zA-Z]*(:?-[a-zA-Z][.0-9a-zA-Z]*)*$/;
|
|
23
|
+
function validateHtmlSelector(selector) {
|
|
24
|
+
if (selector && !exports.htmlSelectorRe.test(selector)) {
|
|
25
|
+
throw new schematics_1.SchematicsException(core_1.tags.oneLine `Selector (${selector})
|
|
26
|
+
is invalid.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.validateHtmlSelector = validateHtmlSelector;
|
|
30
|
+
function validateProjectName(projectName) {
|
|
31
|
+
const errorIndex = getRegExpFailPosition(projectName);
|
|
32
|
+
const unsupportedProjectNames = [];
|
|
33
|
+
const packageNameRegex = /^(?:@[a-zA-Z0-9_-]+\/)?[a-zA-Z0-9_-]+$/;
|
|
34
|
+
if (errorIndex !== null) {
|
|
35
|
+
const firstMessage = core_1.tags.oneLine `
|
|
36
|
+
Project name "${projectName}" is not valid. New project names must
|
|
37
|
+
start with a letter, and must contain only alphanumeric characters or dashes.
|
|
38
|
+
When adding a dash the segment after the dash must also start with a letter.
|
|
39
|
+
`;
|
|
40
|
+
const msg = core_1.tags.stripIndent `
|
|
41
|
+
${firstMessage}
|
|
42
|
+
${projectName}
|
|
43
|
+
${Array(errorIndex + 1).join(' ') + '^'}
|
|
44
|
+
`;
|
|
45
|
+
throw new schematics_1.SchematicsException(msg);
|
|
46
|
+
}
|
|
47
|
+
else if (unsupportedProjectNames.indexOf(projectName) !== -1) {
|
|
48
|
+
throw new schematics_1.SchematicsException(`Project name ${JSON.stringify(projectName)} is not a supported name.`);
|
|
49
|
+
}
|
|
50
|
+
else if (!packageNameRegex.test(projectName)) {
|
|
51
|
+
throw new schematics_1.SchematicsException(`Project name ${JSON.stringify(projectName)} is invalid.`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.validateProjectName = validateProjectName;
|
|
55
|
+
function getRegExpFailPosition(str) {
|
|
56
|
+
const isScope = /^@.*\/.*/.test(str);
|
|
57
|
+
if (isScope) {
|
|
58
|
+
// Remove starting @
|
|
59
|
+
str = str.replace(/^@/, '');
|
|
60
|
+
// Change / to - for validation
|
|
61
|
+
str = str.replace(/\//g, '-');
|
|
62
|
+
}
|
|
63
|
+
const parts = str.indexOf('-') >= 0 ? str.split('-') : [str];
|
|
64
|
+
const matched = [];
|
|
65
|
+
const projectNameRegexp = /^[a-zA-Z][.0-9a-zA-Z]*(-[.0-9a-zA-Z]*)*$/;
|
|
66
|
+
parts.forEach(part => {
|
|
67
|
+
if (part.match(projectNameRegexp)) {
|
|
68
|
+
matched.push(part);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const compare = matched.join('-');
|
|
72
|
+
return str !== compare ? compare.length : null;
|
|
73
|
+
}
|
|
74
74
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
export declare enum ProjectType {
|
|
9
|
-
Application = "application",
|
|
10
|
-
Library = "library"
|
|
11
|
-
}
|
|
12
|
-
export declare enum Builders {
|
|
13
|
-
AppShell = "@angular-devkit/build-angular:app-shell",
|
|
14
|
-
Server = "@angular-devkit/build-angular:server",
|
|
15
|
-
Browser = "@angular-devkit/build-angular:browser",
|
|
16
|
-
Karma = "@angular-devkit/build-angular:karma",
|
|
17
|
-
TsLint = "@angular-devkit/build-angular:tslint",
|
|
18
|
-
DeprecatedNgPackagr = "@angular-devkit/build-ng-packagr:build",
|
|
19
|
-
NgPackagr = "@angular-devkit/build-angular:ng-packagr",
|
|
20
|
-
DevServer = "@angular-devkit/build-angular:dev-server",
|
|
21
|
-
ExtractI18n = "@angular-devkit/build-angular:extract-i18n",
|
|
22
|
-
Protractor = "@angular-devkit/build-angular:protractor"
|
|
23
|
-
}
|
|
24
|
-
export interface FileReplacements {
|
|
25
|
-
replace: string;
|
|
26
|
-
with: string;
|
|
27
|
-
}
|
|
28
|
-
export interface BrowserBuilderBaseOptions {
|
|
29
|
-
main: string;
|
|
30
|
-
tsConfig: string;
|
|
31
|
-
fileReplacements?: FileReplacements[];
|
|
32
|
-
outputPath?: string;
|
|
33
|
-
index?: string;
|
|
34
|
-
polyfills: string;
|
|
35
|
-
assets?: (object | string)[];
|
|
36
|
-
styles?: (object | string)[];
|
|
37
|
-
scripts?: (object | string)[];
|
|
38
|
-
sourceMap?: boolean;
|
|
39
|
-
}
|
|
40
|
-
export declare type OutputHashing = 'all' | 'media' | 'none' | 'bundles';
|
|
41
|
-
export interface BrowserBuilderOptions extends BrowserBuilderBaseOptions {
|
|
42
|
-
serviceWorker?: boolean;
|
|
43
|
-
optimization?: boolean;
|
|
44
|
-
outputHashing?: OutputHashing;
|
|
45
|
-
resourcesOutputPath?: string;
|
|
46
|
-
extractCss?: boolean;
|
|
47
|
-
namedChunks?: boolean;
|
|
48
|
-
aot?: boolean;
|
|
49
|
-
extractLicenses?: boolean;
|
|
50
|
-
vendorChunk?: boolean;
|
|
51
|
-
buildOptimizer?: boolean;
|
|
52
|
-
ngswConfigPath?: string;
|
|
53
|
-
budgets?: {
|
|
54
|
-
type: string;
|
|
55
|
-
maximumWarning?: string;
|
|
56
|
-
maximumError?: string;
|
|
57
|
-
}[];
|
|
58
|
-
webWorkerTsConfig?: string;
|
|
59
|
-
}
|
|
60
|
-
export interface ServeBuilderOptions {
|
|
61
|
-
browserTarget: string;
|
|
62
|
-
}
|
|
63
|
-
export interface LibraryBuilderOptions {
|
|
64
|
-
tsConfig: string;
|
|
65
|
-
project: string;
|
|
66
|
-
}
|
|
67
|
-
export interface ServerBuilderOptions {
|
|
68
|
-
outputPath: string;
|
|
69
|
-
tsConfig: string;
|
|
70
|
-
main: string;
|
|
71
|
-
fileReplacements?: FileReplacements[];
|
|
72
|
-
optimization?: {
|
|
73
|
-
scripts?: boolean;
|
|
74
|
-
styles?: boolean;
|
|
75
|
-
};
|
|
76
|
-
sourceMap?: boolean | {
|
|
77
|
-
scripts?: boolean;
|
|
78
|
-
styles?: boolean;
|
|
79
|
-
hidden?: boolean;
|
|
80
|
-
vendor?: boolean;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
export interface AppShellBuilderOptions {
|
|
84
|
-
browserTarget: string;
|
|
85
|
-
serverTarget: string;
|
|
86
|
-
route: string;
|
|
87
|
-
}
|
|
88
|
-
export interface TestBuilderOptions extends Partial<BrowserBuilderBaseOptions> {
|
|
89
|
-
karmaConfig: string;
|
|
90
|
-
}
|
|
91
|
-
export interface LintBuilderOptions {
|
|
92
|
-
tsConfig: string[] | string;
|
|
93
|
-
exclude?: string[];
|
|
94
|
-
}
|
|
95
|
-
export interface ExtractI18nOptions {
|
|
96
|
-
browserTarget: string;
|
|
97
|
-
}
|
|
98
|
-
export interface E2EOptions {
|
|
99
|
-
protractorConfig: string;
|
|
100
|
-
devServerTarget: string;
|
|
101
|
-
}
|
|
102
|
-
export interface BuilderTarget<TBuilder extends Builders, TOptions> {
|
|
103
|
-
builder: TBuilder;
|
|
104
|
-
options: TOptions;
|
|
105
|
-
configurations?: {
|
|
106
|
-
production: Partial<TOptions>;
|
|
107
|
-
[key: string]: Partial<TOptions>;
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
export declare type LibraryBuilderTarget = BuilderTarget<Builders.NgPackagr, LibraryBuilderOptions>;
|
|
111
|
-
export declare type BrowserBuilderTarget = BuilderTarget<Builders.Browser, BrowserBuilderOptions>;
|
|
112
|
-
export declare type ServerBuilderTarget = BuilderTarget<Builders.Server, ServerBuilderOptions>;
|
|
113
|
-
export declare type AppShellBuilderTarget = BuilderTarget<Builders.AppShell, AppShellBuilderOptions>;
|
|
114
|
-
export declare type LintBuilderTarget = BuilderTarget<Builders.TsLint, LintBuilderOptions>;
|
|
115
|
-
export declare type TestBuilderTarget = BuilderTarget<Builders.Karma, TestBuilderOptions>;
|
|
116
|
-
export declare type ServeBuilderTarget = BuilderTarget<Builders.DevServer, ServeBuilderOptions>;
|
|
117
|
-
export declare type ExtractI18nBuilderTarget = BuilderTarget<Builders.ExtractI18n, ExtractI18nOptions>;
|
|
118
|
-
export declare type E2EBuilderTarget = BuilderTarget<Builders.Protractor, E2EOptions>;
|
|
119
|
-
export interface WorkspaceSchema {
|
|
120
|
-
version: 1;
|
|
121
|
-
defaultProject?: string;
|
|
122
|
-
cli?: {
|
|
123
|
-
warnings?: Record<string, boolean>;
|
|
124
|
-
};
|
|
125
|
-
projects: {
|
|
126
|
-
[key: string]: WorkspaceProject<ProjectType.Application | ProjectType.Library>;
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
export interface WorkspaceProject<TProjectType extends ProjectType = ProjectType.Application> {
|
|
130
|
-
/**
|
|
131
|
-
* Project type.
|
|
132
|
-
*/
|
|
133
|
-
projectType: ProjectType;
|
|
134
|
-
root: string;
|
|
135
|
-
sourceRoot: string;
|
|
136
|
-
prefix: string;
|
|
137
|
-
cli?: {
|
|
138
|
-
warnings?: Record<string, boolean>;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Tool options.
|
|
142
|
-
*/
|
|
143
|
-
architect?: WorkspaceTargets<TProjectType>;
|
|
144
|
-
/**
|
|
145
|
-
* Tool options.
|
|
146
|
-
*/
|
|
147
|
-
targets?: WorkspaceTargets<TProjectType>;
|
|
148
|
-
}
|
|
149
|
-
export interface WorkspaceTargets<TProjectType extends ProjectType = ProjectType.Application> {
|
|
150
|
-
build?: TProjectType extends ProjectType.Library ? LibraryBuilderTarget : BrowserBuilderTarget;
|
|
151
|
-
server?: ServerBuilderTarget;
|
|
152
|
-
lint?: LintBuilderTarget;
|
|
153
|
-
test?: TestBuilderTarget;
|
|
154
|
-
serve?: ServeBuilderTarget;
|
|
155
|
-
e2e?: E2EBuilderTarget;
|
|
156
|
-
'app-shell'?: AppShellBuilderTarget;
|
|
157
|
-
'extract-i18n'?: ExtractI18nBuilderTarget;
|
|
158
|
-
[key: string]: any;
|
|
159
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ProjectType {
|
|
9
|
+
Application = "application",
|
|
10
|
+
Library = "library"
|
|
11
|
+
}
|
|
12
|
+
export declare enum Builders {
|
|
13
|
+
AppShell = "@angular-devkit/build-angular:app-shell",
|
|
14
|
+
Server = "@angular-devkit/build-angular:server",
|
|
15
|
+
Browser = "@angular-devkit/build-angular:browser",
|
|
16
|
+
Karma = "@angular-devkit/build-angular:karma",
|
|
17
|
+
TsLint = "@angular-devkit/build-angular:tslint",
|
|
18
|
+
DeprecatedNgPackagr = "@angular-devkit/build-ng-packagr:build",
|
|
19
|
+
NgPackagr = "@angular-devkit/build-angular:ng-packagr",
|
|
20
|
+
DevServer = "@angular-devkit/build-angular:dev-server",
|
|
21
|
+
ExtractI18n = "@angular-devkit/build-angular:extract-i18n",
|
|
22
|
+
Protractor = "@angular-devkit/build-angular:protractor"
|
|
23
|
+
}
|
|
24
|
+
export interface FileReplacements {
|
|
25
|
+
replace: string;
|
|
26
|
+
with: string;
|
|
27
|
+
}
|
|
28
|
+
export interface BrowserBuilderBaseOptions {
|
|
29
|
+
main: string;
|
|
30
|
+
tsConfig: string;
|
|
31
|
+
fileReplacements?: FileReplacements[];
|
|
32
|
+
outputPath?: string;
|
|
33
|
+
index?: string;
|
|
34
|
+
polyfills: string;
|
|
35
|
+
assets?: (object | string)[];
|
|
36
|
+
styles?: (object | string)[];
|
|
37
|
+
scripts?: (object | string)[];
|
|
38
|
+
sourceMap?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare type OutputHashing = 'all' | 'media' | 'none' | 'bundles';
|
|
41
|
+
export interface BrowserBuilderOptions extends BrowserBuilderBaseOptions {
|
|
42
|
+
serviceWorker?: boolean;
|
|
43
|
+
optimization?: boolean;
|
|
44
|
+
outputHashing?: OutputHashing;
|
|
45
|
+
resourcesOutputPath?: string;
|
|
46
|
+
extractCss?: boolean;
|
|
47
|
+
namedChunks?: boolean;
|
|
48
|
+
aot?: boolean;
|
|
49
|
+
extractLicenses?: boolean;
|
|
50
|
+
vendorChunk?: boolean;
|
|
51
|
+
buildOptimizer?: boolean;
|
|
52
|
+
ngswConfigPath?: string;
|
|
53
|
+
budgets?: {
|
|
54
|
+
type: string;
|
|
55
|
+
maximumWarning?: string;
|
|
56
|
+
maximumError?: string;
|
|
57
|
+
}[];
|
|
58
|
+
webWorkerTsConfig?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface ServeBuilderOptions {
|
|
61
|
+
browserTarget: string;
|
|
62
|
+
}
|
|
63
|
+
export interface LibraryBuilderOptions {
|
|
64
|
+
tsConfig: string;
|
|
65
|
+
project: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ServerBuilderOptions {
|
|
68
|
+
outputPath: string;
|
|
69
|
+
tsConfig: string;
|
|
70
|
+
main: string;
|
|
71
|
+
fileReplacements?: FileReplacements[];
|
|
72
|
+
optimization?: {
|
|
73
|
+
scripts?: boolean;
|
|
74
|
+
styles?: boolean;
|
|
75
|
+
};
|
|
76
|
+
sourceMap?: boolean | {
|
|
77
|
+
scripts?: boolean;
|
|
78
|
+
styles?: boolean;
|
|
79
|
+
hidden?: boolean;
|
|
80
|
+
vendor?: boolean;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface AppShellBuilderOptions {
|
|
84
|
+
browserTarget: string;
|
|
85
|
+
serverTarget: string;
|
|
86
|
+
route: string;
|
|
87
|
+
}
|
|
88
|
+
export interface TestBuilderOptions extends Partial<BrowserBuilderBaseOptions> {
|
|
89
|
+
karmaConfig: string;
|
|
90
|
+
}
|
|
91
|
+
export interface LintBuilderOptions {
|
|
92
|
+
tsConfig: string[] | string;
|
|
93
|
+
exclude?: string[];
|
|
94
|
+
}
|
|
95
|
+
export interface ExtractI18nOptions {
|
|
96
|
+
browserTarget: string;
|
|
97
|
+
}
|
|
98
|
+
export interface E2EOptions {
|
|
99
|
+
protractorConfig: string;
|
|
100
|
+
devServerTarget: string;
|
|
101
|
+
}
|
|
102
|
+
export interface BuilderTarget<TBuilder extends Builders, TOptions> {
|
|
103
|
+
builder: TBuilder;
|
|
104
|
+
options: TOptions;
|
|
105
|
+
configurations?: {
|
|
106
|
+
production: Partial<TOptions>;
|
|
107
|
+
[key: string]: Partial<TOptions>;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export declare type LibraryBuilderTarget = BuilderTarget<Builders.NgPackagr, LibraryBuilderOptions>;
|
|
111
|
+
export declare type BrowserBuilderTarget = BuilderTarget<Builders.Browser, BrowserBuilderOptions>;
|
|
112
|
+
export declare type ServerBuilderTarget = BuilderTarget<Builders.Server, ServerBuilderOptions>;
|
|
113
|
+
export declare type AppShellBuilderTarget = BuilderTarget<Builders.AppShell, AppShellBuilderOptions>;
|
|
114
|
+
export declare type LintBuilderTarget = BuilderTarget<Builders.TsLint, LintBuilderOptions>;
|
|
115
|
+
export declare type TestBuilderTarget = BuilderTarget<Builders.Karma, TestBuilderOptions>;
|
|
116
|
+
export declare type ServeBuilderTarget = BuilderTarget<Builders.DevServer, ServeBuilderOptions>;
|
|
117
|
+
export declare type ExtractI18nBuilderTarget = BuilderTarget<Builders.ExtractI18n, ExtractI18nOptions>;
|
|
118
|
+
export declare type E2EBuilderTarget = BuilderTarget<Builders.Protractor, E2EOptions>;
|
|
119
|
+
export interface WorkspaceSchema {
|
|
120
|
+
version: 1;
|
|
121
|
+
defaultProject?: string;
|
|
122
|
+
cli?: {
|
|
123
|
+
warnings?: Record<string, boolean>;
|
|
124
|
+
};
|
|
125
|
+
projects: {
|
|
126
|
+
[key: string]: WorkspaceProject<ProjectType.Application | ProjectType.Library>;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface WorkspaceProject<TProjectType extends ProjectType = ProjectType.Application> {
|
|
130
|
+
/**
|
|
131
|
+
* Project type.
|
|
132
|
+
*/
|
|
133
|
+
projectType: ProjectType;
|
|
134
|
+
root: string;
|
|
135
|
+
sourceRoot: string;
|
|
136
|
+
prefix: string;
|
|
137
|
+
cli?: {
|
|
138
|
+
warnings?: Record<string, boolean>;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Tool options.
|
|
142
|
+
*/
|
|
143
|
+
architect?: WorkspaceTargets<TProjectType>;
|
|
144
|
+
/**
|
|
145
|
+
* Tool options.
|
|
146
|
+
*/
|
|
147
|
+
targets?: WorkspaceTargets<TProjectType>;
|
|
148
|
+
}
|
|
149
|
+
export interface WorkspaceTargets<TProjectType extends ProjectType = ProjectType.Application> {
|
|
150
|
+
build?: TProjectType extends ProjectType.Library ? LibraryBuilderTarget : BrowserBuilderTarget;
|
|
151
|
+
server?: ServerBuilderTarget;
|
|
152
|
+
lint?: LintBuilderTarget;
|
|
153
|
+
test?: TestBuilderTarget;
|
|
154
|
+
serve?: ServeBuilderTarget;
|
|
155
|
+
e2e?: E2EBuilderTarget;
|
|
156
|
+
'app-shell'?: AppShellBuilderTarget;
|
|
157
|
+
'extract-i18n'?: ExtractI18nBuilderTarget;
|
|
158
|
+
[key: string]: any;
|
|
159
|
+
}
|