feat(node): remove node:node executor (#17615)
This commit is contained in:
parent
7e85063031
commit
58a85d94bc
@ -5520,23 +5520,6 @@
|
|||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"disableCollapsible": false
|
"disableCollapsible": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "executors",
|
|
||||||
"path": "/packages/node/executors",
|
|
||||||
"name": "executors",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"id": "node",
|
|
||||||
"path": "/packages/node/executors/node",
|
|
||||||
"name": "node",
|
|
||||||
"children": [],
|
|
||||||
"isExternal": false,
|
|
||||||
"disableCollapsible": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"isExternal": false,
|
|
||||||
"disableCollapsible": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "generators",
|
"id": "generators",
|
||||||
"path": "/packages/node/generators",
|
"path": "/packages/node/generators",
|
||||||
|
|||||||
@ -1451,12 +1451,12 @@
|
|||||||
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
||||||
"name": "node",
|
"name": "node",
|
||||||
"packageName": "@nx/node",
|
"packageName": "@nx/node",
|
||||||
"description": "The Node Plugin for Nx contains generators and executors to manage Node applications within an Nx workspace.",
|
"description": "The Node Plugin for Nx contains generators to manage Node applications within an Nx workspace.",
|
||||||
"documents": {
|
"documents": {
|
||||||
"/packages/node/documents/overview": {
|
"/packages/node/documents/overview": {
|
||||||
"id": "overview",
|
"id": "overview",
|
||||||
"name": "Overview",
|
"name": "Overview",
|
||||||
"description": "The Node Plugin for Nx contains generators and executors to manage Node applications within an Nx workspace.",
|
"description": "The Node Plugin for Nx contains generators to manage Node applications within an Nx workspace.",
|
||||||
"file": "generated/packages/node/documents/overview",
|
"file": "generated/packages/node/documents/overview",
|
||||||
"itemList": [],
|
"itemList": [],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
@ -1467,17 +1467,7 @@
|
|||||||
},
|
},
|
||||||
"root": "/packages/node",
|
"root": "/packages/node",
|
||||||
"source": "/packages/node/src",
|
"source": "/packages/node/src",
|
||||||
"executors": {
|
"executors": {},
|
||||||
"/packages/node/executors/node": {
|
|
||||||
"description": "Execute a Node application.",
|
|
||||||
"file": "generated/packages/node/executors/node.json",
|
|
||||||
"hidden": false,
|
|
||||||
"name": "node",
|
|
||||||
"originalFilePath": "/packages/node/src/executors/node/schema.json",
|
|
||||||
"path": "/packages/node/executors/node",
|
|
||||||
"type": "executor"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"generators": {
|
"generators": {
|
||||||
"/packages/node/generators/init": {
|
"/packages/node/generators/init": {
|
||||||
"description": "Initialize the `@nrwl/node` plugin.",
|
"description": "Initialize the `@nrwl/node` plugin.",
|
||||||
|
|||||||
@ -1433,12 +1433,12 @@
|
|||||||
"source": "/packages/next/src"
|
"source": "/packages/next/src"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "The Node Plugin for Nx contains generators and executors to manage Node applications within an Nx workspace.",
|
"description": "The Node Plugin for Nx contains generators to manage Node applications within an Nx workspace.",
|
||||||
"documents": [
|
"documents": [
|
||||||
{
|
{
|
||||||
"id": "overview",
|
"id": "overview",
|
||||||
"name": "Overview",
|
"name": "Overview",
|
||||||
"description": "The Node Plugin for Nx contains generators and executors to manage Node applications within an Nx workspace.",
|
"description": "The Node Plugin for Nx contains generators to manage Node applications within an Nx workspace.",
|
||||||
"file": "generated/packages/node/documents/overview",
|
"file": "generated/packages/node/documents/overview",
|
||||||
"itemList": [],
|
"itemList": [],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
@ -1447,17 +1447,7 @@
|
|||||||
"originalFilePath": "shared/packages/node/node-plugin"
|
"originalFilePath": "shared/packages/node/node-plugin"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"executors": [
|
"executors": [],
|
||||||
{
|
|
||||||
"description": "Execute a Node application.",
|
|
||||||
"file": "generated/packages/node/executors/node.json",
|
|
||||||
"hidden": false,
|
|
||||||
"name": "node",
|
|
||||||
"originalFilePath": "/packages/node/src/executors/node/schema.json",
|
|
||||||
"path": "node/executors/node",
|
|
||||||
"type": "executor"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"generators": [
|
"generators": [
|
||||||
{
|
{
|
||||||
"description": "Initialize the `@nrwl/node` plugin.",
|
"description": "Initialize the `@nrwl/node` plugin.",
|
||||||
|
|||||||
@ -259,7 +259,6 @@ describe('nx-dev: Packages Section', () => {
|
|||||||
path: '/packages/node/generators/application',
|
path: '/packages/node/generators/application',
|
||||||
},
|
},
|
||||||
{ title: '@nx/node:library', path: '/packages/node/generators/library' },
|
{ title: '@nx/node:library', path: '/packages/node/generators/library' },
|
||||||
{ title: '@nx/node:node', path: '/packages/node/executors/node' },
|
|
||||||
{ title: 'nx', path: '/packages/nx' },
|
{ title: 'nx', path: '/packages/nx' },
|
||||||
{ title: 'nx:noop', path: '/packages/nx/executors/noop' },
|
{ title: 'nx:noop', path: '/packages/nx/executors/noop' },
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,12 +29,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": [
|
"files": ["./package.json", "./generators.json", "./migrations.json"],
|
||||||
"./package.json",
|
|
||||||
"./generators.json",
|
|
||||||
"./executors.json",
|
|
||||||
"./migrations.json"
|
|
||||||
],
|
|
||||||
"parser": "jsonc-eslint-parser",
|
"parser": "jsonc-eslint-parser",
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx-plugin-checks": "error"
|
"@nx/nx-plugin-checks": "error"
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"executors": {
|
|
||||||
"node": {
|
|
||||||
"implementation": "./src/executors/node/node.impl",
|
|
||||||
"schema": "./src/executors/node/schema.json",
|
|
||||||
"description": "Execute a Node application."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"builders": {
|
|
||||||
"node": {
|
|
||||||
"implementation": "./src/executors/node/compat",
|
|
||||||
"schema": "./src/executors/node/schema.json",
|
|
||||||
"description": "Execute a Node application."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -47,6 +47,12 @@
|
|||||||
"version": "16.3.1-beta.0",
|
"version": "16.3.1-beta.0",
|
||||||
"description": "Replace @nx/node:webpack with @nx/node:webpack for all project targets",
|
"description": "Replace @nx/node:webpack with @nx/node:webpack for all project targets",
|
||||||
"implementation": "./src/migrations/update-16-3-1/update-webpack-executor"
|
"implementation": "./src/migrations/update-16-3-1/update-webpack-executor"
|
||||||
|
},
|
||||||
|
"update-16-4-0-replace-node-executor": {
|
||||||
|
"cli": "nx",
|
||||||
|
"version": "16.4.0-beta.8",
|
||||||
|
"description": "Replace @nx/node:node with @nx/js:node for all project targets",
|
||||||
|
"implementation": "./src/migrations/update-16-4-0/replace-node-executor"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packageJsonUpdates": {
|
"packageJsonUpdates": {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "@nx/node",
|
"name": "@nx/node",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "The Node Plugin for Nx contains generators and executors to manage Node applications within an Nx workspace.",
|
"description": "The Node Plugin for Nx contains generators to manage Node applications within an Nx workspace.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nrwl/nx.git",
|
"url": "https://github.com/nrwl/nx.git",
|
||||||
@ -25,7 +25,6 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://nx.dev",
|
"homepage": "https://nx.dev",
|
||||||
"schematics": "./generators.json",
|
"schematics": "./generators.json",
|
||||||
"builders": "./executors.json",
|
|
||||||
"ng-update": {
|
"ng-update": {
|
||||||
"requirements": {},
|
"requirements": {},
|
||||||
"migrations": "./migrations.json"
|
"migrations": "./migrations.json"
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
import { convertNxExecutor } from '@nx/devkit';
|
|
||||||
import nodeExecutor from './node.impl';
|
|
||||||
|
|
||||||
export default convertNxExecutor(nodeExecutor);
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
import { ExecutorContext } from '@nx/devkit';
|
|
||||||
import type { NodeExecutorOptions } from '@nx/js/src/executors/node/schema';
|
|
||||||
import { nodeExecutor as jsNodeExecutor } from '@nx/js/src/executors/node/node.impl';
|
|
||||||
|
|
||||||
// TODO(jack): Remove for Nx 16
|
|
||||||
export async function* nodeExecutor(
|
|
||||||
options: NodeExecutorOptions,
|
|
||||||
context: ExecutorContext
|
|
||||||
) {
|
|
||||||
yield* jsNodeExecutor(options, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default nodeExecutor;
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"outputCapture": "direct-nodejs",
|
|
||||||
"$schema": "http://json-schema.org/schema",
|
|
||||||
"cli": "nx",
|
|
||||||
"title": "Node executor",
|
|
||||||
"description": "Execute Nodejs applications.",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"buildTarget": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The target to run to build you the app."
|
|
||||||
},
|
|
||||||
"buildTargetOptions": {
|
|
||||||
"type": "object",
|
|
||||||
"description": "Additional options to pass into the build target.",
|
|
||||||
"default": {}
|
|
||||||
},
|
|
||||||
"waitUntilTargets": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "The targets to run before starting the node app.",
|
|
||||||
"default": [],
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"host": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "localhost",
|
|
||||||
"description": "The host to inspect the process on."
|
|
||||||
},
|
|
||||||
"port": {
|
|
||||||
"type": "number",
|
|
||||||
"default": 9229,
|
|
||||||
"description": "The port to inspect the process on. Setting port to 0 will assign random free ports to all forked processes."
|
|
||||||
},
|
|
||||||
"inspect": {
|
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"enum": ["inspect", "inspect-brk"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Ensures the app is starting with debugging.",
|
|
||||||
"default": "inspect"
|
|
||||||
},
|
|
||||||
"runtimeArgs": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "Extra args passed to the node process.",
|
|
||||||
"default": [],
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "Extra args when starting the app.",
|
|
||||||
"default": [],
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"watch": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Enable re-building when files change.",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false,
|
|
||||||
"required": ["buildTarget"]
|
|
||||||
}
|
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
import { addProjectConfiguration, readProjectConfiguration } from '@nx/devkit';
|
||||||
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
|
import update from './replace-node-executor';
|
||||||
|
|
||||||
|
describe('Migration: replace @nx/node:node executor', () => {
|
||||||
|
it(`should replace @nx/node:node executor with @nx/js:node`, async () => {
|
||||||
|
let tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
|
|
||||||
|
addProjectConfiguration(tree, 'myapp', {
|
||||||
|
root: 'apps/myapp',
|
||||||
|
sourceRoot: 'apps/myapp/src',
|
||||||
|
projectType: 'application',
|
||||||
|
targets: {
|
||||||
|
foo: {
|
||||||
|
executor: '@nx/node:node',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
bar: {
|
||||||
|
executor: '@nx/node:node',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
addProjectConfiguration(tree, 'myapp2', {
|
||||||
|
root: 'apps/myapp2',
|
||||||
|
sourceRoot: 'apps/myapp2/src',
|
||||||
|
projectType: 'application',
|
||||||
|
targets: {
|
||||||
|
foo: {
|
||||||
|
executor: '@nx/node:node',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
bar: {
|
||||||
|
executor: '@nx/node:node',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await update(tree);
|
||||||
|
|
||||||
|
expect(readProjectConfiguration(tree, 'myapp')).toEqual({
|
||||||
|
$schema: '../../node_modules/nx/schemas/project-schema.json',
|
||||||
|
name: 'myapp',
|
||||||
|
root: 'apps/myapp',
|
||||||
|
sourceRoot: 'apps/myapp/src',
|
||||||
|
projectType: 'application',
|
||||||
|
targets: {
|
||||||
|
foo: {
|
||||||
|
executor: '@nx/js:node',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
bar: {
|
||||||
|
executor: '@nx/js:node',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(readProjectConfiguration(tree, 'myapp2')).toEqual({
|
||||||
|
$schema: '../../node_modules/nx/schemas/project-schema.json',
|
||||||
|
name: 'myapp2',
|
||||||
|
root: 'apps/myapp2',
|
||||||
|
sourceRoot: 'apps/myapp2/src',
|
||||||
|
projectType: 'application',
|
||||||
|
targets: {
|
||||||
|
foo: {
|
||||||
|
executor: '@nx/js:node',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
bar: {
|
||||||
|
executor: '@nx/js:node',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
import {
|
||||||
|
formatFiles,
|
||||||
|
readProjectConfiguration,
|
||||||
|
Tree,
|
||||||
|
updateProjectConfiguration,
|
||||||
|
} from '@nx/devkit';
|
||||||
|
import { forEachExecutorOptions } from '@nx/devkit/src/generators/executor-options-utils';
|
||||||
|
|
||||||
|
export default async function update(tree: Tree) {
|
||||||
|
const migrateProject = (_options, projectName, targetName) => {
|
||||||
|
const projectConfig = readProjectConfiguration(tree, projectName);
|
||||||
|
projectConfig.targets[targetName].executor = '@nx/js:node';
|
||||||
|
updateProjectConfiguration(tree, projectName, projectConfig);
|
||||||
|
};
|
||||||
|
|
||||||
|
forEachExecutorOptions(tree, '@nx/node:node', migrateProject);
|
||||||
|
|
||||||
|
await formatFiles(tree);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user