@ng-atomic/schematics 17.5.0 → 17.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/collection.json +31 -24
- package/index.js +399 -0
- package/index.js.map +7 -0
- package/lib/_utilities/index.js +188 -0
- package/lib/_utilities/index.js.map +7 -0
- package/lib/atomic-component/index.js +96 -0
- package/lib/atomic-component/index.js.map +7 -0
- package/lib/ng-add/index.js +126 -0
- package/lib/ng-add/index.js.map +7 -0
- package/lib/page/index.js +256 -0
- package/lib/page/index.js.map +7 -0
- package/lib/pages/index.js +39 -0
- package/lib/pages/index.js.map +7 -0
- package/lib/setup/index.js +109 -0
- package/lib/setup/index.js.map +7 -0
- package/lib/style-header/index.js +56 -0
- package/lib/style-header/index.js.map +7 -0
- package/package.json +3 -5
- package/src/_utilities/add-path-to-routes.d.ts +0 -2
- package/src/_utilities/add-path-to-routes.js +0 -34
- package/src/_utilities/add-path-to-routes.js.map +0 -1
- package/src/_utilities/angular-config.d.ts +0 -4
- package/src/_utilities/angular-config.js +0 -23
- package/src/_utilities/angular-config.js.map +0 -1
- package/src/_utilities/index.d.ts +0 -4
- package/src/_utilities/index.js +0 -8
- package/src/_utilities/index.js.map +0 -1
- package/src/_utilities/overwrite.d.ts +0 -2
- package/src/_utilities/overwrite.js +0 -13
- package/src/_utilities/overwrite.js.map +0 -1
- package/src/_utilities/package-config.d.ts +0 -12
- package/src/_utilities/package-config.js +0 -47
- package/src/_utilities/package-config.js.map +0 -1
- package/src/_utilities/save-file.d.ts +0 -2
- package/src/_utilities/save-file.js +0 -11
- package/src/_utilities/save-file.js.map +0 -1
- package/src/_utilities/ts-config.d.ts +0 -2
- package/src/_utilities/ts-config.js +0 -15
- package/src/_utilities/ts-config.js.map +0 -1
- package/src/atomic-component/_test/example.atom.scss +0 -6
- package/src/atomic-component/_test/example.atom.ts +0 -16
- package/src/atomic-component/index.d.ts +0 -10
- package/src/atomic-component/index.js +0 -53
- package/src/atomic-component/index.js.map +0 -1
- package/src/atomic-component/index.spec.ts +0 -187
- package/src/atomic-component/schema.d.ts +0 -24
- package/src/atomic-component/schema.js +0 -3
- package/src/atomic-component/schema.js.map +0 -1
- package/src/index.d.ts +0 -6
- package/src/index.js +0 -10
- package/src/index.js.map +0 -1
- package/src/ng-add/index.d.ts +0 -3
- package/src/ng-add/index.js +0 -31
- package/src/ng-add/index.js.map +0 -1
- package/src/page/_test/example.module.ts +0 -26
- package/src/page/_test/example.page.scss +0 -6
- package/src/page/_test/example.page.ts +0 -15
- package/src/page/index.d.ts +0 -3
- package/src/page/index.js +0 -71
- package/src/page/index.js.map +0 -1
- package/src/page/index.spec.ts +0 -37
- package/src/pages/index.d.ts +0 -3
- package/src/pages/index.js +0 -15
- package/src/pages/index.js.map +0 -1
- package/src/pages/index.spec.ts +0 -17
- package/src/pages/schema.d.ts +0 -7
- package/src/pages/schema.js +0 -3
- package/src/pages/schema.js.map +0 -1
- package/src/setup/index.d.ts +0 -2
- package/src/setup/index.js +0 -18
- package/src/setup/index.js.map +0 -1
- package/src/setup/index.spec.ts +0 -37
- package/src/style-header/_test/example.scss +0 -6
- package/src/style-header/index.d.ts +0 -4
- package/src/style-header/index.js +0 -18
- package/src/style-header/index.js.map +0 -1
- package/src/style-header/index.spec.ts +0 -43
- package/src/style-header/schema.d.ts +0 -6
- package/src/style-header/schema.js +0 -3
- package/src/style-header/schema.js.map +0 -1
- /package/{src → lib}/atomic-component/files/__name@dasherize__/__name@dasherize__.stories.ts.template +0 -0
- /package/{src → lib}/atomic-component/files/__name@dasherize__/index.ts.template +0 -0
- /package/{src → lib}/atomic-component/files/__name@dasherize__/ng-package.json.template +0 -0
- /package/{src → lib}/atomic-component/schema.json +0 -0
- /package/{src → lib}/ng-add/schema.json +0 -0
- /package/{src → lib}/page/files/__name@dasherize__/__name@dasherize__.routes.ts.template +0 -0
- /package/{src → lib}/pages/files/__name@dasherize__/__name@dasherize__.routes.ts.template +0 -0
- /package/{src → lib}/pages/schema.json +0 -0
- /package/{src → lib}/setup/files/atomic/_atom.scss +0 -0
- /package/{src → lib}/setup/files/atomic/_component.scss +0 -0
- /package/{src → lib}/setup/files/atomic/_molecule.scss +0 -0
- /package/{src → lib}/setup/files/atomic/_organism.scss +0 -0
- /package/{src → lib}/setup/files/atomic/_page.scss +0 -0
- /package/{src → lib}/setup/files/atomic/_template.scss +0 -0
- /package/{src → lib}/style-header/schema.json +0 -0
package/src/page/index.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.page = void 0;
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
5
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
-
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
7
|
-
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
8
|
-
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
9
|
-
const lodash_1 = require("lodash");
|
|
10
|
-
const _utilities_1 = require("../_utilities");
|
|
11
|
-
const page = (options) => async (host) => {
|
|
12
|
-
options.type = 'page';
|
|
13
|
-
options.name = resolveName(options.name);
|
|
14
|
-
options.prefix || (options.prefix = `${options.type}s`);
|
|
15
|
-
options.path ?? (options.path = await (0, workspace_1.createDefaultPath)(host, options.project));
|
|
16
|
-
const { name, path, type, project } = options = { ...options, ...(0, parse_name_1.parseName)(options.path, options.name) };
|
|
17
|
-
const { styleHeader, useTypeAsExtension } = options;
|
|
18
|
-
const opt = (0, lodash_1.omit)(options, ['styleHeader', 'useTypeAsExtension', 'story', 'ngPackage']);
|
|
19
|
-
const componentExt = useTypeAsExtension ? type : 'component';
|
|
20
|
-
const scssPath = `${path}/${name}/${name}.${componentExt}.scss`;
|
|
21
|
-
const pages = getPagesOptions(`${path}/${name}`);
|
|
22
|
-
return (0, schematics_1.chain)([
|
|
23
|
-
(0, schematics_1.schematic)('pages', { ...pages, project }),
|
|
24
|
-
addRouteIntoPagesRoutes(options, pages),
|
|
25
|
-
generateRoutes({ name, path, project, type }),
|
|
26
|
-
(0, schematics_1.externalSchematic)('@schematics/angular', 'component', { ...opt, changeDetection: 'Default', export: true }),
|
|
27
|
-
(0, schematics_1.schematic)('style-header', { ...options, styleHeader, name, type, path: scssPath }),
|
|
28
|
-
addRouteIntoPageRoutes(options, { path, name }),
|
|
29
|
-
]);
|
|
30
|
-
};
|
|
31
|
-
exports.page = page;
|
|
32
|
-
const generateRoutes = (options) => {
|
|
33
|
-
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [(0, schematics_1.applyTemplates)({ ...core_1.strings, ...options }), (0, schematics_1.move)(options.path)]));
|
|
34
|
-
};
|
|
35
|
-
const getPagesOptions = (fullPath) => {
|
|
36
|
-
const [_, name, ...paths] = fullPath.split('/').reverse();
|
|
37
|
-
return { name, path: paths.reverse().join('/') };
|
|
38
|
-
};
|
|
39
|
-
const resolveName = (name) => {
|
|
40
|
-
return 'pages/' + name.split('/').filter(path => path !== 'pages').join('/pages/');
|
|
41
|
-
};
|
|
42
|
-
const addRouteIntoPagesRoutes = (options, target) => {
|
|
43
|
-
const routeOptions = buildOption(options, target, 'pages');
|
|
44
|
-
return (0, _utilities_1.addPathToRoutes)(routeOptions);
|
|
45
|
-
};
|
|
46
|
-
const addRouteIntoPageRoutes = (options, target) => {
|
|
47
|
-
const routeOptions = buildOption(options, target, 'page');
|
|
48
|
-
return (0, _utilities_1.addPathToRoutes)(routeOptions);
|
|
49
|
-
};
|
|
50
|
-
const buildOption = (options, { path, name }, type) => {
|
|
51
|
-
console.debug(`${path}/${name}/${name}.routes.ts`);
|
|
52
|
-
return {
|
|
53
|
-
...options,
|
|
54
|
-
routesPath: `${path}/${name}/${name}.routes.ts`,
|
|
55
|
-
route: type === 'pages' ? buildPagesRoute(options.name) : buildPageRoute(name),
|
|
56
|
-
removeOtherRoutes: type === 'page',
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
const buildPagesRoute = (name) => `
|
|
60
|
-
{
|
|
61
|
-
path: '${name}',
|
|
62
|
-
loadChildren: () => import('./${(0, strings_1.dasherize)(name)}/${(0, strings_1.dasherize)(name)}.routes').then(m => m.routes)
|
|
63
|
-
}`;
|
|
64
|
-
const buildPageRoute = (name) => `
|
|
65
|
-
{
|
|
66
|
-
path: '',
|
|
67
|
-
component: ${(0, strings_1.classify)(name)}Page,
|
|
68
|
-
loadChildren: () => import('@ng-atomic/components/pages/blank').then(m => m.routes)
|
|
69
|
-
// loadChildren: () => import('./pages/pages.routes').then(m => m.routes)
|
|
70
|
-
}`;
|
|
71
|
-
//# sourceMappingURL=index.js.map
|
package/src/page/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/page/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,2DAA0I;AAC1I,uEAAmE;AACnE,oEAA6E;AAC7E,qEAA0E;AAC1E,mCAA8B;AAE9B,8CAAgD;AAKzC,MAAM,IAAI,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,KAAK,EAAE,IAAU,EAAE,EAAE;IACnE,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IACtB,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC,OAAO,CAAC,MAAM,KAAd,OAAO,CAAC,MAAM,GAAK,GAAG,OAAO,CAAC,IAAI,GAAG,EAAC;IACtC,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,MAAM,IAAA,6BAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EAAC;IAEhE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,GAAG,EAAC,GAAG,OAAO,EAAE,GAAG,IAAA,sBAAS,E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IAAgB,EAAE,EAAE;IACvE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,YAAY,CAAC,CAAC;IACnD,OAAO;QACN,GAAG,OAAO;QACV,UAAU,EAAE,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,YAAY;QAC/C,KAAK,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC;QAC9E,iBAAiB,EAAE,IAAI,KAAK,MAAM;KAClC,CAAA;AACF,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAAI,EAAU,EAAE,CAAC;;WAE/B,IAAI;kCACmB,IAAA,mBAAS,EAAC,IAAI,CAAC,IAAI,IAAA,mBAAS,EAAC,IAAI,CAAC;GACjE,CAAC;AAEJ,MAAM,cAAc,GAAG,CAAC,IAAI,EAAU,EAAE,CAAC;;;eAG1B,IAAA,kBAAQ,EAAC,IAAI,CAAC;;;GAG1B,CAAC"}
|
package/src/page/index.spec.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { COLLECTION_PATH, createWorkspace } from '../_testing';
|
|
5
|
-
|
|
6
|
-
describe('Page Schematics', () => {
|
|
7
|
-
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
8
|
-
let tree: UnitTestTree;
|
|
9
|
-
|
|
10
|
-
beforeEach(async () => {
|
|
11
|
-
tree = await createWorkspace(runner, tree);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('should create atomic component files', async () => {
|
|
15
|
-
const options = {project: 'app', name: 'example'};
|
|
16
|
-
const host = await runner.runSchematicAsync('page', options, tree).toPromise();
|
|
17
|
-
expect(host.files.includes('/projects/app/src/app/pages/pages.module.ts')).toBeTruthy();
|
|
18
|
-
expect(host.files.includes('/projects/app/src/app/pages/example/example.module.ts')).toBeTruthy();
|
|
19
|
-
expect(host.files.includes('/projects/app/src/app/pages/example/example.page.html')).toBeTruthy();
|
|
20
|
-
expect(host.files.includes('/projects/app/src/app/pages/example/example.page.scss')).toBeTruthy();
|
|
21
|
-
expect(host.files.includes('/projects/app/src/app/pages/example/example.page.spec.ts')).toBeTruthy();
|
|
22
|
-
expect(host.files.includes('/projects/app/src/app/pages/example/example.page.ts')).toBeTruthy();
|
|
23
|
-
|
|
24
|
-
const inputModuleTs = host.read('/projects/app/src/app/pages/example/example.module.ts').toString('utf-8');
|
|
25
|
-
const expectedModuleTs = readFileSync(join(__dirname, '_test/example.module.ts')).toString('utf-8');
|
|
26
|
-
expect(inputModuleTs.replace(/\s/g, '')).toEqual(expectedModuleTs.replace(/\s/g, ''));
|
|
27
|
-
|
|
28
|
-
const inputTs = host.read('/projects/app/src/app/pages/example/example.page.ts').toString('utf-8');
|
|
29
|
-
const expectedTs = readFileSync(join(__dirname, '_test/example.page.ts')).toString('utf-8');
|
|
30
|
-
expect(inputTs.replace(/\s/g, '')).toEqual(expectedTs.replace(/\s/g, ''));
|
|
31
|
-
|
|
32
|
-
const inputScss = host.read('/projects/app/src/app/pages/example/example.page.scss').toString('utf-8');
|
|
33
|
-
const expectedScss = readFileSync(join(__dirname, '_test/example.page.scss')).toString('utf-8');
|
|
34
|
-
expect(inputScss.replace(/\s/g, '')).toEqual(expectedScss.replace(/\s/g, ''));
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
});
|
package/src/pages/index.d.ts
DELETED
package/src/pages/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pages = void 0;
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
5
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
-
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
7
|
-
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
8
|
-
const pages = (options) => async (host) => {
|
|
9
|
-
options.path ?? (options.path = await (0, workspace_1.createDefaultPath)(host, options.project));
|
|
10
|
-
const { name, path } = options = { ...options, ...(0, parse_name_1.parseName)(options.path, options.name) };
|
|
11
|
-
return host.exists(`${path}/${name}/${name}.routes.ts`) ? (0, schematics_1.noop)() : genModule(options);
|
|
12
|
-
};
|
|
13
|
-
exports.pages = pages;
|
|
14
|
-
const genModule = (options) => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [(0, schematics_1.applyTemplates)({ ...core_1.strings, ...options }), (0, schematics_1.move)(options.path)]));
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
package/src/pages/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/pages/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,2DAA2G;AAC3G,uEAAmE;AACnE,qEAA0E;AAGnE,MAAM,KAAK,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,KAAK,EAAE,IAAU,EAAE,EAAE;IACnE,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,MAAM,IAAA,6BAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EAAC;IAChE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,GAAG,EAAC,GAAG,OAAO,EAAE,GAAG,IAAA,sBAAS,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAC,CAAC;IACxF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACxF,CAAC,CAAC;AAJW,QAAA,KAAK,SAIhB;AAEF,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE,CACpC,IAAA,sBAAS,EAAC,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE,CAAC,IAAA,2BAAc,EAAC,EAAC,GAAG,cAAO,EAAE,GAAG,OAAO,EAAC,CAAC,EAAE,IAAA,iBAAI,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/src/pages/index.spec.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
-
import { COLLECTION_PATH, createWorkspace } from '../_testing';
|
|
3
|
-
|
|
4
|
-
describe('Pages Schematics', () => {
|
|
5
|
-
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
6
|
-
let tree: UnitTestTree;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
tree = await createWorkspace(runner, tree);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('should create component files', async () => {
|
|
13
|
-
const options = {project: 'app', name: 'pages'};
|
|
14
|
-
const { files } = await runner.runSchematicAsync('pages', options, tree).toPromise();
|
|
15
|
-
expect(files.includes('/projects/app/src/app/pages/pages.module.ts')).toBeTruthy();
|
|
16
|
-
});
|
|
17
|
-
});
|
package/src/pages/schema.d.ts
DELETED
package/src/pages/schema.js
DELETED
package/src/pages/schema.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/pages/schema.ts"],"names":[],"mappings":""}
|
package/src/setup/index.d.ts
DELETED
package/src/setup/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setup = void 0;
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const _utilities_1 = require("../_utilities");
|
|
6
|
-
const setup = (options) => (0, schematics_1.chain)([
|
|
7
|
-
(0, _utilities_1.addSchematicsConfig)(options, 'atom'),
|
|
8
|
-
(0, _utilities_1.addSchematicsConfig)(options, 'molecule'),
|
|
9
|
-
(0, _utilities_1.addSchematicsConfig)(options, 'organism'),
|
|
10
|
-
(0, _utilities_1.addSchematicsConfig)(options, 'template'),
|
|
11
|
-
(0, _utilities_1.setDefaultCollection)(),
|
|
12
|
-
(0, _utilities_1.addStyleIncludePath)(options),
|
|
13
|
-
(host) => host.exists(`${options.stylesDir}/atomic`) ? (0, schematics_1.noop)() : addStyleFiles(options),
|
|
14
|
-
(0, _utilities_1.addPathsToTsConfig)(options),
|
|
15
|
-
]);
|
|
16
|
-
exports.setup = setup;
|
|
17
|
-
const addStyleFiles = (options) => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [(0, schematics_1.template)({}), (0, schematics_1.move)(options.stylesDir)]));
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/src/setup/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/setup/index.ts"],"names":[],"mappings":";;;AAAA,2DAA4G;AAC5G,8CAAmH;AAE5G,MAAM,KAAK,GAAG,CAAC,OAAY,EAAQ,EAAE,CAAC,IAAA,kBAAK,EAAC;IAClD,IAAA,gCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC;IACpC,IAAA,gCAAmB,EAAC,OAAO,EAAE,UAAU,CAAC;IACxC,IAAA,gCAAmB,EAAC,OAAO,EAAE,UAAU,CAAC;IACxC,IAAA,gCAAmB,EAAC,OAAO,EAAE,UAAU,CAAC;IACxC,IAAA,iCAAoB,GAAE;IACtB,IAAA,gCAAmB,EAAC,OAAO,CAAC;IAC5B,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC;IAC5F,IAAA,+BAAkB,EAAC,OAAO,CAAC;CAC3B,CAAC,CAAC;AATU,QAAA,KAAK,SASf;AAEH,MAAM,aAAa,GAAG,CAAC,OAAY,EAAE,EAAE,CAAC,IAAA,sBAAS,EAAC,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE,CAAC,IAAA,qBAAQ,EAAC,EAAE,CAAC,EAAE,IAAA,iBAAI,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/src/setup/index.spec.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
-
import { COLLECTION_PATH, createWorkspace } from '../_testing';
|
|
3
|
-
import get from 'lodash.get';
|
|
4
|
-
|
|
5
|
-
describe('Setup Schematics', () => {
|
|
6
|
-
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
7
|
-
let tree: UnitTestTree;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
tree = await createWorkspace(runner, tree);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should create component files', async () => {
|
|
14
|
-
const options = {project: 'app', name: 'pages'};
|
|
15
|
-
const host = await runner.runSchematicAsync('setup', options, tree).toPromise();
|
|
16
|
-
const angularJson = JSON.parse(host.read('/angular.json').toString('utf-8'));
|
|
17
|
-
expect(get(angularJson, 'cli.defaultCollection')).toEqual('@ng-atomic/schematics');
|
|
18
|
-
const schematicsJson = get(angularJson, 'projects.app.schematics');
|
|
19
|
-
|
|
20
|
-
for (const type of ['atom', 'molecule', 'organism', 'template']) {
|
|
21
|
-
expect(get(schematicsJson, `@ng-atomic/schematics:${type}`))
|
|
22
|
-
.toEqual({path: `_shared/components/${type}s`});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const architectJson = get(angularJson, 'projects.app.architect');
|
|
26
|
-
expect(get(architectJson, 'build.options.stylePreprocessorOptions.includePaths'))
|
|
27
|
-
.toContain('src/styles');
|
|
28
|
-
|
|
29
|
-
for (const type of ['component', 'atom', 'molecule', 'organism', 'template', 'page']) {
|
|
30
|
-
expect(host.files).toContain(`/src/styles/atomic/_${type}.scss`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const tsconfigJson = JSON.parse(host.read('/tsconfig.json').toString('utf-8'));
|
|
34
|
-
expect(get(tsconfigJson, 'compilerOptions.paths.@components')).toContain('_shared/components');
|
|
35
|
-
expect(get(tsconfigJson, 'compilerOptions.paths.@components/*')).toContain('_shared/components/*');
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
5
|
-
const string_template_1 = tslib_1.__importDefault(require("string-template"));
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const save_file_1 = require("../_utilities/save-file");
|
|
8
|
-
const buildOptions = (options) => ({
|
|
9
|
-
...options,
|
|
10
|
-
name: options?.name || (0, path_1.basename)(options.path, '.scss').split('.')?.[0],
|
|
11
|
-
type: options?.type || (0, path_1.basename)(options.path, '.scss').split('.').reverse()?.[0],
|
|
12
|
-
});
|
|
13
|
-
const buildStyle = ({ styleHeader, name, type }) => (0, string_template_1.default)(styleHeader, { name: (0, strings_1.dasherize)(name), type: type });
|
|
14
|
-
exports.default = (_options) => (host) => {
|
|
15
|
-
const { path, ...extra } = buildOptions(_options);
|
|
16
|
-
return (0, save_file_1.saveFile)(host, path, (src) => `${buildStyle(extra)}${src}`);
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/style-header/index.ts"],"names":[],"mappings":";;;AACA,oEAAkE;AAClE,8EAAqC;AACrC,+BAAgC;AAEhC,uDAAmD;AAEnD,MAAM,YAAY,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,CAAC;IACjD,GAAG,OAAO;IACV,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,IAAA,eAAQ,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACtE,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,IAAA,eAAQ,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;CACjF,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC,EAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAgD,EAAU,EAAE,CACtG,IAAA,yBAAM,EAAC,WAAW,EAAE,EAAC,IAAI,EAAE,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;AAE3D,kBAAe,CAAC,QAAgB,EAAQ,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IACxD,MAAM,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChD,OAAO,IAAA,oBAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;AACrF,CAAC,CAAA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
import { createWorkspace } from '../_testing';
|
|
6
|
-
|
|
7
|
-
const COLLECTION_PATH = path.join(__dirname, '../../collection.json');
|
|
8
|
-
|
|
9
|
-
describe('StyleHeader', () => {
|
|
10
|
-
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|
|
11
|
-
let tree: UnitTestTree;
|
|
12
|
-
|
|
13
|
-
beforeEach(async () => {
|
|
14
|
-
tree = await createWorkspace(runner, tree);
|
|
15
|
-
const options = {project: 'app', style: 'scss', name: 'example', skipImport: true };
|
|
16
|
-
tree = await runner.runExternalSchematicAsync('@schematics/angular', 'component', options, tree).toPromise();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
describe('given all options', () => {
|
|
20
|
-
it('should be added style header', async () => {
|
|
21
|
-
const PATH = '/projects/app/src/app/example/example.component.scss';
|
|
22
|
-
const options = {path: PATH, name: 'example', type: 'component'};
|
|
23
|
-
|
|
24
|
-
await runner.runSchematicAsync('style-header', options, tree).toPromise();
|
|
25
|
-
const input = tree.read(PATH).toString('utf-8');
|
|
26
|
-
const expected = readFileSync(join(__dirname, '_test/example.scss')).toString();
|
|
27
|
-
expect(input.replace(/\s/g, '')).toEqual(expected.replace(/\s/g, ''));
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe('given only options.path', () => {
|
|
32
|
-
it('should be added style header', async () => {
|
|
33
|
-
const PATH = '/projects/app/src/app/example/example.component.scss';
|
|
34
|
-
const options = {path: PATH};
|
|
35
|
-
|
|
36
|
-
await runner.runSchematicAsync('style-header', options, tree).toPromise();
|
|
37
|
-
const input = tree.read(PATH).toString('utf-8');
|
|
38
|
-
const expected = readFileSync(join(__dirname, '_test/example.scss')).toString();
|
|
39
|
-
expect(input.replace(/\s/g, '')).toEqual(expected.replace(/\s/g, ''));
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/style-header/schema.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|