@ng-zen/cli 19.0.0-alpha.1 → 19.0.0-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-zen/cli",
3
- "version": "19.0.0-alpha.1",
3
+ "version": "19.0.0-alpha.2",
4
4
  "description": "A blank schematics",
5
5
  "license": "BSD-2-Clause",
6
6
  "private": false,
@@ -1 +1 @@
1
- {"version":3,"file":"components-generator.js","sourceRoot":"","sources":["../../../../../projects/cli/src/schematics/components/components-generator.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../../types';\n\nexport interface ComponentGeneratorSchema extends GeneratorSchemaBase {\n components: 'button'[];\n}\n"]}
1
+ {"version":3,"file":"components-generator.js","sourceRoot":"","sources":["../../../../../projects/cli/src/schematics/components/components-generator.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../../types';\n\nexport type ComponentType = 'avatar' | 'button';\n\nexport interface ComponentGeneratorSchema extends GeneratorSchemaBase {\n components: ComponentType[];\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  import { GeneratorSchemaBase } from '../../types';
2
2
 
3
+ export type ComponentType = 'avatar' | 'button';
4
+
3
5
  export interface ComponentGeneratorSchema extends GeneratorSchemaBase {
4
- components: 'button'[];
6
+ components: ComponentType[];
5
7
  }
@@ -10,7 +10,7 @@
10
10
  "type": "array",
11
11
  "items": {
12
12
  "type": "string",
13
- "enum": ["button"]
13
+ "enum": ["avatar", "button"]
14
14
  },
15
15
  "multiselect": true,
16
16
  "x-prompt": "Which component should be generated?"
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schematics-folder.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schematics-folder.type.js","sourceRoot":"","sources":["../../../../projects/cli/src/types/schematics-folder.type.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentType } from '../schematics/components/components-generator';\n\nexport type SchematicsFolder = ComponentType;\n"]}
@@ -0,0 +1,3 @@
1
+ import { ComponentType } from '../schematics/components/components-generator';
2
+
3
+ export type SchematicsFolder = ComponentType;
@@ -15,7 +15,7 @@ const getTemplates = (rules) => (0, schematics_1.apply)((0, schematics_1.url)(`.
15
15
  const includeStories = (include) => (0, schematics_1.filter)(filePath => include || !filePath.endsWith('.stories.ts'));
16
16
  function applyFileTemplateUtil(folders, config) {
17
17
  return folders.map(folder => {
18
- const RULES = createTemplateRules(folders, config.path);
18
+ const RULES = createTemplateRules(folder, config.path);
19
19
  const folderSource = (0, schematics_1.apply)((0, schematics_1.url)(`./files/${folder}`), [includeStories(config.stories), ...RULES]);
20
20
  return (0, schematics_1.chain)([folderSource, getTemplates(RULES)].map(schematics_1.mergeWith));
21
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"apply-file-template.util.js","sourceRoot":"","sources":["../../../../projects/cli/src/utils/apply-file-template.util.ts"],"names":[],"mappings":";;AAmBA,sDAQC;AA3BD,+CAA0D;AAC1D,2DAA8G;AAM9G,MAAM,mBAAmB,GAAG,CAAC,MAAe,EAAE,IAAY,EAAU,EAAE,CAAC;IACrE,IAAA,2BAAc,EAAC;QACb,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,cAAc,EAAE;QACvC,GAAG,cAAO;KACX,CAAC;IACF,IAAA,iBAAI,EAAC,IAAA,gBAAS,EAAC,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,aAAa,CAAC,EAAE,KAAK,CAAC,CAAC;AACzE,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,IAAA,mBAAM,EAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAE9G,SAAgB,qBAAqB,CAAC,OAAgB,EAAE,MAA2B;IACjF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAExD,MAAM,YAAY,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,WAAW,MAAM,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;QAEjG,OAAO,IAAA,kBAAK,EAAC,CAAC,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,sBAAS,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { normalize, strings } from '@angular-devkit/core';\nimport { apply, applyTemplates, chain, filter, mergeWith, move, Rule, url } from '@angular-devkit/schematics';\nimport { ComponentGeneratorSchema } from '../schematics/components/components-generator';\nimport { GeneratorSchemaBase } from '../types';\n\ntype Folders = ComponentGeneratorSchema['components'];\n\nconst createTemplateRules = (folder: Folders, path: string): Rule[] => [\n applyTemplates({\n name: folder,\n localeDate: new Date().toLocaleString(),\n ...strings,\n }),\n move(normalize(`${path}/${folder}`)),\n];\n\nconst getTemplates = (rules: Rule[]) => apply(url(`./templates`), rules);\nconst includeStories = (include: boolean) => filter(filePath => include || !filePath.endsWith('.stories.ts'));\n\nexport function applyFileTemplateUtil(folders: Folders, config: GeneratorSchemaBase): Rule[] {\n return folders.map(folder => {\n const RULES = createTemplateRules(folders, config.path);\n\n const folderSource = apply(url(`./files/${folder}`), [includeStories(config.stories), ...RULES]);\n\n return chain([folderSource, getTemplates(RULES)].map(mergeWith));\n });\n}\n"]}
1
+ {"version":3,"file":"apply-file-template.util.js","sourceRoot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strings } from '@angular-devkit/core';\nimport { apply, applyTemplates, chain, filter, mergeWith, move, Rule, url } from '@angular-devkit/schematics';\nimport { GeneratorSchemaBase } from '../types';\nimport { SchematicsFolder } from '../types/schematics-folder.type';\n\nconst createTemplateRules = (folder: string, path: string): Rule[] => [\n applyTemplates({\n name: folder,\n localeDate: new Date().toLocaleString(),\n ...strings,\n }),\n move(normalize(`${path}/${folder}`)),\n];\n\nconst getTemplates = (rules: Rule[]) => apply(url(`./templates`), rules);\nconst includeStories = (include: boolean) => filter(filePath => include || !filePath.endsWith('.stories.ts'));\n\nexport function applyFileTemplateUtil(folders: SchematicsFolder[], config: GeneratorSchemaBase): Rule[] {\n return folders.map(folder => {\n const RULES = createTemplateRules(folder, config.path);\n\n const folderSource = apply(url(`./files/${folder}`), [includeStories(config.stories), ...RULES]);\n\n return chain([folderSource, getTemplates(RULES)].map(mergeWith));\n });\n}\n"]}
@@ -1,11 +1,9 @@
1
1
  import { normalize, strings } from '@angular-devkit/core';
2
2
  import { apply, applyTemplates, chain, filter, mergeWith, move, Rule, url } from '@angular-devkit/schematics';
3
- import { ComponentGeneratorSchema } from '../schematics/components/components-generator';
4
3
  import { GeneratorSchemaBase } from '../types';
4
+ import { SchematicsFolder } from '../types/schematics-folder.type';
5
5
 
6
- type Folders = ComponentGeneratorSchema['components'];
7
-
8
- const createTemplateRules = (folder: Folders, path: string): Rule[] => [
6
+ const createTemplateRules = (folder: string, path: string): Rule[] => [
9
7
  applyTemplates({
10
8
  name: folder,
11
9
  localeDate: new Date().toLocaleString(),
@@ -17,9 +15,9 @@ const createTemplateRules = (folder: Folders, path: string): Rule[] => [
17
15
  const getTemplates = (rules: Rule[]) => apply(url(`./templates`), rules);
18
16
  const includeStories = (include: boolean) => filter(filePath => include || !filePath.endsWith('.stories.ts'));
19
17
 
20
- export function applyFileTemplateUtil(folders: Folders, config: GeneratorSchemaBase): Rule[] {
18
+ export function applyFileTemplateUtil(folders: SchematicsFolder[], config: GeneratorSchemaBase): Rule[] {
21
19
  return folders.map(folder => {
22
- const RULES = createTemplateRules(folders, config.path);
20
+ const RULES = createTemplateRules(folder, config.path);
23
21
 
24
22
  const folderSource = apply(url(`./files/${folder}`), [includeStories(config.stories), ...RULES]);
25
23