@ngx-formly/schematics 5.10.22 → 6.0.0-next.2

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.
Files changed (41) hide show
  1. package/.browserslistrc +16 -0
  2. package/README.md +4 -2
  3. package/package.json +15 -29
  4. package/src/collection.json +3 -9
  5. package/src/ng-add/index.js +24 -17
  6. package/src/ng-add/index.js.map +1 -1
  7. package/src/ng-add/index.spec.js +26 -25
  8. package/src/ng-add/index.spec.js.map +1 -1
  9. package/src/ng-add/schema.json +2 -2
  10. package/{tsconfig.json → tsconfig.lib.json} +2 -3
  11. package/utils/ast.d.ts +1 -1
  12. package/utils/ast.js +7 -6
  13. package/utils/ast.js.map +1 -1
  14. package/utils/lib-versions.js +1 -0
  15. package/utils/lib-versions.js.map +1 -1
  16. package/utils/package.js +1 -0
  17. package/utils/package.js.map +1 -1
  18. package/utils/testing.d.ts +1 -1
  19. package/utils/testing.js +20 -4
  20. package/utils/testing.js.map +1 -1
  21. package/src/ng-add/index_spec.d.ts +0 -1
  22. package/src/ng-add/index_spec.js +0 -100
  23. package/src/ng-add/index_spec.js.map +0 -1
  24. package/src/wrapper-component/files/__name@dasherize@if-flat__/__name@dasherize__.component.__styleext__ +0 -0
  25. package/src/wrapper-component/files/__name@dasherize@if-flat__/__name@dasherize__.component.html +0 -4
  26. package/src/wrapper-component/index.d.ts +0 -10
  27. package/src/wrapper-component/index.js +0 -23
  28. package/src/wrapper-component/index.js.map +0 -1
  29. package/src/wrapper-component/index.spec.d.ts +0 -1
  30. package/src/wrapper-component/index.spec.js +0 -66
  31. package/src/wrapper-component/index.spec.js.map +0 -1
  32. package/src/wrapper-component/index_spec.d.ts +0 -1
  33. package/src/wrapper-component/index_spec.js +0 -55
  34. package/src/wrapper-component/index_spec.js.map +0 -1
  35. package/src/wrapper-component/schema.d.ts +0 -3
  36. package/src/wrapper-component/schema.js +0 -3
  37. package/src/wrapper-component/schema.js.map +0 -1
  38. package/src/wrapper-component/schema.json +0 -109
  39. package/utils/html.d.ts +0 -18
  40. package/utils/html.js +0 -60
  41. package/utils/html.js.map +0 -1
@@ -0,0 +1,16 @@
1
+ # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
+ # For additional information regarding the format and rule options, please see:
3
+ # https://github.com/browserslist/browserslist#queries
4
+
5
+ # For the full list of supported browsers by the Angular framework, please see:
6
+ # https://angular.io/guide/browser-support
7
+
8
+ # You can see what browsers were selected by your queries by running:
9
+ # npx browserslist
10
+
11
+ last 1 Chrome version
12
+ last 1 Firefox version
13
+ last 2 Edge major versions
14
+ last 2 Safari major versions
15
+ last 2 iOS major versions
16
+ Firefox ESR
package/README.md CHANGED
@@ -11,6 +11,7 @@
11
11
  [![Gitter](https://badges.gitter.im/formly-js/ng2-formly.svg)](https://gitter.im/formly-js/ng2-formly)
12
12
  [![Build Status](https://api.travis-ci.org/ngx-formly/ngx-formly.svg?branch=master)](https://api.travis-ci.org/ngx-formly/ngx-formly.svg?branch=master)
13
13
  [![Twitter](https://img.shields.io/badge/twitter-@formlydev-blue.svg)](https://twitter.com/formlydev)
14
+ [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ngx-formly/ngx-formly)
14
15
  </div>
15
16
 
16
17
  ---
@@ -25,7 +26,7 @@ Formly is a dynamic (JSON powered) form library for Angular that bring unmatched
25
26
  - Formly Schema (core)
26
27
  - JSON Schema
27
28
  - 😍 A bunch of themes, out of the box!
28
- - 💪 Build on top of [Angular Reactive Forms](https://angular.io/guide/reactive-forms)
29
+ - 💪 Built on top of [Angular Reactive Forms](https://angular.io/guide/reactive-forms)
29
30
  - 📹 [@eggheadio course](https://egghead.io/playlists/configuration-based-reactive-angular-forms-with-ngx-formly-465f) - 20 lessons & 78 minutes
30
31
 
31
32
  ## Docs
@@ -48,13 +49,14 @@ Formly is a dynamic (JSON powered) form library for Angular that bring unmatched
48
49
  | [Ionic](https://ionicframework.com) | [Demo](https://formly.dev/ui/ionic) | [StackBlitz](https://stackblitz.com/edit/ngx-formly-ui-ionic) |
49
50
  | [PrimeNG](http://primefaces.org/primeng/#/) | [Demo](https://formly.dev/ui/primeng) | [StackBlitz](https://stackblitz.com/edit/ngx-formly-ui-primeng) |
50
51
  | [Kendo](http://www.telerik.com/kendo-angular-ui) | [Demo](https://formly.dev/ui/kendo) | [StackBlitz](https://stackblitz.com/edit/ngx-formly-ui-kendo) |
51
- | [NativeScript](https://www.nativescript.org) | ||
52
52
  | [NG-ZORRO](http://ng.ant.design) | | [StackBlitz](https://stackblitz.com/edit/ngx-formly-ui-ng-zorro-antd) |
53
+ | [NativeScript](https://www.nativescript.org) | ||
53
54
 
54
55
  **Which Version to use?**
55
56
 
56
57
  | Angular version | Formly version |
57
58
  | --------------- | ---------------------- |
59
+ | Angular >= 13 | `@ngx-formly/core@6.x` |
58
60
  | Angular >= 7 | `@ngx-formly/core@5.x` |
59
61
  | Angular >= 6 | `@ngx-formly/core@4.x` |
60
62
  | Angular >= 5 | `@ngx-formly/core@3.x` |
package/package.json CHANGED
@@ -1,40 +1,26 @@
1
1
  {
2
2
  "name": "@ngx-formly/schematics",
3
- "version": "5.10.22",
3
+ "version": "6.0.0-next.2",
4
4
  "license": "MIT",
5
- "homepage": "https://github.com/ngx-formly/ngx-formly#readme",
6
- "description": "ngx-formly is an Angular 2 module which has a Components to help customize and render JavaScript/JSON configured forms. The formly-form Component and the FormlyConfig service are very powerful and bring unmatched maintainability to your application's forms.",
7
- "keywords": [
8
- "angular",
9
- "forms",
10
- "ngx-formly",
11
- "ngx-formly",
12
- "ngx-formly",
13
- "formly",
14
- "angular 2",
15
- "angular 2 forms",
16
- "json forms",
17
- "form library",
18
- "dynamic-forms"
19
- ],
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://github.com/ngx-formly/ngx-formly.git"
23
- },
24
- "bugs": {
25
- "url": "https://github.com/ngx-formly/ngx-formly/issues"
26
- },
27
5
  "scripts": {
28
- "build": "tsc -p tsconfig.json",
29
- "test": "npm run build && jasmine src/**/*_spec.js"
6
+ "build": "tsc -p tsconfig.lib.json"
30
7
  },
31
8
  "schematics": "./src/collection.json",
32
9
  "ng-add": {
33
10
  "save": "devDependencies"
34
11
  },
35
12
  "dependencies": {
36
- "@angular-devkit/core": ">=7.0.0",
37
- "@angular-devkit/schematics": ">=7.0.0",
38
- "@schematics/angular": ">=7.0.0"
13
+ "@angular-devkit/core": "^9.1.9",
14
+ "@angular-devkit/schematics": "^9.1.9",
15
+ "@schematics/angular": "^9.1.9"
16
+ },
17
+ "homepage": "https://github.com/ngx-formly/ngx-formly#readme",
18
+ "description": "Formly is a dynamic (JSON powered) form library for Angular that bring unmatched maintainability to your application's forms.",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/ngx-formly/ngx-formly.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/ngx-formly/ngx-formly/issues"
39
25
  }
40
- }
26
+ }
@@ -3,16 +3,10 @@
3
3
  "extends": ["@schematics/angular"],
4
4
  "schematics": {
5
5
  "ng-add": {
6
- "description": "Adds @ngx-formly to the application without affecting any templates",
7
- "factory": "./ng-add",
6
+ "description": "Installs Angular Formly",
7
+ "factory": "./ng-add/index",
8
8
  "schema": "./ng-add/schema.json",
9
- "aliases": ["init"]
10
- },
11
- "wrapper": {
12
- "aliases": [ "wc" ],
13
- "factory": "./wrapper-component",
14
- "description": "Create an @ngx-formly wrapper component.",
15
- "schema": "./wrapper-component/schema.json"
9
+ "aliases": ["install"]
16
10
  }
17
11
  }
18
12
  }
@@ -1,4 +1,13 @@
1
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const schematics_1 = require("@angular-devkit/schematics");
4
13
  const tasks_1 = require("@angular-devkit/schematics/tasks");
@@ -12,44 +21,42 @@ const package_1 = require("../../utils/package");
12
21
  * - Adds Browser Animation to app.module
13
22
  */
14
23
  function default_1(options) {
15
- return schematics_1.chain([
16
- options && options.skipPackageJson ? schematics_1.noop() : addFormlyToPackageJson(),
24
+ return (0, schematics_1.chain)([
25
+ options && options.skipPackageJson ? (0, schematics_1.noop)() : addFormlyToPackageJson(),
17
26
  addFormlyModuleConfig(options),
18
- options && options.uiTheme ? addUITheme(options) : schematics_1.noop(),
27
+ options && options.uiTheme ? addUITheme(options) : (0, schematics_1.noop)(),
19
28
  ]);
20
29
  }
21
30
  exports.default = default_1;
22
31
  /** Add @angular/forms, @ngx-formly/core to package.json if not already present. */
23
32
  function addFormlyToPackageJson() {
24
33
  return (host, context) => {
25
- package_1.addPackageToPackageJson(host, 'dependencies', '@angular/forms', lib_versions_1.angularVersion);
26
- package_1.addPackageToPackageJson(host, 'dependencies', '@ngx-formly/core', lib_versions_1.ngxFormlyVersion);
34
+ (0, package_1.addPackageToPackageJson)(host, 'dependencies', '@angular/forms', lib_versions_1.angularVersion);
35
+ (0, package_1.addPackageToPackageJson)(host, 'dependencies', '@ngx-formly/core', lib_versions_1.ngxFormlyVersion);
27
36
  context.addTask(new tasks_1.NodePackageInstallTask());
28
37
  return host;
29
38
  };
30
39
  }
31
40
  /** Add formly module to the relative module */
32
41
  function addFormlyModuleConfig(options) {
33
- return (host) => {
34
- const modulePath = ast_1.findModuleFromOptions(host, options);
35
- ast_1.addModuleImportToModule(host, modulePath, 'ReactiveFormsModule', '@angular/forms');
36
- ast_1.addModuleImportToModule(host, modulePath, 'FormlyModule.forRoot({ extras: { lazyRender: true } })', '@ngx-formly/core');
37
- return host;
38
- };
42
+ return (host, context) => __awaiter(this, void 0, void 0, function* () {
43
+ const modulePath = yield (0, ast_1.findModuleFromOptions)(host, options);
44
+ (0, ast_1.addModuleImportToModule)(host, modulePath, 'ReactiveFormsModule', '@angular/forms');
45
+ (0, ast_1.addModuleImportToModule)(host, modulePath, 'FormlyModule.forRoot()', '@ngx-formly/core');
46
+ });
39
47
  }
40
48
  /** Add UI module to app.module */
41
49
  function addUITheme(options) {
42
- return (host, context) => {
43
- const modulePath = ast_1.findModuleFromOptions(host, options);
50
+ return (host, context) => __awaiter(this, void 0, void 0, function* () {
51
+ const modulePath = yield (0, ast_1.findModuleFromOptions)(host, options);
44
52
  const uiTheme = options.uiTheme;
45
53
  if (uiTheme) {
46
- package_1.addPackageToPackageJson(host, 'dependencies', `@ngx-formly/${uiTheme}`, uiTheme === 'ng-zorro-antd' ? '^0.0' : lib_versions_1.ngxFormlyVersion);
54
+ (0, package_1.addPackageToPackageJson)(host, 'dependencies', `@ngx-formly/${uiTheme}`, lib_versions_1.ngxFormlyVersion);
47
55
  // Is this needed if task is added by Formly package call?
48
56
  // context.addTask(new NodePackageInstallTask());
49
- ast_1.addModuleImportToModule(host, modulePath, `Formly${mapUIName(uiTheme)}Module`, `@ngx-formly/${uiTheme}`);
57
+ (0, ast_1.addModuleImportToModule)(host, modulePath, `Formly${mapUIName(uiTheme)}Module`, `@ngx-formly/${uiTheme}`);
50
58
  }
51
- return host;
52
- };
59
+ });
53
60
  }
54
61
  // @TODO: available themes should probably be moved to some config file
55
62
  function mapUIName(uiTheme) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,2DAAuF;AACvF,4DAA0E;AAC1E,yCAAiF;AACjF,2DAA4E;AAC5E,iDAA8D;AAG9D;;;;;GAKG;AACH,mBAAwB,OAAe;IACrC,OAAO,kBAAK,CAAC;QACX,OAAO,IAAI,OAAO,CA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;AACvE,SAAS,SAAS,CAAC,OAAe;IAChC,MAAM,KAAK,GAAiB;QAC1B,SAAS,EAAE,WAAW;QACtB,QAAQ,EAAE,UAAU;QACpB,YAAY,EAAE,cAAc;QAC5B,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,aAAa;KAC/B,CAAC;IAEF,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;AACxB,CAAC"}
@@ -14,26 +14,27 @@ const path_1 = require("path");
14
14
  const test_1 = require("@schematics/angular/utility/test");
15
15
  const testing_2 = require("../../utils/testing");
16
16
  describe('ng-add-schematic', () => {
17
- const collectionPath = path_1.join(__dirname, '../collection.json');
18
- const schematicRunner = new testing_1.SchematicTestRunner('schematics', collectionPath);
19
- const projectPath = testing_2.getTestProjectPath();
17
+ const COLLECTION_PATH = (0, path_1.join)(__dirname, '../collection.json');
18
+ const projectPath = (0, testing_2.getTestProjectPath)();
19
+ let runner;
20
20
  let appTree;
21
21
  beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
22
- appTree = yield testing_2.createWorkspace(schematicRunner, appTree);
22
+ runner = new testing_1.SchematicTestRunner('schematics', COLLECTION_PATH);
23
+ appTree = yield (0, testing_2.createWorkspace)(runner, appTree);
23
24
  }));
24
25
  it('should update package.json', () => __awaiter(void 0, void 0, void 0, function* () {
25
- const tree = yield schematicRunner
26
+ const tree = yield runner
26
27
  .runSchematicAsync('ng-add', {}, appTree)
27
28
  .toPromise();
28
- const packageJson = JSON.parse(test_1.getFileContent(tree, '/package.json'));
29
+ const packageJson = JSON.parse((0, test_1.getFileContent)(tree, '/package.json'));
29
30
  expect(packageJson.dependencies['@angular/forms']).toBeDefined();
30
31
  expect(packageJson.dependencies['@ngx-formly/core']).toBeDefined();
31
32
  }));
32
33
  it('should not add a theme by default to package.json', () => __awaiter(void 0, void 0, void 0, function* () {
33
- const tree = yield schematicRunner
34
+ const tree = yield runner
34
35
  .runSchematicAsync('ng-add', {}, appTree)
35
36
  .toPromise();
36
- const packageJson = JSON.parse(test_1.getFileContent(tree, '/package.json'));
37
+ const packageJson = JSON.parse((0, test_1.getFileContent)(tree, '/package.json'));
37
38
  // @TODO: list of themes should probably be retrieved from some config file
38
39
  ['material', 'bootstrap', 'ionic', 'primeng', 'kendo', 'ng-zorro-antd'].forEach(theme => {
39
40
  expect(packageJson.dependencies[`@ngx-formly/${theme}`]).toBeUndefined();
@@ -41,47 +42,47 @@ describe('ng-add-schematic', () => {
41
42
  }));
42
43
  it('should skip package.json update', () => __awaiter(void 0, void 0, void 0, function* () {
43
44
  const options = { skipPackageJson: true };
44
- const tree = yield schematicRunner
45
+ const tree = yield runner
45
46
  .runSchematicAsync('ng-add', options, appTree)
46
47
  .toPromise();
47
- const packageJson = JSON.parse(test_1.getFileContent(tree, '/package.json'));
48
+ const packageJson = JSON.parse((0, test_1.getFileContent)(tree, '/package.json'));
48
49
  expect(packageJson.dependencies['@ngx-formly/core']).toBeUndefined();
49
50
  }));
50
51
  it('should add to root app module', () => __awaiter(void 0, void 0, void 0, function* () {
51
- const tree = yield schematicRunner
52
+ const tree = yield runner
52
53
  .runSchematicAsync('ng-add', {}, appTree)
53
54
  .toPromise();
54
55
  const content = tree.readContent(`${projectPath}/src/app/app.module.ts`);
55
56
  expect(content).toMatch(
56
- // tslint:disable-next-line:trailing-comma
57
+ // eslint-disable-next-line:trailing-comma
57
58
  /import { FormlyModule } from '@ngx-formly\/core';/);
58
59
  expect(content).toMatch(
59
- // tslint:disable-next-line:trailing-comma
60
+ // eslint-disable-next-line:trailing-comma
60
61
  /FormlyModule.forRoot/);
61
62
  expect(content).toMatch(
62
- // tslint:disable-next-line:trailing-comma
63
+ // eslint-disable-next-line:trailing-comma
63
64
  /import { ReactiveFormsModule } from '@angular\/forms';/);
64
65
  expect(content).toMatch(
65
- // tslint:disable-next-line:trailing-comma
66
+ // eslint-disable-next-line:trailing-comma
66
67
  /ReactiveFormsModule,/);
67
68
  }));
68
69
  it('should add UI theme to package.json', () => __awaiter(void 0, void 0, void 0, function* () {
69
- const tree = yield schematicRunner
70
+ const tree = yield runner
70
71
  .runSchematicAsync('ng-add', { uiTheme: 'bootstrap' }, appTree)
71
72
  .toPromise();
72
- const packageJson = JSON.parse(test_1.getFileContent(tree, '/package.json'));
73
+ const packageJson = JSON.parse((0, test_1.getFileContent)(tree, '/package.json'));
73
74
  expect(packageJson.dependencies['@ngx-formly/bootstrap']).toBeDefined();
74
75
  }));
75
76
  it('should add UI theme to root app module', () => __awaiter(void 0, void 0, void 0, function* () {
76
- const tree = yield schematicRunner
77
+ const tree = yield runner
77
78
  .runSchematicAsync('ng-add', { uiTheme: 'bootstrap' }, appTree)
78
79
  .toPromise();
79
80
  const content = tree.readContent(`${projectPath}/src/app/app.module.ts`);
80
81
  expect(content).toMatch(
81
- // tslint:disable-next-line:trailing-comma
82
+ // eslint-disable-next-line:trailing-comma
82
83
  /import { FormlyBootstrapModule } from '@ngx-formly\/bootstrap';/);
83
84
  expect(content).toMatch(
84
- // tslint:disable-next-line:trailing-comma
85
+ // eslint-disable-next-line:trailing-comma
85
86
  /FormlyBootstrapModule/);
86
87
  }));
87
88
  it('should add to any module', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -96,21 +97,21 @@ describe('ng-add-schematic', () => {
96
97
  })
97
98
  export class FooModule { }
98
99
  `);
99
- const tree = yield schematicRunner
100
+ const tree = yield runner
100
101
  .runSchematicAsync('ng-add', { module: 'app/foo.module.ts' }, appTree)
101
102
  .toPromise();
102
103
  const content = tree.readContent(fooModule);
103
104
  expect(content).toMatch(
104
- // tslint:disable-next-line:trailing-comma
105
+ // eslint-disable-next-line:trailing-comma
105
106
  /import { FormlyModule } from '@ngx-formly\/core';/);
106
107
  expect(content).toMatch(
107
- // tslint:disable-next-line:trailing-comma
108
+ // eslint-disable-next-line:trailing-comma
108
109
  /FormlyModule.forRoot/);
109
110
  expect(content).toMatch(
110
- // tslint:disable-next-line:trailing-comma
111
+ // eslint-disable-next-line:trailing-comma
111
112
  /import { ReactiveFormsModule } from '@angular\/forms';/);
112
113
  expect(content).toMatch(
113
- // tslint:disable-next-line:trailing-comma
114
+ // eslint-disable-next-line:trailing-comma
114
115
  /ReactiveFormsModule,/);
115
116
  }));
116
117
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.spec.js","sourceRoot":"","sources":["index.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gEAAuF;AACvF,+BAA4B;AAC5B,2DAAkE;AAClE,iDAA0E;AAG1E,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,cAAc,GAAG,WAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAC7D,MAAM,eAAe,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAC9E,MAAM,WAAW,GAAG,4BAAkB,EAAE,CAAC;IAEzC,IAAI,OAAqB,CAAC;IAE1B,UAAU,CAAC,GAAS,EAAE;QACpB,OAAO,GAAG,MAAM,yBAAe,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,GAAS,EAAE;QAC1C,MAAM,IAAI,GAAG,MAAM,eAAe;aAC/B,iBAAiB,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,CAAC;aACxC,SAAS,EAAE,CAAC;QAEf,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAc,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;QAEtE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACjE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACrE,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAS,EAAE;QAC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AC1C,sBAAsB,CACvB,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "id": "SchematicsNgxFormlyShell",
4
- "title": "@ngx-formly Shell Options Schema",
3
+ "$id": "ngx-formly-ng-add",
4
+ "title": "Angular Formly ng-add",
5
5
  "type": "object",
6
6
  "properties": {
7
7
  "project": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "lib": [
4
- "es2017",
4
+ "es2018",
5
5
  "dom"
6
6
  ],
7
7
  "declaration": true,
@@ -13,8 +13,7 @@
13
13
  "sourceMap": true,
14
14
  "target": "es6",
15
15
  "types": [
16
- "jasmine",
17
- "node"
16
+ "node", "jest"
18
17
  ]
19
18
  },
20
19
  "include": [
package/utils/ast.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Tree } from '@angular-devkit/schematics';
2
2
  import * as ts from 'typescript';
3
- import { WorkspaceProject, WorkspaceSchema } from '@angular-devkit/core/src/workspace';
3
+ import { WorkspaceProject, WorkspaceSchema } from '@schematics/angular/utility/workspace-models';
4
4
  export declare function getWorkspacePath(host: Tree): string;
5
5
  export declare function getWorkspace(host: Tree): WorkspaceSchema;
6
6
  /** Reads file given path and returns TypeScript source file. */
package/utils/ast.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findModuleFromOptions = exports.getStylesPath = exports.getIndexHtmlPath = exports.addModuleImportToModule = exports.addModuleImportToRootModule = exports.getSourceFile = exports.getWorkspace = exports.getWorkspacePath = void 0;
3
4
  const core_1 = require("@angular-devkit/core");
4
5
  const schematics_1 = require("@angular-devkit/schematics");
5
6
  const ts = require("typescript");
@@ -20,7 +21,7 @@ function getWorkspace(host) {
20
21
  throw new schematics_1.SchematicsException(`Could not find (${path})`);
21
22
  }
22
23
  const content = configBuffer.toString();
23
- return core_1.parseJson(content, core_1.JsonParseMode.Loose);
24
+ return JSON.parse(content);
24
25
  }
25
26
  exports.getWorkspace = getWorkspace;
26
27
  /** Reads file given path and returns TypeScript source file. */
@@ -35,7 +36,7 @@ function getSourceFile(host, path) {
35
36
  exports.getSourceFile = getSourceFile;
36
37
  /** Import and add module to root app module. */
37
38
  function addModuleImportToRootModule(host, moduleName, src, project) {
38
- const modulePath = ng_ast_utils_1.getAppModulePath(host, project.architect.build.options.main);
39
+ const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, project.architect.build.options.main);
39
40
  addModuleImportToModule(host, modulePath, moduleName, src);
40
41
  }
41
42
  exports.addModuleImportToRootModule = addModuleImportToRootModule;
@@ -51,7 +52,7 @@ function addModuleImportToModule(host, modulePath, moduleName, src) {
51
52
  if (!moduleSource) {
52
53
  throw new schematics_1.SchematicsException(`Module not found: ${modulePath}`);
53
54
  }
54
- const changes = ast_utils_1.addImportToModule(moduleSource, modulePath, moduleName, src);
55
+ const changes = (0, ast_utils_1.addImportToModule)(moduleSource, modulePath, moduleName, src);
55
56
  const recorder = host.beginUpdate(modulePath);
56
57
  changes.forEach((change) => {
57
58
  if (change instanceof change_1.InsertChange) {
@@ -79,12 +80,12 @@ function getStylesPath(host, project) {
79
80
  // "main" style sheet.
80
81
  const defaultMainStylePath = styles.find(a => /styles\.(c|le|sc)ss/.test(a));
81
82
  if (defaultMainStylePath) {
82
- return core_1.normalize(defaultMainStylePath);
83
+ return (0, core_1.normalize)(defaultMainStylePath);
83
84
  }
84
85
  // If there was no obvious default file, use the first style asset.
85
86
  const fallbackStylePath = styles.find(a => /\.(c|le|sc)ss/.test(a));
86
87
  if (fallbackStylePath) {
87
- return core_1.normalize(fallbackStylePath);
88
+ return (0, core_1.normalize)(fallbackStylePath);
88
89
  }
89
90
  }
90
91
  throw new schematics_1.SchematicsException('No style files could be found into which a theme could be added');
@@ -103,7 +104,7 @@ function findModuleFromOptions(host, options) {
103
104
  if (options.path === undefined) {
104
105
  options.path = `/${project.sourceRoot}`;
105
106
  }
106
- return find_module_1.findModuleFromOptions(host, options);
107
+ return (0, find_module_1.findModuleFromOptions)(host, options);
107
108
  }
108
109
  exports.findModuleFromOptions = findModuleFromOptions;
109
110
  //# sourceMappingURL=ast.js.map
package/utils/ast.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ast.js","sourceRoot":"","sources":["ast.ts"],"names":[],"mappings":";;AAAA,+CAA2E;AAC3E,2DAAuE;AACvE,iCAAiC;AACjC,qEAA0E;AAC1E,+DAAkE;AAClE,2EAA4E;AAC5E,yEAAsG;AAGtG,SAAgB,gBAAgB,CAAC,IAAU;IACzC,MAAM,aAAa,GAAG,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,OAAO,IAAI,CAAC;AACd,CAAC;AALD,4CAKC;AAED,SAAgB,YAAY,CAAC,IAAU;IACrC,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,YAAY,KAAK,IAAI,EAAE;QACzB,MAAM,IAAI,gCAAmB,CAAC,mBAAmB,IAAI,GAAG,CAAC,CAAC;KAC3D;IACD,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;IAExC,OAAO,gBAAS,CAAC,OAAO,EAAE,oBAAa,CAAC,KAAK,CAA0B,CAAC;AAC1E,CAAC;AATD,oCASC;AAED,gEAAgE;AAChE,SAAgB,aAAa,CAAC,IAAU,EAAE,IAAY;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE;QACX,MAA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I,OAAO,CAAC,UAAU,EAAE,CAAC;KACzC;IAED,OAAO,IAAA,mCAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAhBD,sDAgBC"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngxFormlyVersion = exports.angularVersion = void 0;
3
4
  exports.angularVersion = '^6.0.0';
4
5
  exports.ngxFormlyVersion = '^5.0.0';
5
6
  //# sourceMappingURL=lib-versions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lib-versions.js","sourceRoot":"","sources":["lib-versions.ts"],"names":[],"mappings":";;AAAa,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,gBAAgB,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"lib-versions.js","sourceRoot":"","sources":["lib-versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,gBAAgB,GAAG,QAAQ,CAAC"}
package/utils/package.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addPackageToPackageJson = void 0;
3
4
  /**
4
5
  * Adds a package to the package.json
5
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","sourceRoot":"","sources":["package.ts"],"names":[],"mappings":";;AAEA;;GAEG;AACH,SAAgB,uBAAuB,CACnC,IAAU,EAAE,IAAY,EAAE,GAAW,EAAE,OAAe;IACxD,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;QAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACf,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SACjB;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;SAC3B;QAED,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;KAC/D;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAjBD,0DAiBC"}
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["package.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,uBAAuB,CACnC,IAAU,EAAE,IAAY,EAAE,GAAW,EAAE,OAAe;IACxD,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;QAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACf,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SACjB;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;SAC3B;QAED,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;KAC/D;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAjBD,0DAiBC"}
@@ -12,4 +12,4 @@ export declare function createWorkspace(schematicRunner: SchematicTestRunner, ap
12
12
  routing: boolean;
13
13
  style: string;
14
14
  skipTests: boolean;
15
- }): UnitTestTree;
15
+ }): Promise<UnitTestTree>;
package/utils/testing.js CHANGED
@@ -1,12 +1,22 @@
1
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createWorkspace = exports.getTestProjectPath = void 0;
3
13
  const defaultWorkspaceOptions = {
4
14
  name: 'workspace',
5
15
  newProjectRoot: 'projects',
6
16
  version: '6.0.0',
7
17
  };
8
18
  const defaultAppOptions = {
9
- name: 'bar',
19
+ name: 'formly',
10
20
  inlineStyle: false,
11
21
  inlineTemplate: false,
12
22
  viewEncapsulation: 'Emulated',
@@ -25,9 +35,15 @@ function getTestProjectPath(workspaceOptions = defaultWorkspaceOptions, appOptio
25
35
  }
26
36
  exports.getTestProjectPath = getTestProjectPath;
27
37
  function createWorkspace(schematicRunner, appTree, workspaceOptions = defaultWorkspaceOptions, appOptions = defaultAppOptions) {
28
- appTree = schematicRunner.runExternalSchematic('@schematics/angular', 'workspace', workspaceOptions);
29
- appTree = schematicRunner.runExternalSchematic('@schematics/angular', 'application', appOptions, appTree);
30
- return appTree;
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ appTree = yield schematicRunner
40
+ .runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions)
41
+ .toPromise();
42
+ appTree = yield schematicRunner
43
+ .runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree)
44
+ .toPromise();
45
+ return appTree;
46
+ });
31
47
  }
32
48
  exports.createWorkspace = createWorkspace;
33
49
  //# sourceMappingURL=testing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.js","sourceRoot":"","sources":["testing.ts"],"names":[],"mappings":";;AAKA,MAAM,uBAAuB,GAAG;IAC9B,IAAI,EAAE,WAAW;IACjB,cAAc,EAAE,UAAU;IAC1B,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,KAAK;IAClB,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,UAAU;IAC7B,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,KAAK;CACjB,CAAC;AAEF,iCAAiC;AACjC,iBAAiB;AACjB,gBAAgB;AAChB,uBAAuB;AACvB,iBAAiB;AACjB,KAAK;AAEL,SAAgB,kBAAkB,CAChC,mBAAwB,uBAAuB,EAC/C,aAAkB,iBAAiB;IAEnC,OAAO,IAAI,gBAAgB,CAAC,cAAc,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC;AALD,gDAKC;AAED,SAAgB,eAAe,CAC7B,eAAoC,EACpC,OAAqB,EACrB,gBAAgB,GAAG,uBAAuB,EAC1C,UAAU,GAAG,iBAAiB;IAE9B,OAAO,GAAG,eAAe,CAAC,oBAAoB,CAC5C,qBAAqB,EACrB,WAAW,EACX,gBAAgB,CACjB,CAAC;IACF,OAAO,GAAG,eAAe,CAAC,oBAAoB,CAC5C,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,OAAO,CACR,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAnBD,0CAmBC"}
1
+ {"version":3,"file":"testing.js","sourceRoot":"","sources":["testing.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,MAAM,uBAAuB,GAAG;IAC9B,IAAI,EAAE,WAAW;IACjB,cAAc,EAAE,UAAU;IAC1B,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK;IAClB,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,UAAU;IAC7B,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,KAAK;CACjB,CAAC;AAEF,iCAAiC;AACjC,iBAAiB;AACjB,gBAAgB;AAChB,uBAAuB;AACvB,iBAAiB;AACjB,KAAK;AAEL,SAAgB,kBAAkB,CAChC,mBAAwB,uBAAuB,EAC/C,aAAkB,iBAAiB;IAEnC,OAAO,IAAI,gBAAgB,CAAC,cAAc,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC;AALD,gDAKC;AAED,SAAsB,eAAe,CACnC,eAAoC,EACpC,OAAqB,EACrB,gBAAgB,GAAG,uBAAuB,EAC1C,UAAU,GAAG,iBAAiB;;QAE9B,OAAO,GAAG,MAAM,eAAe;aAC5B,yBAAyB,CACxB,qBAAqB,EACrB,WAAW,EACX,gBAAgB,CACjB;aACA,SAAS,EAAE,CAAC;QACf,OAAO,GAAG,MAAM,eAAe;aAC5B,yBAAyB,CACxB,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,OAAO,CACR;aACA,SAAS,EAAE,CAAC;QAEf,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAvBD,0CAuBC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const testing_1 = require("@angular-devkit/schematics/testing");
4
- const path_1 = require("path");
5
- const test_1 = require("@schematics/angular/utility/test");
6
- const testing_2 = require("../../utils/testing");
7
- describe('ng-add-schematic', () => {
8
- const collectionPath = path_1.join(__dirname, '../collection.json');
9
- const schematicRunner = new testing_1.SchematicTestRunner('schematics', collectionPath);
10
- const projectPath = testing_2.getTestProjectPath();
11
- let appTree;
12
- beforeEach(() => {
13
- appTree = testing_2.createWorkspace(schematicRunner, appTree);
14
- });
15
- it('should update package.json', () => {
16
- const tree = schematicRunner.runSchematic('ng-add', {}, appTree);
17
- const packageJson = JSON.parse(test_1.getFileContent(tree, '/package.json'));
18
- expect(packageJson.dependencies['@angular/forms']).toBeDefined();
19
- expect(packageJson.dependencies['@ngx-formly/core']).toBeDefined();
20
- });
21
- it('should not add a theme by default to package.json', () => {
22
- const tree = schematicRunner.runSchematic('ng-add', {}, appTree);
23
- const packageJson = JSON.parse(test_1.getFileContent(tree, '/package.json'));
24
- // @TODO: list of themes should probably be retrieved from some config file
25
- ['material', 'bootstrap', 'ionic', 'primeng', 'kendo', 'ng-zorro-antd'].forEach(theme => {
26
- expect(packageJson.dependencies[`@ngx-formly/${theme}`]).toBeUndefined();
27
- });
28
- });
29
- it('should skip package.json update', () => {
30
- const options = { skipPackageJson: true };
31
- const tree = schematicRunner.runSchematic('ng-add', options, appTree);
32
- const packageJson = JSON.parse(test_1.getFileContent(tree, '/package.json'));
33
- expect(packageJson.dependencies['@ngx-formly/core']).toBeUndefined();
34
- });
35
- it('should add to root app module', () => {
36
- const tree = schematicRunner.runSchematic('ng-add', {}, appTree);
37
- const content = tree.readContent(`${projectPath}/src/app/app.module.ts`);
38
- expect(content).toMatch(
39
- // tslint:disable-next-line:trailing-comma
40
- /import { FormlyModule } from '@ngx-formly\/core';/);
41
- expect(content).toMatch(
42
- // tslint:disable-next-line:trailing-comma
43
- /FormlyModule.forRoot/);
44
- expect(content).toMatch(
45
- // tslint:disable-next-line:trailing-comma
46
- /import { ReactiveFormsModule } from '@angular\/forms';/);
47
- expect(content).toMatch(
48
- // tslint:disable-next-line:trailing-comma
49
- /ReactiveFormsModule,/);
50
- });
51
- it('should add UI theme to package.json', () => {
52
- const tree = schematicRunner.runSchematic('ng-add', {
53
- uiTheme: 'bootstrap',
54
- }, appTree);
55
- const packageJson = JSON.parse(test_1.getFileContent(tree, '/package.json'));
56
- expect(packageJson.dependencies['@ngx-formly/bootstrap']).toBeDefined();
57
- });
58
- it('should add UI theme to root app module', () => {
59
- const tree = schematicRunner.runSchematic('ng-add', {
60
- uiTheme: 'bootstrap',
61
- }, appTree);
62
- const content = tree.readContent(`${projectPath}/src/app/app.module.ts`);
63
- expect(content).toMatch(
64
- // tslint:disable-next-line:trailing-comma
65
- /import { FormlyBootstrapModule } from '@ngx-formly\/bootstrap';/);
66
- expect(content).toMatch(
67
- // tslint:disable-next-line:trailing-comma
68
- /FormlyBootstrapModule/);
69
- });
70
- it('should add to any module', () => {
71
- const fooModule = `${projectPath}/src/app/foo.module.ts`;
72
- appTree.create(fooModule, `
73
- import { NgModule } from '@angular/core';
74
- import { CommonModule } from '@angular/common';
75
-
76
- @NgModule({
77
- imports: [],
78
- declarations: []
79
- })
80
- export class FooModule { }
81
- `);
82
- const tree = schematicRunner.runSchematic('ng-add', {
83
- module: 'app/foo.module.ts',
84
- }, appTree);
85
- const content = tree.readContent(fooModule);
86
- expect(content).toMatch(
87
- // tslint:disable-next-line:trailing-comma
88
- /import { FormlyModule } from '@ngx-formly\/core';/);
89
- expect(content).toMatch(
90
- // tslint:disable-next-line:trailing-comma
91
- /FormlyModule.forRoot/);
92
- expect(content).toMatch(
93
- // tslint:disable-next-line:trailing-comma
94
- /import { ReactiveFormsModule } from '@angular\/forms';/);
95
- expect(content).toMatch(
96
- // tslint:disable-next-line:trailing-comma
97
- /ReactiveFormsModule,/);
98
- });
99
- });
100
- //# sourceMappingURL=index_spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;AAAA,gEAAuF;AACvF,+BAA4B;AAC5B,2DAAkE;AAClE,iDAA0E;AAG1E,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,cAAc,GAAG,WAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAC7D,MAAM,eAAe,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAC9E,MAAM,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apper for:
3
- </p>
4
- <ng-container #fieldComponent></ng-container>
@@ -1,10 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { Schema } from './schema';
3
- /**
4
- * Scaffolds a new wrapper component.
5
- * Internally it bootstraps the base component schematic
6
- */
7
- export default function (options: Schema): Rule;
8
- /**
9
- * Add the wrapper component to FormlyModule
10
- */
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const schematics_1 = require("@angular-devkit/schematics");
4
- const component_1 = require("@schematics/angular/component");
5
- /**
6
- * Scaffolds a new wrapper component.
7
- * Internally it bootstraps the base component schematic
8
- */
9
- function default_1(options) {
10
- return schematics_1.chain([
11
- component_1.default(Object.assign({}, options)),
12
- ]);
13
- }
14
- exports.default = default_1;
15
- /**
16
- * Add the wrapper component to FormlyModule
17
- */
18
- // function addWrapperToModule(options: Schema) {
19
- // return (host: Tree) => {
20
- // return host;
21
- // };
22
- // }
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,2DAAyD;AACzD,6DAA2D;AAG3D;;;GAGG;AACH,mBAAwB,OAAe;IACrC,OAAO,kBAAK,CAAC;QACX,mBAAc,mBAAM,OAAO,EAAG;KAE/B,CAAC,CAAC;AACL,CAAC;AALD,4BAKC;AAED;;GAEG;AACH,iDAAiD;AACjD,6BAA6B;AAC7B,mBAAmB;AACnB,OAAO;AACP,IAAI"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,66 +0,0 @@
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
- const testing_1 = require("@angular-devkit/schematics/testing");
20
- const path_1 = require("path");
21
- const testing_2 = require("../../utils/testing");
22
- const test_1 = require("@schematics/angular/utility/test");
23
- const schema_1 = require("@schematics/angular/component/schema");
24
- // tslint:disable:max-line-length
25
- xdescribe('Component Schematic', () => {
26
- const collectionPath = path_1.join(__dirname, '../collection.json');
27
- const defaultOptions = {
28
- name: 'foo',
29
- path: 'src/app',
30
- inlineStyle: false,
31
- inlineTemplate: false,
32
- changeDetection: schema_1.ChangeDetection.Default,
33
- module: undefined,
34
- export: false,
35
- project: 'bar',
36
- };
37
- const schematicRunner = new testing_1.SchematicTestRunner('schematics', collectionPath);
38
- const projectPath = testing_2.getTestProjectPath();
39
- let appTree;
40
- beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
41
- appTree = yield testing_2.createWorkspace(schematicRunner, appTree);
42
- }));
43
- it('should create a component', () => __awaiter(void 0, void 0, void 0, function* () {
44
- const tree = yield schematicRunner
45
- .runSchematicAsync('wrapper', Object.assign({}, defaultOptions), appTree)
46
- .toPromise();
47
- const files = tree.files;
48
- expect(files.indexOf(`${projectPath}/src/app/foo/foo.component.css`)).toBeGreaterThanOrEqual(0);
49
- expect(files.indexOf(`${projectPath}/src/app/foo/foo.component.html`)).toBeGreaterThanOrEqual(0);
50
- expect(files.indexOf(`${projectPath}/src/app/foo/foo.component.spec.ts`)).toBeGreaterThanOrEqual(0);
51
- expect(files.indexOf(`${projectPath}/src/app/foo/foo.component.ts`)).toBeGreaterThanOrEqual(0);
52
- const moduleContent = test_1.getFileContent(tree, `${projectPath}/src/app/app.module.ts`);
53
- expect(moduleContent).toMatch(/import.*Foo.*from '.\/foo\/foo.component'/);
54
- expect(moduleContent).toMatch(/declarations:\s*\[[^\]]+?,\r?\n\s+FooComponent\r?\n/m);
55
- }));
56
- xit('should add wrapper to FormlyModule config', () => __awaiter(void 0, void 0, void 0, function* () {
57
- const tree = yield schematicRunner
58
- .runSchematicAsync('wrapper', Object.assign({}, defaultOptions), appTree)
59
- .toPromise();
60
- const moduleContent = test_1.getFileContent(tree, `${projectPath}/src/app/app.module.ts`);
61
- expect(moduleContent).toContain(`wrappers: [
62
- { name: 'foo', component: FooWrapperComponent },
63
- ],`);
64
- }));
65
- });
66
- //# sourceMappingURL=index.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.spec.js","sourceRoot":"","sources":["index.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;GAMG;AACH,gEAAuF;AACvF,+BAA4B;AAC5B,iDAA0E;AAE1E,2DAAkE;AAClE,iEAAuE;AAEvE,iCAAiC;AACjC,SAAS,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,MAAM,cAAc,GAAG,WAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAqB;QACvC,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,wBAAe,CAAC,OAAO;QACxC,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;KACf,CAAC;IACF,MAAM,eAAe,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAC9E,MAAM,WAAW,GAAG,4BAAkB,EAAE,CAAC;IAEzC,IAAI,OAAqB,CAAC;IAE1B,UAAU,CAAC,GAAS,EAAE;QACpB,OAAO,GAAG,MAAM,yBAAe,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAC5D,CA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AAC;;OAE7B,CAAC,CAAC;IACP,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * @license
5
- * Copyright Google Inc. All Rights Reserved.
6
- *
7
- * Use of this source code is governed by an MIT-style license that can be
8
- * found in the LICENSE file at https://angular.io/license
9
- */
10
- const testing_1 = require("@angular-devkit/schematics/testing");
11
- const path_1 = require("path");
12
- const testing_2 = require("../../utils/testing");
13
- const test_1 = require("@schematics/angular/utility/test");
14
- const schema_1 = require("@schematics/angular/component/schema");
15
- // tslint:disable:max-line-length
16
- xdescribe('Component Schematic', () => {
17
- const collectionPath = path_1.join(__dirname, '../collection.json');
18
- const defaultOptions = {
19
- name: 'foo',
20
- path: 'src/app',
21
- inlineStyle: false,
22
- inlineTemplate: false,
23
- changeDetection: schema_1.ChangeDetection.Default,
24
- styleext: 'css',
25
- spec: true,
26
- module: undefined,
27
- export: false,
28
- project: 'bar',
29
- };
30
- const schematicRunner = new testing_1.SchematicTestRunner('schematics', collectionPath);
31
- const projectPath = testing_2.getTestProjectPath();
32
- let appTree;
33
- beforeEach(() => {
34
- appTree = testing_2.createWorkspace(schematicRunner, appTree);
35
- });
36
- it('should create a component', () => {
37
- const tree = schematicRunner.runSchematic('wrapper', Object.assign({}, defaultOptions), appTree);
38
- const files = tree.files;
39
- expect(files.indexOf(`${projectPath}/src/app/foo/foo.component.css`)).toBeGreaterThanOrEqual(0);
40
- expect(files.indexOf(`${projectPath}/src/app/foo/foo.component.html`)).toBeGreaterThanOrEqual(0);
41
- expect(files.indexOf(`${projectPath}/src/app/foo/foo.component.spec.ts`)).toBeGreaterThanOrEqual(0);
42
- expect(files.indexOf(`${projectPath}/src/app/foo/foo.component.ts`)).toBeGreaterThanOrEqual(0);
43
- const moduleContent = test_1.getFileContent(tree, `${projectPath}/src/app/app.module.ts`);
44
- expect(moduleContent).toMatch(/import.*Foo.*from '.\/foo\/foo.component'/);
45
- expect(moduleContent).toMatch(/declarations:\s*\[[^\]]+?,\r?\n\s+FooComponent\r?\n/m);
46
- });
47
- xit('should add wrapper to FormlyModule config', () => {
48
- const tree = schematicRunner.runSchematic('wrapper', Object.assign({}, defaultOptions), appTree);
49
- const moduleContent = test_1.getFileContent(tree, `${projectPath}/src/app/app.module.ts`);
50
- expect(moduleContent).toContain(`wrappers: [
51
- { name: 'foo', component: FooWrapperComponent },
52
- ],`);
53
- });
54
- });
55
- //# sourceMappingURL=index_spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,gEAAuF;AACvF,+BAA4B;AAC5B,iDAA0E;AAE1E,2DAAkE;AAClE,iEAAuE;AAEvE,iCAAiC;AACjC,SAAS,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,MAAM,cAAc,GAAG,WAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAqB;QACvC,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,wBAAe,CAAC,OAAO;QACxC,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;KACf,CAAC;IACF,MAAM,eAAe,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAC9E,MAAM,WAAW,GAAG,4BAAkB,EAAE,CAAC;IAEzC,IAAI,OAAqB,CAAC;IAE1B,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,yBAAe,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2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ponentSchema } from '@schematics/angular/component/schema';
2
- export interface Schema extends ComponentSchema {
3
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":""}
@@ -1,109 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "id": "SchematicsFormlyWrapperComponent",
4
- "title": "Formly Wrapper Component Options Schema",
5
- "type": "object",
6
- "properties": {
7
- "path": {
8
- "type": "string",
9
- "format": "path",
10
- "description": "The path to create the component.",
11
- "visible": false
12
- },
13
- "project": {
14
- "type": "string",
15
- "description": "The name of the project.",
16
- "$default": {
17
- "$source": "projectName"
18
- }
19
- },
20
- "name": {
21
- "type": "string",
22
- "description": "The name of the component.",
23
- "$default": {
24
- "$source": "argv",
25
- "index": 0
26
- }
27
- },
28
- "inlineStyle": {
29
- "description": "Specifies if the style will be in the ts file.",
30
- "type": "boolean",
31
- "default": false,
32
- "alias": "s"
33
- },
34
- "inlineTemplate": {
35
- "description": "Specifies if the template will be in the ts file.",
36
- "type": "boolean",
37
- "default": false,
38
- "alias": "t"
39
- },
40
- "viewEncapsulation": {
41
- "description": "Specifies the view encapsulation strategy.",
42
- "enum": ["Emulated", "Native", "None"],
43
- "type": "string",
44
- "alias": "v"
45
- },
46
- "changeDetection": {
47
- "description": "Specifies the change detection strategy.",
48
- "enum": ["Default", "OnPush"],
49
- "type": "string",
50
- "default": "Default",
51
- "alias": "c"
52
- },
53
- "prefix": {
54
- "type": "string",
55
- "description": "The prefix to apply to generated selectors.",
56
- "alias": "p",
57
- "oneOf": [
58
- {
59
- "maxLength": 0
60
- },
61
- {
62
- "minLength": 1,
63
- "format": "html-selector"
64
- }
65
- ]
66
- },
67
- "styleext": {
68
- "description": "The file extension to be used for style files.",
69
- "type": "string",
70
- "default": "css"
71
- },
72
- "spec": {
73
- "type": "boolean",
74
- "description": "Specifies if a spec file is generated.",
75
- "default": true
76
- },
77
- "flat": {
78
- "type": "boolean",
79
- "description": "Flag to indicate if a dir is created.",
80
- "default": false
81
- },
82
- "skipImport": {
83
- "type": "boolean",
84
- "description": "Flag to skip the module import.",
85
- "default": false
86
- },
87
- "selector": {
88
- "type": "string",
89
- "format": "html-selector",
90
- "description": "The selector to use for the component."
91
- },
92
- "module": {
93
- "type": "string",
94
- "description": "Allows specification of the declaring module.",
95
- "alias": "m"
96
- },
97
- "export": {
98
- "type": "boolean",
99
- "default": false,
100
- "description": "Specifies if declaring module exports the component."
101
- },
102
- "entryComponent": {
103
- "type": "boolean",
104
- "default": false,
105
- "description": "Specifies if the component is an entry component of declaring module."
106
- }
107
- },
108
- "required": []
109
- }
package/utils/html.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Tree } from '@angular-devkit/schematics';
2
- import { WorkspaceProject } from '@angular-devkit/core/src/workspace';
3
- /**
4
- * Parses the index.html file to get the HEAD tag position.
5
- * @param host the tree we are traversing
6
- * @param src the src path of the html file to parse
7
- */
8
- export declare function getHeadTag(host: Tree, src: string): {
9
- position: any;
10
- };
11
- /**
12
- * Adds a link to the index.html head tag Example:
13
- * `<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">`
14
- * @param host The tree we are updating
15
- * @param project The project we're targeting.
16
- * @param link html element string we are inserting.
17
- */
18
- export declare function addHeadLink(host: Tree, project: WorkspaceProject, link: string): void;
package/utils/html.js DELETED
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const schematics_1 = require("@angular-devkit/schematics");
4
- const parse5 = require("parse5");
5
- const ast_1 = require("./ast");
6
- const change_1 = require("@schematics/angular/utility/change");
7
- /**
8
- * Parses the index.html file to get the HEAD tag position.
9
- * @param host the tree we are traversing
10
- * @param src the src path of the html file to parse
11
- */
12
- function getHeadTag(host, src) {
13
- const document = parse5.parse(src, { locationInfo: true });
14
- let head;
15
- const visit = (nodes) => {
16
- nodes.forEach(node => {
17
- const element = node;
18
- if (element.tagName === 'head') {
19
- head = element;
20
- }
21
- else {
22
- if (element.childNodes) {
23
- visit(element.childNodes);
24
- }
25
- }
26
- });
27
- };
28
- visit(document.childNodes);
29
- if (!head) {
30
- throw new schematics_1.SchematicsException('Head element not found!');
31
- }
32
- return {
33
- position: head.__location.startTag.endOffset,
34
- };
35
- }
36
- exports.getHeadTag = getHeadTag;
37
- /**
38
- * Adds a link to the index.html head tag Example:
39
- * `<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">`
40
- * @param host The tree we are updating
41
- * @param project The project we're targeting.
42
- * @param link html element string we are inserting.
43
- */
44
- function addHeadLink(host, project, link) {
45
- const indexPath = ast_1.getIndexHtmlPath(host, project);
46
- const buffer = host.read(indexPath);
47
- if (!buffer) {
48
- throw new schematics_1.SchematicsException(`Could not find file for path: ${indexPath}`);
49
- }
50
- const src = buffer.toString();
51
- if (src.indexOf(link) === -1) {
52
- const node = getHeadTag(host, src);
53
- const insertion = new change_1.InsertChange(indexPath, node.position, link);
54
- const recorder = host.beginUpdate(indexPath);
55
- recorder.insertLeft(insertion.pos, insertion.toAdd);
56
- host.commitUpdate(recorder);
57
- }
58
- }
59
- exports.addHeadLink = addHeadLink;
60
- //# sourceMappingURL=html.js.map
package/utils/html.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["html.ts"],"names":[],"mappings":";;AAAA,2DAAuE;AACvE,iCAAiC;AACjC,+BAAyC;AACzC,+DAAkE;AAGlE;;;;GAIG;AACH,SAAgB,UAAU,CAAC,IAAU,EAAE,GAAW;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAC/B,EAAC,YAAY,EAAE,IAAI,EAAC,CAAgC,CAAC;IAEvD,IAAI,IAAI,CAAC;IACT,MAAM,KAAK,GAAG,CAAC,KAAgC,EAAE,EAAE;QACjD,KA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