@ng-atomic/schematics 1.2.0 → 1.4.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/package.json +1 -1
- package/src/atomic-component/files/__name@dasherize__/__name@dasherize__.stories.ts.template +26 -0
- package/src/atomic-component/files/__name@dasherize__/index.ts.template +1 -0
- package/src/atomic-component/files/__name@dasherize__/ng-package.json.template +11 -0
- package/src/atomic-component/index.js +1 -2
- package/src/atomic-component/index.js.map +1 -1
- package/src/atomic-component/index.spec.ts +4 -1
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
2
|
+
import { Meta, Story } from '@storybook/angular';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
import { <%= classify(name) %><%= classify(type) %>, <%= classify(name) %>Module } from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: '<%= classify(type) %>s/<%= classify(name) %>',
|
|
8
|
+
component: <%= classify(name) %><%= classify(type) %>,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
const ACTIONS = {
|
|
12
|
+
// eventEmitterName: action('eventEmitterName'),
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const Template: Story = (args) => ({
|
|
17
|
+
props: {...args, ...ACTIONS},
|
|
18
|
+
moduleMetadata: {
|
|
19
|
+
imports: [
|
|
20
|
+
<%= classify(name) %>Module,
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const Default = Template.bind({});
|
|
26
|
+
Default.args = {};
|
|
@@ -17,8 +17,7 @@ exports.atomicComponent = (options) => (host, _) => tslib_1.__awaiter(void 0, vo
|
|
|
17
17
|
schematics_1.externalSchematic('@schematics/angular', 'module', { name, path, project: options.project }),
|
|
18
18
|
schematics_1.externalSchematic('@schematics/angular', 'component', Object.assign(Object.assign({}, options), { export: true })),
|
|
19
19
|
// externalSchematic('angular-host-css-variable', 'component', {...options, styleHeader: format(options.styleHeader, { name, type }), export: true}),
|
|
20
|
-
schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./files'), [schematics_1.applyTemplates(Object.assign(Object.assign({}, strings), { name })), schematics_1.move(path)])),
|
|
21
|
-
addExportIntoIndexTs(Object.assign({}, options))
|
|
20
|
+
schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./files'), [schematics_1.applyTemplates(Object.assign(Object.assign({}, strings), { name, type: type !== null && type !== void 0 ? type : 'component' })), schematics_1.move(path)])),
|
|
22
21
|
]);
|
|
23
22
|
});
|
|
24
23
|
exports.atom = (options) => exports.atomicComponent(buildOptions(options, 'atom'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/atomic-component/index.ts"],"names":[],"mappings":";;;;AAAA,2DAGoC;AACpC,kEAAkE;AAClE,uEAAmE;AACnE,qEAA0E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/atomic-component/index.ts"],"names":[],"mappings":";;;;AAAA,2DAGoC;AACpC,kEAAkE;AAClE,uEAAmE;AACnE,qEAA0E;AAC1E,+BAA4B;AAGf,QAAA,eAAe,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,CAAO,IAAU,EAAE,CAAmB,EAAE,EAAE;;IACnG,MAAA,OAAO,CAAC,MAAM,oCAAd,OAAO,CAAC,MAAM,GAAK,QAAQ,EAAC;IAC5B,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC,MAAM,6BAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,QAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,EAAE,CAAC,CAAC;IACzF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,mCAAO,OAAO,GAAK,sBAA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AAC,OAAe,EAAE,IAAY,EAAE,EAAE,CACtD,iCAAK,OAAO,KAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,GAAG,IAAE,CAAC;AAElG,MAAM,oBAAoB,GAAG,CAAC,EAAC,IAAI,EAAE,IAAI,EAAS,EAAE,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IACrE,MAAM,WAAW,GAAG,WAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChG,MAAM,IAAI,GAAG,YAAY,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;IAC/F,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1F,OAAO,IAAI,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -31,6 +31,7 @@ describe('AtomicComponent Schematics', () => {
|
|
|
31
31
|
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.component.scss');
|
|
32
32
|
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.component.spec.ts');
|
|
33
33
|
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.component.ts');
|
|
34
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/example/example.stories.ts');
|
|
34
35
|
expect(files).toContain('/projects/app/src/app/_shared/components/example/index.ts');
|
|
35
36
|
});
|
|
36
37
|
|
|
@@ -44,6 +45,7 @@ describe('AtomicComponent Schematics', () => {
|
|
|
44
45
|
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.component.scss');
|
|
45
46
|
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.component.spec.ts');
|
|
46
47
|
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.component.ts');
|
|
48
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/first/first.stories.ts');
|
|
47
49
|
expect(files).toContain('/projects/app/src/app/_shared/components/first/index.ts');
|
|
48
50
|
|
|
49
51
|
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.module.ts');
|
|
@@ -51,6 +53,7 @@ describe('AtomicComponent Schematics', () => {
|
|
|
51
53
|
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.component.scss');
|
|
52
54
|
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.component.spec.ts');
|
|
53
55
|
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.component.ts');
|
|
56
|
+
expect(files).toContain('/projects/app/src/app/_shared/components/second/second.stories.ts');
|
|
54
57
|
expect(files).toContain('/projects/app/src/app/_shared/components/second/index.ts');
|
|
55
58
|
|
|
56
59
|
const source = tree.read('/projects/app/src/app/_shared/components/index.ts')!.toString('utf-8');
|
|
@@ -72,7 +75,7 @@ describe('AtomicComponent Schematics', () => {
|
|
|
72
75
|
tree = await createNxWorkspace(runner, tree);
|
|
73
76
|
});
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
xit('', async () => {
|
|
76
79
|
const options = {project: 'app', name: '_shared/components/extras/example'};
|
|
77
80
|
// const options = {project: 'app', path: '_shared/components/extras', name: 'example'};
|
|
78
81
|
const { files } = await runner.runSchematicAsync('atomic-component', options, tree).toPromise();
|