@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.
Files changed (57) hide show
  1. package/README.md +46 -46
  2. package/package.json +27 -27
  3. package/src/collection.json +25 -25
  4. package/src/component/files/__name@dasherize__/__name@dasherize__.animations.ts.template +4 -0
  5. package/src/component/files/__name@dasherize__/__name@dasherize__.component.html.template +3 -0
  6. package/src/component/files/__name@dasherize__/__name@dasherize__.component.scss.template +7 -0
  7. package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +25 -0
  8. package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +30 -0
  9. package/src/component/index.d.ts +2 -2
  10. package/src/component/index.js +93 -102
  11. package/src/component/index.js.map +1 -1
  12. package/src/component/index_spec.d.ts +1 -1
  13. package/src/component/index_spec.js +22 -22
  14. package/src/component/schema.json +47 -29
  15. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template +27 -0
  16. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template +47 -0
  17. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.model.ts.template +0 -0
  18. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template +20 -0
  19. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.state.ts.template +13 -0
  20. package/src/container/files/__name@dasherize__/__name@dasherize__.animations.ts.template +4 -0
  21. package/src/container/files/__name@dasherize__/__name@dasherize__.component.html.template +3 -0
  22. package/src/container/files/__name@dasherize__/__name@dasherize__.component.scss.template +5 -0
  23. package/src/container/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +25 -0
  24. package/src/container/files/__name@dasherize__/__name@dasherize__.component.ts.template +81 -0
  25. package/src/container/index.d.ts +2 -2
  26. package/src/container/index.js +115 -282
  27. package/src/container/index.js.map +1 -1
  28. package/src/container/index_spec.d.ts +1 -1
  29. package/src/container/index_spec.js +22 -22
  30. package/src/container/schema.json +47 -24
  31. package/src/entity/files/__name@dasherize__/__name@dasherize__.actions.ts.template +270 -0
  32. package/src/entity/files/__name@dasherize__/__name@dasherize__.effects.ts.template +131 -0
  33. package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +7 -0
  34. package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +13 -0
  35. package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +51 -0
  36. package/src/entity/files/__name@dasherize__/__name@dasherize__.service.ts.template +50 -0
  37. package/src/entity/index.d.ts +2 -2
  38. package/src/entity/index.js +123 -524
  39. package/src/entity/index.js.map +1 -1
  40. package/src/entity/index_spec.d.ts +1 -1
  41. package/src/entity/index_spec.js +22 -22
  42. package/src/entity/schema.json +42 -19
  43. package/src/module/files/__name@dasherize__/__name@dasherize__-routing.module.ts.template +13 -0
  44. package/src/module/files/__name@dasherize__/__name@dasherize__.module.spec.ts.template +13 -0
  45. package/src/module/files/__name@dasherize__/__name@dasherize__.module.ts.template +24 -0
  46. package/src/module/index.d.ts +2 -2
  47. package/src/module/index.js +96 -87
  48. package/src/module/index.js.map +1 -1
  49. package/src/module/index_spec.d.ts +1 -1
  50. package/src/module/index_spec.js +22 -22
  51. package/src/module/schema.json +38 -19
  52. package/src/shared/camelcase-formatter.d.ts +1 -1
  53. package/src/shared/camelcase-formatter.js +18 -18
  54. package/src/shared/statements-adder.d.ts +8 -5
  55. package/src/shared/statements-adder.js +52 -31
  56. package/src/shared/statements-adder.js.map +1 -1
  57. package/tsconfig.json +34 -34
@@ -1,283 +1,116 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.container = void 0;
4
- const camelcase_formatter_1 = require("../shared/camelcase-formatter");
5
- const statements_adder_1 = require("../shared/statements-adder");
6
- const fs = require('fs');
7
- // You don't have to export the function as default. You can also have more than one rule factory
8
- // per file.
9
- function container(_options) {
10
- return (tree, _context) => {
11
- const { name, module } = _options;
12
- const camelName = camelcase_formatter_1.CamelCaseFormatter(name, false);
13
- const ActionsFile = `import { Action } from '@ngrx/store';
14
-
15
- export enum ${camelName}ActionTypes {
16
- LOAD_DATA = '[${camelName}] load data',
17
- CLEANUP = '[${camelName}] cleanup',
18
- }
19
-
20
- /** Action for loading required DB data. */
21
- export class LoadData implements Action {
22
- readonly type = ${camelName}ActionTypes.LOAD_DATA;
23
-
24
- constructor(public payload: {
25
- containerId: string,
26
- }) { }
27
- }
28
-
29
- /** Action for cleaning up loading subscriptions. */
30
- export class Cleanup implements Action {
31
- readonly type = ${camelName}ActionTypes.CLEANUP;
32
- constructor(public payload: {
33
- containerId: string,
34
- }) { }
35
- }
36
-
37
- export type ${camelName}Actions =
38
- LoadData |
39
- Cleanup;
40
- `;
41
- const EffectsFile = `import { Injectable } from '@angular/core';
42
- import { Action } from '@ngrx/store';
43
- import { Actions, createEffect, Effect, ofType } from '@ngrx/effects';
44
-
45
- import { of, Observable } from 'rxjs';
46
- import { mergeMap, tap, map } from 'rxjs/operators';
47
-
48
- import { select, Store } from '@ngrx/store';
49
- import * as fromStore from '../../../core/store/app.reducer';
50
- import { FirebaseService } from '../../../core/firebase/firebase.service';
51
- import { EffectsHelpers } from '../../../core/store/effects.helpers';
52
- import { ${camelName}State } from './${name}.state';
53
-
54
- import { ActionFlow, RouterNavigate, LoadAction, Unsubscribe } from '../../../core/store/app.actions';
55
- import { ${camelName}ActionTypes, Cleanup, LoadData } from './${name}.actions';
56
-
57
- @Injectable()
58
- export class ${camelName}Effects {
59
-
60
- /** Load data from Firebase. */
61
- loadData$: Observable<Action> = createEffect(
62
- () => this.actions$.pipe(
63
- ofType<LoadData>(${camelName}ActionTypes.LOAD_DATA),
64
- mergeMap((action: LoadData) => {
65
-
66
- const loadId = action.payload.containerId;
67
-
68
- return [
69
- ];
70
- }),
71
- ),
72
- );
73
-
74
- /** Unsubscribe connections from Firebase. */
75
- cleanup$: Observable<Action> = createEffect(
76
- () => this.actions$.pipe(
77
- ofType<Cleanup>(${camelName}ActionTypes.CLEANUP),
78
- map((action: Cleanup) => new Unsubscribe(action.payload.containerId)),
79
- ),
80
- );
81
-
82
- constructor(
83
- private actions$: Actions,
84
- private store: Store<fromStore.State>,
85
- private state: ${camelName}State,
86
- private db: FirebaseService,
87
- private eh: EffectsHelpers,
88
- ) {}
89
- }
90
- `;
91
- const SelectorsFile = `import { Injectable } from '@angular/core';
92
- import { Store, select } from '@ngrx/store';
93
- import * as fromStore from '../../../core/store/app.reducer';
94
- import { EntitySelectorService } from '../../../core/store/app.selectors';
95
-
96
- import { Observable, of, combineLatest } from 'rxjs';
97
- import { bufferTime, distinctUntilChanged, shareReplay, mergeMap, filter, switchMap, map } from 'rxjs/operators';
98
-
99
- @Injectable({
100
- providedIn: 'root',
101
- })
102
- export class ${camelName}Selectors {
103
-
104
- constructor(
105
- private slRx: EntitySelectorService,
106
- ) { }
107
-
108
- cleanup(cId: string) {
109
- this.slRx.release(cId);
110
- }
111
- }
112
- `;
113
- const StateFile = `import { Injectable } from '@angular/core';
114
-
115
- import { BehaviorSubject } from 'rxjs';
116
-
117
- @Injectable({
118
- providedIn: 'root',
119
- })
120
- export class ${camelName}State {
121
-
122
- // --------------- LOCAL UI STATE ----------------------
123
-
124
-
125
- constructor(
126
- ) { }
127
- }
128
- `;
129
- const AnimationsFile = `import { trigger, group, query, animateChild, state, style, animate, transition } from '@angular/animations';
130
-
131
- export const ${camelName}Animations = [
132
- ];
133
- `;
134
- const HTMLFile = `<div class="${name}-container">
135
- ${name} works!
136
- </div>`;
137
- const CSSFile = `.${name}-container {
138
- }`;
139
- const SpecFile = `import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
140
-
141
- import { ${camelName}Component } from './${name}.component';
142
-
143
- describe('${camelName}Component', () => {
144
- let component: ${camelName}Component;
145
- let fixture: ComponentFixture<${camelName}Component>;
146
-
147
- beforeEach(waitForAsync(() => {
148
- TestBed.configureTestingModule({
149
- declarations: [ ${camelName}Component ],
150
- })
151
- .compileComponents();
152
- }));
153
-
154
- beforeEach(() => {
155
- fixture = TestBed.createComponent(${camelName}Component);
156
- component = fixture.componentInstance;
157
- fixture.detectChanges();
158
- });
159
-
160
- it('should create', () => {
161
- expect(component).toBeTruthy();
162
- });
163
- });
164
- `;
165
- const ComponentFile = `import { Component, OnInit, OnDestroy, ChangeDetectionStrategy } from '@angular/core';
166
- import { ${camelName}Animations } from './${name}.animations';
167
- import { ParamMap, ActivatedRoute } from '@angular/router';
168
- import { Store, select } from '@ngrx/store';
169
- import * as fromStore from '../../core/store/app.reducer';
170
- import * as fromAuth from '../../core/store/auth/auth.reducer';
171
- import { FirebaseService } from '../../core/firebase/firebase.service';
172
- import { Observable, Subject, BehaviorSubject, combineLatest } from 'rxjs';
173
- import { withLatestFrom, take, takeUntil } from 'rxjs/operators';
174
-
175
- import { ${camelName}State } from './+state/${name}.state';
176
- import { ${camelName}Selectors } from './+state/${name}.selectors';
177
-
178
- import { LoadData, Cleanup } from './+state/${name}.actions';
179
- import { RouterNavigate } from '../../core/store/app.actions';
180
-
181
- import { User } from '../../core/store/user/user.model';
182
-
183
- /** test */
184
- @Component({
185
- selector: 'app-${name}',
186
- templateUrl: './${name}.component.html',
187
- styleUrls: ['./${name}.component.scss'],
188
- changeDetection: ChangeDetectionStrategy.OnPush,
189
- animations: ${camelName}Animations,
190
- })
191
- export class ${camelName}Component implements OnInit, OnDestroy {
192
-
193
- // --------------- ROUTE PARAMS & CURRENT USER ---------
194
-
195
-
196
- // --------------- LOCAL UI STATE ----------------------
197
-
198
-
199
- // --------------- DB ENTITY DATA ----------------------
200
-
201
- /** Container id for selectors and loading. */
202
- containerId: string = this.db.createId();
203
-
204
- // --------------- DATA BINDING STREAMS ----------------
205
-
206
-
207
- // --------------- EVENT BINDING STREAMS ---------------
208
-
209
-
210
- // --------------- OTHER -------------------------------
211
-
212
- /** Unsubscribe observable for subscriptions. */
213
- unsubscribe$: Subject<void> = new Subject();
214
-
215
- constructor(
216
- private state: ${camelName}State,
217
- private route: ActivatedRoute,
218
- private selectors: ${camelName}Selectors,
219
- private store: Store<fromStore.State>,
220
- private db: FirebaseService,
221
- ) {
222
- }
223
-
224
- ngOnInit() {
225
-
226
- // --------------- EVENT HANDLING ----------------------
227
-
228
-
229
- // --------------- LOAD DATA ---------------------------
230
-
231
- // Once everything is set up, load the data for the role.
232
- this.store.dispatch( new LoadData({
233
- containerId: this.containerId,
234
- }) );
235
- }
236
-
237
- ngOnDestroy() {
238
- // Unsubscribe subscriptions.
239
- this.unsubscribe$.next();
240
- this.unsubscribe$.complete();
241
-
242
- // Unsubscribe from firebase connection from load and free up memoized selector values.
243
- this.store.dispatch( new Cleanup({
244
- containerId: this.containerId,
245
- }) );
246
- this.selectors.cleanup(this.containerId);
247
- }
248
- }
249
- `;
250
- const ModuleRoutingFile = `${module}-routing.module.ts`;
251
- const ModuleFile = `${module}.module.ts`;
252
- const filePath = `./src/app/${module}/${ModuleRoutingFile}`;
253
- const labels = ['// Containers', 'const routes: Routes = ['];
254
- const statements = [`import { ${camelName}Component } from './${name}/${name}.component';`, ` { path: '${name}', component: ${camelName}Component }`];
255
- statements_adder_1.AddStatements(filePath, labels, statements, tree);
256
- const filePath2 = `./src/app/${module}/${ModuleFile}`;
257
- const labels2 = ['// Containers', 'EffectsModule.forFeature([', '// Containers'];
258
- const statements2 = [`import { ${camelName}Component } from './${name}/${name}.component';\nimport { ${camelName}Effects } from './${name}/+state/${name}.effects';`, ` ${camelName}Effects,`, ` ${camelName}Component,`];
259
- statements_adder_1.AddStatements(filePath2, labels2, statements2, tree);
260
- // create directories before adding files
261
- const dir = `./src/app/${module}/${name}`;
262
- if (!fs.existsSync(dir)) {
263
- fs.mkdirSync(dir);
264
- }
265
- const statePath = `${dir}/+state`;
266
- if (!fs.existsSync(statePath)) {
267
- fs.mkdirSync(statePath);
268
- }
269
- tree.create(`${statePath}/${name}.actions.ts`, ActionsFile);
270
- tree.create(`${statePath}/${name}.effects.ts`, EffectsFile);
271
- tree.create(`${statePath}/${name}.model.ts`, '');
272
- tree.create(`${statePath}/${name}.selectors.ts`, SelectorsFile);
273
- tree.create(`${statePath}/${name}.state.ts`, StateFile);
274
- tree.create(`${dir}/${name}.animations.ts`, AnimationsFile);
275
- tree.create(`${dir}/${name}.component.html`, HTMLFile);
276
- tree.create(`${dir}/${name}.component.scss`, CSSFile);
277
- tree.create(`${dir}/${name}.component.spec.ts`, SpecFile);
278
- tree.create(`${dir}/${name}.component.ts`, ComponentFile);
279
- return tree;
280
- };
281
- }
282
- exports.container = container;
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.container = 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 classifiedName = core_1.strings.classify(options.name);
27
+ const dasherizedName = core_1.strings.dasherize(options.name);
28
+ const containerPath = `/${options.path}/` +
29
+ core_1.strings.dasherize(options.name) + '/' +
30
+ core_1.strings.dasherize(options.name) + '.component';
31
+ // Add to module
32
+ const modulePath = options.module;
33
+ const moduleText = (0, statements_adder_1.getSourceText)(host, modulePath);
34
+ const moduleToContainerPath = (0, find_module_1.buildRelativePath)(modulePath, containerPath);
35
+ const effectsPath = `/${options.path}/` +
36
+ core_1.strings.dasherize(options.name) + '/+state/' +
37
+ core_1.strings.dasherize(options.name) + '.effects';
38
+ const moduleToEffectsPath = (0, find_module_1.buildRelativePath)(modulePath, effectsPath);
39
+ let insertChangesInModule = (0, statements_adder_1.simpleInsert)(moduleText, modulePath, [
40
+ '// Containers',
41
+ 'EffectsModule.forFeature([',
42
+ '// Containers'
43
+ ], [
44
+ `import { ${classifiedName}Component } from '${moduleToContainerPath}';\nimport { ${classifiedName}Effects } from '${moduleToEffectsPath}';`,
45
+ ` ${classifiedName}Effects,`,
46
+ ` ${classifiedName}Component,`
47
+ ]);
48
+ // Add routing module changes
49
+ context.logger.info(modulePath);
50
+ const moduleDir = (0, core_1.normalize)(modulePath).split('/').slice(0, -1).join('/');
51
+ const moduleFileName = (0, core_1.normalize)(modulePath).split('/').pop() || '';
52
+ const moduleName = moduleFileName.split('.')[0];
53
+ const moduleRoutingPath = `${moduleDir}/${moduleName}-routing.module.ts`;
54
+ context.logger.info(moduleRoutingPath);
55
+ const moduleRoutingText = (0, statements_adder_1.getSourceText)(host, moduleRoutingPath);
56
+ const moduleRoutingToContainerPath = (0, find_module_1.buildRelativePath)(moduleRoutingPath, containerPath);
57
+ context.logger.info("moduleRoutingPath: " + moduleRoutingPath);
58
+ let insertChangesInRoutingModule = (0, statements_adder_1.simpleInsert)(moduleRoutingText, moduleRoutingPath, [
59
+ '// Containers',
60
+ 'const routes: Routes = ['
61
+ ], [
62
+ `import { ${classifiedName}Component } from '${moduleRoutingToContainerPath}';`,
63
+ ` { path: '${dasherizedName}', component: ${classifiedName}Component },`
64
+ ]);
65
+ context.logger.info(`about to start committing`);
66
+ // For each of the files and corresponding set of changes, commit to the tree
67
+ [
68
+ [modulePath, insertChangesInModule],
69
+ [moduleRoutingPath, insertChangesInRoutingModule],
70
+ ].map(([filePath, insertChanges]) => {
71
+ const declarationRecorder = host.beginUpdate(filePath);
72
+ for (const change of insertChanges) {
73
+ if (change instanceof change_1.InsertChange) {
74
+ declarationRecorder.insertLeft(change.pos, change.toAdd);
75
+ }
76
+ }
77
+ host.commitUpdate(declarationRecorder);
78
+ });
79
+ return host;
80
+ };
81
+ }
82
+ function container(options) {
83
+ return (tree, context) => __awaiter(this, void 0, void 0, function* () {
84
+ // Make sure the command is executed in the directory where the container should be generated
85
+ if (!options.inDirectory) {
86
+ context.logger.info("Please navigate to the directory where you want to generate the container.");
87
+ return (0, schematics_1.noop)();
88
+ }
89
+ const workspace = yield (0, workspace_1.getWorkspace)(tree);
90
+ const project = workspace.projects.get(options.project);
91
+ if (!project) {
92
+ throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
93
+ }
94
+ context.logger.info(`options.path: ${options.path}`);
95
+ if (options.path === undefined) {
96
+ options.path = (0, workspace_1.buildDefaultPath)(project);
97
+ }
98
+ context.logger.info(`options.path: ${options.path}`);
99
+ options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
100
+ context.logger.info(`options.module: ${options.module}`);
101
+ const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
102
+ options.name = parsedPath.name;
103
+ options.path = parsedPath.path;
104
+ (0, validation_1.validateHtmlSelector)(options.selector);
105
+ const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
106
+ (0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
107
+ (0, schematics_1.move)(parsedPath.path),
108
+ ]);
109
+ return (0, schematics_1.chain)([
110
+ addInserts(options),
111
+ (0, schematics_1.mergeWith)(templateSource)
112
+ ]);
113
+ });
114
+ }
115
+ exports.container = container;
283
116
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAEA,uEAAmE;AACnE,iEAA2D;AAE3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G,IAAA,mCAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAEzD,MAAM,UAAU,GAAG,IAAA,sBAAS,EAAC,OAAO,CAAC,IAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,GAAG,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('container', () => {
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('container', {}, 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('container', () => {
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('container', {}, schematics_1.Tree.empty()).toPromise();
20
+ expect(tree.files).toEqual([]);
21
+ }));
22
+ });
23
23
  //# sourceMappingURL=index_spec.js.map
@@ -1,24 +1,47 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "id": "MyFullSchematicsSchema",
4
- "title": "My Full Schematics Schema",
5
- "type": "object",
6
- "properties": {
7
- "index": {
8
- "type": "number",
9
- "default": 1
10
- },
11
- "name": {
12
- "type": "string",
13
- "x-prompt": "What should we name the files?"
14
- },
15
- "module": {
16
- "type": "string",
17
- "x-prompt": "Which module should we generate the container in?"
18
- }
19
- },
20
- "required": [
21
- "name",
22
- "module"
23
- ]
24
- }
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "ContainerSchema",
4
+ "title": "Container Schema",
5
+ "type": "object",
6
+ "description": "Creates a new container in the default project.",
7
+ "properties": {
8
+ "index": {
9
+ "type": "number",
10
+ "default": 1
11
+ },
12
+ "path": {
13
+ "type": "string",
14
+ "format": "path",
15
+ "description": "The path at which to create the container file, relative to the current workspace. Should be organized according to the view hierarchy to the extent possible.",
16
+ "visible": false
17
+ },
18
+ "project": {
19
+ "type": "string",
20
+ "description": "The name of the project.",
21
+ "$default": {
22
+ "$source": "projectName"
23
+ }
24
+ },
25
+ "name": {
26
+ "type": "string",
27
+ "description": "The name of the container.",
28
+ "$default": {
29
+ "$source": "argv",
30
+ "index": 0
31
+ },
32
+ "x-prompt": "What name would you like to use for the container?"
33
+ },
34
+ "module": {
35
+ "type": "string",
36
+ "description": "The declaring NgModule.",
37
+ "alias": "m"
38
+ },
39
+ "inDirectory": {
40
+ "type": "boolean",
41
+ "x-prompt": "Are you currently in the directory where you want to generate the container? (please organize your container according to the view hierarchy to the extent possible)"
42
+ }
43
+ },
44
+ "required": [
45
+ "name"
46
+ ]
47
+ }