@barcidev/ngx-autogen 0.1.39 → 0.1.40
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/package.json +1 -1
- package/src/ng-add/index.d.ts +2 -1
- package/src/ng-add/index.js +13 -8
- package/src/ng-add/schema.json +6 -0
- package/src/ngrx/store/schema.json +1 -3
package/package.json
CHANGED
package/src/ng-add/index.d.ts
CHANGED
package/src/ng-add/index.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ngAdd = ngAdd;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const LIBRARY_NAME = "@barcidev/ngx-autogen";
|
|
6
|
-
function ngAdd() {
|
|
6
|
+
function ngAdd(options) {
|
|
7
7
|
return () => {
|
|
8
|
-
return (0, schematics_1.chain)([cleanupPackageJson(), registerInAngularJson()]);
|
|
8
|
+
return (0, schematics_1.chain)([cleanupPackageJson(), registerInAngularJson(options)]);
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
@@ -30,19 +30,24 @@ function cleanupPackageJson() {
|
|
|
30
30
|
/**
|
|
31
31
|
* Regla: Configura la CLI de Angular
|
|
32
32
|
*/
|
|
33
|
-
function registerInAngularJson() {
|
|
33
|
+
function registerInAngularJson(options) {
|
|
34
34
|
return (tree) => {
|
|
35
35
|
const buffer = tree.read("angular.json");
|
|
36
36
|
if (!buffer)
|
|
37
37
|
return tree;
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const collections =
|
|
38
|
+
const workspace = JSON.parse(buffer.toString());
|
|
39
|
+
workspace.cli = workspace.cli || {};
|
|
40
|
+
const collections = workspace.cli.schematicCollections || [];
|
|
41
41
|
if (!collections.includes(LIBRARY_NAME)) {
|
|
42
42
|
collections.push(LIBRARY_NAME);
|
|
43
|
-
|
|
44
|
-
tree.overwrite("angular.json", JSON.stringify(
|
|
43
|
+
workspace.cli.schematicCollections = collections;
|
|
44
|
+
tree.overwrite("angular.json", JSON.stringify(workspace, null, 2));
|
|
45
45
|
}
|
|
46
|
+
if (!workspace.schematics)
|
|
47
|
+
workspace.schematics = {};
|
|
48
|
+
workspace.schematics["@barcidev/ngx-autogen:all"] = {
|
|
49
|
+
lang: options.lang,
|
|
50
|
+
};
|
|
46
51
|
return tree;
|
|
47
52
|
};
|
|
48
53
|
}
|
package/src/ng-add/schema.json
CHANGED
|
@@ -3,5 +3,11 @@
|
|
|
3
3
|
"$id": "ng-add-schema",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
|
+
"lang":{
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The default language for the application (en, es); default is 'en'.",
|
|
9
|
+
"x-prompt": "What is the default language for the application (en, es)?",
|
|
10
|
+
"default": "en"
|
|
11
|
+
}
|
|
6
12
|
}
|
|
7
13
|
}
|
|
@@ -27,9 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"lang":{
|
|
29
29
|
"type": "string",
|
|
30
|
-
"description": "The default language for the application (en, es); default is 'en'."
|
|
31
|
-
"x-prompt": "What is the default language for the application (en, es)?",
|
|
32
|
-
"default": "en"
|
|
30
|
+
"description": "The default language for the application (en, es); default is 'en'."
|
|
33
31
|
}
|
|
34
32
|
},
|
|
35
33
|
"required": ["name"]
|