Skip to content

Commit 73aa215

Browse files
committed
[changed] use 'npm run docs-build' instead of 'npm run build' for '--only-docs'
1 parent 602343a commit 73aa215

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ including `bower` publishing, for you - automatically.
3535
_Initial idea is got from `React-Bootstrap` release tools `./tools/release`,
3636
that have been written by [Matt Smith @mtscout6](https://github.com/mtscout6)_
3737

38-
#### Publishing of built documents static pages
38+
#### Documents pages publishing
3939

4040
If your project compiles static documentation pages (as e.g. `React-Boostrap` does)
4141
and needs to publish them to standalone repo / hosting (via `git push`),
@@ -71,7 +71,9 @@ this is as simple as:
7171
```
7272
> release --only-docs
7373
```
74-
In this case the `package.json` version will be bumped with `--preid docs` as `0.10.0` => `0.10.0-docs.0`
74+
In this case the `package.json` version will be bumped with `--preid docs` as `0.10.0` => `0.10.0-docs.0`.
75+
76+
If `npm run docs-build` script is present, then it will be used instead of `npm run build` script.
7577

7678
#### Pre-release versions publishing
7779

src/release.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const bowerRepo = configOptions.bowerRepo; // if it is not set, then there is no
4242
const docsRoot = path.join(repoRoot, (configOptions.docsRoot || 'docs-built/'));
4343
const tmpDocsRepo = path.join(repoRoot, (configOptions.tmpDocsRepo || 'tmp-docs-repo'));
4444
const docsRepo = configOptions.docsRepo; // if it is not set, then there is no docs/site repo
45+
const docsBuild = npmjson.scripts && npmjson.scripts['docs-build'];
4546

4647
const githubToken = process.env.GITHUB_TOKEN;
4748

@@ -234,12 +235,18 @@ function release({ type, preid, npmTagName }) {
234235
console.log('Completed: '.cyan + '"npm run test"'.green);
235236

236237
// npm run build
237-
if (npmjson.scripts.build && !skipBuildStep) {
238-
console.log('Running: '.cyan + 'build'.green);
239-
runAndGitRevertOnError('npm run build');
240-
console.log('Completed: '.cyan + 'build'.green);
238+
if (argv.onlyDocs && docsBuild) {
239+
console.log('Running: '.cyan + 'docs-build'.green);
240+
runAndGitRevertOnError('npm run docs-build');
241+
console.log('Completed: '.cyan + 'docs-build'.green);
241242
} else {
242-
console.log('Skipping "npm run build" step.'.yellow);
243+
if (npmjson.scripts.build && !skipBuildStep) {
244+
console.log('Running: '.cyan + 'build'.green);
245+
runAndGitRevertOnError('npm run build');
246+
console.log('Completed: '.cyan + 'build'.green);
247+
} else {
248+
console.log('Skipping "npm run build" step.'.yellow);
249+
}
243250
}
244251

245252
const vVersion = `v${newVersion}`;

0 commit comments

Comments
 (0)