feat(vite): infer continuous tasks for dev (#30043)
## Current Behavior The `dev`, `serve`, `preview` and `serve-static` targets inferred by the `@nx/vite/plugin` do not infer `continuous:true` indicating to Nx that these tasks are continuous. ## Expected Behavior Infer `continuous: true` for the serve-like targets for Vite.
This commit is contained in:
parent
63282bc070
commit
7989e39461
@ -123,6 +123,7 @@ exports[`@nx/vite/plugin not root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"command": "vite",
|
"command": "vite",
|
||||||
|
"continuous": true,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"description": "Starts Vite dev server",
|
"description": "Starts Vite dev server",
|
||||||
"help": {
|
"help": {
|
||||||
@ -143,6 +144,7 @@ exports[`@nx/vite/plugin not root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
"my-serve": {
|
"my-serve": {
|
||||||
"command": "vite",
|
"command": "vite",
|
||||||
|
"continuous": true,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"deprecated": "Use devTargetName instead. This option will be removed in Nx 22.",
|
"deprecated": "Use devTargetName instead. This option will be removed in Nx 22.",
|
||||||
"description": "Starts Vite dev server",
|
"description": "Starts Vite dev server",
|
||||||
@ -164,6 +166,7 @@ exports[`@nx/vite/plugin not root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
"preview-site": {
|
"preview-site": {
|
||||||
"command": "vite preview",
|
"command": "vite preview",
|
||||||
|
"continuous": true,
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"build-something",
|
"build-something",
|
||||||
],
|
],
|
||||||
@ -186,6 +189,7 @@ exports[`@nx/vite/plugin not root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"serve-static": {
|
"serve-static": {
|
||||||
|
"continuous": true,
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "build-something",
|
"buildTarget": "build-something",
|
||||||
@ -257,6 +261,7 @@ exports[`@nx/vite/plugin root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"command": "vite",
|
"command": "vite",
|
||||||
|
"continuous": true,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"description": "Starts Vite dev server",
|
"description": "Starts Vite dev server",
|
||||||
"help": {
|
"help": {
|
||||||
@ -277,6 +282,7 @@ exports[`@nx/vite/plugin root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
"preview": {
|
"preview": {
|
||||||
"command": "vite preview",
|
"command": "vite preview",
|
||||||
|
"continuous": true,
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"build",
|
"build",
|
||||||
],
|
],
|
||||||
@ -300,6 +306,7 @@ exports[`@nx/vite/plugin root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"command": "vite",
|
"command": "vite",
|
||||||
|
"continuous": true,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"deprecated": "Use devTargetName instead. This option will be removed in Nx 22.",
|
"deprecated": "Use devTargetName instead. This option will be removed in Nx 22.",
|
||||||
"description": "Starts Vite dev server",
|
"description": "Starts Vite dev server",
|
||||||
@ -320,6 +327,7 @@ exports[`@nx/vite/plugin root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"serve-static": {
|
"serve-static": {
|
||||||
|
"continuous": true,
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "build",
|
"buildTarget": "build",
|
||||||
|
|||||||
@ -455,6 +455,7 @@ describe('@nx/vite/plugin', () => {
|
|||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"command": "vite",
|
"command": "vite",
|
||||||
|
"continuous": true,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"description": "Starts Vite dev server",
|
"description": "Starts Vite dev server",
|
||||||
"help": {
|
"help": {
|
||||||
@ -475,6 +476,7 @@ describe('@nx/vite/plugin', () => {
|
|||||||
},
|
},
|
||||||
"preview": {
|
"preview": {
|
||||||
"command": "vite preview",
|
"command": "vite preview",
|
||||||
|
"continuous": true,
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"build",
|
"build",
|
||||||
],
|
],
|
||||||
@ -498,6 +500,7 @@ describe('@nx/vite/plugin', () => {
|
|||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"command": "vite",
|
"command": "vite",
|
||||||
|
"continuous": true,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"deprecated": "Use devTargetName instead. This option will be removed in Nx 22.",
|
"deprecated": "Use devTargetName instead. This option will be removed in Nx 22.",
|
||||||
"description": "Starts Vite dev server",
|
"description": "Starts Vite dev server",
|
||||||
@ -518,6 +521,7 @@ describe('@nx/vite/plugin', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"serve-static": {
|
"serve-static": {
|
||||||
|
"continuous": true,
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "build",
|
"buildTarget": "build",
|
||||||
|
|||||||
@ -430,6 +430,7 @@ async function buildTarget(
|
|||||||
|
|
||||||
function serveTarget(projectRoot: string, isUsingTsSolutionSetup: boolean) {
|
function serveTarget(projectRoot: string, isUsingTsSolutionSetup: boolean) {
|
||||||
const targetConfig: TargetConfiguration = {
|
const targetConfig: TargetConfiguration = {
|
||||||
|
continuous: true,
|
||||||
command: `vite`,
|
command: `vite`,
|
||||||
options: {
|
options: {
|
||||||
cwd: joinPathFragments(projectRoot),
|
cwd: joinPathFragments(projectRoot),
|
||||||
@ -457,6 +458,7 @@ function serveTarget(projectRoot: string, isUsingTsSolutionSetup: boolean) {
|
|||||||
|
|
||||||
function previewTarget(projectRoot: string, buildTargetName) {
|
function previewTarget(projectRoot: string, buildTargetName) {
|
||||||
const targetConfig: TargetConfiguration = {
|
const targetConfig: TargetConfiguration = {
|
||||||
|
continuous: true,
|
||||||
command: `vite preview`,
|
command: `vite preview`,
|
||||||
dependsOn: [buildTargetName],
|
dependsOn: [buildTargetName],
|
||||||
options: {
|
options: {
|
||||||
@ -521,6 +523,7 @@ function serveStaticTarget(
|
|||||||
isUsingTsSolutionSetup: boolean
|
isUsingTsSolutionSetup: boolean
|
||||||
) {
|
) {
|
||||||
const targetConfig: TargetConfiguration = {
|
const targetConfig: TargetConfiguration = {
|
||||||
|
continuous: true,
|
||||||
executor: '@nx/web:file-server',
|
executor: '@nx/web:file-server',
|
||||||
options: {
|
options: {
|
||||||
buildTarget: `${options.buildTargetName}`,
|
buildTarget: `${options.buildTargetName}`,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user