@nstudio/xplat-utils 15.0.3 → 15.0.4-rc.0
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/package.json +1 -1
- package/src/utils/utils.d.ts +8 -8
- package/src/utils/utils.js +12 -6
package/package.json
CHANGED
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
@@ -75,9 +75,12 @@ function getJsonFromFile(tree, path) {
|
|
75
75
|
exports.getJsonFromFile = getJsonFromFile;
|
76
76
|
function updateJsonFile(tree, path, jsonData) {
|
77
77
|
try {
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
if (tree.exists(path)) {
|
79
|
+
tree.overwrite(path, (0, devkit_1.serializeJson)(jsonData));
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
tree.create(path, (0, devkit_1.serializeJson)(jsonData));
|
83
|
+
}
|
81
84
|
return tree;
|
82
85
|
}
|
83
86
|
catch (err) {
|
@@ -88,9 +91,12 @@ function updateJsonFile(tree, path, jsonData) {
|
|
88
91
|
exports.updateJsonFile = updateJsonFile;
|
89
92
|
function updateFile(tree, path, content) {
|
90
93
|
try {
|
91
|
-
|
92
|
-
|
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) {
|