cli: new new command

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-08-31 18:51:46 +02:00
parent ef8d8d88e5
commit 8d886dd33e
6 changed files with 64 additions and 36 deletions
+5
View File
@@ -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.
+14
View File
@@ -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"
```
+2 -3
View File
@@ -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",
+15 -29
View File
@@ -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 <name>
--option <name>=<value>
--scope <scope>
--npm-registry <URL>
--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 <scope>
--npm-registry <URL>
--no-private
-h, --help
```
### `backstage-cli info`
```
@@ -197,6 +169,20 @@ Options:
-h, --help
```
### `backstage-cli new`
```
Usage: backstage-cli new [options]
Options:
--select <name>
--option <name>=<value>
--scope <scope>
--npm-registry <URL>
--no-private
-h, --help
```
### `backstage-cli package`
```
+27 -3
View File
@@ -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 <name>',
'Select the thing you want to be creating upfront',
)
.option(
'--option <name>=<value>',
'Pre-fill options for the creation process',
(opt, arr: string[]) => [...arr, opt],
[],
)
.option('--scope <scope>', 'The scope to use for new packages')
.option(
'--npm-registry <URL>',
'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 <scope>', 'npm scope')
.option('--npm-registry <URL>', 'npm registry URL')
.option('--no-private', 'Public npm package')
@@ -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": [