@tech4good/angular-schematics 0.0.2 → 13.1.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 +46 -46
- package/package.json +27 -27
- package/src/collection.json +25 -25
- package/src/component/files/__name@dasherize__/__name@dasherize__.animations.ts.template +4 -0
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.html.template +3 -0
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.scss.template +7 -0
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +25 -0
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +30 -0
- package/src/component/index.d.ts +2 -2
- package/src/component/index.js +93 -102
- package/src/component/index.js.map +1 -1
- package/src/component/index_spec.d.ts +1 -1
- package/src/component/index_spec.js +22 -22
- package/src/component/schema.json +47 -29
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template +27 -0
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template +47 -0
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.model.ts.template +0 -0
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template +20 -0
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.state.ts.template +13 -0
- package/src/container/files/__name@dasherize__/__name@dasherize__.animations.ts.template +4 -0
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.html.template +3 -0
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.scss.template +5 -0
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +25 -0
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.ts.template +81 -0
- package/src/container/index.d.ts +2 -2
- package/src/container/index.js +115 -282
- package/src/container/index.js.map +1 -1
- package/src/container/index_spec.d.ts +1 -1
- package/src/container/index_spec.js +22 -22
- package/src/container/schema.json +47 -24
- package/src/entity/files/__name@dasherize__/__name@dasherize__.actions.ts.template +270 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.effects.ts.template +131 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +7 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +13 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +51 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.service.ts.template +50 -0
- package/src/entity/index.d.ts +2 -2
- package/src/entity/index.js +123 -524
- package/src/entity/index.js.map +1 -1
- package/src/entity/index_spec.d.ts +1 -1
- package/src/entity/index_spec.js +22 -22
- package/src/entity/schema.json +42 -19
- package/src/module/files/__name@dasherize__/__name@dasherize__-routing.module.ts.template +13 -0
- package/src/module/files/__name@dasherize__/__name@dasherize__.module.spec.ts.template +13 -0
- package/src/module/files/__name@dasherize__/__name@dasherize__.module.ts.template +24 -0
- package/src/module/index.d.ts +2 -2
- package/src/module/index.js +96 -87
- package/src/module/index.js.map +1 -1
- package/src/module/index_spec.d.ts +1 -1
- package/src/module/index_spec.js +22 -22
- package/src/module/schema.json +38 -19
- package/src/shared/camelcase-formatter.d.ts +1 -1
- package/src/shared/camelcase-formatter.js +18 -18
- package/src/shared/statements-adder.d.ts +8 -5
- package/src/shared/statements-adder.js +52 -31
- package/src/shared/statements-adder.js.map +1 -1
- package/tsconfig.json +34 -34
package/README.md
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
This repository is
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
# Angular Schematics
|
|
2
|
+
|
|
3
|
+
This repository is used to generate modules, containers, components, and entities for Angular projects.
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
1. Run `npm install @tech4good/angular-schematics`.
|
|
8
|
+
2. Set the schematics to be the default using: `ng config cli.defaultCollection @tech4good/angular-schematics`
|
|
9
|
+
3. Change directories to the directory you want to generate the files and run `ng generate <schematic> <name>`, where `schematic` = module, container, component, or entity (or if you did not make it the default, use `ng generate @tech4good/angular-schematics:<schematic> <name>`)
|
|
10
|
+
|
|
11
|
+
### Developing
|
|
12
|
+
|
|
13
|
+
1. Clone this repository.
|
|
14
|
+
2. Run `npm install -g @angular-devkit/schematics-cli` to install globally
|
|
15
|
+
3. Run `npm install`, `npm run build` & `npm link`
|
|
16
|
+
4. Run `npm link @tech4good/angular-schematics` in the Angular project directory
|
|
17
|
+
5. Run `ng generate @tech4good/angular-schematics:<schematic>` to generate files (`schematic` = module, container, component, or entity)
|
|
18
|
+
6. To test/debug new changes, run `npm run build` again before `ng generate ...`
|
|
19
|
+
|
|
20
|
+
### Testing
|
|
21
|
+
|
|
22
|
+
To test, install the repo directly from github into another local repo to test your schematic.
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
npm install https://github.com/tech4good-lab/angular-schematics.git#your-branch-name
|
|
26
|
+
npm link @tech4good/angular-schematics
|
|
27
|
+
ng generate @tech4good/angular-schematics:<schematic>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Unit Testing
|
|
31
|
+
|
|
32
|
+
`npm run test` will run the unit tests, using Jasmine as a runner and test framework.
|
|
33
|
+
|
|
34
|
+
### Publishing
|
|
35
|
+
|
|
36
|
+
To publish, simply do:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run build
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
That's it!
|
|
44
|
+
|
|
45
|
+
You can also use `npm version <version>` to update the version before publishing.
|
|
46
|
+
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tech4good/angular-schematics",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "tsc -p tsconfig.json",
|
|
7
|
-
"test": "npm run build && jasmine src/**/*_spec.js"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [
|
|
10
|
-
"schematics"
|
|
11
|
-
],
|
|
12
|
-
"author": "",
|
|
13
|
-
"license": "MIT",
|
|
14
|
-
"schematics": "./src/collection.json",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@angular-devkit/core": "^
|
|
17
|
-
"@angular-devkit/schematics": "^
|
|
18
|
-
"@angular-devkit/schematics-cli": "^
|
|
19
|
-
"@schematics/angular": "^
|
|
20
|
-
"typescript": "~4.
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@types/node": "^12.11.1",
|
|
24
|
-
"@types/jasmine": "~3.
|
|
25
|
-
"jasmine": "^3.5.0"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tech4good/angular-schematics",
|
|
3
|
+
"version": "13.1.0",
|
|
4
|
+
"description": "A set of schematics for generating modules, containers, components, and entities",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc -p tsconfig.json",
|
|
7
|
+
"test": "npm run build && jasmine src/**/*_spec.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"schematics"
|
|
11
|
+
],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"schematics": "./src/collection.json",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@angular-devkit/core": "^13.2.5",
|
|
17
|
+
"@angular-devkit/schematics": "^13.2.5",
|
|
18
|
+
"@angular-devkit/schematics-cli": "^13.2.5",
|
|
19
|
+
"@schematics/angular": "^13.2.5",
|
|
20
|
+
"typescript": "~4.5.5"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^12.11.1",
|
|
24
|
+
"@types/jasmine": "~3.6.0",
|
|
25
|
+
"jasmine": "^3.5.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/collection.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
-
"schematics": {
|
|
4
|
-
"module": {
|
|
5
|
-
"description": "
|
|
6
|
-
"factory": "./module/index#module",
|
|
7
|
-
"schema": "./module/schema.json"
|
|
8
|
-
},
|
|
9
|
-
"container": {
|
|
10
|
-
"description": "
|
|
11
|
-
"factory": "./container/index#container",
|
|
12
|
-
"schema": "./container/schema.json"
|
|
13
|
-
},
|
|
14
|
-
"component": {
|
|
15
|
-
"description": "
|
|
16
|
-
"factory": "./component/index#component",
|
|
17
|
-
"schema": "./component/schema.json"
|
|
18
|
-
},
|
|
19
|
-
"entity": {
|
|
20
|
-
"description": "
|
|
21
|
-
"factory": "./entity/index#entity",
|
|
22
|
-
"schema": "./entity/schema.json"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"module": {
|
|
5
|
+
"description": "Generate a new module.",
|
|
6
|
+
"factory": "./module/index#module",
|
|
7
|
+
"schema": "./module/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"container": {
|
|
10
|
+
"description": "Generate a new container.",
|
|
11
|
+
"factory": "./container/index#container",
|
|
12
|
+
"schema": "./container/schema.json"
|
|
13
|
+
},
|
|
14
|
+
"component": {
|
|
15
|
+
"description": "Generate a new component.",
|
|
16
|
+
"factory": "./component/index#component",
|
|
17
|
+
"schema": "./component/schema.json"
|
|
18
|
+
},
|
|
19
|
+
"entity": {
|
|
20
|
+
"description": "Generate a new entity.",
|
|
21
|
+
"factory": "./entity/index#entity",
|
|
22
|
+
"schema": "./entity/schema.json"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';
|
|
4
|
+
|
|
5
|
+
describe('<%= classify(name) %>Component', () => {
|
|
6
|
+
let component: <%= classify(name) %>Component;
|
|
7
|
+
let fixture: ComponentFixture<<%= classify(name) %>Component>;
|
|
8
|
+
|
|
9
|
+
beforeEach(waitForAsync(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [<%= classify(name) %>Component],
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(<%= classify(name) %>Component);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, OnInit, ChangeDetectionStrategy, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
import { <%= classify(name) %>Animations } from './<%= dasherize(name) %>.animations';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-<%= dasherize(name) %>',
|
|
6
|
+
templateUrl: './<%= dasherize(name) %>.component.html',
|
|
7
|
+
styleUrls: ['./<%= dasherize(name) %>.component.scss'],
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
animations: <%= classify(name) %>Animations,
|
|
10
|
+
})
|
|
11
|
+
export class <%= classify(name) %>Component implements OnInit {
|
|
12
|
+
// --------------- INPUTS AND OUTPUTS ---------
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
constructor() { }
|
|
19
|
+
|
|
20
|
+
ngOnInit(): void {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// --------------- DATA BINDING FUNCTIONS ----------------
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// --------------- EVENT BINDING FUNCTIONS ---------------
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// --------------- OTHER -------------------------------
|
|
30
|
+
}
|
package/src/component/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
-
export declare function component(
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
export declare function component(options: any): Rule;
|
package/src/component/index.js
CHANGED
|
@@ -1,103 +1,94 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
tree.create(`${dir}/${name}.animations.ts`, AnimationsFile);
|
|
95
|
-
tree.create(`${dir}/${name}.component.html`, HTMLFile);
|
|
96
|
-
tree.create(`${dir}/${name}.component.scss`, CSSFile);
|
|
97
|
-
tree.create(`${dir}/${name}.component.spec.ts`, SpecFile);
|
|
98
|
-
tree.create(`${dir}/${name}.component.ts`, ComponentFile);
|
|
99
|
-
return tree;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
exports.component = component;
|
|
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.component = void 0;
|
|
13
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
+
const change_1 = require("@schematics/angular/utility/change");
|
|
15
|
+
const find_module_1 = require("@schematics/angular/utility/find-module");
|
|
16
|
+
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
17
|
+
const validation_1 = require("@schematics/angular/utility/validation");
|
|
18
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
19
|
+
const core_1 = require("@angular-devkit/core");
|
|
20
|
+
const statements_adder_1 = require("../shared/statements-adder");
|
|
21
|
+
function addInserts(options) {
|
|
22
|
+
return (host, context) => {
|
|
23
|
+
if (!options.module) {
|
|
24
|
+
return host;
|
|
25
|
+
}
|
|
26
|
+
const modulePath = options.module;
|
|
27
|
+
const sourceText = (0, statements_adder_1.getSourceText)(host, modulePath);
|
|
28
|
+
context.logger.info(`modulePath: ${modulePath}`);
|
|
29
|
+
// Get parameters for adding declaration to module (including import)
|
|
30
|
+
context.logger.info(`options.path: ${options.path}`);
|
|
31
|
+
const componentPath = `/${options.path}/` +
|
|
32
|
+
core_1.strings.dasherize(options.name) + '/' +
|
|
33
|
+
core_1.strings.dasherize(options.name) + '.component';
|
|
34
|
+
context.logger.info(`componentPath: ${componentPath}`);
|
|
35
|
+
const relativePath = (0, find_module_1.buildRelativePath)(modulePath, componentPath);
|
|
36
|
+
context.logger.info(`relativePath: ${relativePath}`);
|
|
37
|
+
const classifiedName = core_1.strings.classify(options.name) + 'Component';
|
|
38
|
+
context.logger.info(`classifiedName: ${classifiedName}`);
|
|
39
|
+
const isSharedModule = options.module.startsWith('/src/app/shared');
|
|
40
|
+
let insertChanges = (0, statements_adder_1.simpleInsert)(sourceText, modulePath, [
|
|
41
|
+
'// Components',
|
|
42
|
+
'// Components',
|
|
43
|
+
// If the module is shared, then add an export too
|
|
44
|
+
...isSharedModule ? ['// Components'] : [],
|
|
45
|
+
], [
|
|
46
|
+
`import { ${classifiedName} } from '${relativePath}';`,
|
|
47
|
+
` ${classifiedName},`,
|
|
48
|
+
...isSharedModule ? [` ${classifiedName},`] : [],
|
|
49
|
+
]);
|
|
50
|
+
const declarationRecorder = host.beginUpdate(modulePath);
|
|
51
|
+
for (const change of insertChanges) {
|
|
52
|
+
if (change instanceof change_1.InsertChange) {
|
|
53
|
+
declarationRecorder.insertLeft(change.pos, change.toAdd);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
host.commitUpdate(declarationRecorder);
|
|
57
|
+
return host;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function component(options) {
|
|
61
|
+
return (tree, context) => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
// Make sure the command is executed in the directory where the component should be generated
|
|
63
|
+
if (!options.inDirectory) {
|
|
64
|
+
context.logger.info("Please navigate to the directory where you want to generate the component.");
|
|
65
|
+
return (0, schematics_1.noop)();
|
|
66
|
+
}
|
|
67
|
+
const workspace = yield (0, workspace_1.getWorkspace)(tree);
|
|
68
|
+
const project = workspace.projects.get(options.project);
|
|
69
|
+
if (!project) {
|
|
70
|
+
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
71
|
+
}
|
|
72
|
+
context.logger.info(`options.path: ${options.path}`);
|
|
73
|
+
if (options.path === undefined) {
|
|
74
|
+
options.path = (0, workspace_1.buildDefaultPath)(project);
|
|
75
|
+
}
|
|
76
|
+
context.logger.info(`options.path: ${options.path}`);
|
|
77
|
+
options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
|
|
78
|
+
context.logger.info(`options.module: ${options.module}`);
|
|
79
|
+
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
|
80
|
+
options.name = parsedPath.name;
|
|
81
|
+
options.path = parsedPath.path;
|
|
82
|
+
(0, validation_1.validateHtmlSelector)(options.selector);
|
|
83
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
84
|
+
(0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
85
|
+
(0, schematics_1.move)(parsedPath.path),
|
|
86
|
+
]);
|
|
87
|
+
return (0, schematics_1.chain)([
|
|
88
|
+
addInserts(options),
|
|
89
|
+
(0, schematics_1.mergeWith)(templateSource)
|
|
90
|
+
]);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.component = component;
|
|
103
94
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAIoC;AACpC,+DAAkE;AAClE,yEAAmG;AACnG,uEAAmE;AACnE,uEAA8E;AAC9E,qEAAuF;AAEvF,+CAA+C;AAE/C,iEAAyE;AAEzE,SAAS,UAAU,CAAC,OAAY;IAC9B,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,OAAO,IAAI,CAAC;SACb;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;QAClC,MAAM,UAAU,GAAG,IAAA,gCAAa,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACnD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,UAAU,EAAE,CAAC,CAAC;QAEjD,qEAAqE;QACrE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACrD,MAAM,aAAa,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UAAU,CAAC,IAAI,CAAC;QAC/B,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE/B,IAAA,iCAAoB,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEvC,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,IAAA,2BAAc,kCACT,cAAO,GACP,OAAO,EACV;YACF,IAAA,iBAAI,EAAC,UAAU,CAAC,IAAI,CAAC;SACtB,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,UAAU,CAAC,OAAO,CAAC;YACnB,IAAA,sBAAS,EAAC,cAAc,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AA5CD,8BA4CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
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
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
-
const path = require("path");
|
|
15
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
16
|
-
describe('component', () => {
|
|
17
|
-
it('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
-
const tree = yield runner.runSchematicAsync('component', {}, schematics_1.Tree.empty()).toPromise();
|
|
20
|
-
expect(tree.files).toEqual([]);
|
|
21
|
-
}));
|
|
22
|
-
});
|
|
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
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
16
|
+
describe('component', () => {
|
|
17
|
+
it('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
+
const tree = yield runner.runSchematicAsync('component', {}, schematics_1.Tree.empty()).toPromise();
|
|
20
|
+
expect(tree.files).toEqual([]);
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
23
|
//# sourceMappingURL=index_spec.js.map
|