diff --git a/.changeset/afraid-garlics-glow.md b/.changeset/afraid-garlics-glow.md new file mode 100644 index 0000000000..dfe2596869 --- /dev/null +++ b/.changeset/afraid-garlics-glow.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +The `create-plugin` and `create` commands have both been deprecated in favor of a new `new` command. The `new` command is functionally identical to `create`, but the new naming makes it possible to use as yarn script, since `yarn create` is reserved. diff --git a/.changeset/selfish-wasps-cough.md b/.changeset/selfish-wasps-cough.md new file mode 100644 index 0000000000..cc00520385 --- /dev/null +++ b/.changeset/selfish-wasps-cough.md @@ -0,0 +1,14 @@ +--- +'@backstage/create-app': patch +--- + +Added `yarn new` as one of the scripts installed by default, which calls `backstage-cli new`. This script replaces `create-plugin`, which you can now remove if you want to. It is kept in the `create-app` template for backwards compatibility. + +The `remove-plugin` command has been removed, as it has been removed from the Backstage CLI. + +To apply these changes to an existing app, make the following change to the root `package.json`: + +```diff +- "remove-plugin": "backstage-cli remove-plugin" ++ "new": "backstage-cli new --scope internal" +``` diff --git a/package.json b/package.json index 6cad8106a1..77ee1dccc5 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,8 @@ "lint:all": "backstage-cli repo lint", "lint:type-deps": "node scripts/check-type-dependencies.js", "docker-build": "yarn tsc && yarn workspace example-backend build --build-dependencies && yarn workspace example-backend build-image", - "backstage-create": "backstage-cli create --scope backstage --no-private", - "create-plugin": "yarn backstage-create --select plugin", - "remove-plugin": "backstage-cli remove-plugin", + "new": "backstage-cli new --scope backstage --no-private", + "create-plugin": "echo \"use 'yarn new' instead\"", "release": "node scripts/prepare-release.js && changeset version && yarn diff --yes && yarn prettier --write '{packages,plugins}/*/{package.json,CHANGELOG.md}' '.changeset/*.json' && yarn install --no-immutable", "prettier:check": "prettier --check .", "lerna": "lerna", diff --git a/packages/cli/cli-report.md b/packages/cli/cli-report.md index 14e548eeaf..1c86c8723c 100644 --- a/packages/cli/cli-report.md +++ b/packages/cli/cli-report.md @@ -12,8 +12,7 @@ Options: -h, --help Commands: - create [options] - create-plugin [options] + new [options] plugin:diff [options] test config:docs [options] @@ -100,20 +99,6 @@ Options: -h, --help ``` -### `backstage-cli create` - -``` -Usage: backstage-cli create [options] - -Options: - --select - --option = - --scope - --npm-registry - --no-private - -h, --help -``` - ### `backstage-cli create-github-app` ``` @@ -123,19 +108,6 @@ Options: -h, --help ``` -### `backstage-cli create-plugin` - -``` -Usage: backstage-cli create-plugin [options] - -Options: - --backend - --scope - --npm-registry - --no-private - -h, --help -``` - ### `backstage-cli info` ``` @@ -197,6 +169,20 @@ Options: -h, --help ``` +### `backstage-cli new` + +``` +Usage: backstage-cli new [options] + +Options: + --select + --option = + --scope + --npm-registry + --no-private + -h, --help +``` + ### `backstage-cli package` ``` diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index 9c543f8853..07c9ac92d1 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -198,7 +198,7 @@ export function registerMigrateCommand(program: Command) { export function registerCommands(program: Command) { program - .command('create') + .command('new') .storeOptionsAsProperties(false) .description( 'Open up an interactive guide to creating new things in your app', @@ -222,12 +222,36 @@ export function registerCommands(program: Command) { .action(lazy(() => import('./create/create').then(m => m.default))); program - .command('create-plugin') + .command('create', { hidden: true }) + .storeOptionsAsProperties(false) + .description( + 'Open up an interactive guide to creating new things in your app [DEPRECATED]', + ) + .option( + '--select ', + 'Select the thing you want to be creating upfront', + ) + .option( + '--option =', + 'Pre-fill options for the creation process', + (opt, arr: string[]) => [...arr, opt], + [], + ) + .option('--scope ', 'The scope to use for new packages') + .option( + '--npm-registry ', + 'The package registry to use for new packages', + ) + .option('--no-private', 'Do not mark new packages as private') + .action(lazy(() => import('./create/create').then(m => m.default))); + + program + .command('create-plugin', { hidden: true }) .option( '--backend', 'Create plugin with the backend dependencies as default', ) - .description('Creates a new plugin in the current repository') + .description('Creates a new plugin in the current repository [DEPRECATED]') .option('--scope ', 'npm scope') .option('--npm-registry ', 'npm registry URL') .option('--no-private', 'Public npm package') diff --git a/packages/create-app/templates/default-app/package.json.hbs b/packages/create-app/templates/default-app/package.json.hbs index 26c6a61972..9e20ebfa64 100644 --- a/packages/create-app/templates/default-app/package.json.hbs +++ b/packages/create-app/templates/default-app/package.json.hbs @@ -21,7 +21,7 @@ "lint:all": "backstage-cli repo lint", "prettier:check": "prettier --check .", "create-plugin": "backstage-cli create-plugin --scope internal", - "remove-plugin": "backstage-cli remove-plugin" + "new": "backstage-cli new --scope internal" }, "workspaces": { "packages": [