@nstudio/xplat-utils 15.0.3 → 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 +4 -2
- package/package.json +1 -1
- package/src/utils/types.d.ts +6 -6
- package/src/utils/utils.d.ts +8 -8
- package/src/utils/utils.js +7 -1
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
|
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@
|
50
|
+
npx create-nx-workspace@15.9.2
|
49
51
|
```
|
50
52
|
|
51
53
|
## App generation examples
|
package/package.json
CHANGED
package/src/utils/types.d.ts
CHANGED
@@ -4,9 +4,9 @@ export interface ITargetPlatforms {
|
|
4
4
|
ionic?: boolean;
|
5
5
|
electron?: boolean;
|
6
6
|
}
|
7
|
-
export
|
8
|
-
export
|
9
|
-
export
|
10
|
-
export
|
11
|
-
export
|
12
|
-
export
|
7
|
+
export type PlatformTypes = 'web' | 'nativescript' | 'ionic' | 'electron';
|
8
|
+
export type PlatformNxExtraTypes = 'express' | 'nest' | 'node' | 'react';
|
9
|
+
export type PlatformWithNxTypes = PlatformTypes | PlatformNxExtraTypes;
|
10
|
+
export type PlatformModes = PlatformTypes | 'fullstack';
|
11
|
+
export type FrameworkTypes = 'angular';
|
12
|
+
export type FrameworkOptions = FrameworkTypes | 'all';
|
package/src/utils/utils.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { FrameworkTypes, PlatformNxExtraTypes, PlatformTypes, PlatformWithNxTypes } from './types';
|
2
|
-
import { Tree } from '@angular-devkit/schematics';
|
2
|
+
import { Tree as NgTree } from '@angular-devkit/schematics';
|
3
3
|
export declare const supportedPlatforms: Array<PlatformTypes>;
|
4
4
|
export declare const supportedNxExtraPlatforms: Array<PlatformNxExtraTypes>;
|
5
5
|
export declare const supportedPlatformsWithNx: Array<PlatformWithNxTypes>;
|
@@ -13,14 +13,14 @@ export declare function isXplatWorkspace(): boolean;
|
|
13
13
|
export declare function setTest(): void;
|
14
14
|
export declare function isTesting(): boolean;
|
15
15
|
export declare function jsonParse(content: string): any;
|
16
|
-
export declare function getJsonFromFile(tree:
|
17
|
-
export declare function updateJsonFile(tree:
|
18
|
-
export declare function updateFile(tree:
|
19
|
-
export declare function getNxWorkspaceConfig(tree:
|
20
|
-
export declare const copy: (tree:
|
16
|
+
export declare function getJsonFromFile(tree: NgTree, path: string): any;
|
17
|
+
export declare function updateJsonFile(tree: NgTree, path: string, jsonData: any): import("@angular-devkit/schematics/src/tree/interface").Tree;
|
18
|
+
export declare function updateFile(tree: NgTree, path: string, content: string): import("@angular-devkit/schematics/src/tree/interface").Tree;
|
19
|
+
export declare function getNxWorkspaceConfig(tree: NgTree): any;
|
20
|
+
export declare const copy: (tree: NgTree, from: string, to: string) => void;
|
21
21
|
export declare function getRootTsConfigPath(): string;
|
22
|
-
export declare function getAppPaths(tree:
|
23
|
-
export declare function prerun(options?: any, init?: boolean): (tree:
|
22
|
+
export declare function getAppPaths(tree: NgTree, type?: PlatformTypes): Array<string>;
|
23
|
+
export declare function prerun(options?: any, init?: boolean): (tree: NgTree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
|
24
24
|
export declare function sanitizeCommaDelimitedArg(input: string): Array<string>;
|
25
25
|
export declare function parseProjectNameFromPath(input: string): string;
|
26
26
|
export declare function toFileName(s: string): string;
|
package/src/utils/utils.js
CHANGED
@@ -89,8 +89,14 @@ exports.updateJsonFile = updateJsonFile;
|
|
89
89
|
function updateFile(tree, path, content) {
|
90
90
|
try {
|
91
91
|
// if (tree.exists(path)) {
|
92
|
-
tree.overwrite(path, content);
|
92
|
+
// tree.overwrite(path, content);
|
93
93
|
// }
|
94
|
+
if (tree.exists(path)) {
|
95
|
+
tree.overwrite(path, content);
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
tree.create(path, content);
|
99
|
+
}
|
94
100
|
return tree;
|
95
101
|
}
|
96
102
|
catch (err) {
|