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