@nx/plugin 0.0.0-pr-26891-2baa5df → 0.0.0-pr-26898-984dfaf
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 +1 -1
- package/package.json +6 -6
- package/src/generators/create-package/create-package.js +3 -2
- package/src/generators/create-package/utils/normalize-schema.js +2 -1
- package/src/generators/e2e-project/e2e.js +3 -2
- package/src/generators/executor/executor.js +4 -3
- package/src/generators/executor/files/hasher/hasher.spec.ts.template +1 -2
- package/src/generators/generator/generator.js +4 -3
- package/src/generators/lint-checks/generator.js +4 -3
- package/src/generators/migration/migration.js +3 -2
- package/src/generators/plugin/plugin.js +3 -2
- package/src/generators/plugin/utils/normalize-schema.js +2 -1
- package/src/generators/preset/generator.js +1 -1
- package/src/migrations/update-16-0-0/cli-in-schema-json.js +2 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +1 -1
- package/src/migrations/update-16-2-0/replace-e2e-executor.js +1 -1
- package/src/utils/has-generator.js +2 -1
- package/src/utils/testing-utils/async-commands.d.ts +1 -0
- package/src/utils/testing-utils/async-commands.js +3 -2
- package/src/utils/testing-utils/commands.d.ts +1 -0
- package/src/utils/testing-utils/commands.js +3 -2
- package/src/utils/testing-utils/nx-project.js +6 -5
- package/src/utils/testing-utils/paths.js +4 -3
- package/src/utils/testing-utils/utils.js +15 -15
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ npx nx@latest init
|
|
|
65
65
|
- [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
|
|
66
66
|
- [Intro to Nx](https://nx.dev/getting-started/intro)
|
|
67
67
|
- [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
|
|
68
|
-
- [Blog Posts About Nx](https://
|
|
68
|
+
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
69
69
|
|
|
70
70
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
71
71
|
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/plugin",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-26898-984dfaf",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
|
|
6
6
|
"repository": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"fs-extra": "^11.1.0",
|
|
31
31
|
"tslib": "^2.3.0",
|
|
32
|
-
"@nx/devkit": "0.0.0-pr-
|
|
33
|
-
"@nx/jest": "0.0.0-pr-
|
|
34
|
-
"@nx/js": "0.0.0-pr-
|
|
35
|
-
"@nx/eslint": "0.0.0-pr-
|
|
36
|
-
"@nrwl/nx-plugin": "0.0.0-pr-
|
|
32
|
+
"@nx/devkit": "0.0.0-pr-26898-984dfaf",
|
|
33
|
+
"@nx/jest": "0.0.0-pr-26898-984dfaf",
|
|
34
|
+
"@nx/js": "0.0.0-pr-26898-984dfaf",
|
|
35
|
+
"@nx/eslint": "0.0.0-pr-26898-984dfaf",
|
|
36
|
+
"@nrwl/nx-plugin": "0.0.0-pr-26898-984dfaf"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPackageGenerator =
|
|
4
|
-
exports.createPackageGeneratorInternal = createPackageGeneratorInternal;
|
|
3
|
+
exports.createPackageGeneratorInternal = exports.createPackageGenerator = void 0;
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const js_1 = require("@nx/js");
|
|
7
6
|
const add_tslib_dependencies_1 = require("@nx/js/src/utils/typescript/add-tslib-dependencies");
|
|
@@ -17,6 +16,7 @@ async function createPackageGenerator(host, schema) {
|
|
|
17
16
|
...schema,
|
|
18
17
|
});
|
|
19
18
|
}
|
|
19
|
+
exports.createPackageGenerator = createPackageGenerator;
|
|
20
20
|
async function createPackageGeneratorInternal(host, schema) {
|
|
21
21
|
const tasks = [];
|
|
22
22
|
const options = await (0, normalize_schema_1.normalizeSchema)(host, schema);
|
|
@@ -37,6 +37,7 @@ async function createPackageGeneratorInternal(host, schema) {
|
|
|
37
37
|
}
|
|
38
38
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
39
39
|
}
|
|
40
|
+
exports.createPackageGeneratorInternal = createPackageGeneratorInternal;
|
|
40
41
|
/**
|
|
41
42
|
* Add a preset generator to the plugin if it doesn't exist
|
|
42
43
|
* @param host
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeSchema =
|
|
3
|
+
exports.normalizeSchema = void 0;
|
|
4
4
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
5
5
|
async function normalizeSchema(host, schema) {
|
|
6
6
|
const { projectName, names: projectNames, projectRoot, projectNameAndRootFormat, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -19,3 +19,4 @@ async function normalizeSchema(host, schema) {
|
|
|
19
19
|
name: projectNames.projectSimpleName,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
exports.normalizeSchema = normalizeSchema;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.e2eProjectGenerator =
|
|
4
|
-
exports.e2eProjectGeneratorInternal = e2eProjectGeneratorInternal;
|
|
3
|
+
exports.e2eProjectGeneratorInternal = exports.e2eProjectGenerator = void 0;
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
7
6
|
const jest_1 = require("@nx/jest");
|
|
@@ -121,6 +120,7 @@ async function e2eProjectGenerator(host, schema) {
|
|
|
121
120
|
...schema,
|
|
122
121
|
});
|
|
123
122
|
}
|
|
123
|
+
exports.e2eProjectGenerator = e2eProjectGenerator;
|
|
124
124
|
async function e2eProjectGeneratorInternal(host, schema) {
|
|
125
125
|
const tasks = [];
|
|
126
126
|
validatePlugin(host, schema.pluginName);
|
|
@@ -140,4 +140,5 @@ async function e2eProjectGeneratorInternal(host, schema) {
|
|
|
140
140
|
}
|
|
141
141
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
142
142
|
}
|
|
143
|
+
exports.e2eProjectGeneratorInternal = e2eProjectGeneratorInternal;
|
|
143
144
|
exports.default = e2eProjectGenerator;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createExecutorsJson =
|
|
4
|
-
exports.executorGenerator = executorGenerator;
|
|
5
|
-
exports.executorGeneratorInternal = executorGeneratorInternal;
|
|
3
|
+
exports.executorGeneratorInternal = exports.executorGenerator = exports.createExecutorsJson = void 0;
|
|
6
4
|
const devkit_1 = require("@nx/devkit");
|
|
7
5
|
const path = require("path");
|
|
8
6
|
const generator_1 = require("../lint-checks/generator");
|
|
@@ -39,6 +37,7 @@ async function createExecutorsJson(host, projectRoot, projectName, skipLintCheck
|
|
|
39
37
|
});
|
|
40
38
|
}
|
|
41
39
|
}
|
|
40
|
+
exports.createExecutorsJson = createExecutorsJson;
|
|
42
41
|
async function updateExecutorJson(host, options) {
|
|
43
42
|
const packageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'));
|
|
44
43
|
const packageJsonExecutors = packageJson.executors ?? packageJson.builders;
|
|
@@ -111,6 +110,7 @@ async function executorGenerator(tree, rawOptions) {
|
|
|
111
110
|
...rawOptions,
|
|
112
111
|
});
|
|
113
112
|
}
|
|
113
|
+
exports.executorGenerator = executorGenerator;
|
|
114
114
|
async function executorGeneratorInternal(host, schema) {
|
|
115
115
|
const options = await normalizeOptions(host, schema);
|
|
116
116
|
addFiles(host, options);
|
|
@@ -122,4 +122,5 @@ async function executorGeneratorInternal(host, schema) {
|
|
|
122
122
|
await (0, devkit_1.formatFiles)(host);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
+
exports.executorGeneratorInternal = executorGeneratorInternal;
|
|
125
126
|
exports.default = executorGenerator;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createGeneratorsJson =
|
|
4
|
-
exports.generatorGenerator = generatorGenerator;
|
|
5
|
-
exports.generatorGeneratorInternal = generatorGeneratorInternal;
|
|
3
|
+
exports.generatorGeneratorInternal = exports.generatorGenerator = exports.createGeneratorsJson = void 0;
|
|
6
4
|
const devkit_1 = require("@nx/devkit");
|
|
7
5
|
const has_generator_1 = require("../../utils/has-generator");
|
|
8
6
|
const generator_1 = require("../lint-checks/generator");
|
|
@@ -70,6 +68,7 @@ async function createGeneratorsJson(host, projectRoot, projectName, skipLintChec
|
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
70
|
}
|
|
71
|
+
exports.createGeneratorsJson = createGeneratorsJson;
|
|
73
72
|
async function updateGeneratorJson(host, options) {
|
|
74
73
|
const packageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'));
|
|
75
74
|
const packageJsonGenerators = packageJson.generators ?? packageJson.schematics;
|
|
@@ -112,6 +111,7 @@ async function generatorGenerator(tree, rawOptions) {
|
|
|
112
111
|
...rawOptions,
|
|
113
112
|
});
|
|
114
113
|
}
|
|
114
|
+
exports.generatorGenerator = generatorGenerator;
|
|
115
115
|
async function generatorGeneratorInternal(host, schema) {
|
|
116
116
|
const options = await normalizeOptions(host, schema);
|
|
117
117
|
if ((0, has_generator_1.hasGenerator)(host, options.project, options.name)) {
|
|
@@ -123,4 +123,5 @@ async function generatorGeneratorInternal(host, schema) {
|
|
|
123
123
|
await (0, devkit_1.formatFiles)(host);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
+
exports.generatorGeneratorInternal = generatorGeneratorInternal;
|
|
126
127
|
exports.default = generatorGenerator;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.addMigrationJsonChecks = addMigrationJsonChecks;
|
|
5
|
-
exports.getEsLintOptions = getEsLintOptions;
|
|
3
|
+
exports.getEsLintOptions = exports.addMigrationJsonChecks = void 0;
|
|
6
4
|
const devkit_1 = require("@nx/devkit");
|
|
7
5
|
const logger_1 = require("nx/src/utils/logger");
|
|
8
6
|
const package_json_1 = require("nx/src/utils/package-json");
|
|
@@ -28,6 +26,7 @@ async function pluginLintCheckGenerator(host, options) {
|
|
|
28
26
|
await (0, devkit_1.formatFiles)(host);
|
|
29
27
|
}
|
|
30
28
|
}
|
|
29
|
+
exports.default = pluginLintCheckGenerator;
|
|
31
30
|
function addMigrationJsonChecks(host, options, packageJson) {
|
|
32
31
|
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
33
32
|
if (!projectIsEsLintEnabled(host, projectConfiguration)) {
|
|
@@ -59,6 +58,7 @@ function addMigrationJsonChecks(host, options, packageJson) {
|
|
|
59
58
|
};
|
|
60
59
|
});
|
|
61
60
|
}
|
|
61
|
+
exports.addMigrationJsonChecks = addMigrationJsonChecks;
|
|
62
62
|
function updateProjectTarget(host, options, packageJson) {
|
|
63
63
|
const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
64
64
|
if (!project.targets) {
|
|
@@ -184,3 +184,4 @@ function getEsLintOptions(project) {
|
|
|
184
184
|
x.executor === '@nx/linter:eslint' ||
|
|
185
185
|
x.executor === '@nrwl/linter:eslint');
|
|
186
186
|
}
|
|
187
|
+
exports.getEsLintOptions = getEsLintOptions;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.migrationGenerator =
|
|
4
|
-
exports.migrationGeneratorInternal = migrationGeneratorInternal;
|
|
3
|
+
exports.migrationGeneratorInternal = exports.migrationGenerator = void 0;
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const path = require("path");
|
|
7
6
|
const path_1 = require("path");
|
|
@@ -116,6 +115,7 @@ async function migrationGenerator(tree, rawOptions) {
|
|
|
116
115
|
...rawOptions,
|
|
117
116
|
});
|
|
118
117
|
}
|
|
118
|
+
exports.migrationGenerator = migrationGenerator;
|
|
119
119
|
async function migrationGeneratorInternal(host, schema) {
|
|
120
120
|
const options = await normalizeOptions(host, schema);
|
|
121
121
|
addFiles(host, options);
|
|
@@ -131,4 +131,5 @@ async function migrationGeneratorInternal(host, schema) {
|
|
|
131
131
|
await (0, devkit_1.formatFiles)(host);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
+
exports.migrationGeneratorInternal = migrationGeneratorInternal;
|
|
134
135
|
exports.default = migrationGenerator;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pluginGenerator =
|
|
4
|
-
exports.pluginGeneratorInternal = pluginGeneratorInternal;
|
|
3
|
+
exports.pluginGeneratorInternal = exports.pluginGenerator = void 0;
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const js_1 = require("@nx/js");
|
|
7
6
|
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
@@ -57,6 +56,7 @@ async function pluginGenerator(host, schema) {
|
|
|
57
56
|
...schema,
|
|
58
57
|
});
|
|
59
58
|
}
|
|
59
|
+
exports.pluginGenerator = pluginGenerator;
|
|
60
60
|
async function pluginGeneratorInternal(host, schema) {
|
|
61
61
|
const options = await (0, normalize_schema_1.normalizeOptions)(host, schema);
|
|
62
62
|
const tasks = [];
|
|
@@ -106,4 +106,5 @@ async function pluginGeneratorInternal(host, schema) {
|
|
|
106
106
|
}
|
|
107
107
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
108
108
|
}
|
|
109
|
+
exports.pluginGeneratorInternal = pluginGeneratorInternal;
|
|
109
110
|
exports.default = pluginGenerator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeOptions =
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
async function normalizeOptions(host, options) {
|
|
@@ -41,3 +41,4 @@ async function normalizeOptions(host, options) {
|
|
|
41
41
|
publishable: options.publishable ?? false,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
+
exports.normalizeOptions = normalizeOptions;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const eslint_1 = require("@nx/eslint");
|
|
6
5
|
const plugin_1 = require("../plugin/plugin");
|
|
@@ -48,6 +47,7 @@ async function default_1(tree, options) {
|
|
|
48
47
|
await (0, devkit_1.formatFiles)(tree);
|
|
49
48
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
50
49
|
}
|
|
50
|
+
exports.default = default_1;
|
|
51
51
|
function moveNxPluginToDevDeps(tree) {
|
|
52
52
|
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
53
53
|
const nxPluginEntry = json.dependencies['@nx/plugin'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateCliPropsForPlugins =
|
|
3
|
+
exports.updateCliPropsForPlugins = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const package_json_1 = require("nx/src/utils/package-json");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -83,6 +83,7 @@ function updateCliPropsForPlugins(tree) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
exports.updateCliPropsForPlugins = updateCliPropsForPlugins;
|
|
86
87
|
function removeCliFromExecutorSchemaJsonFiles(tree, collectionPath) {
|
|
87
88
|
const collection = (0, devkit_1.readJson)(tree, collectionPath);
|
|
88
89
|
for (const [name, entry] of Object.entries(collection.executors ?? {}).concat(Object.entries(collection.builders ?? {}))) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = replacePackage;
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
6
5
|
async function replacePackage(tree) {
|
|
7
6
|
await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/nx-plugin', '@nx/plugin');
|
|
8
7
|
await (0, devkit_1.formatFiles)(tree);
|
|
9
8
|
}
|
|
9
|
+
exports.default = replacePackage;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = replaceE2EExecutor;
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
5
|
async function replaceE2EExecutor(tree) {
|
|
@@ -30,3 +29,4 @@ async function replaceE2EExecutor(tree) {
|
|
|
30
29
|
}
|
|
31
30
|
await (0, devkit_1.formatFiles)(tree);
|
|
32
31
|
}
|
|
32
|
+
exports.default = replaceE2EExecutor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasGenerator =
|
|
3
|
+
exports.hasGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function hasGenerator(tree, projectName, generatorName) {
|
|
6
6
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
@@ -13,3 +13,4 @@ function hasGenerator(tree, projectName, generatorName) {
|
|
|
13
13
|
return ((generatorsJson.generators?.[generatorName] ??
|
|
14
14
|
generatorsJson.schematics?.[generatorName]) !== undefined);
|
|
15
15
|
}
|
|
16
|
+
exports.hasGenerator = hasGenerator;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runCommandAsync =
|
|
4
|
-
exports.runNxCommandAsync = runNxCommandAsync;
|
|
3
|
+
exports.runNxCommandAsync = exports.runCommandAsync = void 0;
|
|
5
4
|
const child_process_1 = require("child_process");
|
|
6
5
|
const paths_1 = require("./paths");
|
|
7
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -27,6 +26,7 @@ function runCommandAsync(command, opts = {
|
|
|
27
26
|
});
|
|
28
27
|
});
|
|
29
28
|
}
|
|
29
|
+
exports.runCommandAsync = runCommandAsync;
|
|
30
30
|
/**
|
|
31
31
|
* Run a nx command asynchronously inside the e2e directory
|
|
32
32
|
* @param command
|
|
@@ -47,3 +47,4 @@ function runNxCommandAsync(command, opts = {
|
|
|
47
47
|
return runCommandAsync(`./nx %${command}`, opts);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
exports.runNxCommandAsync = runNxCommandAsync;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runNxCommand =
|
|
4
|
-
exports.runCommand = runCommand;
|
|
3
|
+
exports.runCommand = exports.runNxCommand = void 0;
|
|
5
4
|
const child_process_1 = require("child_process");
|
|
6
5
|
const paths_1 = require("./paths");
|
|
7
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -48,6 +47,7 @@ function runNxCommand(command, opts = {
|
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
}
|
|
50
|
+
exports.runNxCommand = runNxCommand;
|
|
51
51
|
function runCommand(command, opts) {
|
|
52
52
|
try {
|
|
53
53
|
return (0, child_process_1.execSync)(command, {
|
|
@@ -60,3 +60,4 @@ function runCommand(command, opts) {
|
|
|
60
60
|
return e.stdout.toString() + e.stderr.toString();
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
exports.runCommand = runCommand;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.patchPackageJsonForPlugin =
|
|
4
|
-
exports.uniq = uniq;
|
|
5
|
-
exports.runPackageManagerInstall = runPackageManagerInstall;
|
|
6
|
-
exports.newNxProject = newNxProject;
|
|
7
|
-
exports.ensureNxProject = ensureNxProject;
|
|
3
|
+
exports.ensureNxProject = exports.newNxProject = exports.runPackageManagerInstall = exports.uniq = exports.patchPackageJsonForPlugin = void 0;
|
|
8
4
|
const devkit_1 = require("@nx/devkit");
|
|
9
5
|
const devkit_2 = require("@nx/devkit");
|
|
10
6
|
const child_process_1 = require("child_process");
|
|
@@ -25,6 +21,7 @@ function patchPackageJsonForPlugin(npmPackageName, distPath) {
|
|
|
25
21
|
json.devDependencies[npmPackageName] = `file:${devkit_1.workspaceRoot}/${distPath}`;
|
|
26
22
|
(0, devkit_2.writeJsonFile)(path, json);
|
|
27
23
|
}
|
|
24
|
+
exports.patchPackageJsonForPlugin = patchPackageJsonForPlugin;
|
|
28
25
|
/**
|
|
29
26
|
* Generate a unique name for running CLI commands
|
|
30
27
|
* @param prefix
|
|
@@ -34,6 +31,7 @@ function patchPackageJsonForPlugin(npmPackageName, distPath) {
|
|
|
34
31
|
function uniq(prefix) {
|
|
35
32
|
return `${prefix}${Math.floor(Math.random() * 10000000)}`;
|
|
36
33
|
}
|
|
34
|
+
exports.uniq = uniq;
|
|
37
35
|
/**
|
|
38
36
|
* Run the appropriate package manager install command in the e2e directory
|
|
39
37
|
* @param silent silent output from the install
|
|
@@ -47,6 +45,7 @@ function runPackageManagerInstall(silent = true) {
|
|
|
47
45
|
});
|
|
48
46
|
return install ? install.toString() : '';
|
|
49
47
|
}
|
|
48
|
+
exports.runPackageManagerInstall = runPackageManagerInstall;
|
|
50
49
|
/**
|
|
51
50
|
* Creates a new nx project in the e2e directory
|
|
52
51
|
*
|
|
@@ -59,6 +58,7 @@ function newNxProject(npmPackageName, pluginDistPath) {
|
|
|
59
58
|
patchPackageJsonForPlugin(npmPackageName, pluginDistPath);
|
|
60
59
|
runPackageManagerInstall();
|
|
61
60
|
}
|
|
61
|
+
exports.newNxProject = newNxProject;
|
|
62
62
|
/**
|
|
63
63
|
* Ensures that a project has been setup in the e2e directory
|
|
64
64
|
* It will also copy `@nx` packages to the e2e directory
|
|
@@ -67,3 +67,4 @@ function ensureNxProject(npmPackageName, pluginDistPath) {
|
|
|
67
67
|
(0, fs_extra_1.ensureDirSync)((0, paths_1.tmpProjPath)());
|
|
68
68
|
newNxProject(npmPackageName, pluginDistPath);
|
|
69
69
|
}
|
|
70
|
+
exports.ensureNxProject = ensureNxProject;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tmpFolder =
|
|
4
|
-
exports.tmpProjPath = tmpProjPath;
|
|
5
|
-
exports.tmpBackupProjPath = tmpBackupProjPath;
|
|
3
|
+
exports.tmpBackupProjPath = exports.tmpProjPath = exports.tmpFolder = void 0;
|
|
6
4
|
const devkit_1 = require("@nx/devkit");
|
|
7
5
|
function tmpFolder() {
|
|
8
6
|
return `${devkit_1.workspaceRoot}/tmp`;
|
|
9
7
|
}
|
|
8
|
+
exports.tmpFolder = tmpFolder;
|
|
10
9
|
/**
|
|
11
10
|
* The directory where the e2e workspace resides in.
|
|
12
11
|
*
|
|
@@ -18,6 +17,7 @@ function tmpProjPath(path) {
|
|
|
18
17
|
? `${tmpFolder()}/nx-e2e/proj/${path}`
|
|
19
18
|
: `${tmpFolder()}/nx-e2e/proj`;
|
|
20
19
|
}
|
|
20
|
+
exports.tmpProjPath = tmpProjPath;
|
|
21
21
|
/**
|
|
22
22
|
* The workspace backup directory. This is used for caching of the creation of the workspace.
|
|
23
23
|
*
|
|
@@ -29,3 +29,4 @@ function tmpBackupProjPath(path) {
|
|
|
29
29
|
? `${devkit_1.workspaceRoot}/tmp/nx-e2e/proj-backup/${path}`
|
|
30
30
|
: `${devkit_1.workspaceRoot}/tmp/nx-e2e/proj-backup`;
|
|
31
31
|
}
|
|
32
|
+
exports.tmpBackupProjPath = tmpBackupProjPath;
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fileExists = exports.directoryExists = void 0;
|
|
4
|
-
exports.copyNodeModules = copyNodeModules;
|
|
5
|
-
exports.expectTestsPass = expectTestsPass;
|
|
6
|
-
exports.updateFile = updateFile;
|
|
7
|
-
exports.renameFile = renameFile;
|
|
8
|
-
exports.checkFilesExist = checkFilesExist;
|
|
9
|
-
exports.listFiles = listFiles;
|
|
10
|
-
exports.readJson = readJson;
|
|
11
|
-
exports.readFile = readFile;
|
|
12
|
-
exports.cleanup = cleanup;
|
|
13
|
-
exports.rmDist = rmDist;
|
|
14
|
-
exports.removeTmpProject = removeTmpProject;
|
|
15
|
-
exports.getCwd = getCwd;
|
|
16
|
-
exports.exists = exists;
|
|
17
|
-
exports.getSize = getSize;
|
|
3
|
+
exports.getSize = exports.exists = exports.getCwd = exports.removeTmpProject = exports.rmDist = exports.cleanup = exports.readFile = exports.readJson = exports.listFiles = exports.checkFilesExist = exports.renameFile = exports.updateFile = exports.expectTestsPass = exports.copyNodeModules = exports.fileExists = exports.directoryExists = void 0;
|
|
18
4
|
const fs_extra_1 = require("fs-extra");
|
|
19
5
|
const path_1 = require("path");
|
|
20
6
|
const paths_1 = require("./paths");
|
|
@@ -32,6 +18,7 @@ function copyNodeModules(modules) {
|
|
|
32
18
|
(0, fs_extra_1.copySync)(`./node_modules/${module}`, `${(0, paths_1.tmpProjPath)()}/node_modules/${module}`);
|
|
33
19
|
});
|
|
34
20
|
}
|
|
21
|
+
exports.copyNodeModules = copyNodeModules;
|
|
35
22
|
/**
|
|
36
23
|
* Assert test output from a asynchronous CLI command.
|
|
37
24
|
*
|
|
@@ -41,6 +28,7 @@ function expectTestsPass(output) {
|
|
|
41
28
|
expect(output.stderr).toContain('Ran all test suites');
|
|
42
29
|
expect(output.stderr).not.toContain('fail');
|
|
43
30
|
}
|
|
31
|
+
exports.expectTestsPass = expectTestsPass;
|
|
44
32
|
// type callback =
|
|
45
33
|
/**
|
|
46
34
|
* Update a file's content in the e2e directory.
|
|
@@ -59,6 +47,7 @@ function updateFile(file, content) {
|
|
|
59
47
|
(0, fs_extra_1.writeFileSync)((0, paths_1.tmpProjPath)(file), content((0, fs_extra_1.readFileSync)((0, paths_1.tmpProjPath)(file)).toString()));
|
|
60
48
|
}
|
|
61
49
|
}
|
|
50
|
+
exports.updateFile = updateFile;
|
|
62
51
|
/**
|
|
63
52
|
* Rename a file or directory within the e2e directory.
|
|
64
53
|
* @param path Original path
|
|
@@ -68,6 +57,7 @@ function renameFile(path, newPath) {
|
|
|
68
57
|
(0, fs_extra_1.ensureDirSync)((0, path_1.dirname)((0, paths_1.tmpProjPath)(newPath)));
|
|
69
58
|
(0, fs_extra_1.renameSync)((0, paths_1.tmpProjPath)(path), (0, paths_1.tmpProjPath)(newPath));
|
|
70
59
|
}
|
|
60
|
+
exports.renameFile = renameFile;
|
|
71
61
|
/**
|
|
72
62
|
* Check if the file or directory exists.
|
|
73
63
|
*
|
|
@@ -84,6 +74,7 @@ function checkFilesExist(...expectedPaths) {
|
|
|
84
74
|
}
|
|
85
75
|
});
|
|
86
76
|
}
|
|
77
|
+
exports.checkFilesExist = checkFilesExist;
|
|
87
78
|
/**
|
|
88
79
|
* Get a list of all files within a directory.
|
|
89
80
|
* @param dirName Directory name within the e2e directory.
|
|
@@ -91,6 +82,7 @@ function checkFilesExist(...expectedPaths) {
|
|
|
91
82
|
function listFiles(dirName) {
|
|
92
83
|
return (0, fs_extra_1.readdirSync)((0, paths_1.tmpProjPath)(dirName));
|
|
93
84
|
}
|
|
85
|
+
exports.listFiles = listFiles;
|
|
94
86
|
/**
|
|
95
87
|
* Read a JSON file.
|
|
96
88
|
* @param path Path to the JSON file. Absolute or relative to the e2e directory.
|
|
@@ -99,6 +91,7 @@ function listFiles(dirName) {
|
|
|
99
91
|
function readJson(path, options) {
|
|
100
92
|
return (0, devkit_1.parseJson)(readFile(path), options);
|
|
101
93
|
}
|
|
94
|
+
exports.readJson = readJson;
|
|
102
95
|
/**
|
|
103
96
|
* Read a file.
|
|
104
97
|
* @param path Path to the file. Absolute or relative to the e2e directory.
|
|
@@ -107,27 +100,32 @@ function readFile(path) {
|
|
|
107
100
|
const filePath = (0, path_1.isAbsolute)(path) ? path : (0, paths_1.tmpProjPath)(path);
|
|
108
101
|
return (0, fs_extra_1.readFileSync)(filePath, 'utf-8');
|
|
109
102
|
}
|
|
103
|
+
exports.readFile = readFile;
|
|
110
104
|
/**
|
|
111
105
|
* Deletes the e2e directory
|
|
112
106
|
*/
|
|
113
107
|
function cleanup() {
|
|
114
108
|
(0, fs_extra_1.removeSync)((0, paths_1.tmpProjPath)());
|
|
115
109
|
}
|
|
110
|
+
exports.cleanup = cleanup;
|
|
116
111
|
/**
|
|
117
112
|
* Remove the dist folder from the e2e directory
|
|
118
113
|
*/
|
|
119
114
|
function rmDist() {
|
|
120
115
|
(0, fs_extra_1.removeSync)(`${(0, paths_1.tmpProjPath)()}/dist`);
|
|
121
116
|
}
|
|
117
|
+
exports.rmDist = rmDist;
|
|
122
118
|
function removeTmpProject(project) {
|
|
123
119
|
(0, fs_extra_1.removeSync)(`${(0, paths_1.tmpFolder)()}/${project}`);
|
|
124
120
|
}
|
|
121
|
+
exports.removeTmpProject = removeTmpProject;
|
|
125
122
|
/**
|
|
126
123
|
* Get the currend `cwd` in the process
|
|
127
124
|
*/
|
|
128
125
|
function getCwd() {
|
|
129
126
|
return process.cwd();
|
|
130
127
|
}
|
|
128
|
+
exports.getCwd = getCwd;
|
|
131
129
|
/**
|
|
132
130
|
* Check if a file or directory exists.
|
|
133
131
|
* @param path Path to file or directory
|
|
@@ -135,6 +133,7 @@ function getCwd() {
|
|
|
135
133
|
function exists(path) {
|
|
136
134
|
return (0, fileutils_1.directoryExists)(path) || (0, fileutils_1.fileExists)(path);
|
|
137
135
|
}
|
|
136
|
+
exports.exists = exists;
|
|
138
137
|
/**
|
|
139
138
|
* Get the size of a file on disk
|
|
140
139
|
* @param filePath Path to the file
|
|
@@ -142,3 +141,4 @@ function exists(path) {
|
|
|
142
141
|
function getSize(filePath) {
|
|
143
142
|
return (0, fs_extra_1.statSync)(filePath).size;
|
|
144
143
|
}
|
|
144
|
+
exports.getSize = getSize;
|