@nstudio/xplat 19.0.0-alpha.1 → 20.0.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/README.md +0 -1
- package/migrations/update-12-4-3/update-12-4-3.js +1 -1
- package/migrations/update-13-0-0/update-13-0-0.js +1 -1
- package/package.json +7 -7
- package/src/schematics/app-generate/index.js +1 -1
- package/src/schematics/application/index.js +1 -1
- package/src/schematics/component/index.js +1 -1
- package/src/schematics/feature/index.js +1 -1
- package/src/schematics/feature/index.spec.js +1 -2
- package/src/schematics/helpers/index.js +1 -1
- package/src/schematics/init/index.js +1 -1
- package/src/schematics/mode/index.js +1 -1
- package/src/schematics/ng-add/index.js +1 -1
- package/src/utils/ast.js +2 -3
- package/src/utils/errors.js +16 -16
- package/src/utils/general.d.ts +4 -6
- package/src/utils/general.js +10 -10
- package/src/utils/helpers.js +1 -2
- package/src/utils/postinstall.js +1 -2
- package/src/utils/testing-utils.js +12 -12
- package/src/utils/testing.js +3 -4
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +2 -2
- package/src/utils/xplat.d.ts +1 -1
- package/src/utils/xplat.js +0 -1
package/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
<p align="center"><img src="https://raw.githubusercontent.com/nstudio/xplat/master/xplat-logo.png" align="center" width="400"></p>
|
3
3
|
<div align="center">
|
4
4
|
|
5
|
-
[](https://travis-ci.org/nstudio/xplat)
|
6
5
|
[]()
|
7
6
|
[](https://www.npmjs.com/@nstudio/schematics)
|
8
7
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const path_1 = require("path");
|
5
6
|
const fs = require("fs");
|
@@ -295,4 +296,3 @@ function default_1() {
|
|
295
296
|
updateRootPackage,
|
296
297
|
]);
|
297
298
|
}
|
298
|
-
exports.default = default_1;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const xplat_1 = require("@nstudio/xplat");
|
5
6
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
@@ -294,4 +295,3 @@ function default_1() {
|
|
294
295
|
},
|
295
296
|
]);
|
296
297
|
}
|
297
|
-
exports.default = default_1;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nstudio/xplat",
|
3
|
-
"version": "
|
3
|
+
"version": "20.0.0",
|
4
4
|
"description": "Cross-platform (xplat) tools for Nx workspaces.",
|
5
5
|
"homepage": "https://nstudio.io/xplat",
|
6
6
|
"repository": {
|
@@ -41,12 +41,12 @@
|
|
41
41
|
"postinstall": "node src/utils/postinstall.js"
|
42
42
|
},
|
43
43
|
"dependencies": {
|
44
|
-
"@nx/angular": "^
|
45
|
-
"@nx/devkit": "^
|
46
|
-
"@nx/js": "^
|
47
|
-
"@nx/eslint": "
|
48
|
-
"@nstudio/focus": "
|
49
|
-
"@nstudio/xplat-utils": "
|
44
|
+
"@nx/angular": "^20.0.0",
|
45
|
+
"@nx/devkit": "^20.0.0",
|
46
|
+
"@nx/js": "^20.0.0",
|
47
|
+
"@nx/eslint": "^20.0.0",
|
48
|
+
"@nstudio/focus": "20.0.0",
|
49
|
+
"@nstudio/xplat-utils": "20.0.0"
|
50
50
|
},
|
51
51
|
"author": "Nathan Walker",
|
52
52
|
"license": "MIT",
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const utils_1 = require("../../utils");
|
5
6
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
@@ -11,4 +12,3 @@ function default_1(options) {
|
|
11
12
|
(tree, context) => (0, schematics_1.chain)(externalChains),
|
12
13
|
]);
|
13
14
|
}
|
14
|
-
exports.default = default_1;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
6
|
const utils_1 = require("../../utils");
|
@@ -8,4 +9,3 @@ function default_1(options) {
|
|
8
9
|
const externalChains = utils_1.XplatHelpers.getExternalChainsForApplication(options, 'app', packagesToRun);
|
9
10
|
return (0, schematics_1.chain)([(0, xplat_utils_1.prerun)(options, true), (tree) => (0, schematics_1.chain)(externalChains)]);
|
10
11
|
}
|
11
|
-
exports.default = default_1;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
6
|
const utils_1 = require("../../utils");
|
@@ -8,4 +9,3 @@ function default_1(options) {
|
|
8
9
|
const externalChains = utils_1.XplatHelpers.getExternalChainsForGenerator(options, 'component', packagesToRunXplat);
|
9
10
|
return (0, schematics_1.chain)([(0, xplat_utils_1.prerun)(options, true), (tree) => (0, schematics_1.chain)(externalChains)]);
|
10
11
|
}
|
11
|
-
exports.default = default_1;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
6
|
const utils_1 = require("../../utils");
|
@@ -11,4 +12,3 @@ function default_1(options) {
|
|
11
12
|
(tree, context) => (0, schematics_1.chain)(externalChains),
|
12
13
|
]);
|
13
14
|
}
|
14
|
-
exports.default = default_1;
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.sandboxHomeSetup =
|
12
|
+
exports.sandboxHomeSetup = sandboxHomeSetup;
|
13
13
|
const schematics_1 = require("@angular-devkit/schematics");
|
14
14
|
const testing_utils_1 = require("../../utils/testing-utils");
|
15
15
|
const testing_1 = require("../../utils/testing");
|
@@ -350,4 +350,3 @@ function sandboxHomeSetup() {
|
|
350
350
|
</StackLayout>
|
351
351
|
`;
|
352
352
|
}
|
353
|
-
exports.sandboxHomeSetup = sandboxHomeSetup;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const xplat_1 = require("@nstudio/xplat");
|
5
6
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
@@ -56,4 +57,3 @@ function default_1(options) {
|
|
56
57
|
...helperChains,
|
57
58
|
]);
|
58
59
|
}
|
59
|
-
exports.default = default_1;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const xplat_1 = require("@nstudio/xplat");
|
5
6
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
@@ -165,4 +166,3 @@ function default_1(options) {
|
|
165
166
|
}),
|
166
167
|
]);
|
167
168
|
}
|
168
|
-
exports.default = default_1;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
6
|
function default_1(options) {
|
@@ -8,4 +9,3 @@ function default_1(options) {
|
|
8
9
|
(tree, context) => (0, schematics_1.externalSchematic)('@nstudio/focus', 'mode', options),
|
9
10
|
]);
|
10
11
|
}
|
11
|
-
exports.default = default_1;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
3
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
6
|
function default_1(options) {
|
@@ -8,4 +9,3 @@ function default_1(options) {
|
|
8
9
|
(tree, context) => (0, schematics_1.externalSchematic)('@nstudio/xplat', 'init', options),
|
9
10
|
]);
|
10
11
|
}
|
11
|
-
exports.default = default_1;
|
package/src/utils/ast.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.addGlobal = addGlobal;
|
4
|
+
exports.insert = insert;
|
4
5
|
const js_1 = require("@nx/js");
|
5
6
|
const ts = require("typescript");
|
6
7
|
const general_1 = require("./general");
|
@@ -28,7 +29,6 @@ function addGlobal(tree, source, modulePath, statement, isExport) {
|
|
28
29
|
}
|
29
30
|
}
|
30
31
|
}
|
31
|
-
exports.addGlobal = addGlobal;
|
32
32
|
function insert(host, modulePath, changes) {
|
33
33
|
if (changes.length < 1) {
|
34
34
|
return;
|
@@ -61,4 +61,3 @@ function insert(host, modulePath, changes) {
|
|
61
61
|
}
|
62
62
|
host.commitUpdate(recorder);
|
63
63
|
}
|
64
|
-
exports.insert = insert;
|
package/src/utils/errors.js
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.errorXplat = exports.errorMissingPrefix = void 0;
|
4
|
+
exports.unsupportedPlatformError = unsupportedPlatformError;
|
5
|
+
exports.unsupportedPlatformErrorWithNxNote = unsupportedPlatformErrorWithNxNote;
|
6
|
+
exports.noXplatLayerNote = noXplatLayerNote;
|
7
|
+
exports.unsupportedFrameworkError = unsupportedFrameworkError;
|
8
|
+
exports.unsupportedHelperError = unsupportedHelperError;
|
9
|
+
exports.helperTargetError = helperTargetError;
|
10
|
+
exports.helperMissingPlatforms = helperMissingPlatforms;
|
11
|
+
exports.missingArgument = missingArgument;
|
12
|
+
exports.noPlatformError = noPlatformError;
|
13
|
+
exports.platformAppPrefixError = platformAppPrefixError;
|
14
|
+
exports.generatorError = generatorError;
|
15
|
+
exports.generateOptionError = generateOptionError;
|
16
|
+
exports.needFeatureModuleError = needFeatureModuleError;
|
17
|
+
exports.optionsMissingError = optionsMissingError;
|
18
|
+
exports.noteAboutXplatSetupWithFramework = noteAboutXplatSetupWithFramework;
|
4
19
|
const general_1 = require("./general");
|
5
20
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
6
21
|
exports.errorMissingPrefix = `Missing --prefix flag. It's a good practice to specify a 2-3 character prefix for use with your project's component selectors and certain shared class/module names. Example: nx g @nstudio/xplat:init --prefix=foo`;
|
@@ -8,49 +23,38 @@ exports.errorXplat = `You have the xplat tools installed but have yet to generat
|
|
8
23
|
function unsupportedPlatformError(platform) {
|
9
24
|
return `${platform} is currently not a supported platform. Supported at the moment: ${xplat_utils_1.supportedPlatforms}. Please request support for this platform if you'd like and/or submit a PR which we would greatly appreciate.`;
|
10
25
|
}
|
11
|
-
exports.unsupportedPlatformError = unsupportedPlatformError;
|
12
26
|
function unsupportedPlatformErrorWithNxNote(platform, generator) {
|
13
27
|
return `"${platform}" in xplat currently does not support the "${generator}" generator. However it would be awesome to have a "${generator}" generator for "${platform}". Please add an issue to https://github.com/nstudio/xplat/issues with some details of how you'd like it to work for "${platform}" and we'll look into adding to a future release.`;
|
14
28
|
}
|
15
|
-
exports.unsupportedPlatformErrorWithNxNote = unsupportedPlatformErrorWithNxNote;
|
16
29
|
function noXplatLayerNote(platform) {
|
17
30
|
return `Generating "${platform}" app in your workspace. Just so you know, "${platform}" does not have an xplat supporting architecture layer yet. If you'd like to see "${platform}" with an xplat layer in future, please add an issue to https://github.com/nstudio/xplat/issues with some details of how you'd like it to work and we'll look into adding to a future release.`;
|
18
31
|
}
|
19
|
-
exports.noXplatLayerNote = noXplatLayerNote;
|
20
32
|
function unsupportedFrameworkError(framework) {
|
21
33
|
return `${framework} is currently not a supported framework. Supported at the moment: ${xplat_utils_1.supportedFrameworks.map((f) => general_1.stringUtils.capitalize(f))}. Please request support for this framework if you'd like and/or submit a PR which we would greatly appreciate.`;
|
22
34
|
}
|
23
|
-
exports.unsupportedFrameworkError = unsupportedFrameworkError;
|
24
35
|
function unsupportedHelperError(helper) {
|
25
36
|
return `${helper} is not a supported helper. Currently supported: ${general_1.supportedHelpers}`;
|
26
37
|
}
|
27
|
-
exports.unsupportedHelperError = unsupportedHelperError;
|
28
38
|
function helperTargetError(helper) {
|
29
39
|
return `The helper "${helper}" requires the --target flag.`;
|
30
40
|
}
|
31
|
-
exports.helperTargetError = helperTargetError;
|
32
41
|
function helperMissingPlatforms() {
|
33
42
|
return `Missing platforms argument. Example: nx g @nstudio/xplat:helpers imports --platforms=nativescript`;
|
34
43
|
}
|
35
|
-
exports.helperMissingPlatforms = helperMissingPlatforms;
|
36
44
|
function missingArgument(argName, description = '', example = '') {
|
37
45
|
return `Missing ${argName} argument. ${description} ${example ? 'Example: ' + example : ''}`;
|
38
46
|
}
|
39
|
-
exports.missingArgument = missingArgument;
|
40
47
|
function noPlatformError() {
|
41
48
|
return `You must specify which platforms you wish to generate support for. For example: nx g @nstudio/xplat:init --prefix=foo --platforms=${xplat_utils_1.supportedPlatforms.join(',')}`;
|
42
49
|
}
|
43
|
-
exports.noPlatformError = noPlatformError;
|
44
50
|
function platformAppPrefixError() {
|
45
51
|
return `Normally a platform identifier prefixes the project name in xplat. It's possible you may not have generated your app with xplat tools. Please generate your app with xplat or prefix your app's name with the platform it's intended for. For example: web-viewer, nativescript-viewer, ionic-viewer, etc.`;
|
46
52
|
}
|
47
|
-
exports.platformAppPrefixError = platformAppPrefixError;
|
48
53
|
function generatorError(type) {
|
49
54
|
return `If this is a project/app specific ${type}, please specify project names to generate the ${type} for with --projects=name,name2,etc. If you want to generate the ${type} for use across many projects/apps, just specify the platforms you wish to build the ${type} for with --platforms=web,nativescript,etc.${type !== 'feature'
|
50
55
|
? ' and the feature you want them a part of with --feature=foo'
|
51
56
|
: ''}`;
|
52
57
|
}
|
53
|
-
exports.generatorError = generatorError;
|
54
58
|
function generateOptionError(type, missingFeature) {
|
55
59
|
const exampleCommand = `nx g ${type} my-${type} --feature=foo --platforms=web,nativescript`;
|
56
60
|
if (missingFeature) {
|
@@ -60,7 +64,6 @@ function generateOptionError(type, missingFeature) {
|
|
60
64
|
return `You did not specify the name of the ${type} you'd like to generate. For example: ${exampleCommand}`;
|
61
65
|
}
|
62
66
|
}
|
63
|
-
exports.generateOptionError = generateOptionError;
|
64
67
|
function needFeatureModuleError(modulePath, featureName, optionName, isOnlyProject) {
|
65
68
|
// let platforms = '';
|
66
69
|
if (optionName) {
|
@@ -73,12 +76,9 @@ function needFeatureModuleError(modulePath, featureName, optionName, isOnlyProje
|
|
73
76
|
}
|
74
77
|
return `${modulePath} does not exist. Create the feature module first. For example: nx g @nstudio/angular:feature ${featureName}${optionName}`;
|
75
78
|
}
|
76
|
-
exports.needFeatureModuleError = needFeatureModuleError;
|
77
79
|
function optionsMissingError(error) {
|
78
80
|
return `Options missing. ${error} Currently supported platforms: ${xplat_utils_1.supportedPlatforms}`;
|
79
81
|
}
|
80
|
-
exports.optionsMissingError = optionsMissingError;
|
81
82
|
function noteAboutXplatSetupWithFramework(framework, platform) {
|
82
83
|
return `You currently have "${framework}" set as your default frontend framework and have already generated xplat support for "${platform}". A command is coming soon to auto reconfigure your workspace to later add baseline platform support for those which have previously been generated prepaired with a frontend framework.`;
|
83
84
|
}
|
84
|
-
exports.noteAboutXplatSetupWithFramework = noteAboutXplatSetupWithFramework;
|
package/src/utils/general.d.ts
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
/// <reference types="node" />
|
3
1
|
import { Tree as NgTree } from '@angular-devkit/schematics';
|
4
2
|
import { PlatformTypes, FrameworkTypes, ITargetPlatforms } from '@nstudio/xplat-utils';
|
5
3
|
import type { Mode } from 'fs';
|
@@ -47,8 +45,8 @@ export declare function getDefaultTemplateOptions(): {
|
|
47
45
|
classify(str: string): string;
|
48
46
|
underscore(str: string): string;
|
49
47
|
capitalize(str: string): string;
|
50
|
-
group(name: string, group: string): string;
|
51
|
-
featurePath(group: boolean, flat: boolean, path: string, name: string): string;
|
48
|
+
group(name: string, group: string | undefined): string;
|
49
|
+
featurePath(group: boolean | undefined, flat: boolean | undefined, path: string, name: string): string;
|
52
50
|
sanitize: (str: string) => string;
|
53
51
|
};
|
54
52
|
npmScope: string;
|
@@ -78,8 +76,8 @@ export declare const stringUtils: {
|
|
78
76
|
classify(str: string): string;
|
79
77
|
underscore(str: string): string;
|
80
78
|
capitalize(str: string): string;
|
81
|
-
group(name: string, group: string): string;
|
82
|
-
featurePath(group: boolean, flat: boolean, path: string, name: string): string;
|
79
|
+
group(name: string, group: string | undefined): string;
|
80
|
+
featurePath(group: boolean | undefined, flat: boolean | undefined, path: string, name: string): string;
|
83
81
|
sanitize: (str: string) => string;
|
84
82
|
};
|
85
83
|
export declare const toComponentClassName: (name: string) => string;
|
package/src/utils/general.js
CHANGED
@@ -9,7 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.DevkitTreeFromAngularDevkitTree = exports.
|
12
|
+
exports.DevkitTreeFromAngularDevkitTree = exports.actionToFileChangeMap = exports.toNgModuleClassName = exports.toComponentClassName = exports.stringUtils = exports.sanitize = exports.supportedSandboxPlatforms = exports.supportedHelpers = void 0;
|
13
|
+
exports.hasFrontendPlatform = hasFrontendPlatform;
|
14
|
+
exports.hasWebPlatform = hasWebPlatform;
|
15
|
+
exports.updatePackageForNgrx = updatePackageForNgrx;
|
16
|
+
exports.updateTsConfig = updateTsConfig;
|
17
|
+
exports.updatePackageScripts = updatePackageScripts;
|
18
|
+
exports.readWorkspaceJson = readWorkspaceJson;
|
19
|
+
exports.getPrefixWarning = getPrefixWarning;
|
20
|
+
exports.getDefaultTemplateOptions = getDefaultTemplateOptions;
|
21
|
+
exports.convertNgTreeToDevKit = convertNgTreeToDevKit;
|
13
22
|
const nxStringUtils = require("@nx/devkit/src/utils/string-utils");
|
14
23
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
15
24
|
const path_1 = require("path");
|
@@ -31,7 +40,6 @@ function hasFrontendPlatform(targetPlatforms) {
|
|
31
40
|
targetPlatforms.electron ||
|
32
41
|
targetPlatforms.nativescript);
|
33
42
|
}
|
34
|
-
exports.hasFrontendPlatform = hasFrontendPlatform;
|
35
43
|
/**
|
36
44
|
* Check if the platform will need a web app to be generated.
|
37
45
|
*
|
@@ -42,7 +50,6 @@ exports.hasFrontendPlatform = hasFrontendPlatform;
|
|
42
50
|
function hasWebPlatform(targetPlatforms) {
|
43
51
|
return (targetPlatforms.web || targetPlatforms.ionic || targetPlatforms.electron);
|
44
52
|
}
|
45
|
-
exports.hasWebPlatform = hasWebPlatform;
|
46
53
|
function updatePackageForNgrx(tree, packagePath = 'package.json') {
|
47
54
|
if (tree.exists(packagePath)) {
|
48
55
|
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
|
@@ -60,7 +67,6 @@ function updatePackageForNgrx(tree, packagePath = 'package.json') {
|
|
60
67
|
}
|
61
68
|
return tree;
|
62
69
|
}
|
63
|
-
exports.updatePackageForNgrx = updatePackageForNgrx;
|
64
70
|
function updateTsConfig(tree, callback, targetSuffix = '', prefixPath = '') {
|
65
71
|
if (!prefixPath && tree.exists('/tsconfig.base.json')) {
|
66
72
|
// when root tsconfig, always modify base if exists
|
@@ -81,7 +87,6 @@ function updateTsConfig(tree, callback, targetSuffix = '', prefixPath = '') {
|
|
81
87
|
callback(tsConfig);
|
82
88
|
return (0, xplat_utils_1.updateJsonFile)(tree, tsConfigPath, tsConfig);
|
83
89
|
}
|
84
|
-
exports.updateTsConfig = updateTsConfig;
|
85
90
|
function updatePackageScripts(tree, scripts) {
|
86
91
|
const path = 'package.json';
|
87
92
|
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, path);
|
@@ -89,15 +94,12 @@ function updatePackageScripts(tree, scripts) {
|
|
89
94
|
packageJson.scripts = Object.assign(scriptsMap, scripts);
|
90
95
|
return (0, xplat_utils_1.updateJsonFile)(tree, path, packageJson);
|
91
96
|
}
|
92
|
-
exports.updatePackageScripts = updatePackageScripts;
|
93
97
|
function readWorkspaceJson(tree) {
|
94
98
|
return (0, xplat_utils_1.getJsonFromFile)(tree, 'workspace.json');
|
95
99
|
}
|
96
|
-
exports.readWorkspaceJson = readWorkspaceJson;
|
97
100
|
function getPrefixWarning(prefix) {
|
98
101
|
return `A default prefix had already been set for your workspace: ${prefix}. Since xplat had already been configured we will be using '${prefix}' as the prefix.`;
|
99
102
|
}
|
100
|
-
exports.getPrefixWarning = getPrefixWarning;
|
101
103
|
function getDefaultTemplateOptions() {
|
102
104
|
// console.log('getDefaultTemplateOptions getPrefix:', getPrefix());
|
103
105
|
return {
|
@@ -108,7 +110,6 @@ function getDefaultTemplateOptions() {
|
|
108
110
|
dot: '.',
|
109
111
|
};
|
110
112
|
}
|
111
|
-
exports.getDefaultTemplateOptions = getDefaultTemplateOptions;
|
112
113
|
/**
|
113
114
|
* Sanitizes a given string by removing all characters that
|
114
115
|
* are not letters or digits.
|
@@ -172,7 +173,6 @@ function convertNgTreeToDevKit(tree, context) {
|
|
172
173
|
: tree.root.path;
|
173
174
|
return new DevkitTreeFromAngularDevkitTree(tree, root, true);
|
174
175
|
}
|
175
|
-
exports.convertNgTreeToDevKit = convertNgTreeToDevKit;
|
176
176
|
class DevkitTreeFromAngularDevkitTree {
|
177
177
|
constructor(tree, _root, skipWritingConfigInOldFormat) {
|
178
178
|
this.tree = tree;
|
package/src/utils/helpers.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.buildHelperChain =
|
3
|
+
exports.buildHelperChain = buildHelperChain;
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
5
5
|
const errors_1 = require("./errors");
|
6
6
|
function buildHelperChain(helper, options, config, helperChain) {
|
@@ -27,4 +27,3 @@ function buildHelperChain(helper, options, config, helperChain) {
|
|
27
27
|
});
|
28
28
|
}
|
29
29
|
}
|
30
|
-
exports.buildHelperChain = buildHelperChain;
|
package/src/utils/postinstall.js
CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.updateConfig =
|
12
|
+
exports.updateConfig = updateConfig;
|
13
13
|
const fs = require("fs");
|
14
14
|
const path = require("path");
|
15
15
|
const util_1 = require("util");
|
@@ -59,5 +59,4 @@ function updateConfig() {
|
|
59
59
|
}
|
60
60
|
});
|
61
61
|
}
|
62
|
-
exports.updateConfig = updateConfig;
|
63
62
|
updateConfig();
|
@@ -1,10 +1,20 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isInDecoratorMetadata = exports.isInComponentMetadata = exports.isInModuleMetadata =
|
3
|
+
exports.isInDecoratorMetadata = exports.isInComponentMetadata = exports.isInModuleMetadata = void 0;
|
4
|
+
exports.getFileContent = getFileContent;
|
5
|
+
exports.createEmptyWorkspace = createEmptyWorkspace;
|
6
|
+
exports.createXplatWithAppsForElectron = createXplatWithAppsForElectron;
|
7
|
+
exports.createXplatWithApps = createXplatWithApps;
|
8
|
+
exports.createXplatWithNativeScriptWeb = createXplatWithNativeScriptWeb;
|
9
|
+
exports.createNxLib = createNxLib;
|
10
|
+
exports.createXplatLibs = createXplatLibs;
|
11
|
+
exports.createXplatNativeScriptAngular = createXplatNativeScriptAngular;
|
12
|
+
exports.createXplatWebAngular = createXplatWebAngular;
|
13
|
+
exports.createWebAngularApp = createWebAngularApp;
|
14
|
+
exports.createNativeScriptAngularApp = createNativeScriptAngularApp;
|
4
15
|
function getFileContent(tree, filePath) {
|
5
16
|
return tree.readContent(filePath);
|
6
17
|
}
|
7
|
-
exports.getFileContent = getFileContent;
|
8
18
|
function createEmptyWorkspace(tree, framework) {
|
9
19
|
tree.create('/.gitignore', '');
|
10
20
|
tree.create('/angular.json', JSON.stringify({ version: 1, projects: {}, newProjectRoot: '' }));
|
@@ -35,7 +45,6 @@ function createEmptyWorkspace(tree, framework) {
|
|
35
45
|
}));
|
36
46
|
return tree;
|
37
47
|
}
|
38
|
-
exports.createEmptyWorkspace = createEmptyWorkspace;
|
39
48
|
function createXplatWithAppsForElectron(tree) {
|
40
49
|
tree = createXplatWithApps(tree);
|
41
50
|
tree.overwrite('angular.json', JSON.stringify({
|
@@ -71,7 +80,6 @@ function createXplatWithAppsForElectron(tree) {
|
|
71
80
|
}));
|
72
81
|
return tree;
|
73
82
|
}
|
74
|
-
exports.createXplatWithAppsForElectron = createXplatWithAppsForElectron;
|
75
83
|
function createXplatWithApps(tree, framework) {
|
76
84
|
tree = createEmptyWorkspace(tree, framework);
|
77
85
|
createXplatLibs(tree);
|
@@ -79,7 +87,6 @@ function createXplatWithApps(tree, framework) {
|
|
79
87
|
createWebAngularApp(tree);
|
80
88
|
return tree;
|
81
89
|
}
|
82
|
-
exports.createXplatWithApps = createXplatWithApps;
|
83
90
|
function createXplatWithNativeScriptWeb(tree, withRouting, framework, withNxLibName) {
|
84
91
|
tree = createEmptyWorkspace(tree, framework);
|
85
92
|
createXplatLibs(tree);
|
@@ -93,7 +100,6 @@ function createXplatWithNativeScriptWeb(tree, withRouting, framework, withNxLibN
|
|
93
100
|
}
|
94
101
|
return tree;
|
95
102
|
}
|
96
|
-
exports.createXplatWithNativeScriptWeb = createXplatWithNativeScriptWeb;
|
97
103
|
function createNxLib(tree, name) {
|
98
104
|
tree.create(`/libs/${name}/src/lib/index.ts`, '');
|
99
105
|
tree.create(`/libs/${name}/src/lib/${name}.module.ts`, `import {
|
@@ -109,7 +115,6 @@ function createNxLib(tree, name) {
|
|
109
115
|
configPaths[`@testing/${name}`] = [`libs/${name}/src/index.ts`];
|
110
116
|
tree.overwrite('/tsconfig.base.json', JSON.stringify({ compilerOptions: { paths: configPaths } }));
|
111
117
|
}
|
112
|
-
exports.createNxLib = createNxLib;
|
113
118
|
function createXplatLibs(tree) {
|
114
119
|
tree.create('/libs/xplat/core/src/lib/index.ts', '');
|
115
120
|
tree.create('/libs/xplat/core/src/lib/core.module.ts', `import {
|
@@ -148,7 +153,6 @@ function createXplatLibs(tree) {
|
|
148
153
|
`);
|
149
154
|
tree.create('/libs/xplat/utils/src/lib/index.ts', '');
|
150
155
|
}
|
151
|
-
exports.createXplatLibs = createXplatLibs;
|
152
156
|
function createXplatNativeScriptAngular(tree, framework) {
|
153
157
|
const frameworkSuffix = framework === 'angular' ? '' : '-angular';
|
154
158
|
// tree.create(`/libs/xplat/nativescript${frameworkSuffix}/index.ts`, '');
|
@@ -244,7 +248,6 @@ function createXplatNativeScriptAngular(tree, framework) {
|
|
244
248
|
tree.create(`/libs/xplat/nativescript${frameworkSuffix}/scss/src/_variables.scss`, '');
|
245
249
|
tree.create(`/libs/xplat/nativescript${frameworkSuffix}/utils/src/lib/index.ts`, ``);
|
246
250
|
}
|
247
|
-
exports.createXplatNativeScriptAngular = createXplatNativeScriptAngular;
|
248
251
|
function createXplatWebAngular(tree, framework) {
|
249
252
|
const frameworkSuffix = framework === 'angular' ? '' : '-angular';
|
250
253
|
// tree.create(`/libs/xplat/web${frameworkSuffix}/index.ts`, '');
|
@@ -278,7 +281,6 @@ function createXplatWebAngular(tree, framework) {
|
|
278
281
|
tree.create(`/libs/xplat/web${frameworkSuffix}/features/src/lib/index.ts`, '');
|
279
282
|
tree.create(`/libs/xplat/web${frameworkSuffix}/scss/src/_variables.scss`, '');
|
280
283
|
}
|
281
|
-
exports.createXplatWebAngular = createXplatWebAngular;
|
282
284
|
function createWebAngularApp(tree, withRouting) {
|
283
285
|
tree.create('/apps/web-viewer/src/index.html', '');
|
284
286
|
tree.create('/apps/web-viewer/src/app/features/index.ts', '');
|
@@ -313,7 +315,6 @@ function createWebAngularApp(tree, withRouting) {
|
|
313
315
|
`);
|
314
316
|
}
|
315
317
|
}
|
316
|
-
exports.createWebAngularApp = createWebAngularApp;
|
317
318
|
function createNativeScriptAngularApp(tree, withRouting) {
|
318
319
|
tree.create('/apps/nativescript-viewer/package.json', '');
|
319
320
|
tree.create('/apps/nativescript-viewer/tsconfig.json', '');
|
@@ -354,7 +355,6 @@ function createNativeScriptAngularApp(tree, withRouting) {
|
|
354
355
|
`);
|
355
356
|
}
|
356
357
|
}
|
357
|
-
exports.createNativeScriptAngularApp = createNativeScriptAngularApp;
|
358
358
|
const isInModuleMetadata = (moduleName, property, value, inArray) => (0, exports.isInDecoratorMetadata)(moduleName, property, value, 'NgModule', inArray);
|
359
359
|
exports.isInModuleMetadata = isInModuleMetadata;
|
360
360
|
const isInComponentMetadata = (componentName, property, value, inArray) => (0, exports.isInDecoratorMetadata)(componentName, property, value, 'Component', inArray);
|
package/src/utils/testing.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.runSchematic = runSchematic;
|
4
|
+
exports.callRule = callRule;
|
5
|
+
exports.runMigration = runMigration;
|
4
6
|
const path_1 = require("path");
|
5
7
|
const testing_1 = require("@angular-devkit/schematics/testing");
|
6
8
|
const testRunner = new testing_1.SchematicTestRunner('@nstudio/xplat', (0, path_1.join)(__dirname, '../../collection.json'));
|
@@ -8,13 +10,10 @@ const migrationTestRunner = new testing_1.SchematicTestRunner('@nstudio/xplat/mi
|
|
8
10
|
function runSchematic(schematicName, options, tree) {
|
9
11
|
return testRunner.runSchematic(schematicName, options, tree);
|
10
12
|
}
|
11
|
-
exports.runSchematic = runSchematic;
|
12
13
|
function callRule(rule, tree) {
|
13
14
|
return testRunner.callRule(rule, tree).toPromise();
|
14
15
|
}
|
15
|
-
exports.callRule = callRule;
|
16
16
|
function runMigration(migrationName, options, tree) {
|
17
17
|
return migrationTestRunner
|
18
18
|
.runSchematic(migrationName, options, tree);
|
19
19
|
}
|
20
|
-
exports.runMigration = runMigration;
|
package/src/utils/versions.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const xplatVersion = "*";
|
2
|
-
export declare const nxVersion = "^
|
2
|
+
export declare const nxVersion = "^20.0.0";
|
package/src/utils/versions.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.nxVersion = exports.xplatVersion = void 0;
|
4
|
-
exports.xplatVersion = '
|
5
|
-
exports.nxVersion = '^
|
4
|
+
exports.xplatVersion = '20.0.0';
|
5
|
+
exports.nxVersion = '^20.0.0';
|
package/src/utils/xplat.d.ts
CHANGED
@@ -75,7 +75,7 @@ export declare namespace XplatHelpers {
|
|
75
75
|
*/
|
76
76
|
function addPackageWithNgAdd(packageName: string, options?: NgAddSchema, callSchematicIfAdded?: string): Rule;
|
77
77
|
function getPlatformsFromOption(platformArgument?: string, required?: boolean): any[];
|
78
|
-
function getFrameworksFromOptions(frameworkArgument: string):
|
78
|
+
function getFrameworksFromOptions(frameworkArgument: string): Array<FrameworkTypes>;
|
79
79
|
function getFrameworkChoice(frameworkArgument: string, frameworks?: Array<FrameworkTypes>): "angular";
|
80
80
|
function getUpdatedXplatSettings(options: Schema): IXplatSettings;
|
81
81
|
/**
|