Skip to content

Commit

Permalink
chore(docs): Add publishdocs script
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed May 3, 2017
1 parent 4cdc307 commit 1b34e08
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"watch": "karma start --singleRun=false --autoWatch=true --autoWatchInterval=1",
"debug": "karma start --singleRun=false --autoWatch=true --autoWatchInterval=1 --browsers=Chrome",
"docs": "./scripts/docs.js",
"publishdocs": "node scripts/publishdocs.js",
"artifacts": "node scripts/artifact_tagging.js"
},
"homepage": "https://ui-router.github.io",
Expand Down
39 changes: 39 additions & 0 deletions scripts/publishdocs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!env node

let package = require('../package.json').name;
let version = require('../package.json').version;

let corePackage = require('../../core/package.json').name;
let coreVersion = require('../../core/package.json').version;

let PAGES_DIR = "../ui-router.github.io";
let sh = require('shelljs');
let readlineSync = require('readline-sync');
let fs = require('fs');
let path = require('path');
let util = require('./util');
let _exec = util._exec;


sh.cd(path.join(__dirname, '..'));
if (!fs.existsSync(PAGES_DIR)) {
throw new Error("not found: " + PAGES_DIR);
}

if (!readlineSync.keyInYN(`Generate/publish docs from your local copies of ${package}@${version} and ${corePackage}@${coreVersion} ?`)) {
process.exit(1);
}

_exec('npm run docs');

sh.rm('-rf', PAGES_DIR + '/_ng1_docs/latest');
sh.cp('-r', '_doc', PAGES_DIR + '/_ng1_docs/latest');
sh.cp('-r', '_doc', PAGES_DIR + '/_ng1_docs/' + version);
sh.cd(PAGES_DIR + "/_ng1_docs/");
_exec("./process_docs.sh");
_exec("git add .");

sh.echo("\n\nSpot check the docs, then run these commands to publish:\n\n");
sh.echo("cd " + PAGES_DIR);
sh.echo(`git commit -m 'publish docs for ${version}'`);
sh.echo(`git push`);

0 comments on commit 1b34e08

Please sign in to comment.