@nx/plugin 16.6.0-beta.4 → 16.6.0-beta.6
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 +7 -7
- package/src/generators/create-package/schema.json +1 -0
- package/src/generators/e2e-project/schema.json +1 -6
- package/src/generators/executor/executor.js +6 -0
- package/src/generators/executor/schema.json +1 -0
- package/src/generators/generator/generator.js +6 -0
- package/src/generators/lint-checks/schema.json +6 -0
- package/src/generators/migration/migration.js +3 -1
- package/src/generators/migration/schema.json +1 -1
- package/src/generators/plugin/schema.json +1 -1
- package/src/generators/preset/generator.js +16 -5
- package/src/generators/preset/schema.json +10 -0
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/plugin",
|
|
3
|
-
"version": "16.6.0-beta.
|
|
3
|
+
"version": "16.6.0-beta.6",
|
|
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": {
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"migrations": "./migrations.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nrwl/nx-plugin": "16.6.0-beta.
|
|
32
|
-
"@nx/devkit": "16.6.0-beta.
|
|
33
|
-
"@nx/jest": "16.6.0-beta.
|
|
34
|
-
"@nx/js": "16.6.0-beta.
|
|
35
|
-
"@nx/linter": "16.6.0-beta.
|
|
31
|
+
"@nrwl/nx-plugin": "16.6.0-beta.6",
|
|
32
|
+
"@nx/devkit": "16.6.0-beta.6",
|
|
33
|
+
"@nx/jest": "16.6.0-beta.6",
|
|
34
|
+
"@nx/js": "16.6.0-beta.6",
|
|
35
|
+
"@nx/linter": "16.6.0-beta.6",
|
|
36
36
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
37
37
|
"dotenv": "~10.0.0",
|
|
38
38
|
"fs-extra": "^11.1.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "9aad21dbfb2b659e488b6626f59df58ab23c0032"
|
|
45
45
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"$id": "NxPluginE2E",
|
|
5
5
|
"title": "Create an E2E app for a Nx Plugin",
|
|
6
6
|
"description": "Create an E2E app for a Nx Plugin.",
|
|
7
|
+
"examplesFile": "../../../docs/generators/e2e-project-examples.md",
|
|
7
8
|
"type": "object",
|
|
8
9
|
"properties": {
|
|
9
10
|
"pluginName": {
|
|
@@ -29,12 +30,6 @@
|
|
|
29
30
|
"type": "string",
|
|
30
31
|
"description": "Jest config file."
|
|
31
32
|
},
|
|
32
|
-
"standaloneConfig": {
|
|
33
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
34
|
-
"type": "boolean",
|
|
35
|
-
"default": true,
|
|
36
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
|
37
|
-
},
|
|
38
33
|
"linter": {
|
|
39
34
|
"description": "The tool to use for running lint checks.",
|
|
40
35
|
"type": "string",
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const generator_1 = require("../lint-checks/generator");
|
|
8
|
+
const versions_1 = require("../../utils/versions");
|
|
8
9
|
function addFiles(host, options) {
|
|
9
10
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, './files/executor'), `${options.projectSourceRoot}/executors`, Object.assign(Object.assign({}, options), { tmpl: '' }));
|
|
10
11
|
if (options.unitTestRunner === 'none') {
|
|
@@ -49,6 +50,11 @@ function updateExecutorJson(host, options) {
|
|
|
49
50
|
if (!host.exists(executorsPath)) {
|
|
50
51
|
yield createExecutorsJson(host, options.projectRoot, options.project, options.skipLintChecks);
|
|
51
52
|
}
|
|
53
|
+
// add dependencies
|
|
54
|
+
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
|
|
55
|
+
json.dependencies = Object.assign({ '@nx/devkit': versions_1.nxVersion }, json.dependencies);
|
|
56
|
+
return json;
|
|
57
|
+
});
|
|
52
58
|
return (0, devkit_1.updateJson)(host, executorsPath, (json) => {
|
|
53
59
|
var _a;
|
|
54
60
|
let executors = (_a = json.executors) !== null && _a !== void 0 ? _a : json.builders;
|
|
@@ -6,6 +6,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const has_generator_1 = require("../../utils/has-generator");
|
|
8
8
|
const generator_1 = require("../lint-checks/generator");
|
|
9
|
+
const versions_1 = require("../../utils/versions");
|
|
9
10
|
function normalizeOptions(host, options) {
|
|
10
11
|
const { npmScope } = (0, devkit_1.getWorkspaceLayout)(host);
|
|
11
12
|
const { root: projectRoot, sourceRoot: projectSourceRoot } = (0, devkit_1.readProjectConfiguration)(host, options.project);
|
|
@@ -66,6 +67,11 @@ function updateGeneratorJson(host, options) {
|
|
|
66
67
|
if (!host.exists(generatorsPath)) {
|
|
67
68
|
yield createGeneratorsJson(host, options.projectRoot, options.project, options.skipLintChecks, options.skipFormat);
|
|
68
69
|
}
|
|
70
|
+
// add dependencies
|
|
71
|
+
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
|
|
72
|
+
json.dependencies = Object.assign({ '@nx/devkit': versions_1.nxVersion }, json.dependencies);
|
|
73
|
+
return json;
|
|
74
|
+
});
|
|
69
75
|
(0, devkit_1.updateJson)(host, generatorsPath, (json) => {
|
|
70
76
|
var _a;
|
|
71
77
|
let generators = (_a = json.generators) !== null && _a !== void 0 ? _a : json.schematics;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
"title": "",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"description": "Adds linting configuration to validate common json files for nx plugins.",
|
|
8
|
+
"examples": [
|
|
9
|
+
{
|
|
10
|
+
"command": "nx g @nx/plugin:lint-checks",
|
|
11
|
+
"description": "Sets up linting configuration to validate common json files for an nx plugin project."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
8
14
|
"properties": {
|
|
9
15
|
"projectName": {
|
|
10
16
|
"type": "string",
|
|
@@ -6,6 +6,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const generator_1 = require("../lint-checks/generator");
|
|
8
8
|
const package_json_1 = require("nx/src/utils/package-json");
|
|
9
|
+
const versions_1 = require("../../utils/versions");
|
|
9
10
|
function normalizeOptions(host, options) {
|
|
10
11
|
var _a;
|
|
11
12
|
let name;
|
|
@@ -37,7 +38,6 @@ function updateMigrationsJson(host, options) {
|
|
|
37
38
|
generators[options.name] = {
|
|
38
39
|
version: options.packageVersion,
|
|
39
40
|
description: options.description,
|
|
40
|
-
cli: 'nx',
|
|
41
41
|
implementation: `./src/migrations/${options.name}/${options.name}`,
|
|
42
42
|
};
|
|
43
43
|
migrations.generators = generators;
|
|
@@ -68,6 +68,8 @@ function updatePackageJson(host, options) {
|
|
|
68
68
|
else if (preexistingValue.migrations) {
|
|
69
69
|
preexistingValue.migrations = './migrations.json';
|
|
70
70
|
}
|
|
71
|
+
// add dependencies
|
|
72
|
+
json.dependencies = Object.assign({ '@nx/devkit': versions_1.nxVersion }, json.dependencies);
|
|
71
73
|
return json;
|
|
72
74
|
});
|
|
73
75
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
10
|
"command": "nx g migration my-migration --project=my-plugin --version=1.0.0",
|
|
11
|
-
"description": "
|
|
11
|
+
"description": "Adds a new migration to the project `my-plugin`, which will be triggered when migrating to version 1.0.0 or above from a previous version."
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
10
|
"command": "nx g plugin my-plugin --directory=plugins --importPath=@myorg/my-plugin",
|
|
11
|
-
"description": "
|
|
11
|
+
"description": "Generates an Nx plugin project called `plugins-my-plugin` at `libs/plugins/my-plugin`. The project will have an npm package name and import path of `@myorg/my-plugin`."
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
@@ -8,26 +8,37 @@ const create_package_1 = require("../create-package/create-package");
|
|
|
8
8
|
function default_1(tree, options) {
|
|
9
9
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
10
|
const tasks = [];
|
|
11
|
+
const pluginProjectName = (0, devkit_1.names)(options.pluginName.includes('/')
|
|
12
|
+
? options.pluginName.split('/')[1]
|
|
13
|
+
: options.pluginName).fileName;
|
|
14
|
+
options.createPackageName =
|
|
15
|
+
options.createPackageName === 'false' // for command line in e2e, it is passed as a string
|
|
16
|
+
? undefined
|
|
17
|
+
: options.createPackageName;
|
|
11
18
|
const pluginTask = yield (0, plugin_1.pluginGenerator)(tree, {
|
|
12
19
|
compiler: 'tsc',
|
|
13
20
|
linter: linter_1.Linter.EsLint,
|
|
14
|
-
name:
|
|
15
|
-
? options.pluginName.split('/')[1]
|
|
16
|
-
: options.pluginName,
|
|
21
|
+
name: pluginProjectName,
|
|
17
22
|
skipFormat: true,
|
|
18
23
|
unitTestRunner: 'jest',
|
|
19
24
|
importPath: options.pluginName,
|
|
20
|
-
rootProject: true,
|
|
21
25
|
e2eTestRunner: 'jest',
|
|
22
26
|
publishable: true,
|
|
27
|
+
// when creating a CLI package, the plugin will be in the packages folder
|
|
28
|
+
directory: options.createPackageName && options.createPackageName !== 'false'
|
|
29
|
+
? 'packages'
|
|
30
|
+
: undefined,
|
|
31
|
+
rootProject: options.createPackageName ? false : true,
|
|
23
32
|
});
|
|
24
33
|
tasks.push(pluginTask);
|
|
25
34
|
removeNpmScope(tree);
|
|
26
35
|
moveNxPluginToDevDeps(tree);
|
|
27
36
|
if (options.createPackageName) {
|
|
37
|
+
const e2eProject = `${options.pluginName}-e2e`;
|
|
28
38
|
const cliTask = yield (0, create_package_1.default)(tree, {
|
|
39
|
+
directory: 'packages',
|
|
29
40
|
name: options.createPackageName,
|
|
30
|
-
e2eProject:
|
|
41
|
+
e2eProject: e2eProject,
|
|
31
42
|
project: options.pluginName,
|
|
32
43
|
skipFormat: true,
|
|
33
44
|
unitTestRunner: 'jest',
|
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
"$id": "NxPluginPreset",
|
|
5
5
|
"title": "Generator ran by create-nx-plugin",
|
|
6
6
|
"description": "Initializes a workspace with an nx-plugin inside of it. Use as: `create-nx-plugin` or `create-nx-workspace --preset @nx/nx-plugin`.",
|
|
7
|
+
"examples": [
|
|
8
|
+
{
|
|
9
|
+
"command": "npx create-nx-plugin",
|
|
10
|
+
"description": "Creates a new Nx workspace containing an Nx plugin."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"command": "npx create-nx-workspace --preset @nx/plugin",
|
|
14
|
+
"description": "Creates a new Nx workspace containing an Nx plugin."
|
|
15
|
+
}
|
|
16
|
+
],
|
|
7
17
|
"type": "object",
|
|
8
18
|
"properties": {
|
|
9
19
|
"pluginName": {
|
package/src/utils/versions.d.ts
CHANGED
package/src/utils/versions.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsoncEslintParserVersion = void 0;
|
|
3
|
+
exports.jsoncEslintParserVersion = exports.nxVersion = void 0;
|
|
4
|
+
exports.nxVersion = require('../../package.json').version;
|
|
4
5
|
exports.jsoncEslintParserVersion = '^2.1.0';
|