Skip to content

Commit cb70a17

Browse files
committed
Merge pull request #22 from AlexKVal/no-docs-with-preid
[fixed] Do not publish documents with pre-releases
2 parents 3123038 + 2c2e4ad commit cb70a17

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ In this case the `package.json` version will be bumped with `--preid docs` as `0
9696

9797
If `npm run docs-build` script is present, then it will be used instead of `npm run build` script.
9898

99+
*Note: Documents are not published with pre-release version,
100+
(i.e. when you run it with `--preid` option).*
101+
99102
#### Pre-release versions publishing
100103

101104
Say you need to publish pre-release `v0.25.100-pre.0` version

src/release.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,6 @@ const yargsConf = yargs
105105

106106
const argv = yargsConf.argv;
107107

108-
let dryRunMode = argv.dryRun || defaultDryRun;
109-
if (argv.run) {
110-
dryRunMode = false;
111-
}
112-
if (dryRunMode) {
113-
console.log('DRY RUN'.magenta);
114-
if (defaultDryRun) console.log('For actual running of your command please add "--run" option'.yellow);
115-
}
116-
117-
if (argv.onlyDocs) console.log('Publish only documents'.magenta);
118-
119108
config.silent = !argv.verbose;
120109

121110
const versionBumpOptions = {
@@ -125,13 +114,25 @@ const versionBumpOptions = {
125114
};
126115

127116
if (versionBumpOptions.type === undefined && versionBumpOptions.preid === undefined) {
128-
console.log('Must provide either a version bump type, preid (or both)'.red);
117+
console.log('Must provide either a version bump type, "preid" or "--only-docs"'.red);
129118
console.log(yargsConf.help());
130119
exit(1);
131120
}
132121

133122
let notesForRelease = argv.notes;
134123

124+
let dryRunMode = argv.dryRun || defaultDryRun;
125+
if (argv.run) {
126+
dryRunMode = false;
127+
}
128+
if (dryRunMode) {
129+
console.log('DRY RUN'.magenta);
130+
if (defaultDryRun) console.log('For actual running of your command please add "--run" option'.yellow);
131+
}
132+
133+
if (argv.preid) console.log('"--preid" detected. Documents will not be published'.yellow);
134+
if (argv.onlyDocs && !argv.preid) console.log('Publish only documents'.yellow);
135+
135136

136137
//------------------------------------------------------------------------------
137138
// functions
@@ -395,7 +396,7 @@ function release({ type, preid, npmTagName }) {
395396
}
396397

397398
// documents site
398-
if (!isPrivate && docsRepo) {
399+
if (!isPrivate && !preid && docsRepo) {
399400
console.log('Releasing: '.cyan + 'documents site'.green);
400401
releaseAdRepo(docsRepo, docsRoot, tmpDocsRepo, vVersion);
401402
console.log('Documents site has been released'.green);

0 commit comments

Comments
 (0)