@nx/plugin 16.0.0-beta.5
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/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +67 -0
- package/executors.json +16 -0
- package/generators.d.ts +6 -0
- package/generators.js +10 -0
- package/generators.js.map +1 -0
- package/generators.json +81 -0
- package/index.d.ts +0 -0
- package/index.js +1 -0
- package/index.js.map +1 -0
- package/migrations.json +46 -0
- package/package.json +45 -0
- package/src/executors/e2e/compat.d.ts +1 -0
- package/src/executors/e2e/compat.js +7 -0
- package/src/executors/e2e/compat.js.map +1 -0
- package/src/executors/e2e/e2e.impl.d.ts +7 -0
- package/src/executors/e2e/e2e.impl.js +81 -0
- package/src/executors/e2e/e2e.impl.js.map +1 -0
- package/src/executors/e2e/schema.d.ts +6 -0
- package/src/executors/e2e/schema.json +220 -0
- package/src/generators/create-package/create-package.d.ts +5 -0
- package/src/generators/create-package/create-package.js +115 -0
- package/src/generators/create-package/create-package.js.map +1 -0
- package/src/generators/create-package/files/create-framework-package/bin/index.ts__tmpl__ +26 -0
- package/src/generators/create-package/files/e2e/__name__.spec.ts__tmpl__ +30 -0
- package/src/generators/create-package/schema.d.ts +17 -0
- package/src/generators/create-package/schema.json +69 -0
- package/src/generators/create-package/utils/normalize-schema.d.ts +10 -0
- package/src/generators/create-package/utils/normalize-schema.js +22 -0
- package/src/generators/create-package/utils/normalize-schema.js.map +1 -0
- package/src/generators/e2e-project/e2e.d.ts +6 -0
- package/src/generators/e2e-project/e2e.js +107 -0
- package/src/generators/e2e-project/e2e.js.map +1 -0
- package/src/generators/e2e-project/files/tests/__pluginName__.spec.ts__tmpl__ +37 -0
- package/src/generators/e2e-project/files/tsconfig.json__tmpl__ +6 -0
- package/src/generators/e2e-project/schema.d.ts +12 -0
- package/src/generators/e2e-project/schema.json +57 -0
- package/src/generators/executor/executor.d.ts +6 -0
- package/src/generators/executor/executor.js +104 -0
- package/src/generators/executor/executor.js.map +1 -0
- package/src/generators/executor/files/executor/__fileName__/executor.spec.ts__tmpl__ +11 -0
- package/src/generators/executor/files/executor/__fileName__/executor.ts__tmpl__ +11 -0
- package/src/generators/executor/files/executor/__fileName__/schema.d.ts__tmpl__ +1 -0
- package/src/generators/executor/files/executor/__fileName__/schema.json__tmpl__ +9 -0
- package/src/generators/executor/files/hasher/__fileName__/hasher.spec.ts__tmpl__ +22 -0
- package/src/generators/executor/files/hasher/__fileName__/hasher.ts__tmpl__ +12 -0
- package/src/generators/executor/schema.d.ts +9 -0
- package/src/generators/executor/schema.json +64 -0
- package/src/generators/generator/files/generator/__fileName__/generator.spec.ts__tmpl__ +20 -0
- package/src/generators/generator/files/generator/__fileName__/generator.ts__tmpl__ +72 -0
- package/src/generators/generator/files/generator/__fileName__/schema.d.ts__tmpl__ +5 -0
- package/src/generators/generator/files/generator/__fileName__/schema.json__tmpl__ +27 -0
- package/src/generators/generator/generator.d.ts +6 -0
- package/src/generators/generator/generator.js +106 -0
- package/src/generators/generator/generator.js.map +1 -0
- package/src/generators/generator/schema.d.ts +8 -0
- package/src/generators/generator/schema.json +60 -0
- package/src/generators/lint-checks/generator.d.ts +7 -0
- package/src/generators/lint-checks/generator.js +187 -0
- package/src/generators/lint-checks/generator.js.map +1 -0
- package/src/generators/lint-checks/schema.d.ts +4 -0
- package/src/generators/lint-checks/schema.json +25 -0
- package/src/generators/migration/files/migration/__name__/__name__.spec.ts__tmpl__ +17 -0
- package/src/generators/migration/files/migration/__name__/__name__.ts__tmpl__ +6 -0
- package/src/generators/migration/migration.d.ts +5 -0
- package/src/generators/migration/migration.js +111 -0
- package/src/generators/migration/migration.js.map +1 -0
- package/src/generators/migration/schema.d.ts +8 -0
- package/src/generators/migration/schema.json +59 -0
- package/src/generators/plugin/files/plugin/src/index.ts__tmpl__ +0 -0
- package/src/generators/plugin/plugin.d.ts +5 -0
- package/src/generators/plugin/plugin.js +95 -0
- package/src/generators/plugin/plugin.js.map +1 -0
- package/src/generators/plugin/schema.d.ts +17 -0
- package/src/generators/plugin/schema.json +93 -0
- package/src/generators/plugin/utils/normalize-schema.d.ts +14 -0
- package/src/generators/plugin/utils/normalize-schema.js +31 -0
- package/src/generators/plugin/utils/normalize-schema.js.map +1 -0
- package/src/generators/preset/generator.d.ts +3 -0
- package/src/generators/preset/generator.js +53 -0
- package/src/generators/preset/generator.js.map +1 -0
- package/src/generators/preset/schema.d.ts +4 -0
- package/src/generators/preset/schema.json +20 -0
- package/src/migrations/update-14-1-9/add-swc-deps-if-needed.d.ts +2 -0
- package/src/migrations/update-14-1-9/add-swc-deps-if-needed.js +14 -0
- package/src/migrations/update-14-1-9/add-swc-deps-if-needed.js.map +1 -0
- package/src/migrations/update-15-0-0/specify-output-capture.d.ts +2 -0
- package/src/migrations/update-15-0-0/specify-output-capture.js +57 -0
- package/src/migrations/update-15-0-0/specify-output-capture.js.map +1 -0
- package/src/migrations/update-15-9-0/jest-29-configs.d.ts +3 -0
- package/src/migrations/update-15-9-0/jest-29-configs.js +154 -0
- package/src/migrations/update-15-9-0/jest-29-configs.js.map +1 -0
- package/src/migrations/update-15-9-0/jest-29-tests.d.ts +5 -0
- package/src/migrations/update-15-9-0/jest-29-tests.js +65 -0
- package/src/migrations/update-15-9-0/jest-29-tests.js.map +1 -0
- package/src/migrations/update-16-0-0/cli-in-schema-json.d.ts +3 -0
- package/src/migrations/update-16-0-0/cli-in-schema-json.js +84 -0
- package/src/migrations/update-16-0-0/cli-in-schema-json.js.map +1 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/utils/has-generator.d.ts +2 -0
- package/src/utils/has-generator.js +17 -0
- package/src/utils/has-generator.js.map +1 -0
- package/src/utils/testing-utils/async-commands.d.ts +28 -0
- package/src/utils/testing-utils/async-commands.js +51 -0
- package/src/utils/testing-utils/async-commands.js.map +1 -0
- package/src/utils/testing-utils/commands.d.ts +17 -0
- package/src/utils/testing-utils/commands.js +64 -0
- package/src/utils/testing-utils/commands.js.map +1 -0
- package/src/utils/testing-utils/create-package-cli.d.ts +18 -0
- package/src/utils/testing-utils/create-package-cli.js +53 -0
- package/src/utils/testing-utils/create-package-cli.js.map +1 -0
- package/src/utils/testing-utils/index.d.ts +6 -0
- package/src/utils/testing-utils/index.js +10 -0
- package/src/utils/testing-utils/index.js.map +1 -0
- package/src/utils/testing-utils/nx-project.d.ts +25 -0
- package/src/utils/testing-utils/nx-project.js +64 -0
- package/src/utils/testing-utils/nx-project.js.map +1 -0
- package/src/utils/testing-utils/paths.d.ts +15 -0
- package/src/utils/testing-utils/paths.js +33 -0
- package/src/utils/testing-utils/paths.js.map +1 -0
- package/src/utils/testing-utils/utils.d.ts +80 -0
- package/src/utils/testing-utils/utils.js +145 -0
- package/src/utils/testing-utils/utils.js.map +1 -0
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +5 -0
- package/src/utils/versions.js.map +1 -0
- package/testing.d.ts +1 -0
- package/testing.js +5 -0
- package/testing.js.map +1 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateCliPropsForPlugins = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const package_json_1 = require("nx/src/utils/package-json");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
function updateCliPropsForPlugins(tree) {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
+
for (const [name, project] of projects.entries()) {
|
|
10
|
+
if (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'package.json'))) {
|
|
11
|
+
const packageJson = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(project.root, 'package.json'));
|
|
12
|
+
const migrateConfig = (0, package_json_1.readNxMigrateConfig)(packageJson);
|
|
13
|
+
if (migrateConfig.migrations) {
|
|
14
|
+
updateMigrationsJsonForPlugin(tree, (0, devkit_1.joinPathFragments)(project.root, migrateConfig.migrations));
|
|
15
|
+
}
|
|
16
|
+
if (packageJson.generators) {
|
|
17
|
+
removeCliFromGeneratorSchemaJsonFiles(tree, (0, devkit_1.joinPathFragments)(project.root, packageJson.generators));
|
|
18
|
+
}
|
|
19
|
+
if (packageJson.executors) {
|
|
20
|
+
removeCliFromExecutorSchemaJsonFiles(tree, (0, devkit_1.joinPathFragments)(project.root, packageJson.executors));
|
|
21
|
+
}
|
|
22
|
+
if (packageJson.builders) {
|
|
23
|
+
removeCliFromExecutorSchemaJsonFiles(tree, (0, devkit_1.joinPathFragments)(project.root, packageJson.builders));
|
|
24
|
+
}
|
|
25
|
+
if (packageJson.schematics) {
|
|
26
|
+
removeCliFromGeneratorSchemaJsonFiles(tree, (0, devkit_1.joinPathFragments)(project.root, packageJson.schematics));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.updateCliPropsForPlugins = updateCliPropsForPlugins;
|
|
32
|
+
function removeCliFromExecutorSchemaJsonFiles(tree, collectionPath) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const collection = (0, devkit_1.readJson)(tree, collectionPath);
|
|
35
|
+
for (const [name, entry] of Object.entries((_a = collection.executors) !== null && _a !== void 0 ? _a : {}).concat(Object.entries((_b = collection.builders) !== null && _b !== void 0 ? _b : {}))) {
|
|
36
|
+
deleteCliPropFromSchemaFile(collectionPath, entry, tree);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function removeCliFromGeneratorSchemaJsonFiles(tree, collectionPath) {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const collection = (0, devkit_1.readJson)(tree, collectionPath);
|
|
42
|
+
for (const [name, entry] of Object.entries((_a = collection.generators) !== null && _a !== void 0 ? _a : {}).concat(Object.entries((_b = collection.schematics) !== null && _b !== void 0 ? _b : {}))) {
|
|
43
|
+
deleteCliPropFromSchemaFile(collectionPath, entry, tree);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function updateMigrationsJsonForPlugin(tree, collectionPath) {
|
|
47
|
+
(0, devkit_1.updateJson)(tree, collectionPath, (json) => {
|
|
48
|
+
var _a, _b, _c, _d;
|
|
49
|
+
for (const migration in (_a = json.generators) !== null && _a !== void 0 ? _a : {}) {
|
|
50
|
+
if (!(json.generators[migration].cli === 'nx')) {
|
|
51
|
+
(_b = json.schematics) !== null && _b !== void 0 ? _b : (json.schematics = {});
|
|
52
|
+
json.schematics[migration] = json.generators[migration];
|
|
53
|
+
delete json.generators[migration];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
for (const migration in (_c = json.schematics) !== null && _c !== void 0 ? _c : {}) {
|
|
57
|
+
if (json.schematics[migration].cli === 'nx') {
|
|
58
|
+
(_d = json.generators) !== null && _d !== void 0 ? _d : (json.generators = {});
|
|
59
|
+
json.generators[migration] = json.schematics[migration];
|
|
60
|
+
delete json.schematics[migration];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return json;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
exports.default = updateCliPropsForPlugins;
|
|
67
|
+
function deleteCliPropFromSchemaFile(collectionPath, entry, tree) {
|
|
68
|
+
if (!entry.schema) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const schemaPath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(collectionPath), entry.schema);
|
|
72
|
+
if (tree.exists(schemaPath)) {
|
|
73
|
+
(0, devkit_1.updateJson)(tree, schemaPath, (json) => {
|
|
74
|
+
if (json.cli) {
|
|
75
|
+
delete json.cli;
|
|
76
|
+
}
|
|
77
|
+
return json;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
console.warn(`Could not find schema file ${schemaPath}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=cli-in-schema-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-in-schema-json.js","sourceRoot":"","sources":["../../../../../../packages/plugin/src/migrations/update-16-0-0/cli-in-schema-json.ts"],"names":[],"mappings":";;;AAAA,uCASoB;AAKpB,4DAA6E;AAC7E,+BAA+B;AAE/B,SAAgB,wBAAwB,CAAC,IAAU;IACjD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACnC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;QAChD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,EAAE;YAChE,MAAM,WAAW,GAAgB,IAAA,iBAAQ,EACvC,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAChD,CAAC;YACF,MAAM,aAAa,GAAG,IAAA,kCAAmB,EAAC,WAAW,CAAC,CAAC;YACvD,IAAI,aAAa,CAAC,UAAU,EAAE;gBAC5B,6BAA6B,CAC3B,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC,CAC1D,CAAC;aACH;YACD,IAAI,WAAW,CAAC,UAAU,EAAE;gBAC1B,qCAAqC,CACnC,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,CACxD,CAAC;aACH;YACD,IAAI,WAAW,CAAC,SAAS,EAAE;gBACzB,oCAAoC,CAClC,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CACvD,CAAC;aACH;YACD,IAAI,WAAW,CAAC,QAAQ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EAAC,IAAI,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE;YACpC,IAAI,IAAI,CAAC,GAAG,EAAE;gBACZ,OAAO,IAAI,CAAC,GAAG,CAAC;aACjB;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,CAAC,IAAI,CAAC,8BAA8B,UAAU,EAAE,CAAC,CAAC;KAC1D;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
6
|
+
function replacePackage(tree) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
yield (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/nx-plugin', '@nx/plugin');
|
|
9
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
exports.default = replacePackage;
|
|
13
|
+
//# sourceMappingURL=update-16-0-0-add-nx-packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-16-0-0-add-nx-packages.js","sourceRoot":"","sources":["../../../../../../packages/plugin/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts"],"names":[],"mappings":";;;AAAA,uCAA+C;AAC/C,0EAAuF;AAEvF,SAA8B,cAAc,CAAC,IAAU;;QACrD,MAAM,IAAA,iDAA+B,EAAC,IAAI,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC;QAE7E,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAJD,iCAIC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasGenerator = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function hasGenerator(tree, projectName, generatorName) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
8
|
+
const packageJson = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(project.root, 'package.json'));
|
|
9
|
+
if (!packageJson.generators && !packageJson.schematics) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const generatorsPath = (0, devkit_1.joinPathFragments)(project.root, (_a = packageJson.generators) !== null && _a !== void 0 ? _a : packageJson.schematics);
|
|
13
|
+
const generatorsJson = (0, devkit_1.readJson)(tree, generatorsPath);
|
|
14
|
+
return (((_c = (_b = generatorsJson.generators) === null || _b === void 0 ? void 0 : _b[generatorName]) !== null && _c !== void 0 ? _c : (_d = generatorsJson.schematics) === null || _d === void 0 ? void 0 : _d[generatorName]) !== undefined);
|
|
15
|
+
}
|
|
16
|
+
exports.hasGenerator = hasGenerator;
|
|
17
|
+
//# sourceMappingURL=has-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-generator.js","sourceRoot":"","sources":["../../../../../packages/plugin/src/utils/has-generator.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AAGpB,SAAgB,YAAY,CAC1B,IAAU,EACV,WAAmB,EACnB,aAAqB;;IAErB,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAC1B,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAChD,CAAC;IACF,IAAI,CAAC,WAAW,CAAC,UAAU,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE;QACtD,OAAO,KAAK,CAAC;KACd;IACD,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,OAAO,CAAC,IAAI,EACZ,MAAA,WAAW,CAAC,UAAU,mCAAI,WAAW,CAAC,UAAU,CACjD,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,iBAAQ,EAAiB,IAAI,EAAE,cAAc,CAAC,CAAC;IACtE,OAAO,CACL,CAAC,MAAA,MAAA,cAAc,CAAC,UAAU,0CAAG,aAAa,CAAC,mCACzC,MAAA,cAAc,CAAC,UAAU,0CAAG,aAAa,CAAC,CAAC,KAAK,SAAS,CAC5D,CAAC;AACJ,CAAC;AAtBD,oCAsBC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Run a command asynchronously inside the e2e directory.
|
|
4
|
+
*
|
|
5
|
+
* @param command
|
|
6
|
+
* @param opts
|
|
7
|
+
*/
|
|
8
|
+
export declare function runCommandAsync(command: string, opts?: {
|
|
9
|
+
silenceError?: boolean;
|
|
10
|
+
env?: NodeJS.ProcessEnv;
|
|
11
|
+
cwd?: string;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
stdout: string;
|
|
14
|
+
stderr: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Run a nx command asynchronously inside the e2e directory
|
|
18
|
+
* @param command
|
|
19
|
+
* @param opts
|
|
20
|
+
*/
|
|
21
|
+
export declare function runNxCommandAsync(command: string, opts?: {
|
|
22
|
+
silenceError?: boolean;
|
|
23
|
+
env?: NodeJS.ProcessEnv;
|
|
24
|
+
cwd?: string;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
stdout: string;
|
|
27
|
+
stderr: string;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runNxCommandAsync = exports.runCommandAsync = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const paths_1 = require("./paths");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
/**
|
|
9
|
+
* Run a command asynchronously inside the e2e directory.
|
|
10
|
+
*
|
|
11
|
+
* @param command
|
|
12
|
+
* @param opts
|
|
13
|
+
*/
|
|
14
|
+
function runCommandAsync(command, opts = {
|
|
15
|
+
silenceError: false,
|
|
16
|
+
}) {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
var _a;
|
|
19
|
+
(0, child_process_1.exec)(command, {
|
|
20
|
+
cwd: (_a = opts.cwd) !== null && _a !== void 0 ? _a : (0, paths_1.tmpProjPath)(),
|
|
21
|
+
env: Object.assign(Object.assign({}, process.env), opts.env),
|
|
22
|
+
}, (err, stdout, stderr) => {
|
|
23
|
+
if (!opts.silenceError && err) {
|
|
24
|
+
reject(err);
|
|
25
|
+
}
|
|
26
|
+
resolve({ stdout, stderr });
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.runCommandAsync = runCommandAsync;
|
|
31
|
+
/**
|
|
32
|
+
* Run a nx command asynchronously inside the e2e directory
|
|
33
|
+
* @param command
|
|
34
|
+
* @param opts
|
|
35
|
+
*/
|
|
36
|
+
function runNxCommandAsync(command, opts = {
|
|
37
|
+
silenceError: false,
|
|
38
|
+
}) {
|
|
39
|
+
if ((0, utils_1.fileExists)((0, paths_1.tmpProjPath)('package.json'))) {
|
|
40
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
41
|
+
return runCommandAsync(`${pmc.exec} nx ${command}`, opts);
|
|
42
|
+
}
|
|
43
|
+
else if (process.platform === 'win32') {
|
|
44
|
+
return runCommandAsync(`./nx.bat %${command}`, opts);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return runCommandAsync(`./nx %${command}`, opts);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.runNxCommandAsync = runNxCommandAsync;
|
|
51
|
+
//# sourceMappingURL=async-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-commands.js","sourceRoot":"","sources":["../../../../../../packages/plugin/src/utils/testing-utils/async-commands.ts"],"names":[],"mappings":";;;AAAA,iDAAqC;AACrC,mCAAsC;AACtC,uCAAsD;AACtD,mCAAqC;AAErC;;;;;GAKG;AACH,SAAgB,eAAe,CAC7B,OAAe,EACf,OAA0E;IACxE,YAAY,EAAE,KAAK;CACpB;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;;QACrC,IAAA,oBAAI,EACF,OAAO,EACP;YACE,GAAG,EAAE,MAAA,IAAI,CAAC,GAAG,mCAAI,IAAA,mBAAW,GAAE;YAC9B,GAAG,kCAAO,OAAO,CAAC,GAAG,GAAK,IAAI,CAAC,GAAG,CAAE;SACrC,EACD,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE;gBAC7B,MAAM,CAAC,GAAG,CAAC,CAAC;aACb;YACD,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAC9B,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AArBD,0CAqBC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,OAAe,EACf,OAA0E;IACxE,YAAY,EAAE,KAAK;CACpB;IAED,IAAI,IAAA,kBAAU,EAAC,IAAA,mBAAW,EAAC,cAAc,CAAC,CAAC,EAAE;QAC3C,MAAM,GAAG,GAAG,IAAA,iCAAwB,GAAE,CAAC;QACvC,OAAO,eAAe,CAAC,GAAG,GAAG,CAAC,IAAI,OAAO,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;KAC3D;SAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QACvC,OAAO,eAAe,CAAC,aAAa,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;KACtD;SAAM;QACL,OAAO,eAAe,CAAC,SAAS,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;KAClD;AACH,CAAC;AAdD,8CAcC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Run a nx command inside the e2e directory
|
|
4
|
+
* @param command
|
|
5
|
+
* @param opts
|
|
6
|
+
*
|
|
7
|
+
* @see tmpProjPath
|
|
8
|
+
*/
|
|
9
|
+
export declare function runNxCommand(command?: string, opts?: {
|
|
10
|
+
silenceError?: boolean;
|
|
11
|
+
env?: NodeJS.ProcessEnv;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
}): string;
|
|
14
|
+
export declare function runCommand(command: string, opts: {
|
|
15
|
+
env?: NodeJS.ProcessEnv;
|
|
16
|
+
cwd?: string;
|
|
17
|
+
}): string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCommand = exports.runNxCommand = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const paths_1 = require("./paths");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
/**
|
|
9
|
+
* Run a nx command inside the e2e directory
|
|
10
|
+
* @param command
|
|
11
|
+
* @param opts
|
|
12
|
+
*
|
|
13
|
+
* @see tmpProjPath
|
|
14
|
+
*/
|
|
15
|
+
function runNxCommand(command, opts = {
|
|
16
|
+
silenceError: false,
|
|
17
|
+
}) {
|
|
18
|
+
function _runNxCommand(c) {
|
|
19
|
+
const execSyncOptions = {
|
|
20
|
+
cwd: opts.cwd,
|
|
21
|
+
env: Object.assign(Object.assign({}, process.env), opts.env),
|
|
22
|
+
};
|
|
23
|
+
if ((0, utils_1.fileExists)((0, paths_1.tmpProjPath)('package.json'))) {
|
|
24
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
25
|
+
return (0, child_process_1.execSync)(`${pmc.exec} nx ${command}`, execSyncOptions);
|
|
26
|
+
}
|
|
27
|
+
else if (process.platform === 'win32') {
|
|
28
|
+
return (0, child_process_1.execSync)(`./nx.bat %${command}`, execSyncOptions);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return (0, child_process_1.execSync)(`./nx %${command}`, execSyncOptions);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return _runNxCommand(command)
|
|
36
|
+
.toString()
|
|
37
|
+
.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (opts.silenceError) {
|
|
41
|
+
return e.stdout.toString();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.log(e.stdout.toString(), e.stderr.toString());
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.runNxCommand = runNxCommand;
|
|
50
|
+
function runCommand(command, opts) {
|
|
51
|
+
var _a;
|
|
52
|
+
try {
|
|
53
|
+
return (0, child_process_1.execSync)(command, {
|
|
54
|
+
cwd: (_a = opts.cwd) !== null && _a !== void 0 ? _a : (0, paths_1.tmpProjPath)(),
|
|
55
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
56
|
+
env: Object.assign(Object.assign({}, process.env), opts === null || opts === void 0 ? void 0 : opts.env),
|
|
57
|
+
}).toString();
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
return e.stdout.toString() + e.stderr.toString();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.runCommand = runCommand;
|
|
64
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AAM,CAAC,CAAC;SACT;KACF;AACH,CAAC;AApCD,oCAoCC;AAED,SAAgB,UAAU,CACxB,OAAe,EACf,IAA+C;;IAE/C,IAAI;QACF,OAAO,IAAA,wBAAQ,EAAC,OAAO,EAAE;YACvB,GAAG,EAAE,MAAA,IAAI,CAAC,GAAG,mCAAI,IAAA,mBAAW,GAAE;YAC9B,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;YAC/B,GAAG,kCAAO,OAAO,CAAC,GAAG,GAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,CAAE;SACtC,CAAC,CAAC,QAAQ,EAAE,CAAC;KACf;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;KAClD;AACH,CAAC;AAbD,gCAaC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function is used to run the create package CLI command.
|
|
3
|
+
* It builds the plugin library and the create package library and run the create package command with for the plugin library.
|
|
4
|
+
* It needs to be ran inside an Nx project. It would assume that an Nx project already exists.
|
|
5
|
+
* @param projectToBeCreated project name to be created using the cli
|
|
6
|
+
* @param pluginLibraryBuildPath e.g. dist/packages/my-plugin
|
|
7
|
+
* @param createPackageLibraryBuildPath e.g. dist/packages/create-my-plugin-package
|
|
8
|
+
* @param extraArguments extra arguments to be passed to the create package command
|
|
9
|
+
* @param verbose if true, NX_VERBOSE_LOGGING will be set to true
|
|
10
|
+
* @returns results for the create package command
|
|
11
|
+
*/
|
|
12
|
+
export declare function runCreatePackageCli(projectToBeCreated: string, { pluginLibraryBuildPath, createPackageLibraryBuildPath, extraArguments, verbose, }: {
|
|
13
|
+
pluginLibraryBuildPath: string;
|
|
14
|
+
createPackageLibraryBuildPath: string;
|
|
15
|
+
extraArguments?: string[];
|
|
16
|
+
verbose?: boolean;
|
|
17
|
+
}): Promise<string>;
|
|
18
|
+
export declare function generatedPackagePath(projectToBeCreated: string): string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generatedPackagePath = exports.runCreatePackageCli = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const paths_1 = require("./paths");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
/**
|
|
8
|
+
* This function is used to run the create package CLI command.
|
|
9
|
+
* It builds the plugin library and the create package library and run the create package command with for the plugin library.
|
|
10
|
+
* It needs to be ran inside an Nx project. It would assume that an Nx project already exists.
|
|
11
|
+
* @param projectToBeCreated project name to be created using the cli
|
|
12
|
+
* @param pluginLibraryBuildPath e.g. dist/packages/my-plugin
|
|
13
|
+
* @param createPackageLibraryBuildPath e.g. dist/packages/create-my-plugin-package
|
|
14
|
+
* @param extraArguments extra arguments to be passed to the create package command
|
|
15
|
+
* @param verbose if true, NX_VERBOSE_LOGGING will be set to true
|
|
16
|
+
* @returns results for the create package command
|
|
17
|
+
*/
|
|
18
|
+
function runCreatePackageCli(projectToBeCreated, { pluginLibraryBuildPath, createPackageLibraryBuildPath, extraArguments, verbose, }) {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
const childProcess = (0, child_process_1.fork)(`${devkit_1.workspaceRoot}/${createPackageLibraryBuildPath}/bin/index.js`, [projectToBeCreated, ...(extraArguments || [])], {
|
|
21
|
+
stdio: ['pipe', 'pipe', 'pipe', 'ipc'],
|
|
22
|
+
env: Object.assign(Object.assign(Object.assign({}, process.env), { [`NX_E2E_PRESET_VERSION`]: `file:${devkit_1.workspaceRoot}/${pluginLibraryBuildPath}` }), (verbose && { NX_VERBOSE_LOGGING: 'true' })),
|
|
23
|
+
cwd: (0, paths_1.tmpFolder)(),
|
|
24
|
+
});
|
|
25
|
+
// Ensure the child process is killed when the parent exits
|
|
26
|
+
process.on('exit', () => childProcess.kill());
|
|
27
|
+
process.on('SIGTERM', () => childProcess.kill());
|
|
28
|
+
let allMessages = '';
|
|
29
|
+
childProcess.on('message', (message) => {
|
|
30
|
+
allMessages += message;
|
|
31
|
+
});
|
|
32
|
+
childProcess.stdout.on('data', (data) => {
|
|
33
|
+
allMessages += data;
|
|
34
|
+
});
|
|
35
|
+
childProcess.on('error', (error) => {
|
|
36
|
+
reject(error);
|
|
37
|
+
});
|
|
38
|
+
childProcess.on('exit', (code) => {
|
|
39
|
+
if (code === 0) {
|
|
40
|
+
resolve(allMessages);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
reject(allMessages);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.runCreatePackageCli = runCreatePackageCli;
|
|
49
|
+
function generatedPackagePath(projectToBeCreated) {
|
|
50
|
+
return `${(0, paths_1.tmpFolder)()}/${projectToBeCreated}`;
|
|
51
|
+
}
|
|
52
|
+
exports.generatedPackagePath = generatedPackagePath;
|
|
53
|
+
//# sourceMappingURL=create-package-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-package-cli.js","sourceRoot":"","sources":["../../../../../../packages/plugin/src/utils/testing-utils/create-package-cli.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAC3C,mCAAoC;AACpC,iDAAqC;AAErC;;;;;;;;;;GAUG;AACH,SAAgB,mBAAmB,CACjC,kBAA0B,EAC1B,EACE,sBAAsB,EACtB,6BAA6B,EAC7B,cAAc,EACd,OAAO,GAMR;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,YAAY,GAAG,IAAA,oBAAI,EACvB,GAAG,sBAAa,IAAI,6BAA6B,eAAe,EAChE,CAAC,kBAAkB,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,EAC/C;YACE,KAAK,EAAE,CAAC,MAA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IAAI,kBAAkB,EAAE,CAAC;AAChD,CAAC;AAFD,oDAEC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./async-commands"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./commands"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./create-package-cli"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./paths"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./nx-project"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./utils"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugin/src/utils/testing-utils/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,qDAA2B;AAC3B,+DAAqC;AACrC,kDAAwB;AACxB,uDAA6B;AAC7B,kDAAwB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare function patchPackageJsonForPlugin(npmPackageName: string, distPath: string): void;
|
|
2
|
+
/**
|
|
3
|
+
* Generate a unique name for running CLI commands
|
|
4
|
+
* @param prefix
|
|
5
|
+
*
|
|
6
|
+
* @returns `'<prefix><random number>'`
|
|
7
|
+
*/
|
|
8
|
+
export declare function uniq(prefix: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Run the appropriate package manager install command in the e2e directory
|
|
11
|
+
* @param silent silent output from the install
|
|
12
|
+
*/
|
|
13
|
+
export declare function runPackageManagerInstall(silent?: boolean): string;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new nx project in the e2e directory
|
|
16
|
+
*
|
|
17
|
+
* @param npmPackageName package name to test
|
|
18
|
+
* @param pluginDistPath dist path where the plugin was outputted to
|
|
19
|
+
*/
|
|
20
|
+
export declare function newNxProject(npmPackageName: string, pluginDistPath: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Ensures that a project has been setup in the e2e directory
|
|
23
|
+
* It will also copy `@nx` packages to the e2e directory
|
|
24
|
+
*/
|
|
25
|
+
export declare function ensureNxProject(npmPackageName?: string, pluginDistPath?: string): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureNxProject = exports.newNxProject = exports.runPackageManagerInstall = exports.uniq = exports.patchPackageJsonForPlugin = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const devkit_2 = require("@nx/devkit");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const fs_extra_1 = require("fs-extra");
|
|
9
|
+
const paths_1 = require("./paths");
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function runNxNewCommand(args, silent) {
|
|
12
|
+
const localTmpDir = (0, path_1.dirname)((0, paths_1.tmpProjPath)());
|
|
13
|
+
return (0, child_process_1.execSync)(`node ${require.resolve('nx')} new proj --nx-workspace-root=${localTmpDir} --no-interactive --skip-install --collection=@nx/workspace --npmScope=proj --preset=empty ${args || ''}`, Object.assign({ cwd: localTmpDir }, (silent && false ? { stdio: ['ignore', 'ignore', 'ignore'] } : {})));
|
|
14
|
+
}
|
|
15
|
+
function patchPackageJsonForPlugin(npmPackageName, distPath) {
|
|
16
|
+
const path = (0, paths_1.tmpProjPath)('package.json');
|
|
17
|
+
const json = (0, devkit_2.readJsonFile)(path);
|
|
18
|
+
json.devDependencies[npmPackageName] = `file:${devkit_1.workspaceRoot}/${distPath}`;
|
|
19
|
+
(0, devkit_2.writeJsonFile)(path, json);
|
|
20
|
+
}
|
|
21
|
+
exports.patchPackageJsonForPlugin = patchPackageJsonForPlugin;
|
|
22
|
+
/**
|
|
23
|
+
* Generate a unique name for running CLI commands
|
|
24
|
+
* @param prefix
|
|
25
|
+
*
|
|
26
|
+
* @returns `'<prefix><random number>'`
|
|
27
|
+
*/
|
|
28
|
+
function uniq(prefix) {
|
|
29
|
+
return `${prefix}${Math.floor(Math.random() * 10000000)}`;
|
|
30
|
+
}
|
|
31
|
+
exports.uniq = uniq;
|
|
32
|
+
/**
|
|
33
|
+
* Run the appropriate package manager install command in the e2e directory
|
|
34
|
+
* @param silent silent output from the install
|
|
35
|
+
*/
|
|
36
|
+
function runPackageManagerInstall(silent = true) {
|
|
37
|
+
const pmc = (0, devkit_2.getPackageManagerCommand)();
|
|
38
|
+
const install = (0, child_process_1.execSync)(pmc.install, Object.assign({ cwd: (0, paths_1.tmpProjPath)() }, (silent ? { stdio: ['ignore', 'ignore', 'ignore'] } : {})));
|
|
39
|
+
return install ? install.toString() : '';
|
|
40
|
+
}
|
|
41
|
+
exports.runPackageManagerInstall = runPackageManagerInstall;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new nx project in the e2e directory
|
|
44
|
+
*
|
|
45
|
+
* @param npmPackageName package name to test
|
|
46
|
+
* @param pluginDistPath dist path where the plugin was outputted to
|
|
47
|
+
*/
|
|
48
|
+
function newNxProject(npmPackageName, pluginDistPath) {
|
|
49
|
+
(0, utils_1.cleanup)();
|
|
50
|
+
runNxNewCommand('', true);
|
|
51
|
+
patchPackageJsonForPlugin(npmPackageName, pluginDistPath);
|
|
52
|
+
runPackageManagerInstall();
|
|
53
|
+
}
|
|
54
|
+
exports.newNxProject = newNxProject;
|
|
55
|
+
/**
|
|
56
|
+
* Ensures that a project has been setup in the e2e directory
|
|
57
|
+
* It will also copy `@nx` packages to the e2e directory
|
|
58
|
+
*/
|
|
59
|
+
function ensureNxProject(npmPackageName, pluginDistPath) {
|
|
60
|
+
(0, fs_extra_1.ensureDirSync)((0, paths_1.tmpProjPath)());
|
|
61
|
+
newNxProject(npmPackageName, pluginDistPath);
|
|
62
|
+
}
|
|
63
|
+
exports.ensureNxProject = ensureNxProject;
|
|
64
|
+
//# sourceMappingURL=nx-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nx-project.js","sourceRoot":"","sources":["../../../../../../packages/plugin/src/utils/testing-utils/nx-project.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAC3C,uCAIoB;AACpB,iDAAyC;AACzC,+BAA+B;AAC/B,uCAAyC;AACzC,mCAAsC;AACtC,mCAAkC;AAElC,SAAS,eAAe,CAAC,IAAa,EAAE,MAAgB;IACtD,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,IAAA,mBAAW,GAAE,CAAC,CAAC;IAC3C,OAAO,IAAA,wBAAQ,EACb,QAAQ,OAAO,CAAC,OAAO,CACrB,IAAI,CACL,iCAAiC,WAAW,8FAC3C,IAAI,IAAI,EACV,EAAE,kBAEA,GAAG,EAAE,WAAW,IACb,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAExE,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB,CACvC,cAAsB,EACtB,QAAgB;IAEhB,MAAM,IAAI,GAAG,IAAA,mBAAW,EAAC,cAAc,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,IAAA,qBAAY,EAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,GAAG,QAAQ,sBAAa,IAAI,QAAQ,EAAE,CAAC;IAC3E,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AARD,8DAQC;AAED;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,MAAc;IACjC,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAC;AAC5D,CAAC;AAFD,oBAEC;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,SAAkB,IAAI;IAC7D,MAAM,GAAG,GAAG,IAAA,iCAAwB,GAAE,CAAC;IACvC,MAAM,OAAO,GAAG,IAAA,wBAAQ,EAAC,GAAG,CAAC,OAAO,kBAClC,GAAG,EAAE,IAAA,mBAAW,GAAE,IACf,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC5D,CAAC;IACH,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3C,CAAC;AAPD,4DAOC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAC1B,cAAsB,EACtB,cAAsB;IAEtB,IAAA,eAAO,GAAE,CAAC;IACV,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC1B,yBAAyB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IAC1D,wBAAwB,EAAE,CAAC;AAC7B,CAAC;AARD,oCAQC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAC7B,cAAuB,EACvB,cAAuB;IAEvB,IAAA,wBAAa,EAAC,IAAA,mBAAW,GAAE,CAAC,CAAC;IAC7B,YAAY,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;AAC/C,CAAC;AAND,0CAMC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function tmpFolder(): string;
|
|
2
|
+
/**
|
|
3
|
+
* The directory where the e2e workspace resides in.
|
|
4
|
+
*
|
|
5
|
+
* @param path path within the e2e directory
|
|
6
|
+
* @returns `'${process.cwd()}/tmp/nx-e2e/proj/<path>'`
|
|
7
|
+
*/
|
|
8
|
+
export declare function tmpProjPath(path?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* The workspace backup directory. This is used for caching of the creation of the workspace.
|
|
11
|
+
*
|
|
12
|
+
* @param path path within the e2e directory
|
|
13
|
+
* @returns `'${process.cwd()}/tmp/nx-e2e/proj-backup/<path>'`
|
|
14
|
+
*/
|
|
15
|
+
export declare function tmpBackupProjPath(path?: string): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tmpBackupProjPath = exports.tmpProjPath = exports.tmpFolder = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function tmpFolder() {
|
|
6
|
+
return `${devkit_1.workspaceRoot}/tmp`;
|
|
7
|
+
}
|
|
8
|
+
exports.tmpFolder = tmpFolder;
|
|
9
|
+
/**
|
|
10
|
+
* The directory where the e2e workspace resides in.
|
|
11
|
+
*
|
|
12
|
+
* @param path path within the e2e directory
|
|
13
|
+
* @returns `'${process.cwd()}/tmp/nx-e2e/proj/<path>'`
|
|
14
|
+
*/
|
|
15
|
+
function tmpProjPath(path) {
|
|
16
|
+
return path
|
|
17
|
+
? `${tmpFolder()}/nx-e2e/proj/${path}`
|
|
18
|
+
: `${tmpFolder()}/nx-e2e/proj`;
|
|
19
|
+
}
|
|
20
|
+
exports.tmpProjPath = tmpProjPath;
|
|
21
|
+
/**
|
|
22
|
+
* The workspace backup directory. This is used for caching of the creation of the workspace.
|
|
23
|
+
*
|
|
24
|
+
* @param path path within the e2e directory
|
|
25
|
+
* @returns `'${process.cwd()}/tmp/nx-e2e/proj-backup/<path>'`
|
|
26
|
+
*/
|
|
27
|
+
function tmpBackupProjPath(path) {
|
|
28
|
+
return path
|
|
29
|
+
? `${devkit_1.workspaceRoot}/tmp/nx-e2e/proj-backup/${path}`
|
|
30
|
+
: `${devkit_1.workspaceRoot}/tmp/nx-e2e/proj-backup`;
|
|
31
|
+
}
|
|
32
|
+
exports.tmpBackupProjPath = tmpBackupProjPath;
|
|
33
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../../../../packages/plugin/src/utils/testing-utils/paths.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAE3C,SAAgB,SAAS;IACvB,OAAO,GAAG,sBAAa,MAAM,CAAC;AAChC,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,IAAa;IACvC,OAAO,IAAI;QACT,CAAC,CAAC,GAAG,SAAS,EAAE,gBAAgB,IAAI,EAAE;QACtC,CAAC,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;AACnC,CAAC;AAJD,kCAIC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,IAAa;IAC7C,OAAO,IAAI;QACT,CAAC,CAAC,GAAG,sBAAa,2BAA2B,IAAI,EAAE;QACnD,CAAC,CAAC,GAAG,sBAAa,yBAAyB,CAAC;AAChD,CAAC;AAJD,8CAIC"}
|