feat(remix)!: remove deprecated static-serve target name from inferred targets (#30982)
This commit also contains various changes to ensure serve-static tasks depend on their build. BREAKING CHANGE: Remove deprecated static-serve target name from Remix Inferred Tasks in favour of serve-static.
This commit is contained in:
parent
f9d461e663
commit
5f488947dc
@ -242,21 +242,6 @@ function getStartTargetConfig(options: NextPluginOptions, projectRoot: string) {
|
|||||||
return targetConfig;
|
return targetConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStaticServeTargetConfig(options: NextPluginOptions) {
|
|
||||||
const targetConfig: TargetConfiguration = {
|
|
||||||
executor: '@nx/web:file-server',
|
|
||||||
options: {
|
|
||||||
buildTarget: options.buildTargetName,
|
|
||||||
staticFilePath: '{projectRoot}/out',
|
|
||||||
port: 3000,
|
|
||||||
// Routes are found correctly with serve-static
|
|
||||||
spa: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return targetConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getOutputs(projectRoot, nextConfig) {
|
async function getOutputs(projectRoot, nextConfig) {
|
||||||
let dir = '.next';
|
let dir = '.next';
|
||||||
const { PHASE_PRODUCTION_BUILD } = require('next/constants');
|
const { PHASE_PRODUCTION_BUILD } = require('next/constants');
|
||||||
|
|||||||
@ -31,6 +31,9 @@ exports[`@nx/nuxt/plugin not root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
"acme-serve-static": {
|
"acme-serve-static": {
|
||||||
"continuous": true,
|
"continuous": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"acme-build-static",
|
||||||
|
],
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "acme-build-static",
|
"buildTarget": "acme-build-static",
|
||||||
@ -153,6 +156,9 @@ exports[`@nx/nuxt/plugin root project should create nodes 1`] = `
|
|||||||
},
|
},
|
||||||
"serve-static": {
|
"serve-static": {
|
||||||
"continuous": true,
|
"continuous": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"build-static",
|
||||||
|
],
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "build-static",
|
"buildTarget": "build-static",
|
||||||
|
|||||||
@ -190,6 +190,7 @@ function serveTarget(projectRoot: string) {
|
|||||||
|
|
||||||
function serveStaticTarget(options: NuxtPluginOptions) {
|
function serveStaticTarget(options: NuxtPluginOptions) {
|
||||||
const targetConfig: TargetConfiguration = {
|
const targetConfig: TargetConfiguration = {
|
||||||
|
dependsOn: [`${options.buildStaticTargetName}`],
|
||||||
continuous: true,
|
continuous: true,
|
||||||
executor: '@nx/web:file-server',
|
executor: '@nx/web:file-server',
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@ -246,7 +246,7 @@ describe('Remix - Convert To Inferred', () => {
|
|||||||
devTargetName: 'custom-dev',
|
devTargetName: 'custom-dev',
|
||||||
startTargetName: 'start',
|
startTargetName: 'start',
|
||||||
typecheckTargetName: 'typecheck',
|
typecheckTargetName: 'typecheck',
|
||||||
staticServeTargetName: 'static-serve',
|
serveStaticTargetName: 'serve-static',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
updateNxJson(tree, nxJson);
|
updateNxJson(tree, nxJson);
|
||||||
|
|||||||
@ -65,16 +65,6 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should create
|
|||||||
"cwd": "my-app",
|
"cwd": "my-app",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"static-serve": {
|
|
||||||
"command": "remix-serve build/index.js",
|
|
||||||
"continuous": true,
|
|
||||||
"dependsOn": [
|
|
||||||
"build",
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": "my-app",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"tsc": {
|
"tsc": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"command": "tsc --noEmit",
|
"command": "tsc --noEmit",
|
||||||
@ -185,16 +175,6 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer w
|
|||||||
"cwd": "my-app",
|
"cwd": "my-app",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"static-serve": {
|
|
||||||
"command": "remix-serve build/index.js",
|
|
||||||
"continuous": true,
|
|
||||||
"dependsOn": [
|
|
||||||
"build",
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": "my-app",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"tsc": {
|
"tsc": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"command": "tsc --noEmit",
|
"command": "tsc --noEmit",
|
||||||
@ -300,16 +280,6 @@ exports[`@nx/remix/plugin Remix Classic Compiler root project should create node
|
|||||||
"cwd": ".",
|
"cwd": ".",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"static-serve": {
|
|
||||||
"command": "remix-serve build/index.js",
|
|
||||||
"continuous": true,
|
|
||||||
"dependsOn": [
|
|
||||||
"build",
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": ".",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"typecheck": {
|
"typecheck": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"command": "tsc --noEmit",
|
"command": "tsc --noEmit",
|
||||||
@ -412,16 +382,6 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
|
|||||||
"cwd": "my-app",
|
"cwd": "my-app",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"static-serve": {
|
|
||||||
"command": "remix-serve build/server/index.js",
|
|
||||||
"continuous": true,
|
|
||||||
"dependsOn": [
|
|
||||||
"build",
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": "my-app",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"tsc": {
|
"tsc": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"command": "tsc --noEmit",
|
"command": "tsc --noEmit",
|
||||||
@ -526,16 +486,6 @@ exports[`@nx/remix/plugin Remix Vite Compiler root project should create nodes 1
|
|||||||
"cwd": ".",
|
"cwd": ".",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"static-serve": {
|
|
||||||
"command": "remix-serve build/server/index.js",
|
|
||||||
"continuous": true,
|
|
||||||
"dependsOn": [
|
|
||||||
"build",
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": ".",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"typecheck": {
|
"typecheck": {
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"command": "tsc --noEmit",
|
"command": "tsc --noEmit",
|
||||||
|
|||||||
@ -96,7 +96,6 @@ module.exports = {
|
|||||||
devTargetName: 'dev',
|
devTargetName: 'dev',
|
||||||
startTargetName: 'start',
|
startTargetName: 'start',
|
||||||
typecheckTargetName: 'typecheck',
|
typecheckTargetName: 'typecheck',
|
||||||
staticServeTargetName: 'static-serve',
|
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
@ -160,7 +159,6 @@ module.exports = {
|
|||||||
devTargetName: 'dev',
|
devTargetName: 'dev',
|
||||||
startTargetName: 'start',
|
startTargetName: 'start',
|
||||||
typecheckTargetName: 'tsc',
|
typecheckTargetName: 'tsc',
|
||||||
staticServeTargetName: 'static-serve',
|
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
@ -182,7 +180,6 @@ module.exports = {
|
|||||||
devTargetName: 'dev',
|
devTargetName: 'dev',
|
||||||
startTargetName: 'start',
|
startTargetName: 'start',
|
||||||
typecheckTargetName: 'tsc',
|
typecheckTargetName: 'tsc',
|
||||||
staticServeTargetName: 'static-serve',
|
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
@ -347,7 +344,6 @@ module.exports = {
|
|||||||
devTargetName: 'dev',
|
devTargetName: 'dev',
|
||||||
startTargetName: 'start',
|
startTargetName: 'start',
|
||||||
typecheckTargetName: 'typecheck',
|
typecheckTargetName: 'typecheck',
|
||||||
staticServeTargetName: 'static-serve',
|
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
@ -419,7 +415,6 @@ module.exports = {
|
|||||||
devTargetName: 'dev',
|
devTargetName: 'dev',
|
||||||
startTargetName: 'start',
|
startTargetName: 'start',
|
||||||
typecheckTargetName: 'tsc',
|
typecheckTargetName: 'tsc',
|
||||||
staticServeTargetName: 'static-serve',
|
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
|
|||||||
@ -33,11 +33,6 @@ export interface RemixPluginOptions {
|
|||||||
typecheckTargetName?: string;
|
typecheckTargetName?: string;
|
||||||
buildDepsTargetName?: string;
|
buildDepsTargetName?: string;
|
||||||
watchDepsTargetName?: string;
|
watchDepsTargetName?: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use serveStaticTargetName instead. This option will be removed in Nx 21.
|
|
||||||
*/
|
|
||||||
staticServeTargetName?: string;
|
|
||||||
serveStaticTargetName?: string;
|
serveStaticTargetName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,14 +207,6 @@ async function buildRemixTargets(
|
|||||||
remixCompiler,
|
remixCompiler,
|
||||||
isUsingTsSolutionSetup
|
isUsingTsSolutionSetup
|
||||||
);
|
);
|
||||||
// TODO(colum): Remove for Nx 21
|
|
||||||
targets[options.staticServeTargetName] = startTarget(
|
|
||||||
projectRoot,
|
|
||||||
serverBuildPath,
|
|
||||||
options.buildTargetName,
|
|
||||||
remixCompiler,
|
|
||||||
isUsingTsSolutionSetup
|
|
||||||
);
|
|
||||||
targets[options.serveStaticTargetName] = startTarget(
|
targets[options.serveStaticTargetName] = startTarget(
|
||||||
projectRoot,
|
projectRoot,
|
||||||
serverBuildPath,
|
serverBuildPath,
|
||||||
@ -451,8 +438,6 @@ function normalizeOptions(options: RemixPluginOptions) {
|
|||||||
options.devTargetName ??= 'dev';
|
options.devTargetName ??= 'dev';
|
||||||
options.startTargetName ??= 'start';
|
options.startTargetName ??= 'start';
|
||||||
options.typecheckTargetName ??= 'typecheck';
|
options.typecheckTargetName ??= 'typecheck';
|
||||||
// TODO(colum): remove for Nx 21
|
|
||||||
options.staticServeTargetName ??= 'static-serve';
|
|
||||||
options.serveStaticTargetName ??= 'serve-static';
|
options.serveStaticTargetName ??= 'serve-static';
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
|
|||||||
@ -126,6 +126,9 @@ describe('@nx/rspack', () => {
|
|||||||
},
|
},
|
||||||
"serve-static": {
|
"serve-static": {
|
||||||
"continuous": true,
|
"continuous": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"build",
|
||||||
|
],
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "build",
|
"buildTarget": "build",
|
||||||
|
|||||||
@ -238,6 +238,7 @@ async function createRspackTargets(
|
|||||||
};
|
};
|
||||||
|
|
||||||
targets[options.serveStaticTargetName] = {
|
targets[options.serveStaticTargetName] = {
|
||||||
|
dependsOn: [`${options.buildTargetName}`],
|
||||||
continuous: true,
|
continuous: true,
|
||||||
executor: '@nx/web:file-server',
|
executor: '@nx/web:file-server',
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@ -104,6 +104,9 @@ describe('@nx/storybook/plugin', () => {
|
|||||||
},
|
},
|
||||||
"static-storybook": {
|
"static-storybook": {
|
||||||
"continuous": true,
|
"continuous": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"build-storybook",
|
||||||
|
],
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "build-storybook",
|
"buildTarget": "build-storybook",
|
||||||
@ -187,6 +190,9 @@ describe('@nx/storybook/plugin', () => {
|
|||||||
},
|
},
|
||||||
"static-storybook": {
|
"static-storybook": {
|
||||||
"continuous": true,
|
"continuous": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"build-storybook",
|
||||||
|
],
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "build-storybook",
|
"buildTarget": "build-storybook",
|
||||||
@ -268,6 +274,9 @@ describe('@nx/storybook/plugin', () => {
|
|||||||
},
|
},
|
||||||
"static-storybook": {
|
"static-storybook": {
|
||||||
"continuous": true,
|
"continuous": true,
|
||||||
|
"dependsOn": [
|
||||||
|
"build-storybook",
|
||||||
|
],
|
||||||
"executor": "@nx/web:file-server",
|
"executor": "@nx/web:file-server",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "build-storybook",
|
"buildTarget": "build-storybook",
|
||||||
|
|||||||
@ -313,6 +313,7 @@ function serveStaticTarget(
|
|||||||
projectRoot: string
|
projectRoot: string
|
||||||
) {
|
) {
|
||||||
const targetConfig: TargetConfiguration = {
|
const targetConfig: TargetConfiguration = {
|
||||||
|
dependsOn: [`${options.buildStorybookTargetName}`],
|
||||||
continuous: true,
|
continuous: true,
|
||||||
executor: '@nx/web:file-server',
|
executor: '@nx/web:file-server',
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user