diff --git a/packages/cypress/src/plugins/plugin.spec.ts b/packages/cypress/src/plugins/plugin.spec.ts index ba8c50c71db25..7d563bde70c2f 100644 --- a/packages/cypress/src/plugins/plugin.spec.ts +++ b/packages/cypress/src/plugins/plugin.spec.ts @@ -73,10 +73,10 @@ describe('@nx/cypress/plugin', () => { "targets": { "e2e": { "cache": true, - "command": "cypress run --config-file cypress.config.js --e2e", + "command": "cypress run", "configurations": { "production": { - "command": "cypress run --config-file cypress.config.js --e2e --env webServerCommand="nx run my-app:serve:production"", + "command": "cypress run --env webServerCommand="nx run my-app:serve:production"", }, }, "inputs": [ @@ -132,7 +132,7 @@ describe('@nx/cypress/plugin', () => { "targets": { "component-test": { "cache": true, - "command": "cypress open --config-file cypress.config.js --component", + "command": "cypress open --component", "inputs": [ "default", "^production", @@ -190,10 +190,10 @@ describe('@nx/cypress/plugin', () => { "targets": { "e2e": { "cache": true, - "command": "cypress run --config-file cypress.config.js --e2e", + "command": "cypress run", "configurations": { "production": { - "command": "cypress run --config-file cypress.config.js --e2e --env webServerCommand="my-app:serve:production"", + "command": "cypress run --env webServerCommand="my-app:serve:production"", }, }, "inputs": [ @@ -239,7 +239,7 @@ describe('@nx/cypress/plugin', () => { }, "e2e-ci--src/test.cy.ts": { "cache": true, - "command": "cypress run --config-file cypress.config.js --e2e --env webServerCommand="my-app:serve-static" --spec src/test.cy.ts", + "command": "cypress run --env webServerCommand="my-app:serve-static" --spec src/test.cy.ts", "inputs": [ "default", "^production", diff --git a/packages/cypress/src/plugins/plugin.ts b/packages/cypress/src/plugins/plugin.ts index 2bda8424ef4bb..fae62e3a7d1dc 100644 --- a/packages/cypress/src/plugins/plugin.ts +++ b/packages/cypress/src/plugins/plugin.ts @@ -57,7 +57,7 @@ export const createDependencies: CreateDependencies = () => { }; export const createNodes: CreateNodes = [ - '**/cypress.config.{js,ts,mjs,mts,cjs,cts}', + '**/cypress.config.{js,ts,mjs,cjs}', (configFilePath, options, context) => { options = normalizeOptions(options); const projectRoot = dirname(configFilePath); @@ -157,15 +157,13 @@ function buildCypressTargets( const webServerCommands: Record = pluginPresetOptions?.webServerCommands; - const relativeConfigPath = relative(projectRoot, configFilePath); - const namedInputs = getNamedInputs(projectRoot, context); const targets: Record = {}; if ('e2e' in cypressConfig) { targets[options.targetName] = { - command: `cypress run --config-file ${relativeConfigPath} --e2e`, + command: `cypress run`, options: { cwd: projectRoot }, cache: true, inputs: getInputs(namedInputs), @@ -182,7 +180,7 @@ function buildCypressTargets( webServerCommands ?? {} )) { targets[options.targetName].configurations[configuration] = { - command: `cypress run --config-file ${relativeConfigPath} --e2e --env webServerCommand="${webServerCommand}"`, + command: `cypress run --env webServerCommand="${webServerCommand}"`, }; } } @@ -215,7 +213,7 @@ function buildCypressTargets( outputs, inputs, cache: true, - command: `cypress run --config-file ${relativeConfigPath} --e2e --env webServerCommand="${ciWebServerCommand}" --spec ${relativeSpecFilePath}`, + command: `cypress run --env webServerCommand="${ciWebServerCommand}" --spec ${relativeSpecFilePath}`, options: { cwd: projectRoot, }, @@ -241,7 +239,7 @@ function buildCypressTargets( if ('component' in cypressConfig) { // This will not override the e2e target if it is the same targets[options.componentTestingTargetName] ??= { - command: `cypress open --config-file ${relativeConfigPath} --component`, + command: `cypress open --component`, options: { cwd: projectRoot }, cache: true, inputs: getInputs(namedInputs), @@ -259,7 +257,7 @@ function getCypressConfig( const resolvedPath = join(context.workspaceRoot, configFilePath); let module: any; - if (['.ts', '.mts', '.cts'].includes(extname(configFilePath))) { + if (extname(configFilePath) === '.ts') { const tsConfigPath = getRootTsConfigPath(); if (tsConfigPath) { diff --git a/packages/nx/src/tasks-runner/forked-process-task-runner.ts b/packages/nx/src/tasks-runner/forked-process-task-runner.ts index edd324e8e3374..ffd9c741ab419 100644 --- a/packages/nx/src/tasks-runner/forked-process-task-runner.ts +++ b/packages/nx/src/tasks-runner/forked-process-task-runner.ts @@ -484,7 +484,7 @@ export class ForkedProcessTaskRunner { } }); // we exit here because we don't need to write anything to cache. - process.exit(); + process.exit(this.signalToCode('SIGINT')); }); process.on('SIGTERM', () => { this.processes.forEach((p) => { diff --git a/scripts/nx-release.ts b/scripts/nx-release.ts index a9d3ff651a093..0a963bca24032 100755 --- a/scripts/nx-release.ts +++ b/scripts/nx-release.ts @@ -7,6 +7,7 @@ import { URL } from 'node:url'; import { isRelativeVersionKeyword } from 'nx/src/command-line/release/utils/semver'; import { ReleaseType, inc, major, parse } from 'semver'; import * as yargs from 'yargs'; +import * as chalk from 'chalk'; const LARGE_BUFFER = 1024 * 1000000; @@ -119,7 +120,7 @@ const LARGE_BUFFER = 1024 * 1000000; // If publishing locally, force all projects to not be private first if (options.local) { console.log( - '\nPublishing locally, so setting all packages with existing nx-release-publish targets to not be private. If you have created a new private package and you want it to be published, you will need to manually configure the "nx-release-publish" target using executor "@nx/js:release-publish"' + chalk.dim`\n Publishing locally, so setting all packages with existing nx-release-publish targets to not be private. If you have created a new private package and you want it to be published, you will need to manually configure the "nx-release-publish" target using executor "@nx/js:release-publish"` ); const projectGraph = await createProjectGraphAsync(); for (const proj of Object.values(projectGraph.nodes)) { @@ -160,6 +161,20 @@ const LARGE_BUFFER = 1024 * 1000000; }); } + let version; + if (['minor', 'major', 'patch'].includes(options.version)) { + const currentLatestVersion = execSync('npm view nx@latest version') + .toString() + .trim(); + + version = inc(currentLatestVersion, options.version, undefined); + } else { + version = options.version; + } + + console.log(chalk.green` > Published version: ` + version); + console.log(chalk.dim` Use: npx create-nx-workspace@${version}\n`); + process.exit(0); })();