@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barcidev/ngx-autogen",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "A collection of Angular schematics for essential functionalities.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,2 +1,3 @@
1
1
  import { Rule } from "@angular-devkit/schematics";
2
- export declare function ngAdd(): Rule;
2
+ import { NgAddSchemaOptions } from "./schema";
3
+ export declare function ngAdd(options: NgAddSchemaOptions): Rule;
@@ -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 json = JSON.parse(buffer.toString());
39
- json.cli = json.cli || {};
40
- const collections = json.cli.schematicCollections || [];
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
- json.cli.schematicCollections = collections;
44
- tree.overwrite("angular.json", JSON.stringify(json, null, 2));
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
  }
@@ -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"]