From 6266ddd1130cae25af1ad15a52744e6c3e4dd35e Mon Sep 17 00:00:00 2001 From: Stefan Buck Date: Thu, 18 Feb 2021 22:00:09 +0100 Subject: [PATCH] chore: remove app:diff command from cli --- .changeset/unlucky-ducks-report.md | 5 ++ docs/cli/commands.md | 20 -------- packages/cli/src/commands/app/diff.ts | 74 --------------------------- packages/cli/src/commands/index.ts | 7 --- 4 files changed, 5 insertions(+), 101 deletions(-) create mode 100644 .changeset/unlucky-ducks-report.md delete mode 100644 packages/cli/src/commands/app/diff.ts diff --git a/.changeset/unlucky-ducks-report.md b/.changeset/unlucky-ducks-report.md new file mode 100644 index 0000000000..4f361a6279 --- /dev/null +++ b/.changeset/unlucky-ducks-report.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +The `yarn backstage-cli app:diff` has been broken since a couple of months. The command to perform updates `yarn backstage-cli versions:bump` prints change logs which seems to be a good replacement for this command. diff --git a/docs/cli/commands.md b/docs/cli/commands.md index ea72f7e050..5a68690615 100644 --- a/docs/cli/commands.md +++ b/docs/cli/commands.md @@ -24,7 +24,6 @@ Below is a cleaned up output of `yarn backstage-cli --help`. ```text app:build Build an app for a production release -app:diff Diff an existing app with the creation template app:serve Serve an app for local development backend:build Build a backend plugin @@ -112,25 +111,6 @@ Options: -h, --help display help for command ``` -## app:diff - -Scope: `app` - -Diff an existing app with the template used in `@backstage/create-app`. This -will verify that your app package has not diverged from the template, and can be -useful to run after updating the version of `@backstage/cli` in your app. - -This command is experimental and may be removed in the future. - -```text -Usage: backstage-cli app:diff - -Options: - --check Fail if changes are required - --yes Apply all changes - -h, --help display help for command -``` - ## app:serve Scope: `app` diff --git a/packages/cli/src/commands/app/diff.ts b/packages/cli/src/commands/app/diff.ts deleted file mode 100644 index a667407f23..0000000000 --- a/packages/cli/src/commands/app/diff.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Command } from 'commander'; -import { - diffTemplateFiles, - handlers, - handleAllFiles, - inquirerPromptFunc, - makeCheckPromptFunc, - yesPromptFunc, -} from '../../lib/diff'; -import { version } from '../../lib/version'; - -const fileHandlers = [ - { - patterns: ['packages/app/package.json'], - handler: handlers.appPackageJson, - }, - { - patterns: [/tsconfig\.json$/], - handler: handlers.exactMatch, - }, - { - patterns: [ - /README\.md$/, - /\.eslintrc\.js$/, - // make sure files in 1st level of src/ and dev/ exist - /^packages\/app\/(src|dev)\/[^/]+$/, - ], - handler: handlers.exists, - }, - { - patterns: [ - 'lerna.json', - /^src\//, - /^patches\//, - /^packages\/app\/public\//, - /^packages\/app\/cypress/, - // Let plugin:diff take care of the plugins - /^plugins/, - /package\.json$/, - ], - handler: handlers.skip, - }, -]; - -export default async (cmd: Command) => { - let promptFunc = inquirerPromptFunc; - let finalize = () => {}; - - if (cmd.check) { - [promptFunc, finalize] = makeCheckPromptFunc(); - } else if (cmd.yes) { - promptFunc = yesPromptFunc; - } - - const templateFiles = await diffTemplateFiles('default-app', { version }); - await handleAllFiles(fileHandlers, templateFiles, promptFunc); - await finalize(); -}; diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index 1d267c6889..e058aaf696 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -76,13 +76,6 @@ export function registerCommands(program: CommanderStatic) { .option(...configOption) .action(lazy(() => import('./backend/dev').then(m => m.default))); - program - .command('app:diff') - .option('--check', 'Fail if changes are required') - .option('--yes', 'Apply all changes') - .description('Diff an existing app with the creation template') - .action(lazy(() => import('./app/diff').then(m => m.default))); - program .command('create-plugin') .option(