@coolon/angular-ui-powerups 3.1.2 → 3.3.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 (68) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.json +1 -1
  3. package/schematics/bootstrap-app/index.js +9 -3
  4. package/schematics/bootstrap-app/index.js.map +1 -1
  5. package/schematics/bootstrap-app/schema.d.ts +1 -0
  6. package/schematics/bootstrap-app/schema.json +5 -0
  7. package/schematics/bootstrap-app/templates/app/auth/auth.guard.ts.template +8 -8
  8. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.eot +0 -0
  9. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.ijmap +1 -0
  10. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.svg +2373 -0
  11. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.ttf +0 -0
  12. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.woff +0 -0
  13. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.woff2 +0 -0
  14. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/README.md +9 -0
  15. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/codepoints +932 -0
  16. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/material-icons.css +36 -0
  17. package/schematics/bootstrap-app/templates/index.html.template +13 -0
  18. package/schematics/bootstrap-app/templates/styles.scss.template +27 -0
  19. package/schematics/collection.json +5 -0
  20. package/schematics/place-add/index.js +30 -19
  21. package/schematics/place-add/index.js.map +1 -1
  22. package/schematics/place-add/index.spec.d.ts +1 -0
  23. package/schematics/place-add/index.spec.js +364 -0
  24. package/schematics/place-add/index.spec.js.map +1 -0
  25. package/schematics/place-add/schema.d.ts +2 -0
  26. package/schematics/place-add/schema.json +20 -1
  27. package/schematics/place-add/templates/component/__name@dasherize__.component.html.template +1 -0
  28. package/schematics/place-add/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
  29. package/schematics/place-add/templates/component/__name@dasherize__.component.ts.template +29 -0
  30. package/schematics/place-add/templates/files/i18n/places/__name@dasherize__.yml.template +7 -0
  31. package/schematics/utils/build-context.d.ts +34 -0
  32. package/schematics/utils/build-context.js +133 -0
  33. package/schematics/utils/build-context.js.map +1 -0
  34. package/schematics/utils/decorators/decorated-class.d.ts +13 -0
  35. package/schematics/utils/decorators/decorated-class.js +28 -0
  36. package/schematics/utils/decorators/decorated-class.js.map +1 -0
  37. package/schematics/utils/decorators/decorated-source-file.d.ts +15 -0
  38. package/schematics/utils/decorators/decorated-source-file.js +27 -0
  39. package/schematics/utils/decorators/decorated-source-file.js.map +1 -0
  40. package/schematics/utils/import-def.d.ts +30 -0
  41. package/schematics/utils/import-def.js +89 -0
  42. package/schematics/utils/import-def.js.map +1 -0
  43. package/schematics/utils/method-scanner.d.ts +16 -0
  44. package/schematics/utils/method-scanner.js +61 -0
  45. package/schematics/utils/method-scanner.js.map +1 -0
  46. package/schematics/utils/parameter-def.d.ts +5 -0
  47. package/schematics/utils/parameter-def.js +3 -0
  48. package/schematics/utils/parameter-def.js.map +1 -0
  49. package/schematics/utils/path-helper.d.ts +18 -0
  50. package/schematics/utils/path-helper.js +56 -0
  51. package/schematics/utils/path-helper.js.map +1 -0
  52. package/schematics/utils/schematic-tree-file-system.d.ts +28 -0
  53. package/schematics/utils/schematic-tree-file-system.js +101 -0
  54. package/schematics/utils/schematic-tree-file-system.js.map +1 -0
  55. package/schematics/utils/source-file-scanner.d.ts +14 -0
  56. package/schematics/utils/source-file-scanner.js +89 -0
  57. package/schematics/utils/source-file-scanner.js.map +1 -0
  58. package/schematics/utils/source-file-utilities.d.ts +6 -0
  59. package/schematics/utils/source-file-utilities.js +35 -0
  60. package/schematics/utils/source-file-utilities.js.map +1 -0
  61. package/schematics/utils/template-utilities.d.ts +2 -0
  62. package/schematics/utils/template-utilities.js +24 -0
  63. package/schematics/utils/template-utilities.js.map +1 -0
  64. package/schematics/bootstrap-app/templates/app/places/home/home.component.html.template +0 -1
  65. package/schematics/bootstrap-app/templates/app/places/home/home.component.spec.ts.template +0 -25
  66. package/schematics/bootstrap-app/templates/app/places/home/home.component.ts.template +0 -25
  67. package/schematics/bootstrap-app/templates/i18n/places/home.yml.template +0 -6
  68. /package/schematics/{bootstrap-app/templates/app/places/home/home.component.scss.template → place-add/templates/component/__name@dasherize__.component.scss.template} +0 -0
@@ -0,0 +1,36 @@
1
+ @font-face {
2
+ font-family: 'Material Icons';
3
+ font-style: normal;
4
+ font-weight: 400;
5
+ src: url(MaterialIcons-Regular.eot); /* For IE6-8 */
6
+ src: local('Material Icons'),
7
+ local('MaterialIcons-Regular'),
8
+ url(MaterialIcons-Regular.woff2) format('woff2'),
9
+ url(MaterialIcons-Regular.woff) format('woff'),
10
+ url(MaterialIcons-Regular.ttf) format('truetype');
11
+ }
12
+
13
+ .material-icons {
14
+ font-family: 'Material Icons';
15
+ font-weight: normal;
16
+ font-style: normal;
17
+ font-size: 24px; /* Preferred icon size */
18
+ display: inline-block;
19
+ line-height: 1;
20
+ text-transform: none;
21
+ letter-spacing: normal;
22
+ word-wrap: normal;
23
+ white-space: nowrap;
24
+ direction: ltr;
25
+
26
+ /* Support for all WebKit browsers. */
27
+ -webkit-font-smoothing: antialiased;
28
+ /* Support for Safari and Chrome. */
29
+ text-rendering: optimizeLegibility;
30
+
31
+ /* Support for Firefox. */
32
+ -moz-osx-font-smoothing: grayscale;
33
+
34
+ /* Support for IE. */
35
+ font-feature-settings: 'liga';
36
+ }
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>SignUp</title>
6
+ <base href="/" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+ <link rel="icon" type="image/x-icon" href="favicon.ico" />
9
+ </head>
10
+ <body>
11
+ <<%=dasherize(project)%>-root></<%=dasherize(project)%>-root>
12
+ </body>
13
+ </html>
@@ -0,0 +1,27 @@
1
+ /* You can add global styles to this file, and also import other style files */
2
+
3
+ @import "./assets/fonts/material-design-icons/material-icons.css";
4
+ @import "~roboto-fontface/css/roboto/roboto-fontface.css";
5
+ @import "./styles/theme";
6
+ @import "./styles/global-variables";
7
+ @import "~@coolon/angular-ui-powerups/assets/styles";
8
+
9
+ html, body {
10
+ height: 100%;
11
+ }
12
+
13
+ body {
14
+ margin: 0;
15
+ font-family: Roboto, "Helvetica Neue", sans-serif;
16
+ }
17
+
18
+ body {
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: stretch;
22
+ }
23
+
24
+ body > *:first-child {
25
+ flex: 1;
26
+ }
27
+
@@ -18,6 +18,11 @@
18
18
  "description": "Scans your source for place components and generates the place routes file",
19
19
  "factory": "./place-routes/index#generateRoutes",
20
20
  "schema": "./place-routes/schema.json"
21
+ },
22
+ "place-add": {
23
+ "description": "Creates a new place component and associated files",
24
+ "factory": "./place-add/index#addPlace",
25
+ "schema": "./place-add/schema.json"
21
26
  }
22
27
  }
23
28
  }
@@ -1,27 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addPlace = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const build_context_1 = require("../utils/build-context");
6
+ const template_utilities_1 = require("../utils/template-utilities");
4
7
  function addPlace(_options) {
5
- return (tree, _context) => {
6
- // return chain([
7
- // addDependencies(options),
8
- // addRequiredFiles(options)
9
- // ])(tree, _context);
10
- return tree;
8
+ return (tree, context) => {
9
+ const buildContext = build_context_1.BuildContext.forApp(_options.project, tree, context);
10
+ const nameParts = _options.name.split('/');
11
+ const componentName = nameParts[nameParts.length - 1];
12
+ const componentPathParts = nameParts.slice(0, nameParts.length - 1);
13
+ const pathToSourceRoot = [buildContext.sourceRoot].concat(componentPathParts);
14
+ const placeModulePath = buildContext.findFileInAncestorPath(pathToSourceRoot, 'places.module.ts');
15
+ if (!placeModulePath) {
16
+ throw new Error(`Unable to find 'places.module.ts' anywhere in ${pathToSourceRoot.join('/')}`);
17
+ }
18
+ const placeModule = buildContext.getSourceFile(placeModulePath);
19
+ const newPlaceModuleContent = updatePlaceModule(placeModule);
20
+ const componentFiles = template_utilities_1.applyTemplatesWithOverwrite(tree, 'templates/component', {
21
+ name: componentName,
22
+ selectorPrefix: buildContext.selectorPrefix,
23
+ pathToRoot: pathToSourceRoot.map(p => '..').join('/')
24
+ }, `${(pathToSourceRoot.join('/'))}/${componentName}`);
25
+ const additionalFiles = template_utilities_1.applyTemplatesWithOverwrite(tree, 'templates/files', {
26
+ name: componentName
27
+ }, `${buildContext.appRoot}`);
28
+ return schematics_1.chain([componentFiles, additionalFiles])(tree, context);
11
29
  };
12
30
  }
13
31
  exports.addPlace = addPlace;
14
- // function addDependencies(options: Schema): Rule {
15
- // return (tree: Tree, _context: SchematicContext) => {
16
- // _context.addTask(new RunSchematicTask('add-dependencies', options));
17
- // return tree;
18
- // };
19
- // }
20
- //
21
- // function addRequiredFiles(options: Schema): Rule {
22
- // return (tree: Tree, _context: SchematicContext) => {
23
- // _context.addTask(new RunSchematicTask('add-files', options));
24
- // return tree;
25
- // };
26
- // }
32
+ function updatePlaceModule(placeModule) {
33
+ // const imports = placeModule.getImportDeclarations();
34
+ const moduleClass = placeModule.findClassWithDecorator('@NgModule');
35
+ const decorator = moduleClass.getClassDecoratorNode('@NgModule');
36
+ return placeModule.getFullText();
37
+ }
27
38
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-add/index.ts"],"names":[],"mappings":";;;AAIA,SAAgB,QAAQ,CAAC,QAAgB;IACvC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,iBAAiB;QACjB,8BAA8B;QAC9B,8BAA8B;QAC9B,sBAAsB;QACtB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AARD,4BAQC;AAGD,oDAAoD;AACpD,yDAAyD;AACzD,2EAA2E;AAC3E,mBAAmB;AACnB,OAAO;AACP,IAAI;AACJ,EAAE;AACF,qDAAqD;AACrD,yDAAyD;AACzD,oEAAoE;AACpE,mBAAmB;AACnB,OAAO;AACP,IAAI"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AACjF,0DAAsD;AAEtD,oEAA0E;AAI1E,SAAgB,QAAQ,CAAC,QAAgB;IAEvC,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAE/C,MAAM,YAAY,GAAG,4BAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAE1E,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,aAAa,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtD,MAAM,kBAAkB,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACpE,MAAM,gBAAgB,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC9E,MAAM,eAAe,GAAG,YAAY,CAAC,sBAAsB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;QAClG,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,iDAAiD,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SAChG;QACD,MAAM,WAAW,GAAG,YAAY,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAChE,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAA;QAE5D,MAAM,cAAc,GAAG,gDAA2B,CAChD,IAAI,EACJ,qBAAqB,EACrB;YACE,IAAI,EAAE,aAAa;YACnB,cAAc,EAAE,YAAY,CAAC,cAAc;YAC3C,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;SACtD,EACD,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,aAAa,EAAE,CACnD,CAAC;QAGF,MAAM,eAAe,GAAG,gDAA2B,CACjD,IAAI,EACJ,iBAAiB,EACjB;YACE,IAAI,EAAE,aAAa;SACpB,EACD,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC;QAE7B,OAAO,kBAAK,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEjE,CAAC,CAAC;AAEJ,CAAC;AAzCD,4BAyCC;AAED,SAAS,iBAAiB,CAAC,WAAgC;IACzD,uDAAuD;IACvD,MAAM,WAAW,GAAG,WAAW,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAEjE,OAAO,WAAW,CAAC,WAAW,EAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,364 @@
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
+ /**
13
+ * @license
14
+ * Copyright Google Inc. All Rights Reserved.
15
+ *
16
+ * Use of this source code is governed by an MIT-style license that can be
17
+ * found in the LICENSE file at https://angular.io/license
18
+ */
19
+ // tslint:disable:no-big-function
20
+ const testing_1 = require("@angular-devkit/schematics/testing");
21
+ // import { Schema as ApplicationOptions } from '../application/schema';
22
+ // import { createAppModule } from '../utility/test';
23
+ // import { Schema as WorkspaceOptions } from '../workspace/schema';
24
+ // import { ChangeDetection, Schema as ComponentOptions, Style } from './schema';
25
+ describe('Add Place Schematic', () => {
26
+ const schematicRunner = new testing_1.SchematicTestRunner('@coolon/angular-ui-powerups', require.resolve('../collection.json'));
27
+ const workspaceOptions = {
28
+ name: 'testWorkspace',
29
+ newProjectRoot: 'apps',
30
+ version: '10.1.1'
31
+ };
32
+ // const appOptions: ApplicationOptions = {
33
+ const appOptions = {
34
+ name: 'bar',
35
+ routing: true,
36
+ prefix: 'the-prefix',
37
+ };
38
+ const defaultOptions = {
39
+ project: appOptions.name,
40
+ name: 'places/new-place'
41
+ };
42
+ let appTree;
43
+ beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
44
+ appTree = yield schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
45
+ appTree = yield schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise();
46
+ appTree = yield schematicRunner
47
+ .runSchematicAsync('bootstrap-app', {
48
+ project: appOptions.name,
49
+ initialPlaceName: undefined // need to disable this for the test as bootstrap will invoke us if specified
50
+ }, appTree)
51
+ .toPromise();
52
+ }));
53
+ it('should create a component', () => __awaiter(void 0, void 0, void 0, function* () {
54
+ const options = Object.assign({}, defaultOptions);
55
+ const tree = yield schematicRunner.runSchematicAsync('place-add', options, appTree).toPromise();
56
+ const files = tree.files;
57
+ expect(files).toEqual(jasmine.arrayContaining([
58
+ '/apps/bar/src/app/places/new-place/new-place.component.scss',
59
+ '/apps/bar/src/app/places/new-place/new-place.component.html',
60
+ '/apps/bar/src/app/places/new-place/new-place.component.spec.ts',
61
+ '/apps/bar/src/app/places/new-place/new-place.component.ts'
62
+ ]));
63
+ const moduleContent = tree.readContent('/apps/bar/src/app/places/new-place/new-place.component.ts');
64
+ expect(moduleContent).toMatch(/export class NewPlaceComponent extends PlaceComponent/);
65
+ expect(moduleContent).toMatch(/path: 'new-place'/);
66
+ expect(moduleContent).toMatch(/nav: I18n.places.newPlace.nav/);
67
+ expect(moduleContent).toMatch(/selector: 'the-prefix-new-place'/);
68
+ expect(moduleContent).toMatch(/import.*I18n.*from '\.\.\/\.\.\/i18n'/);
69
+ }));
70
+ it('should add it to the place module', () => __awaiter(void 0, void 0, void 0, function* () {
71
+ const options = Object.assign({}, defaultOptions);
72
+ const tree = yield schematicRunner.runSchematicAsync('place-add', options, appTree).toPromise();
73
+ // const moduleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
74
+ // expect(moduleContent).toMatch(/import.*Foo.*from '.\/foo\/foo.component'/);
75
+ // expect(moduleContent).toMatch(/declarations:\s*\[[^\]]+?,\r?\n\s+FooComponent\r?\n/m);
76
+ }));
77
+ it('should create an i18n file', () => __awaiter(void 0, void 0, void 0, function* () {
78
+ const options = Object.assign({}, defaultOptions);
79
+ const tree = yield schematicRunner.runSchematicAsync('place-add', options, appTree).toPromise();
80
+ const files = tree.files;
81
+ expect(files).toEqual(jasmine.arrayContaining([
82
+ '/apps/bar/src/i18n/places/new-place.yml',
83
+ ]));
84
+ }));
85
+ // it('should set change detection to OnPush', async () => {
86
+ // const options = { ...defaultOptions, changeDetection: 'OnPush' };
87
+ //
88
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
89
+ // const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
90
+ // expect(tsContent).toMatch(/changeDetection: ChangeDetectionStrategy.OnPush/);
91
+ // });
92
+ // it('should not set view encapsulation', async () => {
93
+ // const options = { ...defaultOptions };
94
+ //
95
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
96
+ // const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
97
+ // expect(tsContent).not.toMatch(/encapsulation: ViewEncapsulation/);
98
+ // });
99
+ //
100
+ // it('should set view encapsulation to Emulated', async () => {
101
+ // const options = { ...defaultOptions, viewEncapsulation: 'Emulated' };
102
+ //
103
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
104
+ // const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
105
+ // expect(tsContent).toMatch(/encapsulation: ViewEncapsulation.Emulated/);
106
+ // });
107
+ //
108
+ // it('should set view encapsulation to None', async () => {
109
+ // const options = { ...defaultOptions, viewEncapsulation: 'None' };
110
+ //
111
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
112
+ // const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
113
+ // expect(tsContent).toMatch(/encapsulation: ViewEncapsulation.None/);
114
+ // });
115
+ // it('should create a flat component', async () => {
116
+ // const options = { ...defaultOptions, flat: true };
117
+ //
118
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
119
+ // const files = tree.files;
120
+ // expect(files).toEqual(
121
+ // jasmine.arrayContaining([
122
+ // '/projects/bar/src/app/foo.component.css',
123
+ // '/projects/bar/src/app/foo.component.html',
124
+ // '/projects/bar/src/app/foo.component.spec.ts',
125
+ // '/projects/bar/src/app/foo.component.ts',
126
+ // ]),
127
+ // );
128
+ // });
129
+ // it('should find the closest module', async () => {
130
+ // const options = { ...defaultOptions };
131
+ // const fooModule = '/projects/bar/src/app/foo/foo.module.ts';
132
+ // appTree.create(
133
+ // fooModule,
134
+ // `
135
+ // import { NgModule } from '@angular/core';
136
+ // @NgModule({
137
+ // imports: [],
138
+ // declarations: []
139
+ // })
140
+ // export class FooModule { }
141
+ // `
142
+ // );
143
+ //
144
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
145
+ // const fooModuleContent = tree.readContent(fooModule);
146
+ // expect(fooModuleContent).toMatch(/import { FooComponent } from '.\/foo.component'/);
147
+ // });
148
+ // it('should export the component', async () => {
149
+ // const options = { ...defaultOptions, export: true };
150
+ //
151
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
152
+ // const appModuleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
153
+ // expect(appModuleContent).toMatch(/exports: \[FooComponent\]/);
154
+ // });
155
+ // it('should set the entry component', async () => {
156
+ // const options = { ...defaultOptions, entryComponent: true };
157
+ //
158
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
159
+ // const appModuleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
160
+ // expect(appModuleContent).toMatch(/entryComponents: \[FooComponent\]/);
161
+ // });
162
+ // it('should import into a specified module', async () => {
163
+ // const options = { ...defaultOptions, module: 'app.module.ts' };
164
+ //
165
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
166
+ // const appModule = tree.readContent('/projects/bar/src/app/app.module.ts');
167
+ //
168
+ // expect(appModule).toMatch(/import { FooComponent } from '.\/foo\/foo.component'/);
169
+ // });
170
+ // it('should fail if specified module does not exist', async () => {
171
+ // const options = { ...defaultOptions, module: '/projects/bar/src/app.moduleXXX.ts' };
172
+ // let thrownError: Error | null = null;
173
+ // try {
174
+ // await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
175
+ // } catch (err) {
176
+ // thrownError = err;
177
+ // }
178
+ // expect(thrownError).toBeDefined();
179
+ // });
180
+ // it('should handle upper case paths', async () => {
181
+ // const pathOption = 'projects/bar/src/app/SOME/UPPER/DIR';
182
+ // const options = { ...defaultOptions, path: pathOption };
183
+ //
184
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
185
+ // let files = tree.files;
186
+ // let root = `/${pathOption}/foo/foo.component`;
187
+ // expect(files).toEqual(
188
+ // jasmine.arrayContaining([`${root}.css`, `${root}.html`, `${root}.spec.ts`, `${root}.ts`])
189
+ // );
190
+ //
191
+ // const options2 = { ...options, name: 'BAR' };
192
+ // const tree2 = await schematicRunner.runSchematicAsync('component', options2, tree).toPromise();
193
+ // files = tree2.files;
194
+ // root = `/${pathOption}/bar/bar.component`;
195
+ // expect(files).toEqual(
196
+ // jasmine.arrayContaining([`${root}.css`, `${root}.html`, `${root}.spec.ts`, `${root}.ts`])
197
+ // );
198
+ // });
199
+ // it('should create a component in a sub-directory', async () => {
200
+ // const options = { ...defaultOptions, path: 'projects/bar/src/app/a/b/c' };
201
+ //
202
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
203
+ // const files = tree.files;
204
+ // const root = `/${options.path}/foo/foo.component`;
205
+ // expect(files).toEqual(
206
+ // jasmine.arrayContaining([`${root}.css`, `${root}.html`, `${root}.spec.ts`, `${root}.ts`])
207
+ // );
208
+ // });
209
+ // it('should use the prefix', async () => {
210
+ // const options = { ...defaultOptions, prefix: 'pre' };
211
+ //
212
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
213
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
214
+ // expect(content).toMatch(/selector: 'pre-foo'/);
215
+ // });
216
+ // it('should use the default project prefix if none is passed', async () => {
217
+ // const options = { ...defaultOptions, prefix: undefined };
218
+ //
219
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
220
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
221
+ // expect(content).toMatch(/selector: 'app-foo'/);
222
+ // });
223
+ // it('should use the supplied prefix if it is ""', async () => {
224
+ // const options = { ...defaultOptions, prefix: '' };
225
+ //
226
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
227
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
228
+ // expect(content).toMatch(/selector: 'foo'/);
229
+ // });
230
+ // it('should respect the inlineTemplate option', async () => {
231
+ // const options = { ...defaultOptions, inlineTemplate: true };
232
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
233
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
234
+ // expect(content).toMatch(/template: /);
235
+ // expect(content).not.toMatch(/templateUrl: /);
236
+ // expect(tree.files).not.toContain('/projects/bar/src/app/foo/foo.component.html');
237
+ // });
238
+ //
239
+ // it('should respect the inlineStyle option', async () => {
240
+ // const options = { ...defaultOptions, inlineStyle: true };
241
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
242
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
243
+ // expect(content).toMatch(/styles: \[/);
244
+ // expect(content).not.toMatch(/styleUrls: /);
245
+ // expect(tree.files).not.toContain('/projects/bar/src/app/foo/foo.component.css');
246
+ // });
247
+ //
248
+ // it('should respect the displayBlock option when inlineStyle is `false`', async () => {
249
+ // const options = { ...defaultOptions, displayBlock: true };
250
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
251
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.css');
252
+ // expect(content).toMatch(/:host {\r?\n display: block;\r?\n}/);
253
+ // });
254
+ //
255
+ // it('should respect the displayBlock option when inlineStyle is `false` and use correct syntax for `scss`', async () => {
256
+ // const options = { ...defaultOptions, displayBlock: true, style: 'scss' };
257
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
258
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.scss');
259
+ // expect(content).toMatch(/:host {\r?\n display: block;\r?\n}/);
260
+ // });
261
+ //
262
+ // it('should respect the displayBlock option when inlineStyle is `false` and use correct syntax for `sass', async () => {
263
+ // const options = { ...defaultOptions, displayBlock: true, style: 'sass' };
264
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
265
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.sass');
266
+ // expect(content).toMatch(/\\:host\r?\n display: block;\r?\n/);
267
+ // });
268
+ //
269
+ // it('should respect the displayBlock option when inlineStyle is `true`', async () => {
270
+ // const options = { ...defaultOptions, displayBlock: true, inlineStyle: true };
271
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
272
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
273
+ // expect(content).toMatch(/:host {\r?\n(\s*)display: block;(\s*)}\r?\n/);
274
+ // });
275
+ // it('should respect the style option', async () => {
276
+ // const options = { ...defaultOptions, style: Style.Sass };
277
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
278
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
279
+ // expect(content).toMatch(/styleUrls: \['.\/foo.component.sass/);
280
+ // expect(tree.files).toContain('/projects/bar/src/app/foo/foo.component.sass');
281
+ // expect(tree.files).not.toContain('/projects/bar/src/app/foo/foo.component.css');
282
+ // });
283
+ // it('should respect the type option', async () => {
284
+ // const options = { ...defaultOptions, type: 'Route' };
285
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
286
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.route.ts');
287
+ // const testContent = tree.readContent('/projects/bar/src/app/foo/foo.route.spec.ts');
288
+ // expect(content).toContain('export class FooRoute implements OnInit');
289
+ // expect(testContent).toContain("describe('FooRoute'");
290
+ // expect(tree.files).toContain('/projects/bar/src/app/foo/foo.route.css');
291
+ // expect(tree.files).toContain('/projects/bar/src/app/foo/foo.route.html');
292
+ // });
293
+ // it('should allow empty string in the type option', async () => {
294
+ // const options = { ...defaultOptions, type: '' };
295
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
296
+ // const content = tree.readContent('/projects/bar/src/app/foo/foo.ts');
297
+ // const testContent = tree.readContent('/projects/bar/src/app/foo/foo.spec.ts');
298
+ // expect(content).toContain('export class Foo implements OnInit');
299
+ // expect(testContent).toContain("describe('Foo'");
300
+ // expect(tree.files).toContain('/projects/bar/src/app/foo/foo.css');
301
+ // expect(tree.files).toContain('/projects/bar/src/app/foo/foo.html');
302
+ // });
303
+ // it('should use the module flag even if the module is a routing module', async () => {
304
+ // const routingFileName = 'app-routing.module.ts';
305
+ // const routingModulePath = `/projects/bar/src/app/${routingFileName}`;
306
+ // const newTree = createAppModule(appTree, routingModulePath);
307
+ // const options = { ...defaultOptions, module: routingFileName };
308
+ // const tree = await schematicRunner.runSchematicAsync('component', options, newTree).toPromise();
309
+ // const content = tree.readContent(routingModulePath);
310
+ // expect(content).toMatch(/import { FooComponent } from '.\/foo\/foo.component/);
311
+ // });
312
+ // it('should handle a path in the name option', async () => {
313
+ // const options = { ...defaultOptions, name: 'dir/test-component' };
314
+ //
315
+ // const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
316
+ // const content = tree.readContent('/projects/bar/src/app/app.module.ts');
317
+ // expect(content).toMatch(
318
+ // /import { TestComponentComponent } from '\.\/dir\/test-component\/test-component.component'/
319
+ // );
320
+ // });
321
+ // it('should handle a path in the name and module options', async () => {
322
+ // appTree = await schematicRunner
323
+ // .runSchematicAsync('module', { name: 'admin/module', project: 'bar' }, appTree)
324
+ // .toPromise();
325
+ //
326
+ // const options = { ...defaultOptions, name: 'other/test-component', module: 'admin/module' };
327
+ // appTree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
328
+ //
329
+ // const content = appTree.readContent('/projects/bar/src/app/admin/module/module.module.ts');
330
+ // expect(content).toMatch(
331
+ // /import { TestComponentComponent } from '..\/..\/other\/test-component\/test-component.component'/
332
+ // );
333
+ // });
334
+ // it('should create the right selector with a path in the name', async () => {
335
+ // const options = { ...defaultOptions, name: 'sub/test' };
336
+ // appTree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
337
+ // const content = appTree.readContent('/projects/bar/src/app/sub/test/test.component.ts');
338
+ // expect(content).toMatch(/selector: 'app-test'/);
339
+ // });
340
+ // it('should respect the skipSelector option', async () => {
341
+ // const options = { ...defaultOptions, name: 'sub/test', skipSelector: true };
342
+ // appTree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
343
+ // const content = appTree.readContent('/projects/bar/src/app/sub/test/test.component.ts');
344
+ // expect(content).not.toMatch(/selector: 'app-test'/);
345
+ // });
346
+ // it('should respect the sourceRoot value', async () => {
347
+ // const config = JSON.parse(appTree.readContent('/angular.json'));
348
+ // config.projects.bar.sourceRoot = 'projects/bar/custom';
349
+ // appTree.overwrite('/angular.json', JSON.stringify(config, null, 2));
350
+ //
351
+ // // should fail without a module in that dir
352
+ // await expectAsync(
353
+ // schematicRunner.runSchematicAsync('component', defaultOptions, appTree).toPromise(),
354
+ // ).toBeRejected();
355
+ //
356
+ // // move the module
357
+ // appTree.rename('/projects/bar/src/app/app.module.ts', '/projects/bar/custom/app/app.module.ts');
358
+ // appTree = await schematicRunner
359
+ // .runSchematicAsync('component', defaultOptions, appTree)
360
+ // .toPromise();
361
+ // expect(appTree.files).toContain('/projects/bar/custom/app/foo/foo.component.ts');
362
+ // });
363
+ });
364
+ //# sourceMappingURL=index.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-add/index.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;GAMG;AACH,iCAAiC;AACjC,gEAAuF;AACvF,wEAAwE;AACxE,qDAAqD;AACrD,oEAAoE;AACpE,iFAAiF;AAEjF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,eAAe,GAAG,IAAI,6BAAmB,CAC7C,6BAA6B,EAC7B,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CACtC,CAAC;IAEF,MAAM,gBAAgB,GAAG;QACvB,IAAI,EAAE,eAAe;QACrB,cAAc,EAAE,MAAM;QACtB,OAAO,EAAE,QAAQ;KAClB,CAAC;IAEF,2CAA2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
  export interface Schema {
2
+ project: string;
3
+ name: string;
2
4
  }
@@ -4,5 +4,24 @@
4
4
  "type": "object",
5
5
  "description": "Add a new place component",
6
6
  "properties": {
7
- }
7
+ "project": {
8
+ "type": "string",
9
+ "description": "The name of the project.",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ },
14
+ "name": {
15
+ "type": "string",
16
+ "description": "The name of the component.",
17
+ "$default": {
18
+ "$source": "argv",
19
+ "index": 0
20
+ },
21
+ "x-prompt": "What name would you like to use for the place?"
22
+ }
23
+ },
24
+ "required": [
25
+ "name"
26
+ ]
8
27
  }
@@ -0,0 +1,25 @@
1
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { <%=capitalize(camelize(name))%>Component } from './<%=dasherize(name)%>>.component';
4
+
5
+ describe('<%=capitalize(camelize(name))%>Component', () => {
6
+ let component: <%=capitalize(camelize(name))%>Component;
7
+ let fixture: ComponentFixture<<%=capitalize(camelize(name))%>Component>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [ <%=capitalize(camelize(name))%>Component ]
12
+ })
13
+ .compileComponents();
14
+ }));
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(<%=capitalize(camelize(name))%>Component);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,29 @@
1
+ import { Component, OnInit } from '@angular/core';
2
+ import {
3
+ Place,
4
+ PlaceComponent,
5
+ } from '@coolon/angular-ui-powerups';
6
+ import { I18n } from '<%=pathToRoot%>/i18n';
7
+
8
+ @Place({
9
+ path: '<%=dasherize(name)%>',
10
+ data: {
11
+ nav: I18n.places.<%=camelize(name)%>.nav
12
+ },
13
+ authenticate: true
14
+ })
15
+ @Component({
16
+ selector: '<%=selectorPrefix%>-<%=dasherize(name)%>',
17
+ templateUrl: './<%=dasherize(name)%>.component.html',
18
+ styleUrls: ['./<%=dasherize(name)%>.component.scss'],
19
+ })
20
+ export class <%=capitalize(camelize(name))%>Component extends PlaceComponent implements OnInit {
21
+
22
+ constructor() {
23
+ super();
24
+ }
25
+
26
+ ngOnInit() {
27
+ }
28
+
29
+ }