ui-lib-starter 0.0.6 → 0.0.7
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/schematics/cva-component/cva-component.schema.ts +4 -0
- package/schematics/cva-component/index.ts +26 -0
- package/schematics/cva-component/index_spec.ts +14 -0
- package/schematics/schematics/index.ts +10 -0
- package/schematics/schematics/index_spec.ts +14 -0
- package/schematics/collection.json +0 -15
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apply,
|
|
3
|
+
applyTemplates,
|
|
4
|
+
mergeWith,
|
|
5
|
+
move,
|
|
6
|
+
Rule,
|
|
7
|
+
strings,
|
|
8
|
+
url,
|
|
9
|
+
} from '@angular-devkit/schematics';
|
|
10
|
+
import { cvaComponentSchema } from './cva-component.schema';
|
|
11
|
+
|
|
12
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
13
|
+
// per file.
|
|
14
|
+
export function cvaComponent(options: cvaComponentSchema): Rule {
|
|
15
|
+
return (_tree, _context) => {
|
|
16
|
+
const templateSource = apply(url('./files'), [
|
|
17
|
+
applyTemplates({
|
|
18
|
+
...strings,
|
|
19
|
+
...options,
|
|
20
|
+
}),
|
|
21
|
+
move(`/${options.path}/${strings.dasherize(options.name)}`),
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
return mergeWith(templateSource);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
|
|
5
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
6
|
+
|
|
7
|
+
describe('cva-component', () => {
|
|
8
|
+
it('works', async () => {
|
|
9
|
+
const runner = new SchematicTestRunner('schematics', collectionPath);
|
|
10
|
+
const tree = await runner.runSchematic('cva-component', {}, Tree.empty());
|
|
11
|
+
|
|
12
|
+
expect(tree.files).toEqual([]);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
5
|
+
// per file.
|
|
6
|
+
export function schematics(_options: any): Rule {
|
|
7
|
+
return (tree: Tree, _context: SchematicContext) => {
|
|
8
|
+
return tree;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
|
|
5
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
6
|
+
|
|
7
|
+
describe('schematics', () => {
|
|
8
|
+
it('works', async () => {
|
|
9
|
+
const runner = new SchematicTestRunner('schematics', collectionPath);
|
|
10
|
+
const tree = await runner.runSchematic('schematics', {}, Tree.empty());
|
|
11
|
+
|
|
12
|
+
expect(tree.files).toEqual([]);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
-
"schematics": {
|
|
4
|
-
"schematics": {
|
|
5
|
-
"description": "A blank schematic.",
|
|
6
|
-
"factory": "./schematics/index#schematics"
|
|
7
|
-
},
|
|
8
|
-
"cva-component": {
|
|
9
|
-
"description": "This schematic generates CVA component.",
|
|
10
|
-
"factory": "./cva-component/index#cvaComponent",
|
|
11
|
-
"schema": "./cva-component/schema.json",
|
|
12
|
-
"aliases": ["cc"]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|