@yuuvis/client-cli 19.1.1 → 19.3.0
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 -1
- package/cli/commands/generate/app.js +22 -0
- package/cli/commands/generate/app.js.map +1 -1
- package/cli/options/options-generate-app.json +9 -1
- package/cli/utils.js +5 -2
- package/cli/utils.js.map +1 -1
- package/package.json +1 -1
- package/schematics/app-manifest.d.ts +33 -0
- package/schematics/app-manifest.js +6 -0
- package/schematics/app-manifest.js.map +1 -1
- package/schematics/commands/angular-json.d.ts +122 -0
- package/schematics/commands/angular-json.js +228 -0
- package/schematics/commands/angular-json.js.map +1 -0
- package/schematics/commands/app-config-ts.d.ts +11 -0
- package/schematics/commands/app-config-ts.js +44 -0
- package/schematics/commands/app-config-ts.js.map +1 -0
- package/schematics/commands/app-routes-ts.d.ts +12 -0
- package/schematics/commands/app-routes-ts.js +72 -0
- package/schematics/commands/app-routes-ts.js.map +1 -0
- package/schematics/commands/library-component.d.ts +25 -0
- package/schematics/commands/library-component.js +71 -0
- package/schematics/commands/library-component.js.map +1 -0
- package/schematics/commands/ng-package-json.d.ts +67 -0
- package/schematics/commands/ng-package-json.js +102 -0
- package/schematics/commands/ng-package-json.js.map +1 -0
- package/schematics/commands/package-json.d.ts +102 -0
- package/schematics/commands/package-json.js +158 -0
- package/schematics/commands/package-json.js.map +1 -0
- package/schematics/commands/public-api-ts.d.ts +68 -0
- package/schematics/commands/public-api-ts.js +102 -0
- package/schematics/commands/public-api-ts.js.map +1 -0
- package/schematics/commands/tsconfig-json.d.ts +71 -0
- package/schematics/commands/tsconfig-json.js +118 -0
- package/schematics/commands/tsconfig-json.js.map +1 -0
- package/schematics/commands/typescript-file.d.ts +64 -0
- package/schematics/commands/typescript-file.js +127 -0
- package/schematics/commands/typescript-file.js.map +1 -0
- package/schematics/factories/add-app/index.js +6 -5
- package/schematics/factories/add-app/index.js.map +1 -1
- package/schematics/factories/generate-app/index.js +113 -65
- package/schematics/factories/generate-app/index.js.map +1 -1
- package/schematics/factories/generate-app/schema.json +10 -0
- package/schematics/factories/new/index.js +100 -39
- package/schematics/factories/new/index.js.map +1 -1
- package/schematics/files/_root/README.md +8 -0
- package/schematics/files/_scripts/update-shell.js +18 -0
- package/schematics/files/_src/styles.scss +4 -3
- package/schematics/files/_src_app/app.routes.ts.template +1 -1
- package/schematics/patches/impl/0001.patch.js +4 -15
- package/schematics/patches/impl/0001.patch.js.map +1 -1
- package/schematics/project-util.d.ts +1 -1
- package/schematics/project-util.js +1 -0
- package/schematics/project-util.js.map +1 -1
- package/schematics/rules/app-config.d.ts +2 -0
- package/schematics/{tasks/copy-ui-files.js → rules/app-config.js} +13 -14
- package/schematics/rules/app-config.js.map +1 -0
- package/schematics/{tasks/update-app-routes.d.ts → rules/app-routes.d.ts} +1 -1
- package/schematics/{tasks/copy-extensions-files.js → rules/app-routes.js} +13 -14
- package/schematics/rules/app-routes.js.map +1 -0
- package/schematics/{tasks → rules}/clean-up-ng-app.js.map +1 -1
- package/schematics/{tasks/copy-extensions-files.d.ts → rules/copy-resources.d.ts} +2 -0
- package/schematics/{tasks/copy-files.js → rules/copy-resources.js} +31 -3
- package/schematics/rules/copy-resources.js.map +1 -0
- package/schematics/rules/create-update-manifest.d.ts +3 -0
- package/schematics/{tasks → rules}/create-update-manifest.js +2 -2
- package/schematics/rules/create-update-manifest.js.map +1 -0
- package/schematics/{tasks → rules}/generate-library.js.map +1 -1
- package/schematics/{tasks → rules}/ng-new.js.map +1 -1
- package/schematics/{tasks → rules}/npm-install.js.map +1 -1
- package/schematics/schematics-util.d.ts +1 -2
- package/schematics/schematics-util.js +0 -13
- package/schematics/schematics-util.js.map +1 -1
- package/schematics/types/ng-package-json.d.ts +93 -0
- package/schematics/types/ng-package-json.js +3 -0
- package/schematics/types/ng-package-json.js.map +1 -0
- package/schematics/{types.d.ts → types/package-json.d.ts} +3 -0
- package/schematics/{types.js → types/package-json.js} +1 -1
- package/schematics/types/package-json.js.map +1 -0
- package/schematics/types/tsconfig-json.d.ts +69 -0
- package/schematics/types/tsconfig-json.js +3 -0
- package/schematics/types/tsconfig-json.js.map +1 -0
- package/schematics/tasks/copy-extensions-files.js.map +0 -1
- package/schematics/tasks/copy-files.d.ts +0 -2
- package/schematics/tasks/copy-files.js.map +0 -1
- package/schematics/tasks/copy-ui-files.d.ts +0 -2
- package/schematics/tasks/copy-ui-files.js.map +0 -1
- package/schematics/tasks/create-update-manifest.d.ts +0 -4
- package/schematics/tasks/create-update-manifest.js.map +0 -1
- package/schematics/tasks/update-angular-json.d.ts +0 -4
- package/schematics/tasks/update-angular-json.js +0 -105
- package/schematics/tasks/update-angular-json.js.map +0 -1
- package/schematics/tasks/update-app-config.d.ts +0 -2
- package/schematics/tasks/update-app-config.js +0 -69
- package/schematics/tasks/update-app-config.js.map +0 -1
- package/schematics/tasks/update-app-ng-package-json.d.ts +0 -2
- package/schematics/tasks/update-app-ng-package-json.js +0 -71
- package/schematics/tasks/update-app-ng-package-json.js.map +0 -1
- package/schematics/tasks/update-app-routes.js +0 -87
- package/schematics/tasks/update-app-routes.js.map +0 -1
- package/schematics/tasks/update-library-component.d.ts +0 -2
- package/schematics/tasks/update-library-component.js +0 -108
- package/schematics/tasks/update-library-component.js.map +0 -1
- package/schematics/tasks/update-library-public-api.d.ts +0 -2
- package/schematics/tasks/update-library-public-api.js +0 -38
- package/schematics/tasks/update-library-public-api.js.map +0 -1
- package/schematics/tasks/update-library-tsconfig.d.ts +0 -2
- package/schematics/tasks/update-library-tsconfig.js +0 -51
- package/schematics/tasks/update-library-tsconfig.js.map +0 -1
- package/schematics/tasks/update-package-json.d.ts +0 -2
- package/schematics/tasks/update-package-json.js +0 -32
- package/schematics/tasks/update-package-json.js.map +0 -1
- package/schematics/types.js.map +0 -1
- /package/schematics/{tasks → rules}/clean-up-ng-app.d.ts +0 -0
- /package/schematics/{tasks → rules}/clean-up-ng-app.js +0 -0
- /package/schematics/{tasks → rules}/generate-library.d.ts +0 -0
- /package/schematics/{tasks → rules}/generate-library.js +0 -0
- /package/schematics/{tasks → rules}/ng-new.d.ts +0 -0
- /package/schematics/{tasks → rules}/ng-new.js +0 -0
- /package/schematics/{tasks → rules}/npm-install.d.ts +0 -0
- /package/schematics/{tasks → rules}/npm-install.js +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Tree, UpdateRecorder } from "@angular-devkit/schematics";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for commands that can be executed on a public-api.ts file.
|
|
4
|
+
* This interface defines a method to execute a command that modifies the public-api.ts file.
|
|
5
|
+
*/
|
|
6
|
+
export interface PublicApiTsCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Executes the command on the provided public-api.ts content.
|
|
9
|
+
* @param content The content of the public-api.ts file to modify.
|
|
10
|
+
* @param updateRecorder The UpdateRecorder to apply changes to the file.
|
|
11
|
+
*/
|
|
12
|
+
execute(content: string, updateRecorder: UpdateRecorder): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Composite command that executes multiple PublicApiTsCommand instances.
|
|
16
|
+
* This class allows for the execution of a series of commands on a public-api.ts file.
|
|
17
|
+
*/
|
|
18
|
+
export declare class CompositePublicApiTsCommand implements PublicApiTsCommand {
|
|
19
|
+
private readonly commands;
|
|
20
|
+
constructor(commands: PublicApiTsCommand[]);
|
|
21
|
+
/**
|
|
22
|
+
* Executes all commands in the composite command.
|
|
23
|
+
* @param content The content of the public-api.ts file to modify.
|
|
24
|
+
* @param updateRecorder The UpdateRecorder to apply changes to the file.
|
|
25
|
+
*/
|
|
26
|
+
execute(content: string, updateRecorder: UpdateRecorder): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Adds export statements to the public-api.ts file.
|
|
30
|
+
* This command allows for the addition of new export statements to the public-api.ts file.
|
|
31
|
+
*/
|
|
32
|
+
export declare class AddExportsCommand implements PublicApiTsCommand {
|
|
33
|
+
private readonly exports;
|
|
34
|
+
constructor(exports: string[]);
|
|
35
|
+
execute(content: string, updateRecorder: UpdateRecorder): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Edits the public-api.ts file.
|
|
39
|
+
*/
|
|
40
|
+
export declare class PublicApiTsEditor {
|
|
41
|
+
private readonly tree;
|
|
42
|
+
private readonly path;
|
|
43
|
+
private constructor();
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new instance of PublicApiTsEditor.
|
|
46
|
+
* @param tree The Angular DevKit Tree object representing the file system.
|
|
47
|
+
* @param path The path to the public-api.ts file.
|
|
48
|
+
* @returns A promise that resolves to a PublicApiTsEditor instance.
|
|
49
|
+
*/
|
|
50
|
+
static create(tree: Tree, path: string): Promise<PublicApiTsEditor>;
|
|
51
|
+
/**
|
|
52
|
+
* Runs the given command on the public-api.ts file.
|
|
53
|
+
* @param command The command to run.
|
|
54
|
+
*/
|
|
55
|
+
run(command: PublicApiTsCommand): void;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the content of the public-api.ts file.
|
|
58
|
+
* @returns The content of the public-api.ts file.
|
|
59
|
+
*/
|
|
60
|
+
getContent(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Loads the content of the public-api.ts file.
|
|
63
|
+
* If the file does not exist or cannot be read, it throws a SchematicsException.
|
|
64
|
+
* @throws {SchematicsException} If the public-api.ts file does not exist or
|
|
65
|
+
* @returns The content of the public-api.ts file as a string.
|
|
66
|
+
*/
|
|
67
|
+
private load;
|
|
68
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PublicApiTsEditor = exports.AddExportsCommand = exports.CompositePublicApiTsCommand = void 0;
|
|
13
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
+
/**
|
|
15
|
+
* Composite command that executes multiple PublicApiTsCommand instances.
|
|
16
|
+
* This class allows for the execution of a series of commands on a public-api.ts file.
|
|
17
|
+
*/
|
|
18
|
+
class CompositePublicApiTsCommand {
|
|
19
|
+
constructor(commands) {
|
|
20
|
+
this.commands = commands;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Executes all commands in the composite command.
|
|
24
|
+
* @param content The content of the public-api.ts file to modify.
|
|
25
|
+
* @param updateRecorder The UpdateRecorder to apply changes to the file.
|
|
26
|
+
*/
|
|
27
|
+
execute(content, updateRecorder) {
|
|
28
|
+
this.commands.forEach(command => command.execute(content, updateRecorder));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.CompositePublicApiTsCommand = CompositePublicApiTsCommand;
|
|
32
|
+
/**
|
|
33
|
+
* Adds export statements to the public-api.ts file.
|
|
34
|
+
* This command allows for the addition of new export statements to the public-api.ts file.
|
|
35
|
+
*/
|
|
36
|
+
class AddExportsCommand {
|
|
37
|
+
constructor(exports) {
|
|
38
|
+
this.exports = exports;
|
|
39
|
+
}
|
|
40
|
+
execute(content, updateRecorder) {
|
|
41
|
+
const newExports = this.exports
|
|
42
|
+
.filter(exportStatement => !content.includes(exportStatement))
|
|
43
|
+
.map(statement => `\n${statement}`)
|
|
44
|
+
.join('');
|
|
45
|
+
if (newExports.length > 0) {
|
|
46
|
+
updateRecorder.insertRight(content.length, newExports + '\n');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.AddExportsCommand = AddExportsCommand;
|
|
51
|
+
/**
|
|
52
|
+
* Edits the public-api.ts file.
|
|
53
|
+
*/
|
|
54
|
+
class PublicApiTsEditor {
|
|
55
|
+
constructor(tree, path) {
|
|
56
|
+
this.tree = tree;
|
|
57
|
+
this.path = path;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new instance of PublicApiTsEditor.
|
|
61
|
+
* @param tree The Angular DevKit Tree object representing the file system.
|
|
62
|
+
* @param path The path to the public-api.ts file.
|
|
63
|
+
* @returns A promise that resolves to a PublicApiTsEditor instance.
|
|
64
|
+
*/
|
|
65
|
+
static create(tree, path) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return new PublicApiTsEditor(tree, path);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Runs the given command on the public-api.ts file.
|
|
72
|
+
* @param command The command to run.
|
|
73
|
+
*/
|
|
74
|
+
run(command) {
|
|
75
|
+
const content = this.load();
|
|
76
|
+
const recorder = this.tree.beginUpdate(this.path);
|
|
77
|
+
command.execute(content, recorder);
|
|
78
|
+
this.tree.commitUpdate(recorder);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Gets the content of the public-api.ts file.
|
|
82
|
+
* @returns The content of the public-api.ts file.
|
|
83
|
+
*/
|
|
84
|
+
getContent() {
|
|
85
|
+
return this.load();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Loads the content of the public-api.ts file.
|
|
89
|
+
* If the file does not exist or cannot be read, it throws a SchematicsException.
|
|
90
|
+
* @throws {SchematicsException} If the public-api.ts file does not exist or
|
|
91
|
+
* @returns The content of the public-api.ts file as a string.
|
|
92
|
+
*/
|
|
93
|
+
load() {
|
|
94
|
+
const buffer = this.tree.read(this.path);
|
|
95
|
+
if (!buffer) {
|
|
96
|
+
throw new schematics_1.SchematicsException(`Failed to read ${this.path}`);
|
|
97
|
+
}
|
|
98
|
+
return buffer.toString('utf-8');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.PublicApiTsEditor = PublicApiTsEditor;
|
|
102
|
+
//# sourceMappingURL=public-api-ts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api-ts.js","sourceRoot":"","sources":["../../../src/schematics/commands/public-api-ts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAuF;AAevF;;;GAGG;AACH,MAAa,2BAA2B;IACtC,YAA6B,QAA8B;QAA9B,aAAQ,GAAR,QAAQ,CAAsB;IAAG,CAAC;IAE/D;;;;OAIG;IACH,OAAO,CAAC,OAAe,EAAE,cAA8B;QACrD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;IAC7E,CAAC;CACF;AAXD,kEAWC;AAED;;;GAGG;AACH,MAAa,iBAAiB;IAC5B,YAA6B,OAAiB;QAAjB,YAAO,GAAP,OAAO,CAAU;IAAG,CAAC;IAClD,OAAO,CAAC,OAAe,EAAE,cAA8B;QACrD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO;aAC5B,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;aAC7D,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,SAAS,EAAE,CAAC;aAClC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;CACF;AAZD,8CAYC;AAGD;;GAEG;AACH,MAAa,iBAAiB;IAC5B,YAAqC,IAAU,EAAmB,IAAY;QAAzC,SAAI,GAAJ,IAAI,CAAM;QAAmB,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAElF;;;;;OAKG;IACH,MAAM,CAAO,MAAM,CAAC,IAAU,EAAE,IAAY;;YAC1C,OAAO,IAAI,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;KAAA;IAGD;;;OAGG;IACH,GAAG,CAAC,OAA2B;QAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAElD,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEnC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACK,IAAI;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,gCAAmB,CAAC,kBAAkB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CACF;AAhDD,8CAgDC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { AngularTsConfig } from "../types/tsconfig-json";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for commands that can be executed on an Angular tsconfig file.
|
|
4
|
+
* This interface defines a method to execute a command that modifies the tsconfig file.
|
|
5
|
+
*/
|
|
6
|
+
export interface TsConfigJsonCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Executes the command on the provided Angular tsconfig object.
|
|
9
|
+
* @param tsConfigJson The Angular tsconfig object to modify.
|
|
10
|
+
*/
|
|
11
|
+
execute(tsConfigJson: AngularTsConfig): void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Composite command that executes multiple TsConfigJsonCommand instances.
|
|
15
|
+
* This class allows for the execution of a series of commands on an Angular tsconfig file.
|
|
16
|
+
*/
|
|
17
|
+
export declare class CompositeTsConfigJsonCommand implements TsConfigJsonCommand {
|
|
18
|
+
private readonly commands;
|
|
19
|
+
constructor(commands: TsConfigJsonCommand[]);
|
|
20
|
+
/**
|
|
21
|
+
* Executes all commands in the composite command.
|
|
22
|
+
* @param tsConfigJson The Angular tsconfig.json object to modify.
|
|
23
|
+
*/
|
|
24
|
+
execute(tsConfigJson: AngularTsConfig): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Adds or updates paths in the compilerOptions of the tsconfig file.
|
|
28
|
+
* This command allows for the addition or modification of paths in the compilerOptions section.
|
|
29
|
+
*/
|
|
30
|
+
export declare class AddPathsToCompilierOptionsCommand implements TsConfigJsonCommand {
|
|
31
|
+
private readonly paths;
|
|
32
|
+
constructor(paths: Record<string, string[]>);
|
|
33
|
+
execute(tsConfigJson: AngularTsConfig): void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Edits the tsconfig file.
|
|
37
|
+
*/
|
|
38
|
+
export declare class TsConfigEditor {
|
|
39
|
+
private readonly tree;
|
|
40
|
+
private readonly path;
|
|
41
|
+
private comment;
|
|
42
|
+
private constructor();
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new instance of TsConfigEditor.
|
|
45
|
+
* @param tree The Angular DevKit Tree object representing the file system.
|
|
46
|
+
* @param path The path to the tsconfig.json file.
|
|
47
|
+
* @returns A promise that resolves to a TsConfigEditor instance.
|
|
48
|
+
*/
|
|
49
|
+
static create(tree: any, path?: string): Promise<TsConfigEditor>;
|
|
50
|
+
/**
|
|
51
|
+
* Runs the given command on the tsconfig.json file.
|
|
52
|
+
* @param command The command to run.
|
|
53
|
+
*/
|
|
54
|
+
run(command: TsConfigJsonCommand): void;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the content of the tsconfig.json file.
|
|
57
|
+
* @returns The tsconfig.json object.
|
|
58
|
+
*/
|
|
59
|
+
getContent(): AngularTsConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Loads the contents of the tsconfig.json file.
|
|
62
|
+
* @throws {SchematicsException} If the tsconfig file does not exist or
|
|
63
|
+
* @returns The content of the tsconfig file (excluding comments).
|
|
64
|
+
*/
|
|
65
|
+
private load;
|
|
66
|
+
/**
|
|
67
|
+
* Saves the contents of the tsconfig file.
|
|
68
|
+
* @param tsConfigJson The Angular tsconfig object to save.
|
|
69
|
+
*/
|
|
70
|
+
private save;
|
|
71
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TsConfigEditor = exports.AddPathsToCompilierOptionsCommand = exports.CompositeTsConfigJsonCommand = void 0;
|
|
13
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
+
/**
|
|
15
|
+
* Composite command that executes multiple TsConfigJsonCommand instances.
|
|
16
|
+
* This class allows for the execution of a series of commands on an Angular tsconfig file.
|
|
17
|
+
*/
|
|
18
|
+
class CompositeTsConfigJsonCommand {
|
|
19
|
+
constructor(commands) {
|
|
20
|
+
this.commands = commands;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Executes all commands in the composite command.
|
|
24
|
+
* @param tsConfigJson The Angular tsconfig.json object to modify.
|
|
25
|
+
*/
|
|
26
|
+
execute(tsConfigJson) {
|
|
27
|
+
this.commands.forEach(command => command.execute(tsConfigJson));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.CompositeTsConfigJsonCommand = CompositeTsConfigJsonCommand;
|
|
31
|
+
/**
|
|
32
|
+
* Adds or updates paths in the compilerOptions of the tsconfig file.
|
|
33
|
+
* This command allows for the addition or modification of paths in the compilerOptions section.
|
|
34
|
+
*/
|
|
35
|
+
class AddPathsToCompilierOptionsCommand {
|
|
36
|
+
constructor(paths) {
|
|
37
|
+
this.paths = paths;
|
|
38
|
+
}
|
|
39
|
+
execute(tsConfigJson) {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
var _c;
|
|
42
|
+
(_a = tsConfigJson.compilerOptions) !== null && _a !== void 0 ? _a : (tsConfigJson.compilerOptions = {});
|
|
43
|
+
(_b = (_c = tsConfigJson.compilerOptions).paths) !== null && _b !== void 0 ? _b : (_c.paths = {});
|
|
44
|
+
Object.entries(this.paths).forEach(([key, value]) => {
|
|
45
|
+
tsConfigJson.compilerOptions.paths[key] = value;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.AddPathsToCompilierOptionsCommand = AddPathsToCompilierOptionsCommand;
|
|
50
|
+
/**
|
|
51
|
+
* Edits the tsconfig file.
|
|
52
|
+
*/
|
|
53
|
+
class TsConfigEditor {
|
|
54
|
+
constructor(tree, path) {
|
|
55
|
+
this.tree = tree;
|
|
56
|
+
this.path = path;
|
|
57
|
+
this.comment = '';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new instance of TsConfigEditor.
|
|
61
|
+
* @param tree The Angular DevKit Tree object representing the file system.
|
|
62
|
+
* @param path The path to the tsconfig.json file.
|
|
63
|
+
* @returns A promise that resolves to a TsConfigEditor instance.
|
|
64
|
+
*/
|
|
65
|
+
static create(tree, path) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
path = path !== null && path !== void 0 ? path : '/tsconfig.json';
|
|
68
|
+
return new TsConfigEditor(tree, path);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Runs the given command on the tsconfig.json file.
|
|
73
|
+
* @param command The command to run.
|
|
74
|
+
*/
|
|
75
|
+
run(command) {
|
|
76
|
+
const tsConfigJson = this.load();
|
|
77
|
+
command.execute(tsConfigJson);
|
|
78
|
+
this.save(tsConfigJson);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Gets the content of the tsconfig.json file.
|
|
82
|
+
* @returns The tsconfig.json object.
|
|
83
|
+
*/
|
|
84
|
+
getContent() {
|
|
85
|
+
return this.load();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Loads the contents of the tsconfig.json file.
|
|
89
|
+
* @throws {SchematicsException} If the tsconfig file does not exist or
|
|
90
|
+
* @returns The content of the tsconfig file (excluding comments).
|
|
91
|
+
*/
|
|
92
|
+
load() {
|
|
93
|
+
if (!this.tree.exists(this.path)) {
|
|
94
|
+
throw new schematics_1.SchematicsException(`tsconfig file not found at ${this.path}`);
|
|
95
|
+
}
|
|
96
|
+
const tsconfigBuffer = this.tree.read(this.path);
|
|
97
|
+
const tsconfig = tsconfigBuffer.toString('utf8');
|
|
98
|
+
const startIndex = tsconfig.indexOf('{');
|
|
99
|
+
const endIndex = tsconfig.lastIndexOf('}');
|
|
100
|
+
try {
|
|
101
|
+
this.comment = tsconfig.substring(0, startIndex).trim();
|
|
102
|
+
const jsonPart = tsconfig.substring(startIndex, endIndex + 1);
|
|
103
|
+
return JSON.parse(jsonPart);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw new schematics_1.SchematicsException(`Failed to parse tsconfig file at ${this.path}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Saves the contents of the tsconfig file.
|
|
111
|
+
* @param tsConfigJson The Angular tsconfig object to save.
|
|
112
|
+
*/
|
|
113
|
+
save(tsConfigJson) {
|
|
114
|
+
this.tree.overwrite(this.path, `${this.comment}\n${JSON.stringify(tsConfigJson, null, 2)}\n`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.TsConfigEditor = TsConfigEditor;
|
|
118
|
+
//# sourceMappingURL=tsconfig-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig-json.js","sourceRoot":"","sources":["../../../src/schematics/commands/tsconfig-json.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAiE;AAejE;;;GAGG;AACH,MAAa,4BAA4B;IACvC,YAA6B,QAA+B;QAA/B,aAAQ,GAAR,QAAQ,CAAuB;IAAG,CAAC;IAEhE;;;OAGG;IACH,OAAO,CAAC,YAA6B;QACnC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;IAClE,CAAC;CACF;AAVD,oEAUC;AAED;;;GAGG;AACH,MAAa,iCAAiC;IAC5C,YAA6B,KAA+B;QAA/B,UAAK,GAAL,KAAK,CAA0B;IAAG,CAAC;IAChE,OAAO,CAAC,YAA6B;;;QACnC,MAAA,YAAY,CAAC,eAAe,oCAA5B,YAAY,CAAC,eAAe,GAAK,EAAE,EAAC;QACpC,YAAA,YAAY,CAAC,eAAe,EAAC,KAAK,uCAAL,KAAK,GAAK,EAAE,EAAC;QAC1C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAClD,Y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,GAAW,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC;YACH,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;YACxD,MAAM,QAAQ,GAAW,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAA;YAErE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAoB,CAAC;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,gCAAmB,CAAC,oCAAoC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED;;;OAGG;IACK,IAAI,CAAC,YAA6B;QACxC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAChG,CAAC;CACF;AAhED,wCAgEC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SchematicContext, Tree, UpdateRecorder } from "@angular-devkit/schematics";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for commands that can be executed on any TypeScript file.
|
|
5
|
+
*/
|
|
6
|
+
export interface TypeScriptFileCommand {
|
|
7
|
+
execute(sourceFile: ts.SourceFile, recorder: UpdateRecorder, filePath: string, context: SchematicContext): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Composite command that executes multiple TypeScriptFileCommand instances.
|
|
11
|
+
* This class allows for the execution of a series of commands on a typescript file.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CompositeTypeScriptFileCommand implements TypeScriptFileCommand {
|
|
14
|
+
private readonly commands;
|
|
15
|
+
constructor(commands: TypeScriptFileCommand[]);
|
|
16
|
+
/**
|
|
17
|
+
* Executes all commands in the composite command.
|
|
18
|
+
* @param sourceFile The TypeScript source file representing the typescript file.
|
|
19
|
+
* @param recorder The UpdateRecorder to apply changes to the file.
|
|
20
|
+
* @param filePath The path of the typescript file.
|
|
21
|
+
*/
|
|
22
|
+
execute(sourceFile: ts.SourceFile, recorder: UpdateRecorder, filePath: string, context: SchematicContext): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Adds an import statement to a typescript file if it doesn't already exist.
|
|
26
|
+
*/
|
|
27
|
+
export declare class AddImportToFileCommand implements TypeScriptFileCommand {
|
|
28
|
+
private readonly className;
|
|
29
|
+
private readonly moduleName;
|
|
30
|
+
constructor(className: string, moduleName: string);
|
|
31
|
+
execute(sourceFile: ts.SourceFile, recorder: UpdateRecorder, filePath: string): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Class for editing a typescript file.
|
|
35
|
+
*/
|
|
36
|
+
export declare class TypeScriptFileEditor {
|
|
37
|
+
private readonly tree;
|
|
38
|
+
private readonly path;
|
|
39
|
+
private constructor();
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new instance of TypeScriptFileEditor.
|
|
42
|
+
* @param tree The Angular DevKit Tree object representing the file system.
|
|
43
|
+
* @param path The path to the typescript file.
|
|
44
|
+
* @returns A promise that resolves to a TypeScriptFileEditor instance.
|
|
45
|
+
*/
|
|
46
|
+
static create(tree: Tree, path: string): Promise<TypeScriptFileEditor>;
|
|
47
|
+
/**
|
|
48
|
+
* Executes the given command on the typescript file.
|
|
49
|
+
* @param command The command to execute on the typescript file.
|
|
50
|
+
*/
|
|
51
|
+
run(command: TypeScriptFileCommand, context: SchematicContext): void;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the content of the typescript file.
|
|
54
|
+
* @returns The content of the typescript file as a string.
|
|
55
|
+
*/
|
|
56
|
+
getContent(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Loads the typescript file from the specified path.
|
|
59
|
+
* If the file does not exist or cannot be read, it throws a SchematicsException.
|
|
60
|
+
* @returns The content of the typescript file as a string.
|
|
61
|
+
* @throws {SchematicsException} If the typescript file does not exist or cannot be read.
|
|
62
|
+
*/
|
|
63
|
+
private load;
|
|
64
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.TypeScriptFileEditor = exports.AddImportToFileCommand = exports.CompositeTypeScriptFileCommand = void 0;
|
|
16
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
17
|
+
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
18
|
+
const change_1 = require("@schematics/angular/utility/change");
|
|
19
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
20
|
+
/**
|
|
21
|
+
* Composite command that executes multiple TypeScriptFileCommand instances.
|
|
22
|
+
* This class allows for the execution of a series of commands on a typescript file.
|
|
23
|
+
*/
|
|
24
|
+
class CompositeTypeScriptFileCommand {
|
|
25
|
+
constructor(commands) {
|
|
26
|
+
this.commands = commands;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Executes all commands in the composite command.
|
|
30
|
+
* @param sourceFile The TypeScript source file representing the typescript file.
|
|
31
|
+
* @param recorder The UpdateRecorder to apply changes to the file.
|
|
32
|
+
* @param filePath The path of the typescript file.
|
|
33
|
+
*/
|
|
34
|
+
execute(sourceFile, recorder, filePath, context) {
|
|
35
|
+
this.commands.forEach(command => command.execute(sourceFile, recorder, filePath, context));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.CompositeTypeScriptFileCommand = CompositeTypeScriptFileCommand;
|
|
39
|
+
/**
|
|
40
|
+
* Adds an import statement to a typescript file if it doesn't already exist.
|
|
41
|
+
*/
|
|
42
|
+
class AddImportToFileCommand {
|
|
43
|
+
constructor(className, moduleName) {
|
|
44
|
+
this.className = className;
|
|
45
|
+
this.moduleName = moduleName;
|
|
46
|
+
}
|
|
47
|
+
execute(sourceFile, recorder, filePath) {
|
|
48
|
+
// Check if the import already exists
|
|
49
|
+
const hasExistingImport = sourceFile.statements.some(statement => {
|
|
50
|
+
var _a;
|
|
51
|
+
return typescript_1.default.isImportDeclaration(statement) &&
|
|
52
|
+
statement.moduleSpecifier &&
|
|
53
|
+
typescript_1.default.isStringLiteral(statement.moduleSpecifier) &&
|
|
54
|
+
statement.moduleSpecifier.text === this.moduleName &&
|
|
55
|
+
((_a = statement.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings) &&
|
|
56
|
+
typescript_1.default.isNamedImports(statement.importClause.namedBindings) &&
|
|
57
|
+
statement.importClause.namedBindings.elements.some(element => element.name.text === this.className);
|
|
58
|
+
});
|
|
59
|
+
if (hasExistingImport) {
|
|
60
|
+
return; // the class is already imported
|
|
61
|
+
}
|
|
62
|
+
const importChange = (0, ast_utils_1.insertImport)(sourceFile, filePath, this.className, this.moduleName);
|
|
63
|
+
if (importChange) {
|
|
64
|
+
(0, change_1.applyToUpdateRecorder)(recorder, [importChange]);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new schematics_1.SchematicsException(`Cannot insert import statement of ${this.className} to ${filePath}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.AddImportToFileCommand = AddImportToFileCommand;
|
|
72
|
+
/**
|
|
73
|
+
* Class for editing a typescript file.
|
|
74
|
+
*/
|
|
75
|
+
class TypeScriptFileEditor {
|
|
76
|
+
constructor(tree, path) {
|
|
77
|
+
this.tree = tree;
|
|
78
|
+
this.path = path;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Creates a new instance of TypeScriptFileEditor.
|
|
82
|
+
* @param tree The Angular DevKit Tree object representing the file system.
|
|
83
|
+
* @param path The path to the typescript file.
|
|
84
|
+
* @returns A promise that resolves to a TypeScriptFileEditor instance.
|
|
85
|
+
*/
|
|
86
|
+
static create(tree, path) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
return new TypeScriptFileEditor(tree, path);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Executes the given command on the typescript file.
|
|
93
|
+
* @param command The command to execute on the typescript file.
|
|
94
|
+
*/
|
|
95
|
+
run(command, context) {
|
|
96
|
+
const content = this.load();
|
|
97
|
+
const sourceFile = typescript_1.default.createSourceFile(this.path, content, typescript_1.default.ScriptTarget.Latest, true);
|
|
98
|
+
const recorder = this.tree.beginUpdate(this.path);
|
|
99
|
+
command.execute(sourceFile, recorder, this.path, context);
|
|
100
|
+
this.tree.commitUpdate(recorder);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Gets the content of the typescript file.
|
|
104
|
+
* @returns The content of the typescript file as a string.
|
|
105
|
+
*/
|
|
106
|
+
getContent() {
|
|
107
|
+
return this.load();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Loads the typescript file from the specified path.
|
|
111
|
+
* If the file does not exist or cannot be read, it throws a SchematicsException.
|
|
112
|
+
* @returns The content of the typescript file as a string.
|
|
113
|
+
* @throws {SchematicsException} If the typescript file does not exist or cannot be read.
|
|
114
|
+
*/
|
|
115
|
+
load() {
|
|
116
|
+
if (!this.tree.exists(this.path)) {
|
|
117
|
+
throw new schematics_1.SchematicsException(`Typescript file not found at ${this.path}`);
|
|
118
|
+
}
|
|
119
|
+
const buffer = this.tree.read(this.path);
|
|
120
|
+
if (!buffer) {
|
|
121
|
+
throw new schematics_1.SchematicsException(`Failed to read ${this.path}`);
|
|
122
|
+
}
|
|
123
|
+
return buffer.toString('utf-8');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.TypeScriptFileEditor = TypeScriptFileEditor;
|
|
127
|
+
//# sourceMappingURL=typescript-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-file.js","sourceRoot":"","sources":["../../../src/schematics/commands/typescript-file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2DAAoH;AACpH,qEAAqE;AACrE,+DAA2E;AAC3E,4DAA4B;AAS5B;;;GAGG;AACH,MAAa,8BAA8B;IACzC,YAA6B,QAAiC;QAAjC,aAAQ,GAAR,QAAQ,CAAyB;IAAG,CAAC;IAElE;;;;;OAKG;IACH,OAAO,CAAC,UAAyB,EAAE,QAAwB,EAAE,QAAgB,EAAE,OAAyB;QACtG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7F,CAAC;CACF;AAZD,wEAYC;AAED;;GAEG;AACH,MAAa,sBAAsB;IACjC,YAA6B,SAAiB,EAAmB,UAAkB;QAAtD,cAAS,GAAT,SAAS,CAAQ;QAAmB,eAAU,GAAV,UAAU,CAAQ;IAAG,CAAC;IAEvF,OAAO,CAAC,UAAyB,EAAE,QAAwB,EAAE,QAAgB;QAC3E,qCAAqC;QACrC,MAAM,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI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= require("../../schematics-util");
|
|
18
18
|
const utils_1 = require("../../utils");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const npm_install_1 = __importDefault(require("../../
|
|
19
|
+
const app_routes_1 = require("../../rules/app-routes");
|
|
20
|
+
const app_config_1 = require("../../rules/app-config");
|
|
21
|
+
const npm_install_1 = __importDefault(require("../../rules/npm-install"));
|
|
22
22
|
const project_metadata_1 = require("../../project-metadata");
|
|
23
23
|
function addApp(options) {
|
|
24
24
|
return (tree, context) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -31,10 +31,11 @@ function addApp(options) {
|
|
|
31
31
|
context.logger.info(`Found manifest file for package ${options.name}.`);
|
|
32
32
|
const rules = [];
|
|
33
33
|
if (!!appManifest.ui) {
|
|
34
|
-
rules.push((0,
|
|
34
|
+
rules.push((0, app_routes_1.updateAppRoutesRule)(parsedPackageName.libraryFullName, appManifest));
|
|
35
35
|
}
|
|
36
36
|
if (!!appManifest.extension) {
|
|
37
|
-
|
|
37
|
+
const extensionsEntryPoint = `${parsedPackageName.libraryFullName}/extensions`;
|
|
38
|
+
rules.push((0, app_config_1.updateAppConfigRule)(appManifest.id, appManifest.extension, extensionsEntryPoint));
|
|
38
39
|
}
|
|
39
40
|
rules.push((0, npm_install_1.default)('./', options.name));
|
|
40
41
|
return (0, schematics_1.chain)(rules);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/schematics/factories/add-app/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAQA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/schematics/factories/add-app/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAQA,wBA4BC;AApCD,2DAA8E;AAC9E,2DAAsD;AACtD,uCAA+C;AAC/C,uDAA6D;AAC7D,uDAA6D;AAC7D,0EAAiD;AACjD,6DAAyD;AAEzD,SAAgB,MAAM,CAAC,OAAY;IACjC,OAAO,CAAO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