@ng-doc/app 15.0.0-beta.7 → 15.0.0-beta.9

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 (60) hide show
  1. package/package.json +521 -1
  2. package/schematics/collection.json +0 -10
  3. package/schematics/index.d.ts +0 -0
  4. package/schematics/index.js +0 -2
  5. package/schematics/index.js.map +0 -1
  6. package/schematics/ng-add/constants/app-component-content.d.ts +0 -1
  7. package/schematics/ng-add/constants/app-component-content.js +0 -15
  8. package/schematics/ng-add/constants/app-component-content.js.map +0 -1
  9. package/schematics/ng-add/constants/assets.d.ts +0 -5
  10. package/schematics/ng-add/constants/assets.js +0 -21
  11. package/schematics/ng-add/constants/assets.js.map +0 -1
  12. package/schematics/ng-add/constants/modules.d.ts +0 -9
  13. package/schematics/ng-add/constants/modules.js +0 -36
  14. package/schematics/ng-add/constants/modules.js.map +0 -1
  15. package/schematics/ng-add/constants/styles.d.ts +0 -1
  16. package/schematics/ng-add/constants/styles.js +0 -5
  17. package/schematics/ng-add/constants/styles.js.map +0 -1
  18. package/schematics/ng-add/constants/version.d.ts +0 -1
  19. package/schematics/ng-add/constants/version.js +0 -6
  20. package/schematics/ng-add/constants/version.js.map +0 -1
  21. package/schematics/ng-add/index.d.ts +0 -7
  22. package/schematics/ng-add/index.js +0 -34
  23. package/schematics/ng-add/index.js.map +0 -1
  24. package/schematics/ng-add/schema.d.ts +0 -3
  25. package/schematics/ng-add/schema.js +0 -3
  26. package/schematics/ng-add/schema.js.map +0 -1
  27. package/schematics/ng-add/schema.json +0 -16
  28. package/schematics/ng-add/steps/add-assets.d.ts +0 -8
  29. package/schematics/ng-add/steps/add-assets.js +0 -31
  30. package/schematics/ng-add/steps/add-assets.js.map +0 -1
  31. package/schematics/ng-add/steps/add-layout.d.ts +0 -7
  32. package/schematics/ng-add/steps/add-layout.js +0 -47
  33. package/schematics/ng-add/steps/add-layout.js.map +0 -1
  34. package/schematics/ng-add/steps/add-ng-doc-modules.d.ts +0 -7
  35. package/schematics/ng-add/steps/add-ng-doc-modules.js +0 -53
  36. package/schematics/ng-add/steps/add-ng-doc-modules.js.map +0 -1
  37. package/schematics/ng-add/steps/add-styles.d.ts +0 -8
  38. package/schematics/ng-add/steps/add-styles.js +0 -31
  39. package/schematics/ng-add/steps/add-styles.js.map +0 -1
  40. package/schematics/ng-add/steps/replace-builders.d.ts +0 -8
  41. package/schematics/ng-add/steps/replace-builders.js +0 -36
  42. package/schematics/ng-add/steps/replace-builders.js.map +0 -1
  43. package/schematics/ng-add/testing/ng-add.spec.d.ts +0 -1
  44. package/schematics/ng-add/testing/ng-add.spec.js +0 -154
  45. package/schematics/ng-add/testing/ng-add.spec.js.map +0 -1
  46. package/schematics/ng-add/utils/add-unique-import.d.ts +0 -7
  47. package/schematics/ng-add/utils/add-unique-import.js +0 -37
  48. package/schematics/ng-add/utils/add-unique-import.js.map +0 -1
  49. package/schematics/ng-add/utils/create-angular-json.d.ts +0 -4
  50. package/schematics/ng-add/utils/create-angular-json.js +0 -36
  51. package/schematics/ng-add/utils/create-angular-json.js.map +0 -1
  52. package/schematics/ng-add/utils/get-app-template-path.d.ts +0 -12
  53. package/schematics/ng-add/utils/get-app-template-path.js +0 -35
  54. package/schematics/ng-add/utils/get-app-template-path.js.map +0 -1
  55. package/schematics/ng-add/utils/get-initializer.d.ts +0 -8
  56. package/schematics/ng-add/utils/get-initializer.js +0 -27
  57. package/schematics/ng-add/utils/get-initializer.js.map +0 -1
  58. package/schematics/ng-add/utils/get-project.d.ts +0 -8
  59. package/schematics/ng-add/utils/get-project.js +0 -16
  60. package/schematics/ng-add/utils/get-project.js.map +0 -1
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAIN_MODULES = void 0;
4
- exports.MAIN_MODULES = [
5
- {
6
- initializer: 'BrowserAnimationsModule',
7
- imports: [{ name: 'BrowserAnimationsModule', path: '@angular/platform-browser/animations' }],
8
- },
9
- {
10
- initializer: 'NgDocNavbarModule',
11
- imports: [{ name: 'NgDocNavbarModule', path: '@ng-doc/app/components/navbar' }],
12
- },
13
- {
14
- initializer: 'NgDocSidebarModule',
15
- imports: [{ name: 'NgDocSidebarModule', path: '@ng-doc/app/components/sidebar' }],
16
- },
17
- {
18
- initializer: 'RouterModule.forRoot(NG_DOC_ROUTING)',
19
- imports: [
20
- { name: 'RouterModule', path: '@angular/router' },
21
- {
22
- name: 'NG_DOC_ROUTING',
23
- path: '@ng-doc/builder/generated',
24
- },
25
- ],
26
- },
27
- {
28
- initializer: 'NgDocModule.forRoot()',
29
- imports: [{ name: 'NgDocModule', path: '@ng-doc/app' }],
30
- },
31
- {
32
- initializer: 'NgDocGeneratedModule.forRoot()',
33
- imports: [{ name: 'NgDocGeneratedModule', path: '@ng-doc/builder/generated' }],
34
- },
35
- ];
36
- //# sourceMappingURL=modules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/constants/modules.ts"],"names":[],"mappings":";;;AAUa,QAAA,YAAY,GAA4B;IACpD;QACC,WAAW,EAAE,yBAAyB;QACtC,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,yBAAyB,EAAE,IAAI,EAAE,sCAAsC,EAAC,CAAC;KAC1F;IACD;QACC,WAAW,EAAE,mBAAmB;QAChC,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,+BAA+B,EAAC,CAAC;KAC7E;IACD;QACC,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,gCAAgC,EAAC,CAAC;KAC/E;IACD;QACC,WAAW,EAAE,sCAAsC;QACnD,OAAO,EAAE;YACR,EAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,iBAAiB,EAAC;YAC/C;gBACC,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,2BAA2B;aACjC;SACD;KACD;IACD;QACC,WAAW,EAAE,uBAAuB;QACpC,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAC,CAAC;KACrD;IACD;QACC,WAAW,EAAE,gCAAgC;QAC7C,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,2BAA2B,EAAC,CAAC;KAC5E;CACD,CAAC"}
@@ -1 +0,0 @@
1
- export declare const NG_DOC_STYLES: string[];
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NG_DOC_STYLES = void 0;
4
- exports.NG_DOC_STYLES = ['./node_modules/@ng-doc/app/styles/global.css'];
5
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/constants/styles.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAa,CAAC,8CAA8C,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const NG_DOC_VERSION: string;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NG_DOC_VERSION = void 0;
4
- const package_json_1 = require("../../../package.json");
5
- exports.NG_DOC_VERSION = package_json_1.version;
6
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/constants/version.ts"],"names":[],"mappings":";;;AAAA,wDAA8C;AAEjC,QAAA,cAAc,GAAW,sBAAO,CAAC"}
@@ -1,7 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { Schema } from './schema';
3
- /**
4
- *
5
- * @param options
6
- */
7
- export declare function ngAdd(options: Schema): Rule;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ngAdd = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const tasks_1 = require("@angular-devkit/schematics/tasks");
6
- const ng_morph_1 = require("ng-morph");
7
- const version_1 = require("./constants/version");
8
- const add_assets_1 = require("./steps/add-assets");
9
- const add_layout_1 = require("./steps/add-layout");
10
- const add_ng_doc_modules_1 = require("./steps/add-ng-doc-modules");
11
- const add_styles_1 = require("./steps/add-styles");
12
- const replace_builders_1 = require("./steps/replace-builders");
13
- /**
14
- *
15
- * @param options
16
- */
17
- function ngAdd(options) {
18
- return (tree, context) => {
19
- (0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(tree, '/', ['**/*.ts', '**/*.json']));
20
- (0, ng_morph_1.addPackageJsonDependency)(tree, { name: `@ng-doc/builder`, version: version_1.NG_DOC_VERSION });
21
- (0, ng_morph_1.addPackageJsonDependency)(tree, { name: `@ng-doc/ui-kit`, version: version_1.NG_DOC_VERSION });
22
- (0, ng_morph_1.addPackageJsonDependency)(tree, { name: `@ng-doc/core`, version: version_1.NG_DOC_VERSION });
23
- context.addTask(new tasks_1.NodePackageInstallTask(), []);
24
- return (0, schematics_1.chain)([
25
- (0, replace_builders_1.replaceBuilders)(options, context),
26
- (0, add_styles_1.addStyles)(options, context),
27
- (0, add_assets_1.addAssets)(options, context),
28
- (0, add_ng_doc_modules_1.addNgDocModules)(options),
29
- (0, add_layout_1.addLayout)(options),
30
- ]);
31
- };
32
- }
33
- exports.ngAdd = ngAdd;
34
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/app/schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAA+E;AAC/E,4DAAwE;AACxE,uCAAmF;AAEnF,iDAAmD;AAEnD,mDAA6C;AAC7C,mDAA6C;AAC7C,mEAA2D;AAC3D,mDAA6C;AAC7C,+DAAyD;AAEzD;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACpC,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAChD,IAAA,2BAAgB,EAAC,IAAA,wBAAa,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;QAErE,IAAA,mCAAwB,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,wBAAc,EAAC,CAAC,CAAC;QACnF,IAAA,mCAAwB,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,wBAAc,EAAC,CAAC,CAAC;QAClF,IAAA,mCAAwB,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,wBAAc,EAAC,CAAC,CAAC;QAEhF,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,EAAE,EAAE,CAAC,CAAC;QAElD,OAAO,IAAA,kBAAK,EAAC;YACZ,IAAA,kCAAe,EAAC,OAAO,EAAE,OAAO,CAAC;YACjC,IAAA,sBAAS,EAAC,OAAO,EAAE,OAAO,CAAC;YAC3B,IAAA,sBAAS,EAAC,OAAO,EAAE,OAAO,CAAC;YAC3B,IAAA,oCAAe,EAAC,OAAO,CAAC;YACxB,IAAA,sBAAS,EAAC,OAAO,CAAC;SAClB,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAlBD,sBAkBC"}
@@ -1,3 +0,0 @@
1
- export interface Schema {
2
- readonly project: string;
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":["../../../../../libs/app/schematics/ng-add/schema.ts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "ng-doc-ng-add",
4
- "title": "NgDoc ng-add",
5
- "type": "object",
6
- "properties": {
7
- "project": {
8
- "type": "string",
9
- "description": "The name of the project.",
10
- "$default": {
11
- "$source": "projectName"
12
- }
13
- }
14
- },
15
- "required": []
16
- }
@@ -1,8 +0,0 @@
1
- import { Rule, SchematicContext } from '@angular-devkit/schematics';
2
- import { Schema } from '../schema';
3
- /**
4
- *
5
- * @param options
6
- * @param context
7
- */
8
- export declare function addAssets(options: Schema, context: SchematicContext): Rule;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addAssets = void 0;
4
- const schematics_1 = require("@angular/cdk/schematics");
5
- const workspace_1 = require("@schematics/angular/utility/workspace");
6
- const assets_1 = require("../constants/assets");
7
- const get_project_1 = require("../utils/get-project");
8
- /**
9
- *
10
- * @param options
11
- * @param context
12
- */
13
- function addAssets(options, context) {
14
- return (0, workspace_1.updateWorkspace)((workspace) => {
15
- context.logger.info(`[INFO]: Adding global assets...`);
16
- const project = (0, get_project_1.getProject)(options, workspace);
17
- if (!project) {
18
- context.logger.warn(`[WARNING]: Target project not found.`);
19
- return;
20
- }
21
- const targetOptions = (0, schematics_1.getProjectTargetOptions)(project, 'build');
22
- const assets = targetOptions['assets'];
23
- if (!assets) {
24
- targetOptions['assets'] = assets_1.NG_DOC_ASSETS;
25
- return;
26
- }
27
- targetOptions['assets'] = Array.from(new Set([...assets_1.NG_DOC_ASSETS, ...assets]));
28
- });
29
- }
30
- exports.addAssets = addAssets;
31
- //# sourceMappingURL=add-assets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-assets.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/steps/add-assets.ts"],"names":[],"mappings":";;;AAAA,wDAAgE;AAGhE,qEAA8G;AAE9G,gDAAkD;AAElD,sDAAgD;AAEhD;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe,EAAE,OAAyB;IACnE,OAAO,IAAA,2BAAe,EAAC,CAAC,SAA8B,EAAE,EAAE;QACzD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAEvD,MAAM,OAAO,GAAkC,IAAA,wBAAU,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE9E,IAAI,CAAC,OAAO,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YAC5D,OAAO;SACP;QAED,MAAM,aAAa,GAA8B,IAAA,oCAAuB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAE3F,MAAM,MAAM,GAA0B,aAAa,CAAC,QAAQ,CAA0B,CAAC;QAEvF,IAAI,CAAC,MAAM,EAAE;YACZ,aAAa,CAAC,QAAQ,CAAC,GAAG,sBAAa,CAAC;YACxC,OAAO;SACP;QAED,aAAa,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,sBAAa,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACJ,CAAC;AAtBD,8BAsBC"}
@@ -1,7 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { Schema } from '../schema';
3
- /**
4
- *
5
- * @param options
6
- */
7
- export declare function addLayout(options: Schema): Rule;
@@ -1,47 +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
- exports.addLayout = void 0;
13
- const schematics_1 = require("@angular/cdk/schematics");
14
- const workspace_1 = require("@nrwl/workspace");
15
- const app_component_content_1 = require("../constants/app-component-content");
16
- const get_app_template_path_1 = require("../utils/get-app-template-path");
17
- const get_project_1 = require("../utils/get-project");
18
- /**
19
- *
20
- * @param options
21
- */
22
- function addLayout(options) {
23
- return (tree, context) => __awaiter(this, void 0, void 0, function* () {
24
- context.logger.info(`[INFO]: Adding NgDocLayour to the root component...`);
25
- const workspace = yield (0, workspace_1.getWorkspace)(tree);
26
- const project = (0, get_project_1.getProject)(options, workspace);
27
- if (!project) {
28
- return;
29
- }
30
- const buildOptions = (0, schematics_1.getProjectTargetOptions)(project, 'build');
31
- const appTemplatePath = (0, get_app_template_path_1.getAppTemplatePath)(tree, buildOptions['main']);
32
- if (!appTemplatePath) {
33
- context.logger.error('Could not find the default main template file for this project.');
34
- return;
35
- }
36
- const html = tree.read(appTemplatePath);
37
- if (html) {
38
- const recorder = tree.beginUpdate(appTemplatePath);
39
- recorder.remove(0, html.length);
40
- recorder.insertLeft(0, app_component_content_1.APP_COMPONENT_CONTENT);
41
- tree.commitUpdate(recorder);
42
- context.logger.info(`Content of the app component was replaced with ng-doc layout.`);
43
- }
44
- });
45
- }
46
- exports.addLayout = addLayout;
47
- //# sourceMappingURL=add-layout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-layout.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/steps/add-layout.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAAgE;AAIhE,+CAA6C;AAE7C,8EAAyE;AAEzE,0EAAkE;AAClE,sDAAgD;AAEhD;;;GAGG;AACH,SAAgB,SAAS,CAAC,OAAe;IACxC,OAAO,CAAO,IAAU,EAAE,OAAyB,EAAE,EAAE;QACtD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;QAE3E,MAAM,SAAS,GAAwB,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAChE,MAAM,OAAO,GAAkC,IAAA,wBAAU,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE9E,IAAI,CAAC,OAAO,EAAE;YACb,OAAO;SACP;QAED,MAAM,YAAY,GAA8B,IAAA,oCAAuB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAE1F,MAAM,eAAe,GAAuB,IAAA,0CAAkB,EAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAW,CAAC,CAAC;QAErG,IAAI,CAAC,eAAe,EAAE;YACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;YAExF,OAAO;SACP;QAED,MAAM,IAAI,GAAkB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAEvD,IAAI,IAAI,EAAE;YACT,MAAM,QAAQ,GAAmB,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;YAEnE,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,6CAAqB,CAAC,CAAC;YAC9C,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YAE5B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;SACrF;IACF,CAAC,CAAA,CAAC;AACH,CAAC;AAjCD,8BAiCC"}
@@ -1,7 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { Schema } from '../schema';
3
- /**
4
- *
5
- * @param options
6
- */
7
- export declare function addNgDocModules(options: Schema): Rule;
@@ -1,53 +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
- exports.addNgDocModules = void 0;
13
- const schematics_1 = require("@angular/cdk/schematics");
14
- const workspace_1 = require("@schematics/angular/utility/workspace");
15
- const ng_morph_1 = require("ng-morph");
16
- const modules_1 = require("../constants/modules");
17
- const add_unique_import_1 = require("../utils/add-unique-import");
18
- const get_project_1 = require("../utils/get-project");
19
- /**
20
- *
21
- * @param options
22
- */
23
- function addNgDocModules(options) {
24
- return (tree, context) => __awaiter(this, void 0, void 0, function* () {
25
- context.logger.info(`[INFO]: Adding NgDoc modules to the root module...`);
26
- const workspace = yield (0, workspace_1.getWorkspace)(tree);
27
- const project = (0, get_project_1.getProject)(options, workspace);
28
- if (!project) {
29
- context.logger.warn('[WARNING]: Target project not found in current workspace');
30
- return;
31
- }
32
- const buildOptions = (0, schematics_1.getProjectTargetOptions)(project, 'build');
33
- (0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(tree, '/', ['**/*.ts', '**/*.json']));
34
- const mainModule = (0, ng_morph_1.getMainModule)(buildOptions['main']);
35
- importMainModules(mainModule);
36
- (0, ng_morph_1.saveActiveProject)();
37
- });
38
- }
39
- exports.addNgDocModules = addNgDocModules;
40
- /**
41
- *
42
- * @param mainModule
43
- */
44
- function importMainModules(mainModule) {
45
- const mainModulePath = mainModule.getSourceFile().getFilePath();
46
- modules_1.MAIN_MODULES.forEach((module) => {
47
- (0, ng_morph_1.addImportToNgModule)(mainModule, module.initializer, { unique: true });
48
- module.imports.forEach((moduleImport) => {
49
- (0, add_unique_import_1.addUniqueImport)(mainModulePath, moduleImport.name, moduleImport.path);
50
- });
51
- });
52
- }
53
- //# sourceMappingURL=add-ng-doc-modules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-ng-doc-modules.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/steps/add-ng-doc-mod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C,OAAO,CAAC,OAAO,CAAC,CAAC,YAA0B,EAAE,EAAE;YACrD,IAAA,mCAAe,EAAC,cAAc,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- import { Rule, SchematicContext } from '@angular-devkit/schematics';
2
- import { Schema } from '../schema';
3
- /**
4
- *
5
- * @param options
6
- * @param context
7
- */
8
- export declare function addStyles(options: Schema, context: SchematicContext): Rule;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addStyles = void 0;
4
- const schematics_1 = require("@angular/cdk/schematics");
5
- const workspace_1 = require("@schematics/angular/utility/workspace");
6
- const styles_1 = require("../constants/styles");
7
- const get_project_1 = require("../utils/get-project");
8
- /**
9
- *
10
- * @param options
11
- * @param context
12
- */
13
- function addStyles(options, context) {
14
- return (0, workspace_1.updateWorkspace)((workspace) => {
15
- context.logger.info(`[INFO]: Adding global styles...`);
16
- const project = (0, get_project_1.getProject)(options, workspace);
17
- if (!project) {
18
- context.logger.warn(`[WARNING]: Target project not found.`);
19
- return;
20
- }
21
- const targetOptions = (0, schematics_1.getProjectTargetOptions)(project, 'build');
22
- const styles = targetOptions['styles'];
23
- if (!styles) {
24
- targetOptions['styles'] = styles_1.NG_DOC_STYLES;
25
- return;
26
- }
27
- targetOptions['styles'] = Array.from(new Set([...styles_1.NG_DOC_STYLES, ...styles]));
28
- });
29
- }
30
- exports.addStyles = addStyles;
31
- //# sourceMappingURL=add-styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-styles.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/steps/add-styles.ts"],"names":[],"mappings":";;;AAAA,wDAAgE;AAGhE,qEAA8G;AAE9G,gDAAkD;AAElD,sDAAgD;AAEhD;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe,EAAE,OAAyB;IACnE,OAAO,IAAA,2BAAe,EAAC,CAAC,SAA8B,EAAE,EAAE;QACzD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAEvD,MAAM,OAAO,GAAkC,IAAA,wBAAU,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE9E,IAAI,CAAC,OAAO,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YAC5D,OAAO;SACP;QAED,MAAM,aAAa,GAA8B,IAAA,oCAAuB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAE3F,MAAM,MAAM,GAA0B,aAAa,CAAC,QAAQ,CAA0B,CAAC;QAEvF,IAAI,CAAC,MAAM,EAAE;YACZ,aAAa,CAAC,QAAQ,CAAC,GAAG,sBAAa,CAAC;YACxC,OAAO;SACP;QAED,aAAa,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,sBAAa,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACJ,CAAC;AAtBD,8BAsBC"}
@@ -1,8 +0,0 @@
1
- import { Rule, SchematicContext } from '@angular-devkit/schematics';
2
- import { Schema } from '../schema';
3
- /**
4
- *
5
- * @param options
6
- * @param context
7
- */
8
- export declare function replaceBuilders(options: Schema, context: SchematicContext): Rule;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceBuilders = void 0;
4
- const workspace_1 = require("@schematics/angular/utility/workspace");
5
- const get_project_1 = require("../utils/get-project");
6
- /**
7
- *
8
- * @param options
9
- * @param context
10
- */
11
- function replaceBuilders(options, context) {
12
- return (0, workspace_1.updateWorkspace)((workspace) => {
13
- context.logger.info(`[INFO]: Replacing default builders...`);
14
- const project = (0, get_project_1.getProject)(options, workspace);
15
- if (!project) {
16
- context.logger.warn(`[WARNING]: Target project not found.`);
17
- return;
18
- }
19
- const buildTarget = project.targets.get('build');
20
- const serveTarget = project.targets.get('serve');
21
- if (buildTarget) {
22
- buildTarget.builder = '@ng-doc/builder:browser';
23
- }
24
- else {
25
- context.logger.warn(`[WARNING]: "build" target was not found, please add builder manually.`);
26
- }
27
- if (serveTarget) {
28
- serveTarget.builder = '@ng-doc/builder:dev-server';
29
- }
30
- else {
31
- context.logger.warn(`[WARNING]: "serve" target was not found, please add builder manually.`);
32
- }
33
- });
34
- }
35
- exports.replaceBuilders = replaceBuilders;
36
- //# sourceMappingURL=replace-builders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-builders.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/steps/replace-builders.ts"],"names":[],"mappings":";;;AACA,qEAK+C;AAG/C,sDAAgD;AAEhD;;;;GAIG;AACH,SAAgB,eAAe,CAAC,OAAe,EAAE,OAAyB;IACzE,OAAO,IAAA,2BAAe,EAAC,CAAC,SAA8B,EAAE,EAAE;QACzD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QAE7D,MAAM,OAAO,GAAkC,IAAA,wBAAU,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE9E,IAAI,CAAC,OAAO,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YAC5D,OAAO;SACP;QAED,MAAM,WAAW,GAAiC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/E,MAAM,WAAW,GAAiC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE/E,IAAI,WAAW,EAAE;YAChB,WAAW,CAAC,OAAO,GAAG,yBAAyB,CAAC;SAChD;aAAM;YACN,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAC;SAC7F;QAED,IAAI,WAAW,EAAE;YAChB,WAAW,CAAC,OAAO,GAAG,4BAA4B,CAAC;SACnD;aAAM;YACN,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAC;SAC7F;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AA1BD,0CA0BC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,154 +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
- const schematics_1 = require("@angular-devkit/schematics");
13
- const testing_1 = require("@angular-devkit/schematics/testing");
14
- const ng_morph_1 = require("ng-morph");
15
- const path_1 = require("path");
16
- const app_component_content_1 = require("../constants/app-component-content");
17
- const version_1 = require("../constants/version");
18
- const create_angular_json_1 = require("../utils/create-angular-json");
19
- const collectionPath = (0, path_1.join)(__dirname, '../../collection.json');
20
- describe('ng-add', () => {
21
- let host;
22
- let runner;
23
- beforeEach(() => {
24
- host = new testing_1.UnitTestTree(new schematics_1.HostTree());
25
- runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
26
- (0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(host));
27
- (0, ng_morph_1.createSourceFile)('package.json', '{"dependencies": {"@angular/core": "~13.0.0"}}');
28
- (0, create_angular_json_1.createAngularJson)();
29
- createMainFiles();
30
- (0, ng_morph_1.saveActiveProject)();
31
- });
32
- it('should add main modules in package.json', () => __awaiter(void 0, void 0, void 0, function* () {
33
- const options = {
34
- project: '',
35
- };
36
- const tree = yield runner.runSchematicAsync('ng-add', options, host).toPromise();
37
- expect(tree.readContent('package.json')).toEqual(`{
38
- "dependencies": {
39
- "@angular/core": "~13.0.0",
40
- "@ng-doc/builder": "${version_1.NG_DOC_VERSION}",
41
- "@ng-doc/core": "${version_1.NG_DOC_VERSION}",
42
- "@ng-doc/ui-kit": "${version_1.NG_DOC_VERSION}"
43
- }
44
- }`);
45
- }));
46
- it('should replace content of the app components template', () => __awaiter(void 0, void 0, void 0, function* () {
47
- const options = {
48
- project: '',
49
- };
50
- const tree = yield runner.runSchematicAsync('ng-add', options, host).toPromise();
51
- expect(tree.readContent('test/app/app.template.html')).toEqual(app_component_content_1.APP_COMPONENT_CONTENT);
52
- }));
53
- it('should add NgDoc modules', () => __awaiter(void 0, void 0, void 0, function* () {
54
- const options = {
55
- project: '',
56
- };
57
- const tree = yield runner.runSchematicAsync('ng-add', options, host).toPromise();
58
- expect(tree.readContent('test/app/app.module.ts')).toEqual(`import { NgDocModule } from "@ng-doc/app";
59
- import { NG_DOC_ROUTING, NgDocGeneratedModule } from "@ng-doc/builder/generated";
60
- import { RouterModule } from "@angular/router";
61
- import { NgDocSidebarModule } from "@ng-doc/app/components/sidebar";
62
- import { NgDocNavbarModule } from "@ng-doc/app/components/navbar";
63
- import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
64
- import {NgModule} from '@angular/core';
65
- import {AppComponent} from './app.component';
66
-
67
- @NgModule({declarations: [AppComponent],
68
- imports: [BrowserAnimationsModule, NgDocNavbarModule, NgDocSidebarModule, RouterModule.forRoot(NG_DOC_ROUTING), NgDocModule.forRoot(), NgDocGeneratedModule.forRoot()]
69
- })
70
- export class AppModule {}
71
- `);
72
- }));
73
- it('should update angular.json', () => __awaiter(void 0, void 0, void 0, function* () {
74
- const options = {
75
- project: '',
76
- };
77
- const tree = yield runner.runSchematicAsync('ng-add', options, host).toPromise();
78
- expect(tree.readContent('angular.json')).toEqual(`
79
- {
80
- "version": 1,
81
- "defaultProject": "demo",
82
- "projects": {
83
- "demo": {
84
- \t"root": ".",
85
- "architect": {
86
- "build": {
87
- "options": {
88
- "main": "test/main.ts",
89
- "styles": [
90
- "./node_modules/@ng-doc/app/styles/global.css"
91
- ],
92
- "assets": [
93
- {
94
- "glob": "**/*",
95
- "input": "./node_modules/@ng-doc/ui-kit/assets",
96
- "output": "assets"
97
- },
98
- {
99
- "glob": "**/*",
100
- "input": "./node_modules/@ng-doc/app/assets",
101
- "output": "assets"
102
- },
103
- {
104
- "glob": "**/*",
105
- "input": "./node_modules/@ng-doc/builder/generated/assets",
106
- "output": "assets"
107
- }
108
- ]
109
- },
110
- "configurations": {
111
- \t"production": {
112
- \t\t"sourceMap": true,
113
- \t\t\t\t\t"optimization": true,
114
- \t\t\t\t\t"buildOptimizer": true,
115
- \t\t\t\t\t"aot": true
116
- \t}
117
- },
118
- "builder": "@ng-doc/builder:browser"
119
- }
120
- }
121
- }
122
- }
123
- }`);
124
- }));
125
- });
126
- /**
127
- *
128
- */
129
- function createMainFiles() {
130
- (0, ng_morph_1.createSourceFile)('test/main.ts', `import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
131
- import {AppModule} from './app/app.module';
132
- import {environment} from './environments/environment';
133
-
134
- if (environment.production) {
135
- enableProdMode();
136
- }
137
- platformBrowserDynamic()
138
- .bootstrapModule(AppModule)
139
- .catch(err => console.log(err));
140
- `);
141
- (0, ng_morph_1.createSourceFile)('test/app/app.module.ts', `import {NgModule} from '@angular/core';
142
- import {AppComponent} from './app.component';
143
-
144
- @NgModule({declarations: [AppComponent]})
145
- export class AppModule {}
146
- `);
147
- (0, ng_morph_1.createSourceFile)('test/app/app.component.ts', `import {Component} from '@angular/core';
148
- import {AppComponent} from './app.component';
149
-
150
- @Component({templateUrl: './app.template.html'})
151
- export class AppComponent {}`);
152
- (0, ng_morph_1.createSourceFile)('test/app/app.template.html', `<app></app>`);
153
- }
154
- //# sourceMappingURL=ng-add.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ng-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;;CAKD,CACC,CAAC;IAEF,IAAA,2BAAgB,EACf,2BAA2B,EAC3B;;;;6BAI2B,CAC3B,CAAC;IAEF,IAAA,2BAAgB,EAAC,4BAA4B,EAAE,aAAa,CAAC,CAAC;AAC/D,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- *
3
- * @param filePath
4
- * @param namedImport
5
- * @param moduleSpecifier
6
- */
7
- export declare function addUniqueImport(filePath: string, namedImport: string, moduleSpecifier: string): void;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addUniqueImport = void 0;
4
- const ng_morph_1 = require("ng-morph");
5
- /**
6
- *
7
- * @param filePath
8
- * @param namedImport
9
- * @param moduleSpecifier
10
- */
11
- function addUniqueImport(filePath, namedImport, moduleSpecifier) {
12
- const existingNamedImport = (0, ng_morph_1.getImports)(filePath, {
13
- namedImports: namedImport,
14
- moduleSpecifier,
15
- });
16
- if (existingNamedImport.length) {
17
- return;
18
- }
19
- const existingDeclaration = (0, ng_morph_1.getImports)(filePath, {
20
- moduleSpecifier,
21
- });
22
- if (existingDeclaration.length) {
23
- const modules = existingDeclaration[0]
24
- .getNamedImports()
25
- .map((namedImport) => namedImport.getText());
26
- (0, ng_morph_1.editImports)(existingDeclaration[0], () => ({
27
- namedImports: [...modules, namedImport],
28
- }));
29
- return;
30
- }
31
- (0, ng_morph_1.addImports)(filePath, {
32
- moduleSpecifier: moduleSpecifier,
33
- namedImports: [namedImport],
34
- });
35
- }
36
- exports.addUniqueImport = addUniqueImport;
37
- //# sourceMappingURL=add-unique-import.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-unique-import.js","sourceRoot":"","sources":["../../../../../../libs/app/schematics/ng-add/utils/add-unique-import.ts"],"names":[],"mappings":";;;AAAA,uCAAiG;AAEjG;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,QAAgB,EAAE,WAAmB,EAAE,eAAuB;IAC7F,MAAM,mBAAmB,GAAwB,IAAA,qBAAU,EAAC,QAAQ,EAAE;QACrE,YAAY,EAAE,WAAW;QACzB,eAAe;KACf,CAAC,CAAC;IAEH,IAAI,mBAAmB,CAAC,MAAM,EAAE;QAC/B,OAAO;KACP;IAED,MAAM,mBAAmB,GAAwB,IAAA,qBAAU,EAAC,QAAQ,EAAE;QACrE,eAAe;KACf,CAAC,CAAC;IAEH,IAAI,mBAAmB,CAAC,MAAM,EAAE;QAC/B,MAAM,OAAO,GAAa,mBAAmB,CAAC,CAAC,CAAC;aAC9C,eAAe,EAAE;aACjB,GAAG,CAAC,CAAC,WAA4B,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/D,IAAA,sBAAW,EAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;YAC1C,YAAY,EAAE,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC;SACvC,CAAC,CAAC,CAAC;QAEJ,OAAO;KACP;IAED,IAAA,qBAAU,EAAC,QAAQ,EAAE;QACpB,eAAe,EAAE,eAAe;QAChC,YAAY,EAAE,CAAC,WAAW,CAAC;KAC3B,CAAC,CAAC;AACJ,CAAC;AA9BD,0CA8BC"}