ng-alain 15.1.0 → 15.2.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.
@@ -51,28 +51,24 @@ describe('NgAlainSchematic: application', () => {
51
51
  key2: 'KEY2'
52
52
  });
53
53
  const baseRunner = createNgRunner();
54
- const workspaceTree = await baseRunner
55
- .runSchematicAsync('workspace', {
56
- name: 'workspace',
57
- newProjectRoot: 'projects',
58
- version: '6.0.0'
59
- })
60
- .toPromise();
61
- const appTree = await baseRunner
62
- .runSchematicAsync(
63
- 'application',
64
- {
65
- name: APPNAME,
66
- inlineStyle: false,
67
- inlineTemplate: false,
68
- routing: false,
69
- style: 'css',
70
- skipTests: false,
71
- skipPackageJson: false
72
- },
73
- workspaceTree
74
- )
75
- .toPromise();
54
+ const workspaceTree = await baseRunner.runSchematic('workspace', {
55
+ name: 'workspace',
56
+ newProjectRoot: 'projects',
57
+ version: '6.0.0'
58
+ });
59
+ const appTree = await baseRunner.runSchematic(
60
+ 'application',
61
+ {
62
+ name: APPNAME,
63
+ inlineStyle: false,
64
+ inlineTemplate: false,
65
+ routing: false,
66
+ style: 'css',
67
+ skipTests: false,
68
+ skipPackageJson: false
69
+ },
70
+ workspaceTree
71
+ );
76
72
  appTree.create(
77
73
  '/demo.html',
78
74
  `
@@ -86,16 +82,14 @@ describe('NgAlainSchematic: application', () => {
86
82
  );
87
83
 
88
84
  const alainRunner = createAlainRunner();
89
- const tree = await alainRunner
90
- .runSchematicAsync(
91
- 'ng-add',
92
- {
93
- skipPackageJson: false,
94
- defaultLanguage: 'zh'
95
- },
96
- appTree
97
- )
98
- .toPromise();
85
+ const tree = await alainRunner.runSchematic(
86
+ 'ng-add',
87
+ {
88
+ skipPackageJson: false,
89
+ defaultLanguage: 'zh'
90
+ },
91
+ appTree
92
+ );
99
93
 
100
94
  const res = tree.readContent('/demo.html');
101
95
  expect(res).toBe(`
@@ -8,7 +8,7 @@ describe('Schematic: curd', () => {
8
8
 
9
9
  beforeEach(async () => {
10
10
  ({ runner, tree } = await createAlainAndModuleApp());
11
- tree = await runner.runSchematicAsync('curd', { name: 'list', module: 'trade' }, tree).toPromise();
11
+ tree = await runner.runSchematic('curd', { name: 'list', module: 'trade' }, tree);
12
12
  });
13
13
 
14
14
  it('should be generate list page', () => {
@@ -12,7 +12,7 @@ describe('Schematic: edit', () => {
12
12
 
13
13
  beforeEach(async () => {
14
14
  ({ runner, tree } = await createAlainAndModuleApp());
15
- tree = await runner.runSchematicAsync('edit', { name: 'edit', module: 'trade' }, tree).toPromise();
15
+ tree = await runner.runSchematic('edit', { name: 'edit', module: 'trade' }, tree);
16
16
  });
17
17
 
18
18
  it('should be generate list page', () => {
@@ -17,38 +17,34 @@ describe('Schematic: empty', () => {
17
17
  });
18
18
 
19
19
  it('should be generate list page', async () => {
20
- tree = await runner.runSchematicAsync('empty', { name: 'list', module: 'trade' }, tree).toPromise();
20
+ tree = await runner.runSchematic('empty', { name: 'list', module: 'trade' }, tree);
21
21
  [modulePath, routingPath, tsPath, htmlPath].forEach(path => expect(tree.exists(path)).toBe(true));
22
22
  expect(tree.exists(servicePath)).toBe(false);
23
23
  });
24
24
 
25
25
  it('should be has import code', async () => {
26
- tree = await runner.runSchematicAsync('empty', { name: 'list', module: 'trade' }, tree).toPromise();
26
+ tree = await runner.runSchematic('empty', { name: 'list', module: 'trade' }, tree);
27
27
  expect(tree.readContent(modulePath)).toContain(`import { TradeListComponent } from './list/list.component';`);
28
28
  });
29
29
 
30
30
  it('should be include module name in component name', async () => {
31
- tree = await runner.runSchematicAsync('empty', { name: 'list', module: 'trade' }, tree).toPromise();
31
+ tree = await runner.runSchematic('empty', { name: 'list', module: 'trade' }, tree);
32
32
  expect(tree.readContent(tsPath)).toContain(`TradeListComponent`);
33
33
  });
34
34
 
35
35
  it('shuold be exclude style', async () => {
36
- tree = await runner.runSchematicAsync('empty', { name: 'list', module: 'trade' }, tree).toPromise();
36
+ tree = await runner.runSchematic('empty', { name: 'list', module: 'trade' }, tree);
37
37
  expect(tree.readContent(tsPath)).not.toContain(`styleUrls`);
38
38
  });
39
39
 
40
40
  it('shuold be include service', async () => {
41
- tree = await runner
42
- .runSchematicAsync('empty', { name: 'list', module: 'trade', service: 'none' }, tree)
43
- .toPromise();
41
+ tree = await runner.runSchematic('empty', { name: 'list', module: 'trade', service: 'none' }, tree);
44
42
  expect(tree.readContent(servicePath)).toContain(`@Injectable()`);
45
43
  expect(tree.readContent(modulePath)).toContain(`TradeService`);
46
44
  });
47
45
 
48
46
  it('shuold be include root service', async () => {
49
- tree = await runner
50
- .runSchematicAsync('empty', { name: 'list', module: 'trade', service: 'root' }, tree)
51
- .toPromise();
47
+ tree = await runner.runSchematic('empty', { name: 'list', module: 'trade', service: 'root' }, tree);
52
48
  expect(tree.readContent(servicePath)).toContain(`@Injectable({ providedIn: 'root' })`);
53
49
  });
54
50
  });
@@ -56,8 +52,8 @@ describe('Schematic: empty', () => {
56
52
  describe('ng-alain.json', () => {
57
53
  it('should be specify routesRoot', async () => {
58
54
  const alainJson = { projects: { foo: { routesRoot: 'app/pages' } } };
59
- ({ runner, tree } = await createAlainAndModuleApp('trade', null, alainJson));
60
- tree = await runner.runSchematicAsync('empty', { name: 'list', module: 'trade' }, tree).toPromise();
55
+ ({ runner, tree } = await createAlainAndModuleApp('trade', undefined, alainJson));
56
+ tree = await runner.runSchematic('empty', { name: 'list', module: 'trade' }, tree);
61
57
  expect(tree.exists('/projects/foo/src/app/pages/trade/trade.module.ts')).toBe(true);
62
58
  });
63
59
  });
@@ -14,7 +14,7 @@ describe('Schematic: list', () => {
14
14
  beforeEach(async () => {
15
15
  ({ runner, tree } = await createAlainAndModuleApp());
16
16
 
17
- tree = await runner.runSchematicAsync('list', { name: 'list', module: 'trade' }, tree).toPromise();
17
+ tree = await runner.runSchematic('list', { name: 'list', module: 'trade' }, tree);
18
18
  });
19
19
 
20
20
  it('should be generate list page', () => {
@@ -34,9 +34,7 @@ describe('Schematic: list', () => {
34
34
  });
35
35
 
36
36
  it('should be support targets (like: list/edit)', async () => {
37
- tree = await runner
38
- .runSchematicAsync('list', { name: 'list2', module: 'trade', target: 'list/edit' }, tree)
39
- .toPromise();
37
+ tree = await runner.runSchematic('list', { name: 'list2', module: 'trade', target: 'list/edit' }, tree);
40
38
  expect(tree.exists(`/projects/foo/src/app/routes/trade/list/edit/list2/list2.component.html`)).toBe(true);
41
39
  });
42
40
 
@@ -45,7 +43,7 @@ describe('Schematic: list', () => {
45
43
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
44
  spyOn(fs, 'readdirSync').and.returnValue({ length: 1 } as any);
47
45
  try {
48
- tree = await runner.runSchematicAsync('list', { name: 'list', module: 'trade' }, tree).toPromise();
46
+ tree = await runner.runSchematic('list', { name: 'list', module: 'trade' }, tree);
49
47
  expect(true).toBe(false);
50
48
  } catch (e) {
51
49
  expect(e.message).toContain(`already exists`);
@@ -53,7 +51,7 @@ describe('Schematic: list', () => {
53
51
  });
54
52
 
55
53
  it('shuold be include service', async () => {
56
- tree = await runner.runSchematicAsync('list', { name: 'list', module: 'trade', service: 'none' }, tree).toPromise();
54
+ tree = await runner.runSchematic('list', { name: 'list', module: 'trade', service: 'none' }, tree);
57
55
  const servicePath = '/projects/foo/src/app/routes/trade/list/list.service.ts';
58
56
  expect(tree.readContent(servicePath)).toContain(`@Injectable()`);
59
57
  expect(tree.readContent(modulePath)).toContain(`TradeService`);
@@ -17,7 +17,7 @@ describe('NgAlainSchematic: module', () => {
17
17
  });
18
18
 
19
19
  it('should create a module', async () => {
20
- tree = await runner.runSchematicAsync('module', { ...defaultOptions }, tree).toPromise();
20
+ tree = await runner.runSchematic('module', { ...defaultOptions }, tree);
21
21
  expect(tree.files.includes('/projects/foo/src/app/routes/trade/trade.module.ts')).toBe(true);
22
22
  expect(tree.files.includes('/projects/foo/src/app/routes/trade/trade-routing.module.ts')).toBe(true);
23
23
  const routesRoutingModuleContent = tree.readContent(`/projects/foo/src/app/routes/routes-routing.module.ts`);
@@ -27,15 +27,17 @@ describe('NgAlainSchematic: module', () => {
27
27
  });
28
28
 
29
29
  it('should import into another module', async () => {
30
- tree = await runner
31
- .runSchematicAsync('module', { ...defaultOptions, module: 'app.module.ts', path: '/projects/foo/src/app' }, tree)
32
- .toPromise();
30
+ tree = await runner.runSchematic(
31
+ 'module',
32
+ { ...defaultOptions, module: 'app.module.ts', path: '/projects/foo/src/app' },
33
+ tree
34
+ );
33
35
  const content = tree.readContent('/projects/foo/src/app/app.module.ts');
34
36
  expect(content).toContain(`import { TradeModule } from './trade/trade.module';`);
35
37
  });
36
38
 
37
39
  it('shuold be include service', async () => {
38
- tree = await runner.runSchematicAsync('module', { ...defaultOptions, service: 'none' }, tree).toPromise();
40
+ tree = await runner.runSchematic('module', { ...defaultOptions, service: 'none' }, tree);
39
41
  const content = tree.readContent('/projects/foo/src/app/routes/trade/trade.service.ts');
40
42
  const contentModule = tree.readContent('/projects/foo/src/app/routes/trade/trade.module.ts');
41
43
  expect(content).toContain(`@Injectable()`);
@@ -44,7 +46,7 @@ describe('NgAlainSchematic: module', () => {
44
46
  });
45
47
 
46
48
  it('shuold be include root service', async () => {
47
- tree = await runner.runSchematicAsync('module', { ...defaultOptions, service: 'root' }, tree).toPromise();
49
+ tree = await runner.runSchematic('module', { ...defaultOptions, service: 'root' }, tree);
48
50
  const content = tree.readContent('/projects/foo/src/app/routes/trade/trade.service.ts');
49
51
  expect(content).toContain(`@Injectable({ providedIn: 'root' })`);
50
52
  expect(content).toContain(`TradeService`);
@@ -15,6 +15,6 @@ describe('Schematic: ng-update: v15Rule', () => {
15
15
  logs.length = 0;
16
16
  runner = new SchematicTestRunner('schematics', migrationCollection);
17
17
  runner.logger.subscribe(e => logs.push(e.message));
18
- await runner.runSchematicAsync('migration-v15', {}, tree).toPromise();
18
+ await runner.runSchematic('migration-v15', {}, tree);
19
19
  }
20
20
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-alain",
3
- "version": "15.1.0",
3
+ "version": "15.2.0",
4
4
  "description": "Schematics specific to ng-alain",
5
5
  "author": "cipchk<cipchk@qq.com>",
6
6
  "license": "MIT",
@@ -10,9 +10,7 @@ describe('NgAlainSchematic: plugin', () => {
10
10
 
11
11
  it('should be throw error when not find plugin name', async () => {
12
12
  try {
13
- await runner
14
- .runSchematicAsync('plugin', { name: 'invalid-name', type: 'remove', packageManager: 'npm' }, tree)
15
- .toPromise();
13
+ await runner.runSchematic('plugin', { name: 'invalid-name', type: 'remove', packageManager: 'npm' }, tree);
16
14
  expect(true).toBe(false);
17
15
  } catch {
18
16
  expect(true).toBe(true);
@@ -17,7 +17,7 @@ describe('NgAlainSchematic: plugin: codeStyle', () => {
17
17
  });
18
18
 
19
19
  describe('when remove', () => {
20
- beforeEach(async () => runner.runSchematicAsync('plugin', { name: 'codeStyle', type: 'remove' }, tree).toPromise());
20
+ beforeEach(async () => runner.runSchematic('plugin', { name: 'codeStyle', type: 'remove' }, tree));
21
21
 
22
22
  it(`should remove precommit`, () => {
23
23
  const json = JSON.parse(tree.readContent('package.json'));
@@ -18,9 +18,7 @@ describe('NgAlainSchematic: plugin: default-language', () => {
18
18
  });
19
19
 
20
20
  it('should be from en to zh', async () => {
21
- await runner
22
- .runSchematicAsync('plugin', { name: 'defaultLanguage', type: 'add', defaultLanguage: 'zh' }, tree)
23
- .toPromise();
21
+ await runner.runSchematic('plugin', { name: 'defaultLanguage', type: 'add', defaultLanguage: 'zh' }, tree);
24
22
  const content = tree.readContent(PATH);
25
23
  expect(content).toContain(`@angular/common/locales/zh`);
26
24
  expect(content).toContain(`NZ_I18N, zh_CN`);
@@ -8,7 +8,7 @@ describe('NgAlainSchematic: plugin: docker', () => {
8
8
 
9
9
  beforeEach(async () => {
10
10
  ({ runner, tree } = await createAlainApp());
11
- tree = await runner.runSchematicAsync('plugin', { name: 'docker', type: 'add' }, tree).toPromise();
11
+ tree = await runner.runSchematic('plugin', { name: 'docker', type: 'add' }, tree);
12
12
  });
13
13
 
14
14
  describe('when add', () => {
@@ -21,10 +21,7 @@ describe('NgAlainSchematic: plugin: docker', () => {
21
21
  });
22
22
 
23
23
  describe('when remove', () => {
24
- beforeEach(
25
- async () =>
26
- (tree = await runner.runSchematicAsync('plugin', { name: 'docker', type: 'remove' }, tree).toPromise())
27
- );
24
+ beforeEach(async () => (tree = await runner.runSchematic('plugin', { name: 'docker', type: 'remove' }, tree)));
28
25
  it(`should add fiels`, () => {
29
26
  expect(tree.exists(`/projects/${APPNAME}/.dockerignore`)).toBe(false);
30
27
  expect(tree.exists(`/projects/${APPNAME}/docker-compose.yml`)).toBe(false);
@@ -49,7 +49,7 @@ describe('NgAlainSchematic: plugin: icon', () => {
49
49
  beforeEach(async () => {
50
50
  ({ runner, tree } = await createAlainApp());
51
51
  Object.keys(testCases).forEach(name => tree.create(`/projects/foo/src/${name}`, testCases[name]));
52
- tree = await runner.runSchematicAsync('plugin', { name: 'icon', type: 'add' }, tree).toPromise();
52
+ tree = await runner.runSchematic('plugin', { name: 'icon', type: 'add' }, tree);
53
53
  });
54
54
 
55
55
  it(`should working`, () => {
@@ -20,9 +20,7 @@ describe('NgAlainSchematic: plugin: networkEnv', () => {
20
20
 
21
21
  describe('when remove', () => {
22
22
  beforeEach(async () =>
23
- runner
24
- .runSchematicAsync('plugin', { name: 'networkEnv', type: 'remove', packageManager: 'npm' }, tree)
25
- .toPromise()
23
+ runner.runSchematic('plugin', { name: 'networkEnv', type: 'remove', packageManager: 'npm' }, tree)
26
24
  );
27
25
 
28
26
  it(`should remove .npmrc`, () => {
@@ -45,9 +43,7 @@ describe('NgAlainSchematic: plugin: networkEnv', () => {
45
43
 
46
44
  describe('when remove', () => {
47
45
  beforeEach(async () =>
48
- runner
49
- .runSchematicAsync('plugin', { name: 'networkEnv', type: 'remove', packageManager: 'yarn' }, tree)
50
- .toPromise()
46
+ runner.runSchematic('plugin', { name: 'networkEnv', type: 'remove', packageManager: 'yarn' }, tree)
51
47
  );
52
48
 
53
49
  it(`should remove .yarnrc`, () => {
@@ -8,7 +8,7 @@ describe('NgAlainSchematic: plugin: rtl', () => {
8
8
 
9
9
  beforeEach(async () => {
10
10
  ({ runner, tree } = await createAlainApp());
11
- tree = await runner.runSchematicAsync('plugin', { name: 'rtl', type: 'add' }, tree).toPromise();
11
+ tree = await runner.runSchematic('plugin', { name: 'rtl', type: 'add' }, tree);
12
12
  });
13
13
 
14
14
  it(`should be working`, () => {
@@ -8,7 +8,7 @@ describe('NgAlainSchematic: plugin: sts', () => {
8
8
 
9
9
  beforeEach(async () => {
10
10
  ({ runner, tree } = await createAlainApp());
11
- tree = await runner.runSchematicAsync('plugin', { name: 'sts', type: 'add' }, tree).toPromise();
11
+ tree = await runner.runSchematic('plugin', { name: 'sts', type: 'add' }, tree);
12
12
  });
13
13
 
14
14
  describe('when add', () => {
@@ -30,9 +30,7 @@ describe('NgAlainSchematic: plugin: sts', () => {
30
30
  });
31
31
 
32
32
  describe('when remove', () => {
33
- beforeEach(
34
- async () => (tree = await runner.runSchematicAsync('plugin', { name: 'sts', type: 'remove' }, tree).toPromise())
35
- );
33
+ beforeEach(async () => (tree = await runner.runSchematic('plugin', { name: 'sts', type: 'remove' }, tree)));
36
34
  it(`should add fiels`, () => {
37
35
  const json = JSON.parse(tree.readContent('package.json'));
38
36
  expect(json.devDependencies['ng-alain-sts']).not.toBeDefined();
package/sta/index.spec.ts CHANGED
@@ -41,7 +41,7 @@ describe('Schematic: sta', () => {
41
41
  let tree: UnitTestTree;
42
42
 
43
43
  async function run(): Promise<void> {
44
- tree = await runner.runSchematicAsync('sta', { spec: SPEC }, tree).toPromise();
44
+ tree = await runner.runSchematic('sta', { spec: SPEC }, tree);
45
45
  }
46
46
 
47
47
  beforeEach(async () => ({ runner, tree } = await createAlainAndModuleApp()));
@@ -56,7 +56,7 @@ describe('Schematic: sta', () => {
56
56
  });
57
57
 
58
58
  it('#tagsMapping', async () => {
59
- tree = await runner.runSchematicAsync('sta', { spec: SPEC, tagsMapping: { user: 'AA' } }, tree).toPromise();
59
+ tree = await runner.runSchematic('sta', { spec: SPEC, tagsMapping: { user: 'AA' } }, tree);
60
60
  const newModulePath = '/projects/foo/src/app/_sta/AA/service.ts';
61
61
  expect(tree.exists(newModulePath)).toBe(true);
62
62
  expect(tree.readContent(newModulePath)).toContain(`export class AaService`);
package/tpl/index.spec.ts CHANGED
@@ -10,7 +10,7 @@ describe('Schematic: tpl', () => {
10
10
  let tree: UnitTestTree;
11
11
 
12
12
  async function run(): Promise<void> {
13
- tree = await runner.runSchematicAsync('tpl', { name: 'edit', module: 'trade', modal: true }, tree).toPromise();
13
+ tree = await runner.runSchematic('tpl', { name: 'edit', module: 'trade', modal: true }, tree);
14
14
  }
15
15
 
16
16
  beforeEach(async () => ({ runner, tree } = await createAlainAndModuleApp()));
@@ -27,20 +27,16 @@ const COMPONENTS = [Components...];
27
27
 
28
28
  describe('#withoutModulePrefixInComponentName', () => {
29
29
  it('with true', async () => {
30
- tree = await runner
31
- .runSchematicAsync(
32
- 'empty',
33
- { name: 'list', module: 'trade', withoutModulePrefixInComponentName: true } as CommonSchema,
34
- tree
35
- )
36
- .toPromise();
30
+ tree = await runner.runSchematic(
31
+ 'empty',
32
+ { name: 'list', module: 'trade', withoutModulePrefixInComponentName: true } as CommonSchema,
33
+ tree
34
+ );
37
35
  const listTsCon = tree.readContent(`/projects/foo/src/app/routes/trade/list/list.component.ts`);
38
36
  expect(listTsCon).toContain(`ListComponent`);
39
37
  });
40
38
  it('with false', async () => {
41
- tree = await runner
42
- .runSchematicAsync('empty', { name: 'list', module: 'trade' } as CommonSchema, tree)
43
- .toPromise();
39
+ tree = await runner.runSchematic('empty', { name: 'list', module: 'trade' } as CommonSchema, tree);
44
40
  const listTsCon = tree.readContent(`/projects/foo/src/app/routes/trade/list/list.component.ts`);
45
41
  expect(listTsCon).toContain(`TradeListComponent`);
46
42
  });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZORROVERSION = exports.VERSION = void 0;
4
- exports.VERSION = '^15.1.0';
5
- exports.ZORROVERSION = '^15.0.3';
4
+ exports.VERSION = '^15.2.0';
5
+ exports.ZORROVERSION = '^15.1.0';
6
6
  //# sourceMappingURL=lib-versions.js.map
@@ -1,2 +1,2 @@
1
- export const VERSION = '^15.1.0';
2
- export const ZORROVERSION = '^15.0.3';
1
+ export const VERSION = '^15.2.0';
2
+ export const ZORROVERSION = '^15.1.0';
package/utils/testing.js CHANGED
@@ -29,15 +29,12 @@ exports.createAlainRunner = createAlainRunner;
29
29
  function createAlainApp(ngAddOptions) {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
31
  const baseRunner = createNgRunner();
32
- const workspaceTree = yield baseRunner
33
- .runSchematicAsync('workspace', {
32
+ const workspaceTree = yield baseRunner.runSchematic('workspace', {
34
33
  name: 'workspace',
35
34
  newProjectRoot: 'projects',
36
35
  version: '8.0.0'
37
- })
38
- .toPromise();
39
- const appTree = yield baseRunner
40
- .runSchematicAsync('application', {
36
+ });
37
+ const appTree = yield baseRunner.runSchematic('application', {
41
38
  name: exports.APPNAME,
42
39
  inlineStyle: false,
43
40
  inlineTemplate: false,
@@ -45,12 +42,9 @@ function createAlainApp(ngAddOptions) {
45
42
  style: 'css',
46
43
  skipTests: false,
47
44
  skipPackageJson: false
48
- }, workspaceTree)
49
- .toPromise();
45
+ }, workspaceTree);
50
46
  const alainRunner = createAlainRunner();
51
- const tree = yield alainRunner
52
- .runSchematicAsync('ng-add', Object.assign({ skipPackageJson: false }, ngAddOptions), appTree)
53
- .toPromise();
47
+ const tree = yield alainRunner.runSchematic('ng-add', Object.assign({ skipPackageJson: false }, ngAddOptions), appTree);
54
48
  return { runner: alainRunner, tree };
55
49
  });
56
50
  }
@@ -61,9 +55,7 @@ function createAlainAndModuleApp(name = 'trade', ngAddOptions, alainData) {
61
55
  if (alainData != null) {
62
56
  res.tree.create('ng-alain.json', JSON.stringify(alainData));
63
57
  }
64
- res.tree = yield res.runner
65
- .runSchematicAsync('module', { name, project: exports.APPNAME, routing: true }, res.tree)
66
- .toPromise();
58
+ res.tree = yield res.runner.runSchematic('module', { name, project: exports.APPNAME, routing: true }, res.tree);
67
59
  return res;
68
60
  });
69
61
  }
@@ -71,15 +63,12 @@ exports.createAlainAndModuleApp = createAlainAndModuleApp;
71
63
  function createTestApp() {
72
64
  return __awaiter(this, void 0, void 0, function* () {
73
65
  const runner = yield createNgRunner();
74
- const workspaceTree = yield runner
75
- .runSchematicAsync('workspace', {
66
+ const workspaceTree = yield runner.runSchematic('workspace', {
76
67
  name: 'workspace',
77
68
  newProjectRoot: 'projects',
78
69
  version: '8.0.0'
79
- })
80
- .toPromise();
81
- const appTree = yield runner
82
- .runSchematicAsync('application', {
70
+ });
71
+ const appTree = yield runner.runSchematic('application', {
83
72
  name: exports.APPNAME,
84
73
  inlineStyle: false,
85
74
  inlineTemplate: false,
@@ -87,8 +76,7 @@ function createTestApp() {
87
76
  style: 'css',
88
77
  skipTests: false,
89
78
  skipPackageJson: false
90
- }, workspaceTree)
91
- .toPromise();
79
+ }, workspaceTree);
92
80
  return { runner, tree: appTree };
93
81
  });
94
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../schematics/utils/testing.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAuF;AACvF,+BAA4B;AAI5B,8DAA8D;AACjD,QAAA,cAAc,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;AAEvE,oEAAoE;AACvD,QAAA,mBAAmB,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAE9D,QAAA,OAAO,GAAG,KAAK,CAAC;AAChB,QAAA,WAAW,GAAG,aAAa,eAAO,EAAE,CAAC;AAOlD,SAAgB,cAAc;IAC5B,OAAO,IAAI,6BAAmB,CAAC,YAAY,EAAE,IAAA,WAAI,EAAC,oDA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ACrB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;SAC7D;QACD,GAAG,CAAC,IAAI,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,eAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QACxG,OAAO,GAAG,CAAC;IACb,CAAC;CAAA;AAXD,0DAWC;AAED,SAAsB,aAAa;;QACjC,MAAM,MAAM,GAAG,MAAM,cAAc,EAAE,CAAC;QACtC,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE;YAC3D,IAAI,EAAE,WAAW;YACjB,cAAc,EAAE,UAAU;YAC1B,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,CACvC,aAAa,EACb;YACE,IAAI,EAAE,eAAO;YACb,WAAW,EAAE,KAAK;YAClB,cAAc,EAAE,KAAK;YACrB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,KAAK;YAChB,eAAe,EAAE,KAAK;SACvB,EACD,aAAa,CACd,CAAC;QACF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACnC,CAAC;CAAA;AArBD,sCAqBC"}
package/utils/testing.ts CHANGED
@@ -27,39 +27,33 @@ export function createAlainRunner(): SchematicTestRunner {
27
27
 
28
28
  export async function createAlainApp(ngAddOptions?: NgAddSchema): Promise<AppResult> {
29
29
  const baseRunner = createNgRunner();
30
- const workspaceTree = await baseRunner
31
- .runSchematicAsync('workspace', {
32
- name: 'workspace',
33
- newProjectRoot: 'projects',
34
- version: '8.0.0'
35
- })
36
- .toPromise();
37
- const appTree = await baseRunner
38
- .runSchematicAsync(
39
- 'application',
40
- {
41
- name: APPNAME,
42
- inlineStyle: false,
43
- inlineTemplate: false,
44
- routing: false,
45
- style: 'css',
46
- skipTests: false,
47
- skipPackageJson: false
48
- },
49
- workspaceTree
50
- )
51
- .toPromise();
30
+ const workspaceTree = await baseRunner.runSchematic('workspace', {
31
+ name: 'workspace',
32
+ newProjectRoot: 'projects',
33
+ version: '8.0.0'
34
+ });
35
+ const appTree = await baseRunner.runSchematic(
36
+ 'application',
37
+ {
38
+ name: APPNAME,
39
+ inlineStyle: false,
40
+ inlineTemplate: false,
41
+ routing: false,
42
+ style: 'css',
43
+ skipTests: false,
44
+ skipPackageJson: false
45
+ },
46
+ workspaceTree
47
+ );
52
48
  const alainRunner = createAlainRunner();
53
- const tree = await alainRunner
54
- .runSchematicAsync(
55
- 'ng-add',
56
- {
57
- skipPackageJson: false,
58
- ...ngAddOptions
59
- },
60
- appTree
61
- )
62
- .toPromise();
49
+ const tree = await alainRunner.runSchematic(
50
+ 'ng-add',
51
+ {
52
+ skipPackageJson: false,
53
+ ...ngAddOptions
54
+ },
55
+ appTree
56
+ );
63
57
  return { runner: alainRunner, tree };
64
58
  }
65
59
 
@@ -72,35 +66,29 @@ export async function createAlainAndModuleApp(
72
66
  if (alainData != null) {
73
67
  res.tree.create('ng-alain.json', JSON.stringify(alainData));
74
68
  }
75
- res.tree = await res.runner
76
- .runSchematicAsync('module', { name, project: APPNAME, routing: true }, res.tree)
77
- .toPromise();
69
+ res.tree = await res.runner.runSchematic('module', { name, project: APPNAME, routing: true }, res.tree);
78
70
  return res;
79
71
  }
80
72
 
81
73
  export async function createTestApp(): Promise<{ runner: SchematicTestRunner; tree: UnitTestTree }> {
82
74
  const runner = await createNgRunner();
83
- const workspaceTree = await runner
84
- .runSchematicAsync('workspace', {
85
- name: 'workspace',
86
- newProjectRoot: 'projects',
87
- version: '8.0.0'
88
- })
89
- .toPromise();
90
- const appTree = await runner
91
- .runSchematicAsync(
92
- 'application',
93
- {
94
- name: APPNAME,
95
- inlineStyle: false,
96
- inlineTemplate: false,
97
- routing: false,
98
- style: 'css',
99
- skipTests: false,
100
- skipPackageJson: false
101
- },
102
- workspaceTree
103
- )
104
- .toPromise();
75
+ const workspaceTree = await runner.runSchematic('workspace', {
76
+ name: 'workspace',
77
+ newProjectRoot: 'projects',
78
+ version: '8.0.0'
79
+ });
80
+ const appTree = await runner.runSchematic(
81
+ 'application',
82
+ {
83
+ name: APPNAME,
84
+ inlineStyle: false,
85
+ inlineTemplate: false,
86
+ routing: false,
87
+ style: 'css',
88
+ skipTests: false,
89
+ skipPackageJson: false
90
+ },
91
+ workspaceTree
92
+ );
105
93
  return { runner, tree: appTree };
106
94
  }
package/utils/versions.js CHANGED
@@ -43,7 +43,7 @@ function UpgradeMainVersions(tree, version = lib_versions_1.VERSION) {
43
43
  `@angular/language-service@^15.1.0`,
44
44
  `@delon/testing@${version}`
45
45
  ], 'devDependencies');
46
- (0, package_1.addPackage)(tree, [`rxjs@~7.8.0`, `ng-zorro-antd@^15.0.3`]);
46
+ (0, package_1.addPackage)(tree, [`rxjs@~7.8.0`, `ng-zorro-antd@^15.1.0`]);
47
47
  }
48
48
  exports.UpgradeMainVersions = UpgradeMainVersions;
49
49
  function addESLintRule(context, showLog = true) {
package/utils/versions.ts CHANGED
@@ -41,7 +41,7 @@ export function UpgradeMainVersions(tree: Tree, version: string = VERSION): void
41
41
  ],
42
42
  'devDependencies'
43
43
  );
44
- addPackage(tree, [`rxjs@~7.8.0`, `ng-zorro-antd@^15.0.3`]);
44
+ addPackage(tree, [`rxjs@~7.8.0`, `ng-zorro-antd@^15.1.0`]);
45
45
  }
46
46
 
47
47
  export function addESLintRule(context: SchematicContext, showLog: Boolean = true): Rule {
@@ -12,7 +12,7 @@ describe('Schematic: view', () => {
12
12
 
13
13
  beforeEach(async () => {
14
14
  ({ runner, tree } = await createAlainAndModuleApp());
15
- tree = await runner.runSchematicAsync('view', { name: 'view', module: 'trade' }, tree).toPromise();
15
+ tree = await runner.runSchematic('view', { name: 'view', module: 'trade' }, tree);
16
16
  });
17
17
 
18
18
  it('should be generate list page', () => {
@@ -24,7 +24,7 @@ describe('Schematic: view', () => {
24
24
  });
25
25
 
26
26
  it('should support a.b.c module name', async () => {
27
- tree = await runner.runSchematicAsync('view', { name: 'view', module: 'trade', target: 'list' }, tree).toPromise();
27
+ tree = await runner.runSchematic('view', { name: 'view', module: 'trade', target: 'list' }, tree);
28
28
  expect(tree.exists('/projects/foo/src/app/routes/trade/list/view/view.component.ts')).toBe(true);
29
29
  });
30
30
  });