From bf3a05773205f3e3341ab9c472614e4b824eac3b Mon Sep 17 00:00:00 2001 From: FrozenPandaz Date: Wed, 5 Apr 2023 10:57:58 -0400 Subject: [PATCH] feat(core): remove @nrwl/cli --- CONTRIBUTING.md | 2 +- .../packages/jest/documents/overview.md | 2 +- docs/shared/packages/jest/jest-plugin.md | 2 +- packages/cli/.eslintrc.json | 19 ------ packages/cli/README.md | 11 ---- packages/cli/bin/nx.ts | 3 - packages/cli/jest.config.ts | 11 ---- packages/cli/lib/decorate-cli.ts | 1 - packages/cli/package.json | 34 ---------- packages/cli/project.json | 66 ------------------- packages/cli/tsconfig.json | 16 ----- packages/cli/tsconfig.lib.json | 17 ----- packages/cli/tsconfig.spec.json | 22 ------- packages/nx/bin/nx.ts | 2 + packages/nx/migrations.json | 6 ++ packages/nx/package.json | 1 - packages/nx/project.json | 3 - packages/nx/src/command-line/migrate.ts | 1 - .../update-16-0-0/remove-nrwl-cli.ts | 17 +++++ packages/workspace/package.json | 1 - scripts/depcheck/missing.ts | 2 +- tsconfig.base.json | 2 - 22 files changed, 29 insertions(+), 212 deletions(-) delete mode 100644 packages/cli/.eslintrc.json delete mode 100644 packages/cli/README.md delete mode 100644 packages/cli/bin/nx.ts delete mode 100644 packages/cli/jest.config.ts delete mode 100644 packages/cli/lib/decorate-cli.ts delete mode 100644 packages/cli/package.json delete mode 100644 packages/cli/project.json delete mode 100644 packages/cli/tsconfig.json delete mode 100644 packages/cli/tsconfig.lib.json delete mode 100644 packages/cli/tsconfig.spec.json create mode 100644 packages/nx/src/migrations/update-16-0-0/remove-nrwl-cli.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5e55a4e9a1165d..3020277a7ee8ed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,7 +70,7 @@ If you have problems publishing, make sure you use Node 18 and NPM 8. **NOTE:** After you finish with local testing don't forget to stop the local registry (e.g. closing the Terminal 1) and disabling the local registy using `yarn local-registry disable`. Keeping local registry enabled will change your lock file resolutions to `localhost:4873` on the next `yarn install`. You can also run `yarn local-registry clear` to clean all packages in that local registry. -**NOTE:** To use this newly published local version, you need to make a new workspace or change all of your target packages to this new version, eg: `"@nrwl/cli": "^16.0.0",` and re-run `yarn install` in your testing project. +**NOTE:** To use this newly published local version, you need to make a new workspace or change all of your target packages to this new version, eg: `"nx": "^16.0.0",` and re-run `yarn install` in your testing project. ### Publishing for Yarn 2+ (Berry) diff --git a/docs/generated/packages/jest/documents/overview.md b/docs/generated/packages/jest/documents/overview.md index b81dd1351243c8..7549a52022ace6 100644 --- a/docs/generated/packages/jest/documents/overview.md +++ b/docs/generated/packages/jest/documents/overview.md @@ -153,7 +153,7 @@ export default { If your code editor doesn't provide a way to debug your tests, you can leverage the Chrome DevTools to debug your tests with the `--inspect-brk` flag for node. ```shell -node --inspect-brk ./node_modules/@nrwl/cli/bin/nx test +node --inspect-brk ./node_modules/nx/bin/nx.js test ``` Enter [chrome://inspect](chrome://inspect) in Chrome address bar and inspect the target to attach to the node process. Visit the official [Jest documentation](https://jestjs.io/docs/en/troubleshooting#tests-are-failing-and-you-don-t-know-why) to find out more. diff --git a/docs/shared/packages/jest/jest-plugin.md b/docs/shared/packages/jest/jest-plugin.md index b81dd1351243c8..7549a52022ace6 100644 --- a/docs/shared/packages/jest/jest-plugin.md +++ b/docs/shared/packages/jest/jest-plugin.md @@ -153,7 +153,7 @@ export default { If your code editor doesn't provide a way to debug your tests, you can leverage the Chrome DevTools to debug your tests with the `--inspect-brk` flag for node. ```shell -node --inspect-brk ./node_modules/@nrwl/cli/bin/nx test +node --inspect-brk ./node_modules/nx/bin/nx.js test ``` Enter [chrome://inspect](chrome://inspect) in Chrome address bar and inspect the target to attach to the node process. Visit the official [Jest documentation](https://jestjs.io/docs/en/troubleshooting#tests-are-failing-and-you-don-t-know-why) to find out more. diff --git a/packages/cli/.eslintrc.json b/packages/cli/.eslintrc.json deleted file mode 100644 index 5354eb31ef7048..00000000000000 --- a/packages/cli/.eslintrc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../.eslintrc", - "rules": {}, - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/packages/cli/README.md b/packages/cli/README.md deleted file mode 100644 index 37eb64ddbdbef1..00000000000000 --- a/packages/cli/README.md +++ /dev/null @@ -1,11 +0,0 @@ -

Nx - Smart, Fast and Extensible Build System

- -{{links}} - -
- -# Nx: Smart, Fast and Extensible Build System - -Nx is a next generation build system with first class monorepo support and powerful integrations. - -{{content}} diff --git a/packages/cli/bin/nx.ts b/packages/cli/bin/nx.ts deleted file mode 100644 index e906e77b5a0037..00000000000000 --- a/packages/cli/bin/nx.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node - -require('nx/bin/nx'); diff --git a/packages/cli/jest.config.ts b/packages/cli/jest.config.ts deleted file mode 100644 index f3ac86d00561e2..00000000000000 --- a/packages/cli/jest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -export default { - transform: { - '^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], - globals: {}, - displayName: 'cli', - testEnvironment: 'node', - preset: '../../jest.preset.js', -}; diff --git a/packages/cli/lib/decorate-cli.ts b/packages/cli/lib/decorate-cli.ts deleted file mode 100644 index fbb9636c447e0e..00000000000000 --- a/packages/cli/lib/decorate-cli.ts +++ /dev/null @@ -1 +0,0 @@ -export * from 'nx/src/adapter/decorate-cli'; diff --git a/packages/cli/package.json b/packages/cli/package.json deleted file mode 100644 index 9c5ad8ce714260..00000000000000 --- a/packages/cli/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "@nrwl/cli", - "version": "0.0.1", - "private": false, - "description": "Smart, Fast and Extensible Build System", - "repository": { - "type": "git", - "url": "https://github.com/nrwl/nx.git", - "directory": "packages/cli" - }, - "keywords": [ - "Monorepo", - "Angular", - "React", - "Web", - "Node", - "Nest", - "Jest", - "Cypress", - "CLI" - ], - "author": "Victor Savkin", - "license": "MIT", - "bugs": { - "url": "https://github.com/nrwl/nx/issues" - }, - "homepage": "https://nx.dev", - "dependencies": { - "nx": "file:../nx" - }, - "publishConfig": { - "access": "public" - } -} diff --git a/packages/cli/project.json b/packages/cli/project.json deleted file mode 100644 index ff54093a3ebf44..00000000000000 --- a/packages/cli/project.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "cli", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/cli", - "projectType": "library", - "targets": { - "test": {}, - "build-base": { - "executor": "@nrwl/js:tsc", - "options": { - "main": "packages/cli/bin/nx.ts", - "assets": [ - { - "input": "packages/cli", - "glob": "**/files/**", - "output": "/" - }, - { - "input": "packages/cli", - "glob": "**/files/**/.gitkeep", - "output": "/" - }, - { - "input": "packages/cli", - "glob": "**/*.json", - "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"], - "output": "/" - }, - { - "input": "packages/cli", - "glob": "**/*.js", - "ignore": ["**/jest.config.js"], - "output": "/" - }, - { - "input": "packages/cli", - "glob": "**/*.d.ts", - "output": "/" - }, - { - "input": "", - "glob": "LICENSE", - "output": "/" - } - ] - } - }, - "build": { - "executor": "nx:run-commands", - "outputs": ["{workspaceRoot}/build/packages/cli"], - "options": { - "commands": [ - { - "command": "node ./scripts/chmod build/packages/cli/bin/nx.js" - }, - { - "command": "node ./scripts/copy-readme.js cli" - } - ], - "parallel": false - } - }, - "lint": {} - }, - "implicitDependencies": ["workspace"] -} diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json deleted file mode 100644 index 58bd2c97a66f5e..00000000000000 --- a/packages/cli/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "types": ["node", "jest"] - }, - "include": [], - "files": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/packages/cli/tsconfig.lib.json b/packages/cli/tsconfig.lib.json deleted file mode 100644 index 1d2ddef3c1be3a..00000000000000 --- a/packages/cli/tsconfig.lib.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, - "types": ["node"] - }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*_spec.ts", - "**/*_test.ts", - "jest.config.ts" - ], - "include": ["**/*.ts"] -} diff --git a/packages/cli/tsconfig.spec.json b/packages/cli/tsconfig.spec.json deleted file mode 100644 index 869c90c526a0fe..00000000000000 --- a/packages/cli/tsconfig.spec.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*_spec.ts", - "**/*_test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", - "**/*.d.ts", - "jest.config.ts" - ] -} diff --git a/packages/nx/bin/nx.ts b/packages/nx/bin/nx.ts index 66fcd97dc381e7..cf34ee21e120a7 100644 --- a/packages/nx/bin/nx.ts +++ b/packages/nx/bin/nx.ts @@ -115,6 +115,7 @@ function resolveNx(workspace: WorkspaceTypeAndRoot | null) { paths: workspace ? [workspace.dir] : undefined, }); } catch { + // TODO(v17): Remove this // fallback for old CLI install setup return require.resolve('@nrwl/cli/bin/nx.js', { paths: workspace ? [workspace.dir] : undefined, @@ -164,6 +165,7 @@ function warnIfUsingOutdatedGlobalInstall( } function getLocalNxVersion(workspace: WorkspaceTypeAndRoot): string | null { + // TODO(v17): Remove @nrwl/cli from this list const localNxPackages = ['nx', '@nrwl/tao', '@nrwl/cli']; for (const pkg of localNxPackages) { try { diff --git a/packages/nx/migrations.json b/packages/nx/migrations.json index 6611c37444a876..d944ff976f5a1e 100644 --- a/packages/nx/migrations.json +++ b/packages/nx/migrations.json @@ -53,6 +53,12 @@ "version": "15.8.2-beta.0", "description": "Updates the nx wrapper.", "implementation": "./src/migrations/update-15-8-2/update-nxw" + }, + "16.0.0-remove-nrwl-cli": { + "cli": "nx", + "version": "16.0.0-beta.0", + "description": "Remove @nrwl/cli.", + "implementation": "./src/migrations/update-16-0-0/remove-nrwl-cli" } } } diff --git a/packages/nx/package.json b/packages/nx/package.json index 1a4bc29f0ce84c..2a0cdb17dae9fa 100644 --- a/packages/nx/package.json +++ b/packages/nx/package.json @@ -97,7 +97,6 @@ "@nrwl/linter", "@nrwl/workspace", "@nrwl/angular", - "@nrwl/cli", "@nrwl/cypress", "@nrwl/detox", "@nrwl/devkit", diff --git a/packages/nx/project.json b/packages/nx/project.json index 95c2bc6d70aa4b..944192a27e3402 100644 --- a/packages/nx/project.json +++ b/packages/nx/project.json @@ -86,9 +86,6 @@ { "command": "node ./scripts/copy-readme.js nx" }, - { - "command": "node ./scripts/add-dependency-to-build.js nx @nrwl/cli" - }, { "command": "node ./scripts/add-dependency-to-build.js nx @nrwl/tao" } diff --git a/packages/nx/src/command-line/migrate.ts b/packages/nx/src/command-line/migrate.ts index b94fd8d6692471..52dc38d6466576 100644 --- a/packages/nx/src/command-line/migrate.ts +++ b/packages/nx/src/command-line/migrate.ts @@ -610,7 +610,6 @@ const LEGACY_NRWL_PACKAGE_GROUP: ArrayPackageGroup = [ { package: '@nrwl/storybook', version: '*' }, { package: '@nrwl/web', version: '*' }, { package: '@nrwl/js', version: '*' }, - { package: '@nrwl/cli', version: '*' }, { package: '@nrwl/nx-cloud', version: 'latest' }, { package: '@nrwl/react-native', version: '*' }, { package: '@nrwl/detox', version: '*' }, diff --git a/packages/nx/src/migrations/update-16-0-0/remove-nrwl-cli.ts b/packages/nx/src/migrations/update-16-0-0/remove-nrwl-cli.ts new file mode 100644 index 00000000000000..f13430e58ec2b3 --- /dev/null +++ b/packages/nx/src/migrations/update-16-0-0/remove-nrwl-cli.ts @@ -0,0 +1,17 @@ +import { Tree } from '../../generators/tree'; +import { formatChangedFilesWithPrettierIfAvailable } from '../../generators/internal-utils/format-changed-files-with-prettier-if-available'; +import { updateJson } from '../../generators/utils/json'; + +export default async function (tree: Tree) { + updateJson(tree, 'package.json', (json) => { + for (const deps of [json.dependencies, json.devDependencies]) { + if (deps) { + delete deps['@nrwl/cli']; + } + } + + return json; + }); + + await formatChangedFilesWithPrettierIfAvailable(tree); +} diff --git a/packages/workspace/package.json b/packages/workspace/package.json index 0910daf7445e6b..1648a980f92aad 100644 --- a/packages/workspace/package.json +++ b/packages/workspace/package.json @@ -37,7 +37,6 @@ "@nrwl/jest": "*", "@nrwl/linter": "*", "@nrwl/angular": "*", - "@nrwl/cli": "*", "@nrwl/cypress": "*", "@nrwl/detox": "*", "@nrwl/devkit": "*", diff --git a/scripts/depcheck/missing.ts b/scripts/depcheck/missing.ts index 174c6adbbf4179..b653377f9f950d 100644 --- a/scripts/depcheck/missing.ts +++ b/scripts/depcheck/missing.ts @@ -8,7 +8,6 @@ const IGNORE_MATCHES_IN_PACKAGE = { 'prettier', 'typescript', 'rxjs', - '@nrwl/cli', '@nrwl/workspace', // These are installed as needed and should not be added to package.json '@nrwl/cypress', @@ -138,6 +137,7 @@ const IGNORE_MATCHES_IN_PACKAGE = { '@angular-devkit/architect', '@angular/cli', '@nrwl/angular', + '@nrwl/cli', '@nestjs/cli', // nx init nest makes use of nestjs cli (which should be available in NestJS CLI app) to parse the nest-cli.json file 'ts-node', // We *may* fall back on ts-node, but we want to encourage the use of @swc-node instead so we don't explicitly list ts-node as an optional dep '@nrwl/nx-android-arm-eabi', // native optional deps diff --git a/tsconfig.base.json b/tsconfig.base.json index 88456cbebb59b8..4673491aff46c9 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -19,8 +19,6 @@ "paths": { "@nrwl/angular": ["packages/angular"], "@nrwl/angular/*": ["packages/angular/*"], - "@nrwl/cli": ["packages/cli"], - "@nrwl/cli/*": ["packages/cli/*"], "@nrwl/cypress": ["packages/cypress"], "@nrwl/cypress/*": ["packages/cypress/*"], "@nrwl/detox": ["packages/detox"],