@coolon/angular-ui-powerups 3.2.0 → 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.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/schematics/bootstrap-app/index.js +9 -3
- package/schematics/bootstrap-app/index.js.map +1 -1
- package/schematics/bootstrap-app/schema.d.ts +1 -0
- package/schematics/bootstrap-app/schema.json +5 -0
- package/schematics/bootstrap-app/templates/app/auth/auth.guard.ts.template +8 -8
- package/schematics/bootstrap-app/templates/styles.scss.template +5 -0
- package/schematics/collection.json +5 -0
- package/schematics/place-add/index.js +30 -19
- package/schematics/place-add/index.js.map +1 -1
- package/schematics/place-add/index.spec.d.ts +1 -0
- package/schematics/place-add/index.spec.js +364 -0
- package/schematics/place-add/index.spec.js.map +1 -0
- package/schematics/place-add/schema.d.ts +2 -0
- package/schematics/place-add/schema.json +20 -1
- package/schematics/place-add/templates/component/__name@dasherize__.component.html.template +1 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.ts.template +29 -0
- package/schematics/place-add/templates/files/i18n/places/__name@dasherize__.yml.template +7 -0
- package/schematics/utils/build-context.d.ts +34 -0
- package/schematics/utils/build-context.js +133 -0
- package/schematics/utils/build-context.js.map +1 -0
- package/schematics/utils/decorators/decorated-class.d.ts +13 -0
- package/schematics/utils/decorators/decorated-class.js +28 -0
- package/schematics/utils/decorators/decorated-class.js.map +1 -0
- package/schematics/utils/decorators/decorated-source-file.d.ts +15 -0
- package/schematics/utils/decorators/decorated-source-file.js +27 -0
- package/schematics/utils/decorators/decorated-source-file.js.map +1 -0
- package/schematics/utils/import-def.d.ts +30 -0
- package/schematics/utils/import-def.js +89 -0
- package/schematics/utils/import-def.js.map +1 -0
- package/schematics/utils/method-scanner.d.ts +16 -0
- package/schematics/utils/method-scanner.js +61 -0
- package/schematics/utils/method-scanner.js.map +1 -0
- package/schematics/utils/parameter-def.d.ts +5 -0
- package/schematics/utils/parameter-def.js +3 -0
- package/schematics/utils/parameter-def.js.map +1 -0
- package/schematics/utils/path-helper.d.ts +18 -0
- package/schematics/utils/path-helper.js +56 -0
- package/schematics/utils/path-helper.js.map +1 -0
- package/schematics/utils/schematic-tree-file-system.d.ts +28 -0
- package/schematics/utils/schematic-tree-file-system.js +101 -0
- package/schematics/utils/schematic-tree-file-system.js.map +1 -0
- package/schematics/utils/source-file-scanner.d.ts +14 -0
- package/schematics/utils/source-file-scanner.js +89 -0
- package/schematics/utils/source-file-scanner.js.map +1 -0
- package/schematics/utils/source-file-utilities.d.ts +6 -0
- package/schematics/utils/source-file-utilities.js +35 -0
- package/schematics/utils/source-file-utilities.js.map +1 -0
- package/schematics/utils/template-utilities.d.ts +2 -0
- package/schematics/utils/template-utilities.js +24 -0
- package/schematics/utils/template-utilities.js.map +1 -0
- package/schematics/bootstrap-app/templates/app/places/home/home.component.html.template +0 -1
- package/schematics/bootstrap-app/templates/app/places/home/home.component.spec.ts.template +0 -25
- package/schematics/bootstrap-app/templates/app/places/home/home.component.ts.template +0 -25
- package/schematics/bootstrap-app/templates/i18n/places/home.yml.template +0 -6
- /package/schematics/{bootstrap-app/templates/app/places/home/home.component.scss.template → place-add/templates/component/__name@dasherize__.component.scss.template} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.3.0](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.2.0...v3.3.0) (2020-09-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* added ability to bootstrap app with custom default place ([68b781d](https://bitbucket.org/coolon/angular-ui-powerups/commit/68b781d80fa3e9e071ecbe29280990548fd217f5))
|
|
11
|
+
* added new add-place schematic ([a87a237](https://bitbucket.org/coolon/angular-ui-powerups/commit/a87a23792d3fec2514f93c514afd437c26abbcc8))
|
|
12
|
+
|
|
5
13
|
## [3.2.0](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.1.2...v3.2.0) (2020-09-18)
|
|
6
14
|
|
|
7
15
|
|
package/package.json
CHANGED
|
@@ -22,11 +22,17 @@ function bootstrapApp(_options) {
|
|
|
22
22
|
schematics_1.applyTemplates(Object.assign(Object.assign({}, _options), core_1.strings)),
|
|
23
23
|
schematics_1.move(`apps/${_options.project}/src`)
|
|
24
24
|
]);
|
|
25
|
-
const
|
|
25
|
+
const rules = [
|
|
26
26
|
templateSource,
|
|
27
27
|
updatePackageJsonScripts(_options)
|
|
28
|
-
]
|
|
29
|
-
|
|
28
|
+
];
|
|
29
|
+
if (_options.initialPlaceName) {
|
|
30
|
+
rules.push(schematics_1.externalSchematic('@coolon/angular-ui-powerups', 'place-add', {
|
|
31
|
+
project: _options.project,
|
|
32
|
+
name: `places/${_options.initialPlaceName}`
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
return schematics_1.chain(rules)(tree, _context);
|
|
30
36
|
};
|
|
31
37
|
}
|
|
32
38
|
exports.bootstrapApp = bootstrapApp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/bootstrap-app/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/bootstrap-app/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAC7D,2DAaoC;AACpC,kDAAoD;AAGpD,yFAAyF;AAEzF,SAAgB,YAAY,CAAC,QAAgB;IAE3C,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAGhD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD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;AACV,4EAA4E;AAC5E,EAAE;AACF,2BAA2B;AAC3B,kBAAkB;AAClB,UAAU;AACV,EAAE;AACF,2CAA2C;AAC3C,OAAO;AACP,IAAI;AAGJ,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,6 +1,5 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
3
|
-
import { AuthService } from './auth.service';
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
@Injectable({
|
|
@@ -8,16 +7,17 @@ import { AuthService } from './auth.service';
|
|
|
8
7
|
})
|
|
9
8
|
export class AuthGuard implements CanActivate {
|
|
10
9
|
|
|
11
|
-
constructor(
|
|
10
|
+
constructor() {
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
async canActivate(next: ActivatedRouteSnapshot,
|
|
15
14
|
state: RouterStateSnapshot): Promise<boolean | UrlTree> {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
return true;
|
|
16
|
+
// /* Try to auth with the server. If auth'd resolve to true, else resolve to false */
|
|
17
|
+
// if (this.auth.authenticated.value) {
|
|
18
|
+
// return true;
|
|
19
|
+
// } else {
|
|
20
|
+
// this.auth.startLoginFlow();
|
|
21
|
+
// }
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -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,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
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":";;;
|
|
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,C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ACzD,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,2CAA2C;IAC3C,MAAM,UAAU,GAAG;QACjB,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,YAAY;KACrB,CAAC;IAEF,MAAM,cAAc,GAAG;QACrB,OAAO,EAAE,UAAU,CAAC,IAAI;QACxB,IAAI,EAAE,kBAAkB;KACzB,CAAC;IACF,IAAI,OAAqB,CAAC;IAE1B,UAAU,CAAC,GAAS,EAAE;QACpB,OAAO,GAAG,MAAM,eAAe,CAAC,yBAAyB,CAAC,qBAAqB,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC,SAAS,EAAE,CAAC;QAC5H,OAAO,GAAG,MAAM,eAAe,CAAC,yBAAyB,CAAC,qBAAqB,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,E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uE;IACvE,EAAE;IACF,qGAAqG;IACrG,6EAA6E;IAC7E,6BAA6B;IAC7B,mGAAmG;IACnG,OAAO;IACP,MAAM;IAEN,0EAA0E;IAC1E,oCAAoC;IACpC,sFAAsF;IACtF,oBAAoB;IACpB,EAAE;IACF,iGAAiG;IACjG,kGAAkG;IAClG,EAAE;IACF,gGAAgG;IAChG,6BAA6B;IAC7B,yGAAyG;IACzG,OAAO;IACP,MAAM;IAEN,+EAA+E;IAC/E,6DAA6D;IAC7D,kGAAkG;IAClG,6FAA6F;IAC7F,qDAAqD;IACrD,MAAM;IAEN,6DAA6D;IAC7D,iFAAiF;IACjF,kGAAkG;IAClG,6FAA6F;IAC7F,yDAAyD;IACzD,MAAM;IAEN,0DAA0D;IAC1D,qEAAqE;IACrE,4DAA4D;IAC5D,yEAAyE;IACzE,EAAE;IACF,gDAAgD;IAChD,uBAAuB;IACvB,2FAA2F;IAC3F,sBAAsB;IACtB,EAAE;IACF,uBAAuB;IACvB,qGAAqG;IACrG,oCAAoC;IACpC,+DAA+D;IAC/D,oBAAoB;IACpB,sFAAsF;IACtF,MAAM;AAER,CAAC,CAAC,CAAC"}
|
|
@@ -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 @@
|
|
|
1
|
+
<p><%=name%> works!</p>
|