Skip to content

Commit

Permalink
[changed] use 'npm run docs-build' instead of 'npm run build' for '--…
Browse files Browse the repository at this point in the history
…only-docs'
  • Loading branch information
AlexKVal committed Sep 16, 2015
1 parent 602343a commit 73aa215
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ including `bower` publishing, for you - automatically.
_Initial idea is got from `React-Bootstrap` release tools `./tools/release`,
that have been written by [Matt Smith @mtscout6](https://github.com/mtscout6)_

#### Publishing of built documents static pages
#### Documents pages publishing

If your project compiles static documentation pages (as e.g. `React-Boostrap` does)
and needs to publish them to standalone repo / hosting (via `git push`),
Expand Down Expand Up @@ -71,7 +71,9 @@ this is as simple as:
```
> release --only-docs
```
In this case the `package.json` version will be bumped with `--preid docs` as `0.10.0` => `0.10.0-docs.0`
In this case the `package.json` version will be bumped with `--preid docs` as `0.10.0` => `0.10.0-docs.0`.

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

#### Pre-release versions publishing

Expand Down
17 changes: 12 additions & 5 deletions src/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const bowerRepo = configOptions.bowerRepo; // if it is not set, then there is no
const docsRoot = path.join(repoRoot, (configOptions.docsRoot || 'docs-built/'));
const tmpDocsRepo = path.join(repoRoot, (configOptions.tmpDocsRepo || 'tmp-docs-repo'));
const docsRepo = configOptions.docsRepo; // if it is not set, then there is no docs/site repo
const docsBuild = npmjson.scripts && npmjson.scripts['docs-build'];

const githubToken = process.env.GITHUB_TOKEN;

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

// npm run build
if (npmjson.scripts.build && !skipBuildStep) {
console.log('Running: '.cyan + 'build'.green);
runAndGitRevertOnError('npm run build');
console.log('Completed: '.cyan + 'build'.green);
if (argv.onlyDocs && docsBuild) {
console.log('Running: '.cyan + 'docs-build'.green);
runAndGitRevertOnError('npm run docs-build');
console.log('Completed: '.cyan + 'docs-build'.green);
} else {
console.log('Skipping "npm run build" step.'.yellow);
if (npmjson.scripts.build && !skipBuildStep) {
console.log('Running: '.cyan + 'build'.green);
runAndGitRevertOnError('npm run build');
console.log('Completed: '.cyan + 'build'.green);
} else {
console.log('Skipping "npm run build" step.'.yellow);
}
}

const vVersion = `v${newVersion}`;
Expand Down

0 comments on commit 73aa215

Please sign in to comment.