@nstudio/angular 15.0.4-rc.0 → 15.0.4-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,10 +42,12 @@ You are now ready to create apps:
42
42
  nx g app
43
43
  ```
44
44
 
45
- **NOTE:** If you encounter any issue, you can try creating an Nx workspace with version specified, for example:
45
+ **NOTE:** If you encounter any issue, you can try creating an Nx workspace with a version specified.
46
+
47
+ We have tested with the following, for example:
46
48
 
47
49
  ```
48
- npx create-nx-workspace@14.1.7
50
+ npx create-nx-workspace@15.9.2
49
51
  ```
50
52
 
51
53
  ## App generation examples
package/collection.json CHANGED
@@ -54,11 +54,6 @@
54
54
  "schema": "./src/schematics/elements/schema.json",
55
55
  "description": "Create custom elements for the web with Angular."
56
56
  },
57
- "helpers": {
58
- "factory": "./src/schematics/helpers",
59
- "schema": "./src/schematics/helpers/schema.json",
60
- "description": "Helpers for Angular."
61
- },
62
57
  "xplat": {
63
58
  "factory": "./src/schematics/xplat",
64
59
  "schema": "./src/schematics/xplat/schema.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nstudio/angular",
3
- "version": "15.0.4-rc.0",
3
+ "version": "15.0.4-rc.1",
4
4
  "description": "Angular Plugin for xplat",
5
5
  "homepage": "https://nstudio.io/xplat",
6
6
  "repository": {
@@ -32,6 +32,6 @@
32
32
  "@nrwl/angular": "^15.0.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "@nstudio/xplat": "15.0.4-rc.0"
35
+ "@nstudio/xplat": "15.0.4-rc.1"
36
36
  }
37
37
  }
@@ -4,6 +4,7 @@ const schematics_1 = require("@angular-devkit/schematics");
4
4
  const workspace_1 = require("@nrwl/workspace");
5
5
  const xplat_1 = require("@nstudio/xplat");
6
6
  const xplat_utils_1 = require("@nstudio/xplat-utils");
7
+ const devkit_1 = require("@nrwl/devkit");
7
8
  let customElementList;
8
9
  let componentSymbols;
9
10
  let componentSymbolList;
@@ -170,15 +171,16 @@ function addFiles(options, extra = '') {
170
171
  ])));
171
172
  }
172
173
  function updateWorkspaceSupport(options, tree, context) {
173
- const packagePath = 'package.json';
174
- const json = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
175
- json.scripts = json.scripts || {};
176
- json.dependencies = json.dependencies || {};
177
- const angularVersion = json.dependencies['@angular/core'];
178
- json.dependencies = Object.assign(Object.assign({}, json.dependencies), { '@angular/elements': angularVersion, '@webcomponents/webcomponentsjs': '^2.6.0' });
179
- json.devDependencies = json.devDependencies || {};
180
- json.devDependencies = Object.assign(Object.assign({}, json.devDependencies), { 'http-server': '^14.1.1', 'ngx-build-plus': '^15.0.0' });
181
- return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, json);
174
+ const nxTree = (0, xplat_1.convertNgTreeToDevKit)(tree, context);
175
+ (0, devkit_1.updateJson)(nxTree, 'package.json', (json) => {
176
+ json.scripts = json.scripts || {};
177
+ json.dependencies = json.dependencies || {};
178
+ const angularVersion = json.dependencies['@angular/core'];
179
+ json.dependencies = Object.assign(Object.assign({}, json.dependencies), { '@angular/elements': angularVersion, '@webcomponents/webcomponentsjs': '^2.6.0' });
180
+ json.devDependencies = json.devDependencies || {};
181
+ json.devDependencies = Object.assign(Object.assign({}, json.devDependencies), { 'http-server': '^14.1.1', 'ngx-build-plus': '^15.0.0' });
182
+ return json;
183
+ });
182
184
  }
183
185
  function createCustomElementList(componentSymbols) {
184
186
  const customElements = ['let component;'];
@@ -37,7 +37,7 @@ function default_1(options) {
37
37
  // update libs index
38
38
  (tree, context) => options.onlyProject
39
39
  ? (0, schematics_1.noop)()(tree, context)
40
- : xplat_1.XplatFeatureHelpers.adjustBarrelIndex(options, 'libs/xplat/features/src/lib/index.ts'),
40
+ : xplat_1.XplatFeatureHelpers.adjustBarrelIndex(options, 'libs/xplat/features/src/lib/index.ts')(tree, context),
41
41
  // external schematic handling
42
42
  (tree, context) => (0, schematics_1.chain)(externalChains),
43
43
  (0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sandboxHomeSetup = void 0;
13
13
  const schematics_1 = require("@angular-devkit/schematics");
14
14
  const testing_1 = require("@nstudio/xplat/testing");
15
- const testing_2 = require("../../utils/testing");
16
15
  const xplat_utils_1 = require("@nstudio/xplat-utils");
16
+ const testing_2 = require("../../utils/testing");
17
17
  describe('feature schematic', () => {
18
18
  let appTree;
19
19
  const defaultOptions = {
@@ -1,78 +1,15 @@
1
1
  import * as ts from 'typescript';
2
- import { Tree } from '@nrwl/devkit';
3
- declare type DecoratorName = 'Component' | 'Directive' | 'NgModule' | 'Pipe';
4
- export declare function addToCollection(tree: Tree, source: ts.SourceFile, barrelIndexPath: string, symbolName: string, insertSpaces?: string): ts.SourceFile[];
5
- /**
6
- * Check if the Component, Directive or Pipe is standalone
7
- * @param sourceFile TS Source File containing the token to check
8
- * @param decoratorName The type of decorator to check (Component, Directive, Pipe)
9
- */
10
- export declare function isStandalone(sourceFile: ts.SourceFile, decoratorName: DecoratorName): boolean;
11
- export declare function getDecoratorMetadata(source: ts.SourceFile, identifier: string, module: string): ts.Node[];
12
- export declare function _addSymbolToNgModuleMetadata(host: Tree, source: ts.SourceFile, ngModulePath: string, metadataField: string, expression: string): ts.SourceFile;
13
- export declare function removeFromNgModule(host: Tree, source: ts.SourceFile, modulePath: string, property: string): ts.SourceFile;
14
- /**
15
- * Add an import to a Standalone Component
16
- * @param host Virtual Tree
17
- * @param source TS Source File containing the Component
18
- * @param componentPath The path to the Component
19
- * @param symbolName The import to add to the Component
20
- */
21
- export declare function addImportToComponent(host: Tree, source: ts.SourceFile, componentPath: string, symbolName: string): ts.SourceFile;
22
- /**
23
- * Add an import to a Standalone Directive
24
- * @param host Virtual Tree
25
- * @param source TS Source File containing the Directive
26
- * @param directivePath The path to the Directive
27
- * @param symbolName The import to add to the Directive
28
- */
29
- export declare function addImportToDirective(host: Tree, source: ts.SourceFile, directivePath: string, symbolName: string): ts.SourceFile;
30
- /**
31
- * Add an import to a Standalone Pipe
32
- * @param host Virtual Tree
33
- * @param source TS Source File containing the Pipe
34
- * @param pipePath The path to the Pipe
35
- * @param symbolName The import to add to the Pipe
36
- */
37
- export declare function addImportToPipe(host: Tree, source: ts.SourceFile, pipePath: string, symbolName: string): ts.SourceFile;
38
- /**
39
- * Add an import to an NgModule
40
- * @param host Virtual Tree
41
- * @param source TS Source File containing the NgModule
42
- * @param modulePath The path to the NgModule
43
- * @param symbolName The import to add to the NgModule
44
- */
45
- export declare function addImportToModule(host: Tree, source: ts.SourceFile, modulePath: string, symbolName: string): ts.SourceFile;
46
- export declare function addImportToTestBed(host: Tree, source: ts.SourceFile, specPath: string, symbolName: string): ts.SourceFile;
47
- export declare function addDeclarationsToTestBed(host: Tree, source: ts.SourceFile, specPath: string, symbolName: string[]): ts.SourceFile;
48
- export declare function replaceIntoToTestBed(host: Tree, source: ts.SourceFile, specPath: string, newSymbol: string, previousSymbol: string): ts.SourceFile;
2
+ import { Tree } from '@angular-devkit/schematics';
3
+ export declare function addToCollection(source: ts.SourceFile, barrelIndexPath: string, symbolName: string, insertSpaces?: string): any[];
4
+ export declare function addSymbolToNgModuleMetadata(source: ts.SourceFile, ngModulePath: string, metadataField: string, expression: string): any[];
5
+ export declare function removeFromNgModule(source: ts.SourceFile, modulePath: string, property: string): any[];
6
+ export declare function addImportToModule(source: ts.SourceFile, modulePath: string, symbolName: string): any[];
7
+ export declare function addImportToTestBed(source: ts.SourceFile, specPath: string, symbolName: string): any[];
49
8
  export declare function getBootstrapComponent(source: ts.SourceFile, moduleClassName: string): string;
50
- export declare function addRouteToNgModule(host: Tree, ngModulePath: string, source: ts.SourceFile, route: string): ts.SourceFile;
51
- /**
52
- * Add a provider to bootstrapApplication call for Standalone Applications
53
- * @param tree Virtual Tree
54
- * @param filePath Path to the file containing the bootstrapApplication call
55
- * @param providerToAdd Provider to add
56
- */
57
- export declare function addProviderToBootstrapApplication(tree: Tree, filePath: string, providerToAdd: string): void;
58
- /**
59
- * Add a provider to an NgModule
60
- * @param host Virtual Tree
61
- * @param source TS Source File containing the NgModule
62
- * @param modulePath Path to the NgModule
63
- * @param symbolName The provider to add
64
- */
65
- export declare function addProviderToModule(host: Tree, source: ts.SourceFile, modulePath: string, symbolName: string): ts.SourceFile;
66
- /**
67
- * Add a provider to a Standalone Component
68
- * @param host Virtual Tree
69
- * @param source TS Source File containing the Component
70
- * @param componentPath Path to the Component
71
- * @param symbolName The provider to add
72
- */
73
- export declare function addProviderToComponent(host: Tree, source: ts.SourceFile, componentPath: string, symbolName: string): ts.SourceFile;
74
- export declare function addDeclarationToModule(host: Tree, source: ts.SourceFile, modulePath: string, symbolName: string): ts.SourceFile;
75
- export declare function addEntryComponents(host: Tree, source: ts.SourceFile, modulePath: string, symbolName: string): ts.SourceFile;
9
+ export declare function addRoute(ngModulePath: string, source: ts.SourceFile, route: string): any[];
10
+ export declare function addProviderToModule(source: ts.SourceFile, modulePath: string, symbolName: string): any[];
11
+ export declare function addDeclarationToModule(source: ts.SourceFile, modulePath: string, symbolName: string): any[];
12
+ export declare function addEntryComponents(source: ts.SourceFile, modulePath: string, symbolName: string): any[];
76
13
  export declare function readBootstrapInfo(host: Tree, app: string): {
77
14
  moduleSpec: string;
78
15
  modulePath: string;
@@ -83,5 +20,3 @@ export declare function readBootstrapInfo(host: Tree, app: string): {
83
20
  bootstrapComponentFileName: string;
84
21
  };
85
22
  export declare function getDecoratorPropertyValueNode(host: Tree, modulePath: string, identifier: string, property: string, module: string): ts.Node;
86
- export declare function getTsSourceFile(host: Tree, path: string): ts.SourceFile;
87
- export {};