@ng-atomic/schematics 0.0.1
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 +7 -0
- package/collection.json +56 -0
- package/package.json +14 -0
- package/src/_testing/build-expected-file-paths.d.ts +1 -0
- package/src/_testing/build-expected-file-paths.js +11 -0
- package/src/_testing/build-expected-file-paths.js.map +1 -0
- package/src/_testing/config.d.ts +1 -0
- package/src/_testing/config.js +6 -0
- package/src/_testing/config.js.map +1 -0
- package/src/_testing/create-app-module.d.ts +3 -0
- package/src/_testing/create-app-module.js +48 -0
- package/src/_testing/create-app-module.js.map +1 -0
- package/src/_testing/create-package.d.ts +3 -0
- package/src/_testing/create-package.js +14 -0
- package/src/_testing/create-package.js.map +1 -0
- package/src/_testing/create-workspace.d.ts +42 -0
- package/src/_testing/create-workspace.js +40 -0
- package/src/_testing/create-workspace.js.map +1 -0
- package/src/_testing/index.d.ts +4 -0
- package/src/_testing/index.js +8 -0
- package/src/_testing/index.js.map +1 -0
- package/src/_utilities/add-path-to-routes.d.ts +2 -0
- package/src/_utilities/add-path-to-routes.js +29 -0
- package/src/_utilities/add-path-to-routes.js.map +1 -0
- package/src/_utilities/angular-config.d.ts +4 -0
- package/src/_utilities/angular-config.js +18 -0
- package/src/_utilities/angular-config.js.map +1 -0
- package/src/_utilities/index.d.ts +4 -0
- package/src/_utilities/index.js +8 -0
- package/src/_utilities/index.js.map +1 -0
- package/src/_utilities/overwrite.d.ts +2 -0
- package/src/_utilities/overwrite.js +13 -0
- package/src/_utilities/overwrite.js.map +1 -0
- package/src/_utilities/package-config.d.ts +12 -0
- package/src/_utilities/package-config.js +47 -0
- package/src/_utilities/package-config.js.map +1 -0
- package/src/_utilities/ts-config.d.ts +2 -0
- package/src/_utilities/ts-config.js +13 -0
- package/src/_utilities/ts-config.js.map +1 -0
- package/src/atomic-component/_test/example.atom.ts.expected +15 -0
- package/src/atomic-component/files/__name@dasherize__/index.ts.template +1 -0
- package/src/atomic-component/index.d.ts +8 -0
- package/src/atomic-component/index.js +38 -0
- package/src/atomic-component/index.js.map +1 -0
- package/src/atomic-component/index.spec.ts +159 -0
- package/src/atomic-component/schema.d.ts +20 -0
- package/src/atomic-component/schema.js +3 -0
- package/src/atomic-component/schema.js.map +1 -0
- package/src/atomic-component/schema.json +133 -0
- package/src/ng-add/index.d.ts +3 -0
- package/src/ng-add/index.js +35 -0
- package/src/ng-add/index.js.map +1 -0
- package/src/ng-add/schema.json +29 -0
- package/src/page/_test/test.module.ts.expected +26 -0
- package/src/page/index.d.ts +3 -0
- package/src/page/index.js +54 -0
- package/src/page/index.js.map +1 -0
- package/src/page/index.spec.ts +29 -0
- package/src/pages/files/__name@dasherize__/__name@dasherize__.module.ts.template +15 -0
- package/src/pages/index.d.ts +3 -0
- package/src/pages/index.js +16 -0
- package/src/pages/index.js.map +1 -0
- package/src/pages/index.spec.ts +17 -0
- package/src/pages/schema.d.ts +7 -0
- package/src/pages/schema.js +3 -0
- package/src/pages/schema.js.map +1 -0
- package/src/pages/schema.json +44 -0
- package/src/setup/files/atomic/_atom.scss +7 -0
- package/src/setup/files/atomic/_component.scss +12 -0
- package/src/setup/files/atomic/_molecule.scss +7 -0
- package/src/setup/files/atomic/_organism.scss +7 -0
- package/src/setup/files/atomic/_page.scss +7 -0
- package/src/setup/files/atomic/_template.scss +7 -0
- package/src/setup/index.d.ts +2 -0
- package/src/setup/index.js +17 -0
- package/src/setup/index.js.map +1 -0
- package/src/setup/index.spec.ts +37 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import {
|
|
6
|
+
buildExpectedFilePaths,
|
|
7
|
+
createWorkspace,
|
|
8
|
+
defaultWorkspaceOptions,
|
|
9
|
+
defaultAppOptions,
|
|
10
|
+
getTestProjectPath,
|
|
11
|
+
createNxWorkspace,
|
|
12
|
+
} from '../_testing';
|
|
13
|
+
|
|
14
|
+
const COLLECTION_PATH = path.join(__dirname, '../../collection.json');
|
|
15
|
+
|
|
16
|
+
describe('AtomicComponent Schematics', () => {
|
|
17
|
+
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
18
|
+
let tree: UnitTestTree;
|
|
19
|
+
|
|
20
|
+
describe('Angular Workspace', () => {
|
|
21
|
+
beforeEach(async () => {
|
|
22
|
+
tree = await createWorkspace(runner, tree);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should create atomic component files', async () => {
|
|
26
|
+
const options = {project: 'app', path: '_shared/components', name: 'example'};
|
|
27
|
+
|
|
28
|
+
const { files } = await runner.runSchematicAsync('atomic-component', options, tree).toPromise();
|
|
29
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.module.ts');
|
|
30
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.component.html');
|
|
31
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.component.scss');
|
|
32
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.component.spec.ts');
|
|
33
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.component.ts');
|
|
34
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/example/index.ts');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should create atomic component files', async () => {
|
|
38
|
+
tree = await runner.runSchematicAsync('atomic-component', {project: 'app', name: '_shared/components/first'}, tree).toPromise();
|
|
39
|
+
tree = await runner.runSchematicAsync('atomic-component', {project: 'app', name: '_shared/components/second'}, tree).toPromise();
|
|
40
|
+
|
|
41
|
+
const { files } = tree;
|
|
42
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.module.ts');
|
|
43
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.component.html');
|
|
44
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.component.scss');
|
|
45
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.component.spec.ts');
|
|
46
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.component.ts');
|
|
47
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/first/index.ts');
|
|
48
|
+
|
|
49
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.module.ts');
|
|
50
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.component.html');
|
|
51
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.component.scss');
|
|
52
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.component.spec.ts');
|
|
53
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.component.ts');
|
|
54
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/second/index.ts');
|
|
55
|
+
|
|
56
|
+
const source = tree.read('/projects/app/src/app/_shared/components/index.ts')!.toString('utf-8');
|
|
57
|
+
expect(source).toEqual(`export { FirstModule } from './first';\nexport { SecondModule } from './second';`);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should create atomic components files in app2', async () => {
|
|
61
|
+
const options = {project: 'app2', name: '_shared/components/example'};
|
|
62
|
+
const projectPath = getTestProjectPath(defaultWorkspaceOptions, {...defaultAppOptions, name: 'app2'});
|
|
63
|
+
const expectedFilePaths = buildExpectedFilePaths(options.name, 'example', projectPath, 'component');
|
|
64
|
+
|
|
65
|
+
const { files } = await runner.runSchematicAsync('atomic-component', options, tree).toPromise();
|
|
66
|
+
expectedFilePaths.forEach(path => expect(files.includes(path)).toBeTruthy());
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('Nx Workspace', () => {
|
|
71
|
+
beforeEach(async () => {
|
|
72
|
+
tree = await createNxWorkspace(runner, tree);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('', async () => {
|
|
76
|
+
const options = {project: 'app', name: '_shared/components/extras/example'};
|
|
77
|
+
// const options = {project: 'app', path: '_shared/components/extras', name: 'example'};
|
|
78
|
+
const { files } = await runner.runSchematicAsync('atomic-component', options, tree).toPromise();
|
|
79
|
+
expect(files).toContain('/apps/app/src/app/_shared/components/extras/example/example.module.ts');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe('Atom Schematics', () => {
|
|
86
|
+
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
87
|
+
let tree: UnitTestTree;
|
|
88
|
+
|
|
89
|
+
beforeEach(async () => {
|
|
90
|
+
tree = await createWorkspace(runner, tree);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should create atom files', async () => {
|
|
94
|
+
const options = {project: 'app', name: '_shared/components/example'};
|
|
95
|
+
const projectPath = getTestProjectPath(defaultWorkspaceOptions, {...defaultAppOptions, name: 'app'});
|
|
96
|
+
const expectedFilePaths = buildExpectedFilePaths(options.name, 'example', projectPath, 'atom');
|
|
97
|
+
|
|
98
|
+
const host = await runner.runSchematicAsync('atom', options, tree).toPromise();
|
|
99
|
+
expectedFilePaths.forEach(path => expect(host.files.includes(path)).toBeTruthy());
|
|
100
|
+
|
|
101
|
+
const input = host.read('/projects/app/src/app/_shared/components/example/example.atom.ts').toString('utf-8');
|
|
102
|
+
const expected = readFileSync(join(__dirname, '_test/example.atom.ts.expected')).toString();
|
|
103
|
+
expect(input.replace(/\s/g, '')).toEqual(expected.replace(/\s/g, ''));
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe('Molecule Schematics', () => {
|
|
108
|
+
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
109
|
+
let tree: UnitTestTree;
|
|
110
|
+
|
|
111
|
+
beforeEach(async () => {
|
|
112
|
+
tree = await createWorkspace(runner, tree);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('should create molecule files', async () => {
|
|
116
|
+
const options = {project: 'app', name: '_shared/components/example'};
|
|
117
|
+
const projectPath = getTestProjectPath(defaultWorkspaceOptions, {...defaultAppOptions, name: 'app'});
|
|
118
|
+
const expectedFilePaths = buildExpectedFilePaths(options.name, 'example', projectPath, 'molecule');
|
|
119
|
+
|
|
120
|
+
const { files } = await runner.runSchematicAsync('molecule', options, tree).toPromise();
|
|
121
|
+
expectedFilePaths.forEach(path => expect(files.includes(path)).toBeTruthy());
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe('Organism Schematics', () => {
|
|
126
|
+
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
127
|
+
let tree: UnitTestTree;
|
|
128
|
+
|
|
129
|
+
beforeEach(async () => {
|
|
130
|
+
tree = await createWorkspace(runner, tree);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should create organism files', async () => {
|
|
134
|
+
const options = {project: 'app', name: '_shared/components/example'};
|
|
135
|
+
const projectPath = getTestProjectPath(defaultWorkspaceOptions, {...defaultAppOptions, name: 'app'});
|
|
136
|
+
const expectedFilePaths = buildExpectedFilePaths(options.name, 'example', projectPath, 'organism');
|
|
137
|
+
|
|
138
|
+
const { files } = await runner.runSchematicAsync('organism', options, tree).toPromise();
|
|
139
|
+
expectedFilePaths.forEach(path => expect(files.includes(path)).toBeTruthy());
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe('Template Schematics', () => {
|
|
144
|
+
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
145
|
+
let tree: UnitTestTree;
|
|
146
|
+
|
|
147
|
+
beforeEach(async () => {
|
|
148
|
+
tree = await createWorkspace(runner, tree);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('should create template files', async () => {
|
|
152
|
+
const options = {project: 'app', name: '_shared/components/example'};
|
|
153
|
+
const projectPath = getTestProjectPath(defaultWorkspaceOptions, {...defaultAppOptions, name: 'app'});
|
|
154
|
+
const expectedFilePaths = buildExpectedFilePaths(options.name, 'example', projectPath, 'template');
|
|
155
|
+
|
|
156
|
+
const { files } = await runner.runSchematicAsync('template', options, tree).toPromise();
|
|
157
|
+
expectedFilePaths.forEach(path => expect(files.includes(path)).toBeTruthy());
|
|
158
|
+
});
|
|
159
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Schema {
|
|
2
|
+
path?: string;
|
|
3
|
+
project?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
displayBlock?: string;
|
|
6
|
+
inlineTemplate?: string;
|
|
7
|
+
viewEncapsulation?: "Emulated" | "Native" | "None" | "ShadowDom";
|
|
8
|
+
changeDetection?: "Default" | "OnPush";
|
|
9
|
+
prefix?: string;
|
|
10
|
+
style?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
skipTests?: boolean;
|
|
13
|
+
flat?: boolean;
|
|
14
|
+
skipImport?: boolean;
|
|
15
|
+
selector?: string;
|
|
16
|
+
skipSelector?: boolean;
|
|
17
|
+
module?: string;
|
|
18
|
+
export?: boolean;
|
|
19
|
+
styleHeader?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/atomic-component/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsAngularComponent",
|
|
4
|
+
"title": "Angular Component Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "Creates a new generic component definition in the given or default project.",
|
|
7
|
+
"properties": {
|
|
8
|
+
"path": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"format": "path",
|
|
11
|
+
"description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.",
|
|
12
|
+
"visible": false
|
|
13
|
+
},
|
|
14
|
+
"project": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "The name of the project.",
|
|
17
|
+
"$default": {
|
|
18
|
+
"$source": "projectName"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"name": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The name of the component.",
|
|
24
|
+
"$default": {
|
|
25
|
+
"$source": "argv",
|
|
26
|
+
"index": 0
|
|
27
|
+
},
|
|
28
|
+
"x-prompt": "What name would you like to use for the component?"
|
|
29
|
+
},
|
|
30
|
+
"displayBlock": {
|
|
31
|
+
"description": "Specifies if the style will contain `:host { display: block; }`.",
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"default": false,
|
|
34
|
+
"alias": "b"
|
|
35
|
+
},
|
|
36
|
+
"inlineTemplate": {
|
|
37
|
+
"description": "When true, includes template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.",
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"default": false,
|
|
40
|
+
"alias": "t",
|
|
41
|
+
"x-user-analytics": 10
|
|
42
|
+
},
|
|
43
|
+
"viewEncapsulation": {
|
|
44
|
+
"description": "The view encapsulation strategy to use in the new component.",
|
|
45
|
+
"enum": ["Emulated", "Native", "None", "ShadowDom"],
|
|
46
|
+
"type": "string",
|
|
47
|
+
"alias": "v",
|
|
48
|
+
"x-user-analytics": 11
|
|
49
|
+
},
|
|
50
|
+
"changeDetection": {
|
|
51
|
+
"description": "The change detection strategy to use in the new component.",
|
|
52
|
+
"enum": ["Default", "OnPush"],
|
|
53
|
+
"type": "string",
|
|
54
|
+
"default": "Default",
|
|
55
|
+
"alias": "c"
|
|
56
|
+
},
|
|
57
|
+
"prefix": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "The prefix to apply to the generated component selector.",
|
|
60
|
+
"alias": "p",
|
|
61
|
+
"oneOf": [
|
|
62
|
+
{
|
|
63
|
+
"maxLength": 0
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"minLength": 1,
|
|
67
|
+
"format": "html-selector"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"style": {
|
|
72
|
+
"description": "The file extension or preprocessor to use for style files.",
|
|
73
|
+
"type": "string",
|
|
74
|
+
"default": "scss",
|
|
75
|
+
"enum": [
|
|
76
|
+
"scss",
|
|
77
|
+
"sass"
|
|
78
|
+
],
|
|
79
|
+
"x-user-analytics": 5
|
|
80
|
+
},
|
|
81
|
+
"type": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\"."
|
|
84
|
+
},
|
|
85
|
+
"skipTests": {
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"description": "When true, does not create \"spec.ts\" test files for the new component.",
|
|
88
|
+
"default": false,
|
|
89
|
+
"x-user-analytics": 12
|
|
90
|
+
},
|
|
91
|
+
"flat": {
|
|
92
|
+
"type": "boolean",
|
|
93
|
+
"description": "When true, creates the new files at the top level of the current project.",
|
|
94
|
+
"default": false
|
|
95
|
+
},
|
|
96
|
+
"skipImport": {
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"description": "When true, does not import this component into the owning NgModule.",
|
|
99
|
+
"default": false,
|
|
100
|
+
"x-user-analytics": 18
|
|
101
|
+
},
|
|
102
|
+
"selector": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"format": "html-selector",
|
|
105
|
+
"description": "The HTML selector to use for this component."
|
|
106
|
+
},
|
|
107
|
+
"skipSelector": {
|
|
108
|
+
"type": "boolean",
|
|
109
|
+
"default": false,
|
|
110
|
+
"description": "Specifies if the component should have a selector or not."
|
|
111
|
+
},
|
|
112
|
+
"module": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"description": "The declaring NgModule.",
|
|
115
|
+
"alias": "m"
|
|
116
|
+
},
|
|
117
|
+
"export": {
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"default": false,
|
|
120
|
+
"description": "When true, the declaring NgModule exports this component.",
|
|
121
|
+
"x-user-analytics": 19
|
|
122
|
+
},
|
|
123
|
+
"styleHeader": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"default": "@import 'host-variable';\n@import 'atomic/{type}';\n$host: host('{name}');\n\n:host {\n\t@include {type}($host);\n}\n",
|
|
126
|
+
"description": ""
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": [
|
|
130
|
+
"name"
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCustomWebpackVersion = void 0;
|
|
4
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
5
|
+
const _utilities_1 = require("../_utilities");
|
|
6
|
+
function default_1(options) {
|
|
7
|
+
return (host, context) => {
|
|
8
|
+
const ngCoreVersionTag = _utilities_1.getPackageVersionFromPackageJson(host, '@angular/core');
|
|
9
|
+
const angularDependencyVersion = ngCoreVersionTag || `0.0.0-NG`;
|
|
10
|
+
if (angularDependencyVersion === '0.0.0-NG') {
|
|
11
|
+
throw new Error('@angular/core version is not supported.');
|
|
12
|
+
}
|
|
13
|
+
// 必要なパッケージの追加
|
|
14
|
+
_utilities_1.addPackageToPackageJson(host, 'angular-atomic-schematics', getCustomWebpackVersion(angularDependencyVersion), 'devDependencies');
|
|
15
|
+
_utilities_1.addPackageToPackageJson(host, 'angular-host-css-variable', getCustomWebpackVersion(angularDependencyVersion), 'devDependencies');
|
|
16
|
+
_utilities_1.addPackageToPackageJson(host, 'angular-custom-webpack-chaining', getCustomWebpackVersion(angularDependencyVersion), 'devDependencies');
|
|
17
|
+
const installTaskId = context.addTask(new tasks_1.NodePackageInstallTask());
|
|
18
|
+
// angular-host-css-variableのインストール
|
|
19
|
+
const runSchematicTask = context.addTask(new tasks_1.RunSchematicTask('angular-host-css-variable', 'ng-add', { project: options.project }), [installTaskId]);
|
|
20
|
+
// Set Up Angular Atomic Schematics
|
|
21
|
+
context.addTask(new tasks_1.RunSchematicTask('setup-project', Object.assign({}, options)), [runSchematicTask]);
|
|
22
|
+
return host;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.default = default_1;
|
|
26
|
+
function getCustomWebpackVersion(ver) {
|
|
27
|
+
const [major, minor, patch] = (ver.replace(/(\^|\~)/, '')).split('.');
|
|
28
|
+
switch (major) {
|
|
29
|
+
case '10': return '^0.1000.0';
|
|
30
|
+
case '11': return '^0.1100.0';
|
|
31
|
+
default: throw new Error('@angular/core version is not supported.');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.getCustomWebpackVersion = getCustomWebpackVersion;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/ng-add/index.ts"],"names":[],"mappings":";;;AACA,4DAA4F;AAC5F,8CAA0F;AAE1F,mBAAwB,OAAY;IAClC,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,gBAAgB,GAAG,6CAAgC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACjF,MAAM,wBAAwB,GAAG,gBAAgB,IAAI,UAAU,CAAC;QAEhE,IAAI,wBAAwB,KAAK,UAAU,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC5D;QAEH,cAAc;QACd,oCAAuB,CACtB,IAAI,EACJ,2BAA2B,EAC3B,uBAAuB,CAAC,wBAAwB,CAAC,EACjD,iBAAiB,CACjB,CAAC;QAEF,oCAAuB,CACtB,IAAI,EACJ,2BAA2B,EAC3B,uBAAuB,CAAC,wBAAwB,CAAC,EACjD,iBAAiB,CACjB,CAAC;QAEF,oCAAuB,CACtB,IAAI,EACJ,iCAAiC,EAC9B,uBAAuB,CAAC,wBAAwB,CAAC,EACpD,iBAAiB,CACjB,CAAC;QAEF,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAEpE,mCAAmC;QACnC,MAAM,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,wBAAgB,CAC5D,2BAA2B,EAC3B,QAAQ,EACR,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAC5B,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;QAEpB,mCAAmC;QACnC,OAAO,CAAC,OAAO,CAAC,IAAI,wBAAgB,CAAC,eAAe,oBAAM,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAA;QAExF,OAAO,IAAI,CAAA;IACX,CAAC,CAAA;AACH,CAAC;AA7CD,4BA6CC;AAED,SAAgB,uBAAuB,CAAC,GAAW;IACjD,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtE,QAAQ,KAAK,EAAE;QACb,KAAK,IAAI,CAAC,CAAC,OAAO,WAAW,CAAC;QAC9B,KAAK,IAAI,CAAC,CAAC,OAAO,WAAW,CAAC;QAC9B,OAAO,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KACrE;AACH,CAAC;AAPD,0DAOC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "ngx-atomic-schematics-ng-add",
|
|
4
|
+
"title": "Angular Atomic Schematics ng-add schematic",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name of the project.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"componentsDir": {
|
|
15
|
+
"description": "Setup components directory",
|
|
16
|
+
"type": "string",
|
|
17
|
+
"default": "src/app/_shared/components",
|
|
18
|
+
"x-prompt": "Where do you setup Angular Atomic Components?"
|
|
19
|
+
},
|
|
20
|
+
"stylesDir": {
|
|
21
|
+
"description": "Setup styles directory",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"default": "src/styles",
|
|
24
|
+
"x-prompt": "Where do you setup Angular Atomic Styles?"
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": []
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { Routes, RouterModule } from '@angular/router';
|
|
4
|
+
import { TestPage } from './test.page';
|
|
5
|
+
|
|
6
|
+
const routes: Routes = [
|
|
7
|
+
{
|
|
8
|
+
path: '',
|
|
9
|
+
component: TestPage,
|
|
10
|
+
// loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule)
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
@NgModule({
|
|
15
|
+
declarations: [
|
|
16
|
+
TestPage
|
|
17
|
+
],
|
|
18
|
+
imports: [
|
|
19
|
+
CommonModule,
|
|
20
|
+
RouterModule.forChild(routes)
|
|
21
|
+
],
|
|
22
|
+
exports: [
|
|
23
|
+
TestPage
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
export class TestModule { }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.page = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
7
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
8
|
+
const _utilities_1 = require("../_utilities");
|
|
9
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
10
|
+
exports.page = (options) => (host) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
(_a = options.path) !== null && _a !== void 0 ? _a : (options.path = yield workspace_1.createDefaultPath(host, options.project));
|
|
13
|
+
(_b = options.type) !== null && _b !== void 0 ? _b : (options.type = 'page');
|
|
14
|
+
options.name = resolveName(options.name);
|
|
15
|
+
const { name, path, type, project, styleHeader } = options = Object.assign(Object.assign({}, options), parse_name_1.parseName(options.path, options.name));
|
|
16
|
+
const pages = getPagesOptions(`${path}/${name}`);
|
|
17
|
+
delete options['styleHeader'];
|
|
18
|
+
return schematics_1.chain([
|
|
19
|
+
schematics_1.schematic('pages', Object.assign(Object.assign({}, pages), { project })),
|
|
20
|
+
addRouteIntoPagesModule(options, pages),
|
|
21
|
+
schematics_1.schematic('pages', { name, path, project }),
|
|
22
|
+
schematics_1.externalSchematic('@schematics/angular', 'component', Object.assign(Object.assign({}, options), { export: true })),
|
|
23
|
+
// externalSchematic('@ng-atomic/host-variable', 'component', {...options, styleHeader: format(styleHeader, {name, type}), export: true}),
|
|
24
|
+
addRouteIntoPageModule(options, { path, name }),
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
const getPagesOptions = (fullPath) => {
|
|
28
|
+
const [_, name, ...paths] = fullPath.split('/').reverse();
|
|
29
|
+
return { name, path: paths.reverse().join('/') };
|
|
30
|
+
};
|
|
31
|
+
const resolveName = (name) => {
|
|
32
|
+
return 'pages/' + name.split('/').filter(path => path !== 'pages').join('/pages/');
|
|
33
|
+
};
|
|
34
|
+
const addRouteIntoPagesModule = (options, target) => {
|
|
35
|
+
const routeOptions = buildOption(options, target, 'pages');
|
|
36
|
+
return _utilities_1.addPathToRoutes(routeOptions);
|
|
37
|
+
};
|
|
38
|
+
const addRouteIntoPageModule = (options, target) => {
|
|
39
|
+
const routeOptions = buildOption(options, target, 'page');
|
|
40
|
+
return _utilities_1.addPathToRoutes(routeOptions);
|
|
41
|
+
};
|
|
42
|
+
const buildOption = (options, { path, name }, type) => (Object.assign(Object.assign({}, options), { routingModulePath: `${path}/${name}/${name}.module.ts`, route: type === 'pages' ? buildPagesRoute(options.name) : buildPageRoute(name), removeOtherRoutes: type === 'page' }));
|
|
43
|
+
const buildPagesRoute = (name) => `
|
|
44
|
+
{
|
|
45
|
+
path: '${name}',
|
|
46
|
+
loadChildren: () => import('./${strings_1.dasherize(name)}/${strings_1.dasherize(name)}.module').then(m => m.${strings_1.classify(name)}Module)
|
|
47
|
+
}`;
|
|
48
|
+
const buildPageRoute = (name) => `
|
|
49
|
+
{
|
|
50
|
+
path: '',
|
|
51
|
+
component: ${strings_1.classify(name)}Page,
|
|
52
|
+
// loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule)
|
|
53
|
+
}`;
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/page/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { COLLECTION_PATH, createWorkspace } from '../_testing';
|
|
5
|
+
|
|
6
|
+
describe('Page Schematics', () => {
|
|
7
|
+
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
8
|
+
let tree: UnitTestTree;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
tree = await createWorkspace(runner, tree);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should create atomic component files', async () => {
|
|
15
|
+
const options = {project: 'app', name: 'test'};
|
|
16
|
+
const host = await runner.runSchematicAsync('page', options, tree).toPromise();
|
|
17
|
+
expect(host.files.includes('/projects/app/src/app/pages/pages.module.ts')).toBeTruthy();
|
|
18
|
+
expect(host.files.includes('/projects/app/src/app/pages/test/test.module.ts')).toBeTruthy();
|
|
19
|
+
expect(host.files.includes('/projects/app/src/app/pages/test/test.page.html')).toBeTruthy();
|
|
20
|
+
expect(host.files.includes('/projects/app/src/app/pages/test/test.page.scss')).toBeTruthy();
|
|
21
|
+
expect(host.files.includes('/projects/app/src/app/pages/test/test.page.spec.ts')).toBeTruthy();
|
|
22
|
+
expect(host.files.includes('/projects/app/src/app/pages/test/test.page.ts')).toBeTruthy();
|
|
23
|
+
|
|
24
|
+
const input = host.read('/projects/app/src/app/pages/test/test.module.ts').toString('utf-8');
|
|
25
|
+
const expected = readFileSync(join(__dirname, '_test/test.module.ts.expected')).toString('utf-8');
|
|
26
|
+
expect(input.replace(/\s/g, '')).toEqual(expected.replace(/\s/g, ''));
|
|
27
|
+
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';<% if (commonModule) { %>
|
|
2
|
+
import { CommonModule } from '@angular/common';<% } %>
|
|
3
|
+
import { Routes, RouterModule } from '@angular/router';
|
|
4
|
+
|
|
5
|
+
const routes: Routes = [
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
@NgModule({
|
|
9
|
+
declarations: [],
|
|
10
|
+
imports: [<% if (commonModule) { %>
|
|
11
|
+
CommonModule,<% } %>
|
|
12
|
+
RouterModule.forChild(routes)
|
|
13
|
+
]
|
|
14
|
+
})
|
|
15
|
+
export class <%= classify(name) %>Module { }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pages = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular-devkit/core");
|
|
6
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
|
+
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
8
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
9
|
+
exports.pages = (options) => (host) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
+
var _a;
|
|
11
|
+
(_a = options.path) !== null && _a !== void 0 ? _a : (options.path = yield workspace_1.createDefaultPath(host, options.project));
|
|
12
|
+
const { name, path } = options = Object.assign(Object.assign({}, options), parse_name_1.parseName(options.path, options.name));
|
|
13
|
+
return host.exists(`${path}/${name}/${name}.module.ts`) ? schematics_1.noop() : genModule(options);
|
|
14
|
+
});
|
|
15
|
+
const genModule = (options) => schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./files'), [schematics_1.applyTemplates(Object.assign(Object.assign({}, core_1.strings), options)), schematics_1.move(options.path)]));
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/pages/index.ts"],"names":[],"mappings":";;;;AAAA,+CAA+C;AAC/C,2DAA2G;AAC3G,uEAAmE;AACnE,qEAA0E;AAG7D,QAAA,KAAK,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,CAAO,IAAU,EAAE,EAAE;;IACnE,MAAA,OAAO,CAAC,IAAI,oCAAZ,OAAO,CAAC,IAAI,GAAK,MAAM,6BAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EAAC;IAChE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,mCAAO,OAAO,GAAK,sBAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACxF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,iBAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACxF,CAAC,CAAA,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE,CACpC,sBAAS,CAAC,kBAAK,CAAC,gBAAG,CAAC,SAAS,CAAC,EAAE,CAAC,2BAAc,iCAAK,cAAO,GAAK,OAAO,EAAE,EAAE,iBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
+
import { COLLECTION_PATH, createWorkspace } from '../_testing';
|
|
3
|
+
|
|
4
|
+
describe('Pages Schematics', () => {
|
|
5
|
+
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
6
|
+
let tree: UnitTestTree;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
tree = await createWorkspace(runner, tree);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should create component files', async () => {
|
|
13
|
+
const options = {project: 'app', name: 'pages'};
|
|
14
|
+
const { files } = await runner.runSchematicAsync('pages', options, tree).toPromise();
|
|
15
|
+
expect(files.includes('/projects/app/src/app/pages/pages.module.ts')).toBeTruthy();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/pages/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsAngularModule",
|
|
4
|
+
"title": "Angular Module Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "Creates a new generic NgModule definition in the given or default project.",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the NgModule.",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "argv",
|
|
13
|
+
"index": 0
|
|
14
|
+
},
|
|
15
|
+
"x-prompt": "What name would you like to use for the NgModule?"
|
|
16
|
+
},
|
|
17
|
+
"path": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "path",
|
|
20
|
+
"description": "The path at which to create the NgModule, relative to the workspace root.",
|
|
21
|
+
"visible": false
|
|
22
|
+
},
|
|
23
|
+
"project": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "The name of the project.",
|
|
26
|
+
"$default": {
|
|
27
|
+
"$source": "projectName"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"commonModule": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"description": "When true, the new NgModule imports \"CommonModule\". ",
|
|
33
|
+
"default": true,
|
|
34
|
+
"visible": false
|
|
35
|
+
},
|
|
36
|
+
"lintFix": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"default": false,
|
|
39
|
+
"description": "When true, applies lint fixes after generating the module.",
|
|
40
|
+
"x-user-analytics": 15
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": []
|
|
44
|
+
}
|