From d46d83feac4496e2f7ecad0af6322345213e05a9 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 25 Nov 2019 19:00:52 +0100 Subject: [PATCH] fix: deprecate --first-release and --release-count at shipjs prepare (#447) --- GUIDE.md | 11 +++-------- packages/shipjs/src/flow/prepare.js | 13 +++++++++++++ .../src/step/prepare/__tests__/printHelp.spec.js | 8 +------- packages/shipjs/src/step/prepare/printHelp.js | 12 +----------- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/GUIDE.md b/GUIDE.md index 39b77f0b..91990c44 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -77,9 +77,10 @@ You can get an access token from [here](https://github.com/settings/tokens). Or you can simply run `hub api user`, follow the instruction and it will generate the token and write the config file for you. ### Before running Shipjs + Shipjs compares previous version. -Before running the `shipjs` commands, you need release first version by yourself. +Before running the `shipjs` commands, you need release first version by yourself. Let's release first version with [yarn version](https://yarnpkg.com/en/docs/cli/version) commands. @@ -417,7 +418,7 @@ NAME shipjs prepare - Prepare a release. USAGE - shipjs prepare [--help] [--dir PATH] [--yes] [--first-release] [--release-count COUNT] [--dry-run] + shipjs prepare [--help] [--dir PATH] [--yes] [--dry-run] OPTIONS -h, --help @@ -429,12 +430,6 @@ OPTIONS -y, --yes Skip all the interactive prompts and use the default values. - -f, --first-release - Generate the CHANGELOG for the first time - - -r, --release-count COUNT - How many releases to be generated from the latest - -D, --dry-run Displays the steps without actually doing them. ``` diff --git a/packages/shipjs/src/flow/prepare.js b/packages/shipjs/src/flow/prepare.js index d9b0d0f9..fba0f332 100644 --- a/packages/shipjs/src/flow/prepare.js +++ b/packages/shipjs/src/flow/prepare.js @@ -20,6 +20,9 @@ import createPullRequest from '../step/prepare/createPullRequest'; import notifyPrepared from '../step/prepare/notifyPrepared'; import finished from '../step/finished'; +import { print } from '../util'; +import { warning } from '../color'; + async function prepare({ help = false, dir = '.', @@ -36,6 +39,7 @@ async function prepare({ if (dryRun) { printDryRunBanner(); } + printDeprecated({ firstRelease, releaseCount }); checkHub(); const config = loadConfig(dir); const { currentVersion, baseBranch } = validate({ config, dir }); @@ -97,6 +101,15 @@ const arg = { '-N': '--no-browse', }; +function printDeprecated({ firstRelease, releaseCount }) { + if (firstRelease) { + print(warning(`DEPRECATED: --first-release, -f`)); + } + if (releaseCount) { + print(warning(`DEPRECATED: --release-count, -r`)); + } +} + export default { arg, fn: prepare, diff --git a/packages/shipjs/src/step/prepare/__tests__/printHelp.spec.js b/packages/shipjs/src/step/prepare/__tests__/printHelp.spec.js index 7f909314..dda8ed14 100644 --- a/packages/shipjs/src/step/prepare/__tests__/printHelp.spec.js +++ b/packages/shipjs/src/step/prepare/__tests__/printHelp.spec.js @@ -13,7 +13,7 @@ describe('printHelp', () => { shipjs prepare - Prepare a release. USAGE - shipjs prepare [--help] [--dir PATH] [--yes] [--first-release] [--release-count COUNT] [--dry-run] [--no-browse] + shipjs prepare [--help] [--dir PATH] [--yes] [--dry-run] [--no-browse] OPTIONS -h, --help @@ -25,12 +25,6 @@ describe('printHelp', () => { -y, --yes Skip all the interactive prompts and use the default values. - -f, --first-release - Generate the CHANGELOG for the first time - - -r, --release-count COUNT - How many releases to be generated from the latest - -D, --dry-run Displays the steps without actually doing them. diff --git a/packages/shipjs/src/step/prepare/printHelp.js b/packages/shipjs/src/step/prepare/printHelp.js index 111c1054..4bae951b 100644 --- a/packages/shipjs/src/step/prepare/printHelp.js +++ b/packages/shipjs/src/step/prepare/printHelp.js @@ -9,13 +9,9 @@ export default () => const help = `--help`; const dir = `--dir ${underline('PATH')}`; const yes = `--yes`; - const firstRelease = `--first-release`; - const releaseCount = `--release-count ${underline('COUNT')}`; const dryRun = `--dry-run`; const noBrowse = `--no-browse`; - const all = [help, dir, yes, firstRelease, releaseCount, dryRun, noBrowse] - .map(x => `[${x}]`) - .join(' '); + const all = [help, dir, yes, dryRun, noBrowse].map(x => `[${x}]`).join(' '); const messages = [ bold('NAME'), @@ -38,12 +34,6 @@ export default () => indent(`-y, ${yes}`), indent(' Skip all the interactive prompts and use the default values.'), '', - indent(`-f, ${firstRelease}`), - indent(' Generate the CHANGELOG for the first time'), - '', - indent(`-r, ${releaseCount}`), - indent(' How many releases to be generated from the latest'), - '', indent(`-D, ${dryRun}`), indent(' Displays the steps without actually doing them.'), '',