feat(misc): remove handling of @nrwl scope (#28589)
This PR removes logic where we handle both `@nx/` and `@nrwl/` scope. The latter scope has stopped being published in v20, and are no longer relevant. - Cleans up e2e - Removes references to `@nrwl/` scope in our generators and executors - Removes `@nrwl/` from `nx/package.json` `packageGroup` - Cleans up documentation quality script
This commit is contained in:
parent
fb9c5ede84
commit
aec53a0406
@ -359,7 +359,7 @@ module.exports = {
|
|||||||
const esmapp = uniq('esmapp');
|
const esmapp = uniq('esmapp');
|
||||||
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/node:app ${esmapp} --linter=eslint --framework=none --bundler=webpack`
|
`generate @nx/node:app ${esmapp} --linter=eslint --framework=none --bundler=webpack`
|
||||||
);
|
);
|
||||||
updateJson(`apps/${esmapp}/tsconfig.app.json`, (config) => {
|
updateJson(`apps/${esmapp}/tsconfig.app.json`, (config) => {
|
||||||
config.module = 'esnext';
|
config.module = 'esnext';
|
||||||
|
|||||||
@ -298,7 +298,7 @@ ${content}`;
|
|||||||
it.skip('should CT vite projects importing other projects', () => {
|
it.skip('should CT vite projects importing other projects', () => {
|
||||||
const viteLibName = uniq('vite-lib');
|
const viteLibName = uniq('vite-lib');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/react:lib ${viteLibName} --bundler=vite --no-interactive`
|
`generate @nx/react:lib ${viteLibName} --bundler=vite --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
updateFile(`libs/${viteLibName}/src/lib/${viteLibName}.tsx`, () => {
|
updateFile(`libs/${viteLibName}/src/lib/${viteLibName}.tsx`, () => {
|
||||||
@ -316,7 +316,7 @@ export default MyComponent;`;
|
|||||||
});
|
});
|
||||||
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/react:cypress-component-configuration --project=${viteLibName} --generate-tests --bundler=vite --build-target=${appName}:build`
|
`generate @nx/react:cypress-component-configuration --project=${viteLibName} --generate-tests --bundler=vite --build-target=${appName}:build`
|
||||||
);
|
);
|
||||||
if (runE2ETests()) {
|
if (runE2ETests()) {
|
||||||
expect(runCLI(`component-test ${viteLibName}`)).toContain(
|
expect(runCLI(`component-test ${viteLibName}`)).toContain(
|
||||||
|
|||||||
@ -123,8 +123,7 @@ export function findLintTarget(
|
|||||||
return Object.values(project.targets ?? {}).find(
|
return Object.values(project.targets ?? {}).find(
|
||||||
(target) =>
|
(target) =>
|
||||||
target.executor === '@nx/eslint:lint' ||
|
target.executor === '@nx/eslint:lint' ||
|
||||||
target.executor === '@nx/linter:eslint' ||
|
target.executor === '@nx/linter:eslint'
|
||||||
target.executor === '@nrwl/linter:eslint'
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,8 +149,6 @@ function migrateEslintFile(projectEslintPath: string, tree: Tree) {
|
|||||||
config = removeCompatExtends(config, [
|
config = removeCompatExtends(config, [
|
||||||
'plugin:@nx/typescript',
|
'plugin:@nx/typescript',
|
||||||
'plugin:@nx/javascript',
|
'plugin:@nx/javascript',
|
||||||
'plugin:@nrwl/typescript',
|
|
||||||
'plugin:@nrwl/javascript',
|
|
||||||
]);
|
]);
|
||||||
config = removePredefinedConfigs(config, '@nx/eslint-plugin', 'nx', [
|
config = removePredefinedConfigs(config, '@nx/eslint-plugin', 'nx', [
|
||||||
'flat/base',
|
'flat/base',
|
||||||
@ -165,9 +162,7 @@ function migrateEslintFile(projectEslintPath: string, tree: Tree) {
|
|||||||
delete json.root;
|
delete json.root;
|
||||||
// remove nrwl/nx plugins
|
// remove nrwl/nx plugins
|
||||||
if (json.plugins) {
|
if (json.plugins) {
|
||||||
json.plugins = json.plugins.filter(
|
json.plugins = json.plugins.filter((p) => p !== '@nx');
|
||||||
(p) => p !== '@nx' && p !== '@nrwl/nx'
|
|
||||||
);
|
|
||||||
if (json.plugins.length === 0) {
|
if (json.plugins.length === 0) {
|
||||||
delete json.plugins;
|
delete json.plugins;
|
||||||
}
|
}
|
||||||
@ -193,9 +188,7 @@ function migrateEslintFile(projectEslintPath: string, tree: Tree) {
|
|||||||
override.extends = override.extends.filter(
|
override.extends = override.extends.filter(
|
||||||
(ext) =>
|
(ext) =>
|
||||||
ext !== 'plugin:@nx/typescript' &&
|
ext !== 'plugin:@nx/typescript' &&
|
||||||
ext !== 'plugin:@nrwl/nx/typescript' &&
|
ext !== 'plugin:@nx/javascript'
|
||||||
ext !== 'plugin:@nx/javascript' &&
|
|
||||||
ext !== 'plugin:@nrwl/nx/javascript'
|
|
||||||
);
|
);
|
||||||
if (override.extends.length === 0) {
|
if (override.extends.length === 0) {
|
||||||
delete override.extends;
|
delete override.extends;
|
||||||
|
|||||||
@ -329,7 +329,7 @@ function isMigrationToMonorepoNeeded(tree: Tree, graph: ProjectGraph): boolean {
|
|||||||
|
|
||||||
for (const targetConfig of Object.values(rootProject.data.targets ?? {})) {
|
for (const targetConfig of Object.values(rootProject.data.targets ?? {})) {
|
||||||
if (
|
if (
|
||||||
['@nx/eslint:lint', '@nrwl/linter:eslint', '@nx/linter:eslint'].includes(
|
['@nx/eslint:lint', '@nx/linter:eslint'].includes(
|
||||||
targetConfig.executor
|
targetConfig.executor
|
||||||
) ||
|
) ||
|
||||||
(targetConfig.executor === 'nx:run-commands' &&
|
(targetConfig.executor === 'nx:run-commands' &&
|
||||||
|
|||||||
@ -959,7 +959,7 @@ module.exports = [
|
|||||||
rules: {}
|
rules: {}
|
||||||
})),
|
})),
|
||||||
{ ignores: ["src/ignore/to/keep.ts"] },
|
{ ignores: ["src/ignore/to/keep.ts"] },
|
||||||
...compat.config({ extends: ["plugin:@nrwl/javascript"] }).map(config => ({
|
...compat.config({ extends: ["plugin:@nx/javascript"] }).map(config => ({
|
||||||
files: ['*.js', '*.jsx'],
|
files: ['*.js', '*.jsx'],
|
||||||
...config,
|
...config,
|
||||||
rules: {}
|
rules: {}
|
||||||
@ -969,8 +969,6 @@ module.exports = [
|
|||||||
const result = removeCompatExtends(content, [
|
const result = removeCompatExtends(content, [
|
||||||
'plugin:@nx/typescript',
|
'plugin:@nx/typescript',
|
||||||
'plugin:@nx/javascript',
|
'plugin:@nx/javascript',
|
||||||
'plugin:@nrwl/typescript',
|
|
||||||
'plugin:@nrwl/javascript',
|
|
||||||
]);
|
]);
|
||||||
expect(result).toMatchInlineSnapshot(`
|
expect(result).toMatchInlineSnapshot(`
|
||||||
"const { FlatCompat } = require("@eslint/eslintrc");
|
"const { FlatCompat } = require("@eslint/eslintrc");
|
||||||
|
|||||||
@ -59,10 +59,7 @@ export async function* nodeExecutor(
|
|||||||
const buildTargetExecutor =
|
const buildTargetExecutor =
|
||||||
project.data.targets[buildTarget.target]?.executor;
|
project.data.targets[buildTarget.target]?.executor;
|
||||||
|
|
||||||
if (
|
if (buildTargetExecutor === 'nx:run-commands') {
|
||||||
buildTargetExecutor === 'nx:run-commands' ||
|
|
||||||
buildTargetExecutor === '@nrwl/workspace:run-commands'
|
|
||||||
) {
|
|
||||||
// Run commands does not emit build event, so we have to switch to run entire build through Nx CLI.
|
// Run commands does not emit build event, so we have to switch to run entire build through Nx CLI.
|
||||||
options.runBuildTargetDependencies = true;
|
options.runBuildTargetDependencies = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,11 +51,7 @@ function updateProjectBuildTargets(
|
|||||||
let updated = false;
|
let updated = false;
|
||||||
for (const target of projectTargets) {
|
for (const target of projectTargets) {
|
||||||
const targetConfiguration = projectConfiguration.targets?.[target];
|
const targetConfiguration = projectConfiguration.targets?.[target];
|
||||||
if (
|
if (!targetConfiguration || targetConfiguration.executor !== '@nx/js:tsc')
|
||||||
!targetConfiguration ||
|
|
||||||
(targetConfiguration.executor !== '@nx/js:tsc' &&
|
|
||||||
targetConfiguration.executor !== '@nrwl/js:tsc')
|
|
||||||
)
|
|
||||||
continue;
|
continue;
|
||||||
targetConfiguration.executor = '@nx/js:swc';
|
targetConfiguration.executor = '@nx/js:swc';
|
||||||
updated = true;
|
updated = true;
|
||||||
|
|||||||
@ -98,61 +98,35 @@
|
|||||||
"migrations": "./migrations.json",
|
"migrations": "./migrations.json",
|
||||||
"packageGroup": [
|
"packageGroup": [
|
||||||
"@nx/js",
|
"@nx/js",
|
||||||
"@nrwl/js",
|
|
||||||
"@nx/jest",
|
"@nx/jest",
|
||||||
"@nrwl/jest",
|
|
||||||
"@nx/linter",
|
"@nx/linter",
|
||||||
"@nx/eslint",
|
"@nx/eslint",
|
||||||
"@nrwl/linter",
|
|
||||||
"@nx/workspace",
|
"@nx/workspace",
|
||||||
"@nrwl/workspace",
|
|
||||||
"@nx/angular",
|
"@nx/angular",
|
||||||
"@nrwl/angular",
|
|
||||||
"@nx/cypress",
|
"@nx/cypress",
|
||||||
"@nrwl/cypress",
|
|
||||||
"@nx/detox",
|
"@nx/detox",
|
||||||
"@nrwl/detox",
|
|
||||||
"@nx/devkit",
|
"@nx/devkit",
|
||||||
"@nrwl/devkit",
|
|
||||||
"@nx/esbuild",
|
"@nx/esbuild",
|
||||||
"@nrwl/esbuild",
|
|
||||||
"@nx/eslint-plugin",
|
"@nx/eslint-plugin",
|
||||||
"@nrwl/eslint-plugin-nx",
|
|
||||||
"@nx/expo",
|
"@nx/expo",
|
||||||
"@nrwl/expo",
|
|
||||||
"@nx/express",
|
"@nx/express",
|
||||||
"@nrwl/express",
|
|
||||||
"@nx/gradle",
|
"@nx/gradle",
|
||||||
"@nx/nest",
|
"@nx/nest",
|
||||||
"@nrwl/nest",
|
|
||||||
"@nx/next",
|
"@nx/next",
|
||||||
"@nrwl/next",
|
|
||||||
"@nx/node",
|
"@nx/node",
|
||||||
"@nrwl/node",
|
|
||||||
"@nx/nuxt",
|
"@nx/nuxt",
|
||||||
"@nx/playwright",
|
"@nx/playwright",
|
||||||
"@nx/plugin",
|
"@nx/plugin",
|
||||||
"@nrwl/nx-plugin",
|
|
||||||
"@nx/react",
|
"@nx/react",
|
||||||
"@nrwl/react",
|
|
||||||
"@nx/react-native",
|
"@nx/react-native",
|
||||||
"@nrwl/react-native",
|
|
||||||
"@nx/rollup",
|
"@nx/rollup",
|
||||||
"@nrwl/rollup",
|
|
||||||
"@nx/remix",
|
"@nx/remix",
|
||||||
"@nrwl/remix",
|
|
||||||
"@nx/rspack",
|
"@nx/rspack",
|
||||||
"@nrwl/rspack",
|
|
||||||
"@nx/storybook",
|
"@nx/storybook",
|
||||||
"@nrwl/storybook",
|
|
||||||
"@nrwl/tao",
|
|
||||||
"@nx/vite",
|
"@nx/vite",
|
||||||
"@nrwl/vite",
|
|
||||||
"@nx/vue",
|
"@nx/vue",
|
||||||
"@nx/web",
|
"@nx/web",
|
||||||
"@nrwl/web",
|
|
||||||
"@nx/webpack",
|
"@nx/webpack",
|
||||||
"@nrwl/webpack",
|
|
||||||
{
|
{
|
||||||
"package": "nx-cloud",
|
"package": "nx-cloud",
|
||||||
"version": "latest"
|
"version": "latest"
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export function shouldMergeAngularProjects(
|
|||||||
// Include projects from angular.json if explicitly required.
|
// Include projects from angular.json if explicitly required.
|
||||||
// e.g. when invoked from `packages/devkit/src/utils/convert-nx-executor.ts`
|
// e.g. when invoked from `packages/devkit/src/utils/convert-nx-executor.ts`
|
||||||
(includeProjectsFromAngularJson ||
|
(includeProjectsFromAngularJson ||
|
||||||
// Or if a workspace has `@nrwl/angular`/`@nx/angular` installed then projects from `angular.json` to be considered by Nx.
|
// Or if a workspace has `@nx/angular` installed then projects from `angular.json` to be considered by Nx.
|
||||||
isAngularPluginInstalled())
|
isAngularPluginInstalled())
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
@ -42,12 +42,7 @@ export function isAngularPluginInstalled() {
|
|||||||
require.resolve('@nx/angular');
|
require.resolve('@nx/angular');
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
try {
|
return false;
|
||||||
require.resolve('@nrwl/angular');
|
|
||||||
return true;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,8 +12,7 @@ import { existsSync } from 'fs';
|
|||||||
export function jsPluginConfig(
|
export function jsPluginConfig(
|
||||||
nxJson: NxJsonConfiguration
|
nxJson: NxJsonConfiguration
|
||||||
): Required<NrwlJsPluginConfig> {
|
): Required<NrwlJsPluginConfig> {
|
||||||
const nxJsonConfig: NrwlJsPluginConfig =
|
const nxJsonConfig: NrwlJsPluginConfig = nxJson?.pluginsConfig?.['@nx/js'];
|
||||||
nxJson?.pluginsConfig?.['@nx/js'] ?? nxJson?.pluginsConfig?.['@nrwl/js'];
|
|
||||||
|
|
||||||
// using lerna _before_ installing deps is causing an issue when parsing lockfile.
|
// using lerna _before_ installing deps is causing an issue when parsing lockfile.
|
||||||
// See: https://github.com/lerna/lerna/issues/3807
|
// See: https://github.com/lerna/lerna/issues/3807
|
||||||
@ -58,14 +57,7 @@ export function jsPluginConfig(
|
|||||||
packageJsonDeps['@nx/next'] ||
|
packageJsonDeps['@nx/next'] ||
|
||||||
packageJsonDeps['@nx/react'] ||
|
packageJsonDeps['@nx/react'] ||
|
||||||
packageJsonDeps['@nx/angular'] ||
|
packageJsonDeps['@nx/angular'] ||
|
||||||
packageJsonDeps['@nx/web'] ||
|
packageJsonDeps['@nx/web']
|
||||||
packageJsonDeps['@nrwl/workspace'] ||
|
|
||||||
packageJsonDeps['@nrwl/js'] ||
|
|
||||||
packageJsonDeps['@nrwl/node'] ||
|
|
||||||
packageJsonDeps['@nrwl/next'] ||
|
|
||||||
packageJsonDeps['@nrwl/react'] ||
|
|
||||||
packageJsonDeps['@nrwl/angular'] ||
|
|
||||||
packageJsonDeps['@nrwl/web']
|
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
analyzePackageJson: true,
|
analyzePackageJson: true,
|
||||||
|
|||||||
@ -173,9 +173,7 @@ function generateExecutorOverviewOutput({
|
|||||||
{
|
{
|
||||||
text:
|
text:
|
||||||
`${pluginName}:${name}` +
|
`${pluginName}:${name}` +
|
||||||
(pluginName.startsWith('@nrwl/')
|
(pluginName.startsWith('@nx/') ? chalk.dim(` (v${nxVersion})`) : ''),
|
||||||
? chalk.dim(` (v${nxVersion})`)
|
|
||||||
: ''),
|
|
||||||
padding: [1, 0, 0, 0],
|
padding: [1, 0, 0, 0],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -335,18 +333,12 @@ function generateLinkOutput({
|
|||||||
type: 'generators' | 'executors';
|
type: 'generators' | 'executors';
|
||||||
}): string {
|
}): string {
|
||||||
const nxPackagePrefix = '@nx/';
|
const nxPackagePrefix = '@nx/';
|
||||||
const nrwlPackagePrefix = '@nrwl/';
|
if (!pluginName.startsWith(nxPackagePrefix)) {
|
||||||
if (
|
|
||||||
!pluginName.startsWith(nxPackagePrefix) &&
|
|
||||||
!pluginName.startsWith(nrwlPackagePrefix)
|
|
||||||
) {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const link = `https://nx.dev/nx-api/${pluginName.substring(
|
const link = `https://nx.dev/nx-api/${pluginName.substring(
|
||||||
pluginName.startsWith(nxPackagePrefix)
|
nxPackagePrefix.length
|
||||||
? nxPackagePrefix.length
|
|
||||||
: nrwlPackagePrefix.length
|
|
||||||
)}/${type}/${name}`;
|
)}/${type}/${name}`;
|
||||||
|
|
||||||
return `\n\n${chalk.dim(
|
return `\n\n${chalk.dim(
|
||||||
|
|||||||
@ -201,25 +201,20 @@ async function getGithubStars(repos: { owner: string; repo: string }[]) {
|
|||||||
|
|
||||||
async function getNxVersion(data: any) {
|
async function getNxVersion(data: any) {
|
||||||
const latest = data['dist-tags'].latest;
|
const latest = data['dist-tags'].latest;
|
||||||
const nxPackages = [
|
const nxPackages = ['@nx/devkit', '@nx/workspace'];
|
||||||
'@nx/devkit',
|
|
||||||
'@nrwl/devkit',
|
|
||||||
'@nx/workspace',
|
|
||||||
'@nrwl/workspace',
|
|
||||||
];
|
|
||||||
let devkitVersion = '';
|
let devkitVersion = '';
|
||||||
for (let i = 0; i < nxPackages.length && !devkitVersion; i++) {
|
for (let i = 0; i < nxPackages.length && !devkitVersion; i++) {
|
||||||
const packageName = nxPackages[i];
|
const packageName = nxPackages[i];
|
||||||
if (data.versions[latest]?.dependencies) {
|
if (data.versions[latest]?.dependencies) {
|
||||||
devkitVersion = data.versions[latest]?.dependencies[packageName];
|
devkitVersion = data.versions[latest]?.dependencies[packageName];
|
||||||
if (devkitVersion) {
|
if (devkitVersion) {
|
||||||
return await findNxRange(packageName, devkitVersion);
|
return await findNxRange(devkitVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!devkitVersion && data.versions[latest]?.peerDependencies) {
|
if (!devkitVersion && data.versions[latest]?.peerDependencies) {
|
||||||
devkitVersion = data.versions[latest]?.peerDependencies[packageName];
|
devkitVersion = data.versions[latest]?.peerDependencies[packageName];
|
||||||
if (devkitVersion) {
|
if (devkitVersion) {
|
||||||
return await findNxRange(packageName, devkitVersion);
|
return await findNxRange(devkitVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,20 +222,17 @@ async function getNxVersion(data: any) {
|
|||||||
return devkitVersion;
|
return devkitVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findNxRange(packageName: string, devkitVersion: string) {
|
async function findNxRange(devkitVersion: string) {
|
||||||
devkitVersion = devkitVersion
|
devkitVersion = devkitVersion
|
||||||
.replace('^', '')
|
.replace('^', '')
|
||||||
.replace('>=', '')
|
.replace('>=', '')
|
||||||
.replace('>', '');
|
.replace('>', '');
|
||||||
const lookupPackage = packageName.includes('@nx')
|
|
||||||
? '@nx/devkit'
|
|
||||||
: '@nrwl/devkit';
|
|
||||||
const { data: devkitData } = await axios.get(
|
const { data: devkitData } = await axios.get(
|
||||||
`https://registry.npmjs.org/${lookupPackage}`
|
`https://registry.npmjs.org/@nx/devkit`
|
||||||
);
|
);
|
||||||
if (!devkitData.versions[devkitVersion]?.peerDependencies) {
|
if (!devkitData.versions[devkitVersion]?.peerDependencies) {
|
||||||
const dependencies = devkitData.versions[devkitVersion]?.dependencies;
|
const dependencies = devkitData.versions[devkitVersion]?.dependencies;
|
||||||
return dependencies && (dependencies?.nx || dependencies['@nrwl/tao']);
|
return dependencies?.nx;
|
||||||
}
|
}
|
||||||
return devkitData.versions[devkitVersion]?.peerDependencies.nx;
|
return devkitData.versions[devkitVersion]?.peerDependencies.nx;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user