Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deprecate --first-release and --release-count at shipjs prepare #447

Merged
merged 2 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand All @@ -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.
```
Expand Down
13 changes: 13 additions & 0 deletions packages/shipjs/src/flow/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '.',
Expand All @@ -36,6 +39,7 @@ async function prepare({
if (dryRun) {
printDryRunBanner();
}
printDeprecated({ firstRelease, releaseCount });
checkHub();
const config = loadConfig(dir);
const { currentVersion, baseBranch } = validate({ config, dir });
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 1 addition & 7 deletions packages/shipjs/src/step/prepare/__tests__/printHelp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down
12 changes: 1 addition & 11 deletions packages/shipjs/src/step/prepare/printHelp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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.'),
'',
Expand Down