@po-ui/ng-code-editor 15.15.0 → 16.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 (38) hide show
  1. package/{esm2020 → esm2022}/lib/components/po-code-editor/interfaces/po-code-editor-registerable-options.interface.mjs +1 -1
  2. package/{esm2020 → esm2022}/lib/components/po-code-editor/interfaces/po-code-editor-registerable-suggestion.interface.mjs +1 -1
  3. package/{esm2020 → esm2022}/lib/components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface.mjs +1 -1
  4. package/{esm2020 → esm2022}/lib/components/po-code-editor/interfaces/po-code-editor-registerable.interface.mjs +1 -1
  5. package/esm2022/lib/components/po-code-editor/po-code-editor-base.component.mjs +261 -0
  6. package/esm2022/lib/components/po-code-editor/po-code-editor-register.service.mjs +72 -0
  7. package/{esm2020 → esm2022}/lib/components/po-code-editor/po-code-editor-suggestion.service.mjs +28 -29
  8. package/esm2022/lib/components/po-code-editor/po-code-editor.component.mjs +234 -0
  9. package/{esm2020 → esm2022}/lib/components/po-code-editor/po-code-editor.module.mjs +37 -37
  10. package/{esm2020 → esm2022}/lib/index.mjs +3 -3
  11. package/{esm2020 → esm2022}/po-ui-ng-code-editor.mjs +4 -4
  12. package/{esm2020 → esm2022}/public-api.mjs +1 -1
  13. package/{fesm2020 → fesm2022}/po-ui-ng-code-editor.mjs +607 -597
  14. package/{fesm2020 → fesm2022}/po-ui-ng-code-editor.mjs.map +1 -1
  15. package/index.d.ts +5 -5
  16. package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-options.interface.d.ts +22 -22
  17. package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-suggestion.interface.d.ts +37 -37
  18. package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface.d.ts +21 -21
  19. package/lib/components/po-code-editor/interfaces/po-code-editor-registerable.interface.d.ts +17 -17
  20. package/lib/components/po-code-editor/po-code-editor-base.component.d.ts +194 -194
  21. package/lib/components/po-code-editor/po-code-editor-register.service.d.ts +70 -70
  22. package/lib/components/po-code-editor/po-code-editor-suggestion.service.d.ts +10 -10
  23. package/lib/components/po-code-editor/po-code-editor.component.d.ts +61 -61
  24. package/lib/components/po-code-editor/po-code-editor.module.d.ts +16 -16
  25. package/lib/index.d.ts +7 -7
  26. package/package.json +12 -18
  27. package/po-ui-ng-code-editor-16.0.0-next.2.tgz +0 -0
  28. package/public-api.d.ts +1 -1
  29. package/schematics/ng-add/index.d.ts +10 -10
  30. package/schematics/ng-add/index.js +38 -38
  31. package/schematics/ng-add/index.spec.d.ts +1 -1
  32. package/schematics/ng-add/index.spec.js +113 -113
  33. package/esm2020/lib/components/po-code-editor/po-code-editor-base.component.mjs +0 -261
  34. package/esm2020/lib/components/po-code-editor/po-code-editor-register.service.mjs +0 -66
  35. package/esm2020/lib/components/po-code-editor/po-code-editor.component.mjs +0 -229
  36. package/fesm2015/po-ui-ng-code-editor.mjs +0 -632
  37. package/fesm2015/po-ui-ng-code-editor.mjs.map +0 -1
  38. package/po-ui-ng-code-editor-15.15.0.tgz +0 -0
@@ -1,61 +1,61 @@
1
- import { AfterViewInit, DoCheck, ElementRef, NgZone } from '@angular/core';
2
- import { PoCodeEditorBaseComponent } from './po-code-editor-base.component';
3
- import { PoCodeEditorRegister } from './po-code-editor-register.service';
4
- import { PoCodeEditorRegisterableSuggestion } from './interfaces/po-code-editor-registerable-suggestion.interface';
5
- import { PoCodeEditorSuggestionService } from './po-code-editor-suggestion.service';
6
- import * as i0 from "@angular/core";
7
- /**
8
- * @docsExtends PoCodeEditorBaseComponent
9
- *
10
- * @example
11
- *
12
- * <example name="po-code-editor-basic" title="PO Code Editor Basic">
13
- * <file name="sample-po-code-editor-basic/sample-po-code-editor-basic.component.html"> </file>
14
- * <file name="sample-po-code-editor-basic/sample-po-code-editor-basic.component.ts"> </file>
15
- * </example>
16
- *
17
- * <example name="po-code-editor-labs" title="PO Code Editor Labs">
18
- * <file name="sample-po-code-editor-labs/sample-po-code-editor-labs.component.html"> </file>
19
- * <file name="sample-po-code-editor-labs/sample-po-code-editor-labs.component.ts"> </file>
20
- * </example>
21
- *
22
- * <example name="po-code-editor-diff" title="PO Code Editor - Diff">
23
- * <file name="sample-po-code-editor-diff/sample-po-code-editor-diff.component.html"> </file>
24
- * <file name="sample-po-code-editor-diff/sample-po-code-editor-diff.component.ts"> </file>
25
- * </example>
26
- *
27
- * <example name="po-code-editor-terraform" title="PO Code Editor - Terraform">
28
- * <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.component.html"> </file>
29
- * <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.component.ts"> </file>
30
- * <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.constant.ts"> </file>
31
- * <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.module.ts"> </file>
32
- * </example>
33
- *
34
- * <example name="po-code-editor-suggestion" title="PO Code Editor Suggestion">
35
- * <file name="sample-po-code-editor-suggestion/sample-po-code-editor-suggestion.component.html"> </file>
36
- * <file name="sample-po-code-editor-suggestion/sample-po-code-editor-suggestion.component.ts"> </file>
37
- * </example>
38
- */
39
- export declare class PoCodeEditorComponent extends PoCodeEditorBaseComponent implements AfterViewInit, DoCheck {
40
- private zone;
41
- private el;
42
- private poCodeEditorSuggestionService;
43
- private codeEditorRegister?;
44
- editorContainer: ElementRef;
45
- canLoad: boolean;
46
- constructor(zone: NgZone, el: ElementRef, poCodeEditorSuggestionService: PoCodeEditorSuggestionService, codeEditorRegister?: PoCodeEditorRegister);
47
- ngAfterViewInit(): void;
48
- ngDoCheck(): void;
49
- monacoCreateModel(value: string): any;
50
- setValueInEditor(): void;
51
- setLanguage(language: string): void;
52
- setTheme(theme: string): void;
53
- setReadOnly(readOnly: boolean): void;
54
- setSuggestions(newSuggestions: Array<PoCodeEditorRegisterableSuggestion>, language?: string): void;
55
- writeValue(value: any): void;
56
- private initMonaco;
57
- private setMonacoLanguage;
58
- private registerCustomLanguage;
59
- static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorComponent, never>;
60
- static ɵcmp: i0.ɵɵComponentDeclaration<PoCodeEditorComponent, "po-code-editor", never, {}, {}, never, never, false, never>;
61
- }
1
+ import { AfterViewInit, DoCheck, ElementRef, NgZone } from '@angular/core';
2
+ import { PoCodeEditorBaseComponent } from './po-code-editor-base.component';
3
+ import { PoCodeEditorRegister } from './po-code-editor-register.service';
4
+ import { PoCodeEditorRegisterableSuggestion } from './interfaces/po-code-editor-registerable-suggestion.interface';
5
+ import { PoCodeEditorSuggestionService } from './po-code-editor-suggestion.service';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * @docsExtends PoCodeEditorBaseComponent
9
+ *
10
+ * @example
11
+ *
12
+ * <example name="po-code-editor-basic" title="PO Code Editor Basic">
13
+ * <file name="sample-po-code-editor-basic/sample-po-code-editor-basic.component.html"> </file>
14
+ * <file name="sample-po-code-editor-basic/sample-po-code-editor-basic.component.ts"> </file>
15
+ * </example>
16
+ *
17
+ * <example name="po-code-editor-labs" title="PO Code Editor Labs">
18
+ * <file name="sample-po-code-editor-labs/sample-po-code-editor-labs.component.html"> </file>
19
+ * <file name="sample-po-code-editor-labs/sample-po-code-editor-labs.component.ts"> </file>
20
+ * </example>
21
+ *
22
+ * <example name="po-code-editor-diff" title="PO Code Editor - Diff">
23
+ * <file name="sample-po-code-editor-diff/sample-po-code-editor-diff.component.html"> </file>
24
+ * <file name="sample-po-code-editor-diff/sample-po-code-editor-diff.component.ts"> </file>
25
+ * </example>
26
+ *
27
+ * <example name="po-code-editor-terraform" title="PO Code Editor - Terraform">
28
+ * <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.component.html"> </file>
29
+ * <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.component.ts"> </file>
30
+ * <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.constant.ts"> </file>
31
+ * <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.module.ts"> </file>
32
+ * </example>
33
+ *
34
+ * <example name="po-code-editor-suggestion" title="PO Code Editor Suggestion">
35
+ * <file name="sample-po-code-editor-suggestion/sample-po-code-editor-suggestion.component.html"> </file>
36
+ * <file name="sample-po-code-editor-suggestion/sample-po-code-editor-suggestion.component.ts"> </file>
37
+ * </example>
38
+ */
39
+ export declare class PoCodeEditorComponent extends PoCodeEditorBaseComponent implements AfterViewInit, DoCheck {
40
+ private zone;
41
+ private el;
42
+ private poCodeEditorSuggestionService;
43
+ private codeEditorRegister?;
44
+ editorContainer: ElementRef;
45
+ canLoad: boolean;
46
+ constructor(zone: NgZone, el: ElementRef, poCodeEditorSuggestionService: PoCodeEditorSuggestionService, codeEditorRegister?: PoCodeEditorRegister);
47
+ ngAfterViewInit(): void;
48
+ ngDoCheck(): void;
49
+ monacoCreateModel(value: string): any;
50
+ setValueInEditor(): void;
51
+ setLanguage(language: string): void;
52
+ setTheme(theme: string): void;
53
+ setReadOnly(readOnly: boolean): void;
54
+ setSuggestions(newSuggestions: Array<PoCodeEditorRegisterableSuggestion>, language?: string): void;
55
+ writeValue(value: any): void;
56
+ private initMonaco;
57
+ private setMonacoLanguage;
58
+ private registerCustomLanguage;
59
+ static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorComponent, never>;
60
+ static ɵcmp: i0.ɵɵComponentDeclaration<PoCodeEditorComponent, "po-code-editor", never, {}, {}, never, never, false, never>;
61
+ }
@@ -1,16 +1,16 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import { PoCodeEditorRegisterable } from './interfaces/po-code-editor-registerable.interface';
3
- import * as i0 from "@angular/core";
4
- import * as i1 from "./po-code-editor.component";
5
- import * as i2 from "@angular/common";
6
- /**
7
- * @description
8
- *
9
- * Módulo do componente po-code-editor.
10
- */
11
- export declare class PoCodeEditorModule {
12
- static forRegister(props: PoCodeEditorRegisterable): ModuleWithProviders<PoCodeEditorModule>;
13
- static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorModule, never>;
14
- static ɵmod: i0.ɵɵNgModuleDeclaration<PoCodeEditorModule, [typeof i1.PoCodeEditorComponent], [typeof i2.CommonModule], [typeof i1.PoCodeEditorComponent]>;
15
- static ɵinj: i0.ɵɵInjectorDeclaration<PoCodeEditorModule>;
16
- }
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { PoCodeEditorRegisterable } from './interfaces/po-code-editor-registerable.interface';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "./po-code-editor.component";
5
+ import * as i2 from "@angular/common";
6
+ /**
7
+ * @description
8
+ *
9
+ * Módulo do componente po-code-editor.
10
+ */
11
+ export declare class PoCodeEditorModule {
12
+ static forRegister(props: PoCodeEditorRegisterable): ModuleWithProviders<PoCodeEditorModule>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorModule, never>;
14
+ static ɵmod: i0.ɵɵNgModuleDeclaration<PoCodeEditorModule, [typeof i1.PoCodeEditorComponent], [typeof i2.CommonModule], [typeof i1.PoCodeEditorComponent]>;
15
+ static ɵinj: i0.ɵɵInjectorDeclaration<PoCodeEditorModule>;
16
+ }
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { PoCodeEditorComponent } from './components/po-code-editor/po-code-editor.component';
2
- export { PoCodeEditorRegister } from './components/po-code-editor/po-code-editor-register.service';
3
- export { PoCodeEditorRegisterable } from './components/po-code-editor/interfaces/po-code-editor-registerable.interface';
4
- export { PoCodeEditorRegisterableOptions } from './components/po-code-editor/interfaces/po-code-editor-registerable-options.interface';
5
- export { PoCodeEditorRegisterableTokens } from './components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface';
6
- export { PoCodeEditorRegisterableSuggestion } from './components/po-code-editor/interfaces/po-code-editor-registerable-suggestion.interface';
7
- export { PoCodeEditorModule } from './components/po-code-editor/po-code-editor.module';
1
+ export { PoCodeEditorComponent } from './components/po-code-editor/po-code-editor.component';
2
+ export { PoCodeEditorRegister } from './components/po-code-editor/po-code-editor-register.service';
3
+ export { PoCodeEditorRegisterable } from './components/po-code-editor/interfaces/po-code-editor-registerable.interface';
4
+ export { PoCodeEditorRegisterableOptions } from './components/po-code-editor/interfaces/po-code-editor-registerable-options.interface';
5
+ export { PoCodeEditorRegisterableTokens } from './components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface';
6
+ export { PoCodeEditorRegisterableSuggestion } from './components/po-code-editor/interfaces/po-code-editor-registerable-suggestion.interface';
7
+ export { PoCodeEditorModule } from './components/po-code-editor/po-code-editor.module';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@po-ui/ng-code-editor",
3
- "version": "15.15.0",
3
+ "version": "16.0.0-next.2",
4
4
  "tag": "next",
5
5
  "description": "PO UI - Code Editor",
6
6
  "author": "PO UI",
@@ -12,26 +12,22 @@
12
12
  },
13
13
  "schematics": "./schematics/collection.json",
14
14
  "dependencies": {
15
- "@po-ui/ng-components": "15.15.0",
16
- "@po-ui/ng-schematics": "15.15.0",
15
+ "@po-ui/ng-components": "16.0.0-next.2",
16
+ "@po-ui/ng-schematics": "16.0.0-next.2",
17
17
  "monaco-editor": "0.24.0",
18
18
  "core-js": "^3.13.0",
19
19
  "intl": "^1.2.5",
20
20
  "tslib": "^2.3.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@angular/common": "^15.0.3",
24
- "@angular/core": "^15.0.3",
25
- "@angular/forms": "^15.0.3",
26
- "@po-ui/ng-components": "15.15.0",
23
+ "@angular/common": "~16.2.0",
24
+ "@angular/core": "~16.2.0",
25
+ "@angular/forms": "~16.2.0",
26
+ "@po-ui/ng-components": "16.0.0-next.2",
27
27
  "monaco-editor": "0.24.0",
28
- "zone.js": "~0.12.0"
28
+ "zone.js": "~0.13.1"
29
29
  },
30
- "module": "fesm2015/po-ui-ng-code-editor.mjs",
31
- "es2020": "fesm2020/po-ui-ng-code-editor.mjs",
32
- "esm2020": "esm2020/po-ui-ng-code-editor.mjs",
33
- "fesm2020": "fesm2020/po-ui-ng-code-editor.mjs",
34
- "fesm2015": "fesm2015/po-ui-ng-code-editor.mjs",
30
+ "module": "fesm2022/po-ui-ng-code-editor.mjs",
35
31
  "typings": "index.d.ts",
36
32
  "exports": {
37
33
  "./package.json": {
@@ -39,11 +35,9 @@
39
35
  },
40
36
  ".": {
41
37
  "types": "./index.d.ts",
42
- "esm2020": "./esm2020/po-ui-ng-code-editor.mjs",
43
- "es2020": "./fesm2020/po-ui-ng-code-editor.mjs",
44
- "es2015": "./fesm2015/po-ui-ng-code-editor.mjs",
45
- "node": "./fesm2015/po-ui-ng-code-editor.mjs",
46
- "default": "./fesm2020/po-ui-ng-code-editor.mjs"
38
+ "esm2022": "./esm2022/po-ui-ng-code-editor.mjs",
39
+ "esm": "./esm2022/po-ui-ng-code-editor.mjs",
40
+ "default": "./fesm2022/po-ui-ng-code-editor.mjs"
47
41
  }
48
42
  },
49
43
  "sideEffects": false,
package/public-api.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './lib/index';
1
+ export * from './lib/index';
@@ -1,10 +1,10 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- /**
3
- * Scaffolds the basics of the PO Code Editor, this includes:
4
- * - Install dependencies;
5
- * - Imports PoCodeEditorModule to app root module;
6
- * - Configure the theme's style in the project workspace;
7
- * - Configure the monaco editor's asset in the project workspace;
8
- *
9
- */
10
- export default function (options: any): Rule;
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Scaffolds the basics of the PO Code Editor, this includes:
4
+ * - Install dependencies;
5
+ * - Imports PoCodeEditorModule to app root module;
6
+ * - Configure the theme's style in the project workspace;
7
+ * - Configure the monaco editor's asset in the project workspace;
8
+ *
9
+ */
10
+ export default function (options: any): Rule;
@@ -1,39 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const schematics_1 = require("@angular-devkit/schematics");
4
- const tasks_1 = require("@angular-devkit/schematics/tasks");
5
- const package_config_1 = require("@po-ui/ng-schematics/package-config");
6
- const module_1 = require("@po-ui/ng-schematics/module/module");
7
- const build_target_options_1 = require("@po-ui/ng-schematics/build-target-options/build-target-options");
8
- /** PO Module name that will be inserted into app root module */
9
- const poCodeEditorModuleName = 'PoCodeEditorModule';
10
- const poCodeEditorModuleSourcePath = '@po-ui/ng-code-editor';
11
- // Path needs to be always relative to the `package.json` or workspace root.
12
- const poThemeStylePath = './node_modules/@po-ui/style/css/po-theme-default.min.css';
13
- // Monaco asset to be included in the project.
14
- const poCodeEditorMonacoAsset = { glob: '**/*', input: 'node_modules/monaco-editor/min', output: '/assets/monaco/' };
15
- /**
16
- * Scaffolds the basics of the PO Code Editor, this includes:
17
- * - Install dependencies;
18
- * - Imports PoCodeEditorModule to app root module;
19
- * - Configure the theme's style in the project workspace;
20
- * - Configure the monaco editor's asset in the project workspace;
21
- *
22
- */
23
- function default_1(options) {
24
- return (0, schematics_1.chain)([
25
- addPoPackageAndInstall(),
26
- (0, module_1.addModuleImportToRootModule)(options, poCodeEditorModuleName, poCodeEditorModuleSourcePath),
27
- (0, build_target_options_1.configuringBuildTargets)(options, 'styles', poThemeStylePath),
28
- (0, build_target_options_1.configuringBuildTargets)(options, 'assets', poCodeEditorMonacoAsset)
29
- ]);
30
- }
31
- exports.default = default_1;
32
- function addPoPackageAndInstall() {
33
- return (tree, context) => {
34
- (0, package_config_1.addPackageToPackageJson)(tree, '@po-ui/ng-code-editor', '15.15.0');
35
- // install packages
36
- context.addTask(new tasks_1.NodePackageInstallTask());
37
- };
38
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
5
+ const package_config_1 = require("@po-ui/ng-schematics/package-config");
6
+ const module_1 = require("@po-ui/ng-schematics/module/module");
7
+ const build_target_options_1 = require("@po-ui/ng-schematics/build-target-options/build-target-options");
8
+ /** PO Module name that will be inserted into app root module */
9
+ const poCodeEditorModuleName = 'PoCodeEditorModule';
10
+ const poCodeEditorModuleSourcePath = '@po-ui/ng-code-editor';
11
+ // Path needs to be always relative to the `package.json` or workspace root.
12
+ const poThemeStylePath = './node_modules/@po-ui/style/css/po-theme-default.min.css';
13
+ // Monaco asset to be included in the project.
14
+ const poCodeEditorMonacoAsset = { glob: '**/*', input: 'node_modules/monaco-editor/min', output: '/assets/monaco/' };
15
+ /**
16
+ * Scaffolds the basics of the PO Code Editor, this includes:
17
+ * - Install dependencies;
18
+ * - Imports PoCodeEditorModule to app root module;
19
+ * - Configure the theme's style in the project workspace;
20
+ * - Configure the monaco editor's asset in the project workspace;
21
+ *
22
+ */
23
+ function default_1(options) {
24
+ return (0, schematics_1.chain)([
25
+ addPoPackageAndInstall(),
26
+ (0, module_1.addModuleImportToRootModule)(options, poCodeEditorModuleName, poCodeEditorModuleSourcePath),
27
+ (0, build_target_options_1.configuringBuildTargets)(options, 'styles', poThemeStylePath),
28
+ (0, build_target_options_1.configuringBuildTargets)(options, 'assets', poCodeEditorMonacoAsset)
29
+ ]);
30
+ }
31
+ exports.default = default_1;
32
+ function addPoPackageAndInstall() {
33
+ return (tree, context) => {
34
+ (0, package_config_1.addPackageToPackageJson)(tree, '@po-ui/ng-code-editor', '16.0.0-next.2');
35
+ // install packages
36
+ context.addTask(new tasks_1.NodePackageInstallTask());
37
+ };
38
+ }
39
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,114 +1,114 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const testing_1 = require("@angular-devkit/schematics/testing");
5
- const project_1 = require("@po-ui/ng-schematics/project");
6
- const path = require("path");
7
- const collectionPath = path.join(__dirname, '../collection.json');
8
- xdescribe('Schematic: ng-add', () => {
9
- const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
10
- const workspaceOptions = {
11
- name: 'workspace',
12
- newProjectRoot: 'projects',
13
- version: '6.0.0'
14
- };
15
- const componentOptions = {
16
- name: 'po'
17
- };
18
- let appTree;
19
- beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
20
- appTree = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
21
- appTree = yield runner
22
- .runExternalSchematicAsync('@schematics/angular', 'application', componentOptions, appTree)
23
- .toPromise();
24
- }));
25
- describe('Dependencies:', () => {
26
- it('should update package.json with @po-ui/ng-code-editor dependency and run nodePackageInstall', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
27
- const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
28
- const packageJson = JSON.parse(getFileContent(tree, '/package.json'));
29
- const dependencies = packageJson.dependencies;
30
- expect(dependencies['@po-ui/ng-code-editor']).toBeDefined();
31
- expect(Object.keys(dependencies)).toEqual(Object.keys(dependencies).sort());
32
- expect(runner.tasks.some(task => task.name === 'node-package')).toBe(true);
33
- }));
34
- });
35
- describe('Imports:', () => {
36
- it('should add the PoCodeEditorModule to the project module', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
37
- const poCodeEditorModuleName = 'PoCodeEditorModule';
38
- const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
39
- const fileContent = getFileContent(tree, `projects/${componentOptions.name}/src/app/app.module.ts`);
40
- expect(fileContent).toContain(poCodeEditorModuleName);
41
- }));
42
- });
43
- describe('Theme configuration:', () => {
44
- const defaultThemePath = './node_modules/@po-ui/style/css/po-theme-default.min.css';
45
- it('should add default theme in styles of build project', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
46
- var _a;
47
- const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
48
- const workspace = (_a = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _a !== void 0 ? _a : {};
49
- const project = (0, project_1.getProjectFromWorkspace)(workspace);
50
- expectProjectPropertyFile(project, defaultThemePath, 'styles');
51
- }));
52
- it('shouldn`t add a theme file in styles of build project multiple times', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
53
- var _b;
54
- writePropertiesFileToWorkspace(appTree, defaultThemePath, 'styles');
55
- const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
56
- const workspace = (_b = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _b !== void 0 ? _b : {};
57
- const project = (0, project_1.getProjectFromWorkspace)(workspace);
58
- const styles = (0, project_1.getProjectTargetOptions)(project, 'build').styles;
59
- expect(styles).toEqual([`projects/${componentOptions.name}/src/styles.css`, defaultThemePath]);
60
- }));
61
- });
62
- describe('Assets configuration:', () => {
63
- const defaultAssetsPath = {
64
- 'glob': '**/*',
65
- 'input': 'node_modules/monaco-editor/min',
66
- 'output': '/assets/monaco/'
67
- };
68
- it('should add assets of build project', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
69
- var _a;
70
- const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
71
- const workspace = (_a = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _a !== void 0 ? _a : {};
72
- const project = (0, project_1.getProjectFromWorkspace)(workspace);
73
- const assets = (0, project_1.getProjectTargetOptions)(project, 'build').assets;
74
- const hasMonacoAssets = assets.some(element => typeof element === 'object' && JSON.stringify(element) === JSON.stringify(defaultAssetsPath));
75
- expect(hasMonacoAssets).toBe(true);
76
- }));
77
- it('shouldn`t add a monaco assets file in assets of build project multiple times', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
78
- var _b;
79
- writePropertiesFileToWorkspace(appTree, `${defaultAssetsPath}`, 'assets');
80
- const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
81
- const workspace = (_b = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _b !== void 0 ? _b : {};
82
- const project = (0, project_1.getProjectFromWorkspace)(workspace);
83
- const assets = (0, project_1.getProjectTargetOptions)(project, 'build').assets;
84
- const getMonacoAssets = assets.filter(element => JSON.stringify(element) === JSON.stringify(defaultAssetsPath));
85
- expect(getMonacoAssets.length).toBe(1);
86
- }));
87
- });
88
- });
89
- /** Gets the content of a specified file from a schematic tree. */
90
- function getFileContent(tree, filePath) {
91
- const contentBuffer = tree.read(filePath);
92
- if (!contentBuffer) {
93
- throw new Error(`Cannot read "${filePath}" because it does not exist.`);
94
- }
95
- return contentBuffer.toString();
96
- }
97
- /** Expects the given file to be in the property of the specified workspace project. */
98
- function expectProjectPropertyFile(project, filePath, property) {
99
- expect((0, project_1.getProjectTargetOptions)(project, 'build')[property]).toContain(filePath, `Expected "${filePath}" to be added to the project ${property} in the workspace.`);
100
- }
101
- function writePropertiesFileToWorkspace(tree, filePath, property) {
102
- var _a;
103
- const workspace = (_a = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _a !== void 0 ? _a : {};
104
- const project = (0, project_1.getProjectFromWorkspace)(workspace);
105
- const buildOptions = (0, project_1.getProjectTargetOptions)(project, 'build');
106
- if (!buildOptions[property]) {
107
- buildOptions[property] = [filePath];
108
- }
109
- else {
110
- buildOptions[property].push(filePath);
111
- }
112
- tree.overwrite('/angular.json', JSON.stringify(workspace, null, 2));
113
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const testing_1 = require("@angular-devkit/schematics/testing");
5
+ const project_1 = require("@po-ui/ng-schematics/project");
6
+ const path = require("path");
7
+ const collectionPath = path.join(__dirname, '../collection.json');
8
+ xdescribe('Schematic: ng-add', () => {
9
+ const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
10
+ const workspaceOptions = {
11
+ name: 'workspace',
12
+ newProjectRoot: 'projects',
13
+ version: '6.0.0'
14
+ };
15
+ const componentOptions = {
16
+ name: 'po'
17
+ };
18
+ let appTree;
19
+ beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
20
+ appTree = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
21
+ appTree = yield runner
22
+ .runExternalSchematicAsync('@schematics/angular', 'application', componentOptions, appTree)
23
+ .toPromise();
24
+ }));
25
+ describe('Dependencies:', () => {
26
+ it('should update package.json with @po-ui/ng-code-editor dependency and run nodePackageInstall', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
27
+ const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
28
+ const packageJson = JSON.parse(getFileContent(tree, '/package.json'));
29
+ const dependencies = packageJson.dependencies;
30
+ expect(dependencies['@po-ui/ng-code-editor']).toBeDefined();
31
+ expect(Object.keys(dependencies)).toEqual(Object.keys(dependencies).sort());
32
+ expect(runner.tasks.some(task => task.name === 'node-package')).toBe(true);
33
+ }));
34
+ });
35
+ describe('Imports:', () => {
36
+ it('should add the PoCodeEditorModule to the project module', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
37
+ const poCodeEditorModuleName = 'PoCodeEditorModule';
38
+ const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
39
+ const fileContent = getFileContent(tree, `projects/${componentOptions.name}/src/app/app.module.ts`);
40
+ expect(fileContent).toContain(poCodeEditorModuleName);
41
+ }));
42
+ });
43
+ describe('Theme configuration:', () => {
44
+ const defaultThemePath = './node_modules/@po-ui/style/css/po-theme-default.min.css';
45
+ it('should add default theme in styles of build project', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
46
+ var _a;
47
+ const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
48
+ const workspace = (_a = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _a !== void 0 ? _a : {};
49
+ const project = (0, project_1.getProjectFromWorkspace)(workspace);
50
+ expectProjectPropertyFile(project, defaultThemePath, 'styles');
51
+ }));
52
+ it('shouldn`t add a theme file in styles of build project multiple times', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
53
+ var _b;
54
+ writePropertiesFileToWorkspace(appTree, defaultThemePath, 'styles');
55
+ const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
56
+ const workspace = (_b = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _b !== void 0 ? _b : {};
57
+ const project = (0, project_1.getProjectFromWorkspace)(workspace);
58
+ const styles = (0, project_1.getProjectTargetOptions)(project, 'build').styles;
59
+ expect(styles).toEqual([`projects/${componentOptions.name}/src/styles.css`, defaultThemePath]);
60
+ }));
61
+ });
62
+ describe('Assets configuration:', () => {
63
+ const defaultAssetsPath = {
64
+ 'glob': '**/*',
65
+ 'input': 'node_modules/monaco-editor/min',
66
+ 'output': '/assets/monaco/'
67
+ };
68
+ it('should add assets of build project', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
69
+ var _a;
70
+ const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
71
+ const workspace = (_a = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _a !== void 0 ? _a : {};
72
+ const project = (0, project_1.getProjectFromWorkspace)(workspace);
73
+ const assets = (0, project_1.getProjectTargetOptions)(project, 'build').assets;
74
+ const hasMonacoAssets = assets.some(element => typeof element === 'object' && JSON.stringify(element) === JSON.stringify(defaultAssetsPath));
75
+ expect(hasMonacoAssets).toBe(true);
76
+ }));
77
+ it('shouldn`t add a monaco assets file in assets of build project multiple times', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
78
+ var _b;
79
+ writePropertiesFileToWorkspace(appTree, `${defaultAssetsPath}`, 'assets');
80
+ const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
81
+ const workspace = (_b = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _b !== void 0 ? _b : {};
82
+ const project = (0, project_1.getProjectFromWorkspace)(workspace);
83
+ const assets = (0, project_1.getProjectTargetOptions)(project, 'build').assets;
84
+ const getMonacoAssets = assets.filter(element => JSON.stringify(element) === JSON.stringify(defaultAssetsPath));
85
+ expect(getMonacoAssets.length).toBe(1);
86
+ }));
87
+ });
88
+ });
89
+ /** Gets the content of a specified file from a schematic tree. */
90
+ function getFileContent(tree, filePath) {
91
+ const contentBuffer = tree.read(filePath);
92
+ if (!contentBuffer) {
93
+ throw new Error(`Cannot read "${filePath}" because it does not exist.`);
94
+ }
95
+ return contentBuffer.toString();
96
+ }
97
+ /** Expects the given file to be in the property of the specified workspace project. */
98
+ function expectProjectPropertyFile(project, filePath, property) {
99
+ expect((0, project_1.getProjectTargetOptions)(project, 'build')[property]).toContain(filePath, `Expected "${filePath}" to be added to the project ${property} in the workspace.`);
100
+ }
101
+ function writePropertiesFileToWorkspace(tree, filePath, property) {
102
+ var _a;
103
+ const workspace = (_a = (0, project_1.getWorkspaceConfigGracefully)(tree)) !== null && _a !== void 0 ? _a : {};
104
+ const project = (0, project_1.getProjectFromWorkspace)(workspace);
105
+ const buildOptions = (0, project_1.getProjectTargetOptions)(project, 'build');
106
+ if (!buildOptions[property]) {
107
+ buildOptions[property] = [filePath];
108
+ }
109
+ else {
110
+ buildOptions[property].push(filePath);
111
+ }
112
+ tree.overwrite('/angular.json', JSON.stringify(workspace, null, 2));
113
+ }
114
114
  //# sourceMappingURL=index.spec.js.map