New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nx/workspace

Package Overview
Dependencies
Maintainers
0
Versions
862
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nx/workspace - npm Package Compare versions

Comparing version 0.0.0-pr-29314-e664f92 to 0.0.0-pr-29636-0cd26ed

src/utilities/typescript/ts-solution-setup.d.ts

13

migrations.json

@@ -66,4 +66,17 @@ {

}
},
"20.4.0": {
"version": "20.4.0-beta.1",
"x-prompt": "Do you want to update to TypeScript v5.7?",
"requires": {
"typescript": ">=5.6.0 <5.7.0"
},
"packages": {
"typescript": {
"version": "~5.7.2",
"alwaysAddToPackageJson": false
}
}
}
}
}

6

package.json
{
"name": "@nx/workspace",
"version": "0.0.0-pr-29314-e664f92",
"version": "0.0.0-pr-29636-0cd26ed",
"private": false,

@@ -41,3 +41,3 @@ "description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",

"dependencies": {
"@nx/devkit": "0.0.0-pr-29314-e664f92",
"@nx/devkit": "0.0.0-pr-29636-0cd26ed",
"chalk": "^4.1.0",

@@ -47,3 +47,3 @@ "enquirer": "~2.3.6",

"yargs-parser": "21.1.1",
"nx": "0.0.0-pr-29314-e664f92"
"nx": "0.0.0-pr-29636-0cd26ed"
},

@@ -50,0 +50,0 @@ "publishConfig": {

@@ -22,2 +22,3 @@ "use strict";

'eslint.config.js',
'eslint.config.cjs',
/^jest\.config\.((app|lib)\.)?[jt]s$/,

@@ -24,0 +25,0 @@ 'vite.config.ts',

@@ -14,4 +14,8 @@ "use strict";

!tree.exists('eslint.config.js') &&
!tree.exists('eslint.config.cjs') &&
!tree.exists('eslint.config.mjs') &&
!tree.exists('.eslintrc.base.json') &&
!tree.exists('eslint.base.config.js')) {
!tree.exists('eslint.base.config.js') &&
!tree.exists('eslint.base.config.cjs') &&
!tree.exists('eslint.base.config.mjs')) {
return;

@@ -18,0 +22,0 @@ }

@@ -10,2 +10,3 @@ "use strict";

const utils_1 = require("./utils");
const ts_solution_setup_1 = require("../../../utilities/typescript/ts-solution-setup");
let tsModule;

@@ -23,5 +24,9 @@ /**

const projects = (0, devkit_1.getProjects)(tree);
const isUsingTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
// use the source root to find the from location
// this attempts to account for libs that have been created with --importPath
const tsConfigPath = (0, ts_config_1.getRootTsConfigPathInTree)(tree);
const tsConfigPath = isUsingTsSolution
? 'tsconfig.json'
: (0, ts_config_1.getRootTsConfigPathInTree)(tree);
// If we are using a ts solution setup, we need to use tsconfig.json instead of tsconfig.base.json
let tsConfig;

@@ -89,23 +94,51 @@ let mainEntryPointImportPath;

if (tsConfig) {
const path = tsConfig.compilerOptions.paths[projectRef.from];
if (!path) {
throw new Error([
`unable to find "${projectRef.from}" in`,
`${tsConfigPath} compilerOptions.paths`,
].join(' '));
if (!isUsingTsSolution) {
updateTsConfigPaths(tsConfig, projectRef, tsConfigPath, projectRoot, schema);
}
const updatedPath = path.map((x) => (0, devkit_1.joinPathFragments)(projectRoot.to, (0, path_1.relative)(projectRoot.from, x)));
if (schema.updateImportPath && projectRef.to) {
tsConfig.compilerOptions.paths[projectRef.to] = updatedPath;
if (projectRef.from !== projectRef.to) {
delete tsConfig.compilerOptions.paths[projectRef.from];
}
}
else {
tsConfig.compilerOptions.paths[projectRef.from] = updatedPath;
updateTsConfigReferences(tsConfig, projectRoot, tsConfigPath, schema);
}
(0, devkit_1.writeJson)(tree, tsConfigPath, tsConfig);
}
(0, devkit_1.writeJson)(tree, tsConfigPath, tsConfig);
}
}
function updateTsConfigReferences(tsConfig, projectRoot, tsConfigPath, schema) {
// Since paths can be './path' or 'path' we check if both are the same relative path to the workspace root
const projectRefIndex = tsConfig.references.findIndex((ref) => (0, path_1.relative)(ref.path, projectRoot.from) === '');
if (projectRefIndex === -1) {
throw new Error(`unable to find "${projectRoot.from}" in ${tsConfigPath} references`);
}
const updatedPath = (0, devkit_1.joinPathFragments)(projectRoot.to, (0, path_1.relative)(projectRoot.from, tsConfig.references[projectRefIndex].path));
let normalizedPath = (0, path_1.normalize)(updatedPath);
if (!normalizedPath.startsWith('.') &&
!normalizedPath.startsWith('../') &&
!(0, path_1.isAbsolute)(normalizedPath)) {
normalizedPath = `./${normalizedPath}`;
}
if (schema.updateImportPath && projectRoot.to) {
tsConfig.references[projectRefIndex].path = normalizedPath;
}
else {
tsConfig.references.push({ path: normalizedPath });
}
}
function updateTsConfigPaths(tsConfig, projectRef, tsConfigPath, projectRoot, schema) {
const path = tsConfig.compilerOptions.paths[projectRef.from];
if (!path) {
throw new Error([
`unable to find "${projectRef.from}" in`,
`${tsConfigPath} compilerOptions.paths`,
].join(' '));
}
const updatedPath = path.map((x) => (0, devkit_1.joinPathFragments)(projectRoot.to, (0, path_1.relative)(projectRoot.from, x)));
if (schema.updateImportPath && projectRef.to) {
tsConfig.compilerOptions.paths[projectRef.to] = updatedPath;
if (projectRef.from !== projectRef.to) {
delete tsConfig.compilerOptions.paths[projectRef.from];
}
}
else {
tsConfig.compilerOptions.paths[projectRef.from] = updatedPath;
}
}
function ensureTrailingSlash(path) {

@@ -112,0 +145,0 @@ return path.endsWith('/') ? path : `${path}/`;

@@ -44,3 +44,5 @@ "use strict";

}
if (file === '.eslintrc.json' || file === 'eslint.config.js') {
if (file === '.eslintrc.json' ||
file === 'eslint.config.js' ||
file === 'eslint.config.cjs') {
continue;

@@ -77,3 +79,5 @@ }

}
if (file === '.eslintrc.json' || file === 'eslint.config.js') {
if (file === '.eslintrc.json' ||
file === 'eslint.config.cjs' ||
file === 'eslint.config.js') {
continue;

@@ -80,0 +84,0 @@ }

@@ -333,8 +333,12 @@ "use strict";

options.preset === presets_1.Preset.ReactNative ||
options.preset === presets_1.Preset.RemixMonorepo) &&
options.preset === presets_1.Preset.RemixMonorepo ||
options.preset === presets_1.Preset.VueMonorepo ||
options.preset === presets_1.Preset.Nuxt ||
options.preset === presets_1.Preset.NodeMonorepo ||
options.preset === presets_1.Preset.Express) &&
options.workspaces)) {
const workspaces = options.workspaceGlobs ?? ['packages/**'];
const workspaces = options.workspaceGlobs ?? ['packages/*'];
if (options.packageManager === 'pnpm') {
tree.write((0, path_1.join)(options.directory, 'pnpm-workspace.yaml'), `packages:
- ${workspaces.join('\n - ')}
${workspaces.map((workspace) => `- "${workspace}"`).join('\n ')}
`);

@@ -341,0 +345,0 @@ }

@@ -132,2 +132,4 @@ "use strict";

nxCloudToken: options.nxCloudToken,
useTsSolution: options.workspaces,
formatter: options.formatter,
});

@@ -161,2 +163,4 @@ }

nxCloudToken: options.nxCloudToken,
useTsSolution: options.workspaces,
formatter: options.formatter,
});

@@ -234,2 +238,4 @@ }

addPlugin,
useTsSolution: options.workspaces,
formatter: options.formatter,
});

@@ -245,2 +251,4 @@ }

addPlugin,
useTsSolution: options.workspaces,
formatter: options.formatter,
});

@@ -328,2 +336,4 @@ }

addPlugin,
useTsSolution: options.workspaces,
formatter: options.formatter,
});

@@ -330,0 +340,0 @@ }

@@ -14,3 +14,3 @@ import { Preset } from '../utils/presets';

packageManager?: PackageManager;
bundler?: 'vite' | 'webpack' | 'rspack' | 'esbuild';
bundler?: 'vite' | 'rsbuild' | 'webpack' | 'rspack' | 'esbuild';
docker?: boolean;

@@ -17,0 +17,0 @@ nextAppDir?: boolean;

@@ -75,3 +75,3 @@ {

"type": "string",
"enum": ["webpack", "vite", "rspack", "esbuild"],
"enum": ["vite", "rspack", "rsbuild", "esbuild", "webpack"],
"default": "vite"

@@ -78,0 +78,0 @@ },

@@ -7,2 +7,4 @@ "use strict";

const find_project_for_path_1 = require("nx/src/project-graph/utils/find-project-for-path");
const ts_solution_setup_1 = require("../../../utilities/typescript/ts-solution-setup");
const path_1 = require("path");
/**

@@ -14,3 +16,6 @@ * Updates the tsconfig paths to remove the project.

async function updateTsconfig(tree, schema) {
const tsConfigPath = (0, ts_config_1.getRootTsConfigPathInTree)(tree);
const isUsingTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
const tsConfigPath = isUsingTsSolution
? 'tsconfig.json'
: (0, ts_config_1.getRootTsConfigPathInTree)(tree);
if (tree.exists(tsConfigPath)) {

@@ -20,8 +25,18 @@ const graph = await (0, devkit_1.createProjectGraphAsync)();

(0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
for (const importPath in json.compilerOptions.paths) {
for (const path of json.compilerOptions.paths[importPath]) {
const project = (0, find_project_for_path_1.findProjectForPath)((0, devkit_1.normalizePath)(path), projectMapping);
if (project === schema.projectName) {
delete json.compilerOptions.paths[importPath];
break;
if (isUsingTsSolution) {
const projectConfigs = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(graph);
const project = projectConfigs.projects[schema.projectName];
if (!project) {
throw new Error(`Could not find project '${schema.project}'. Please choose a project that exists in the Nx Workspace.`);
}
json.references = json.references.filter((ref) => (0, path_1.relative)(ref.path, project.root) !== '');
}
else {
for (const importPath in json.compilerOptions.paths) {
for (const path of json.compilerOptions.paths[importPath]) {
const project = (0, find_project_for_path_1.findProjectForPath)((0, devkit_1.normalizePath)(path), projectMapping);
if (project === schema.projectName) {
delete json.compilerOptions.paths[importPath];
break;
}
}

@@ -28,0 +43,0 @@ }

export declare const nxVersion: any;
export declare const typescriptVersion = "~5.6.2";
export declare const angularCliVersion = "~19.0.0";
export declare const typescriptVersion = "~5.7.2";
export declare const angularCliVersion = "~19.1.0";

@@ -5,5 +5,5 @@ "use strict";

exports.nxVersion = require('../../package.json').version;
exports.typescriptVersion = '~5.6.2';
exports.typescriptVersion = '~5.7.2';
// TODO: remove when preset generation is reworked and
// deps are not installed from workspace
exports.angularCliVersion = '~19.0.0';
exports.angularCliVersion = '~19.1.0';

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc