build(docs-infra): make the git ref for cli command docs configurable (#26391)

PR Close #26391
This commit is contained in:
George Kalpakas 2018-10-11 11:52:27 +03:00 committed by Miško Hevery
parent 7acdad6921
commit 67608a907e
3 changed files with 17 additions and 11 deletions

View File

@ -1 +1,3 @@
/node_modules
package.json
yarn.lock

View File

@ -1,5 +0,0 @@
{
"dependencies": {
"@angular/cli": "https://github.com/angular/cli-builds#master"
}
}

View File

@ -1,7 +1,16 @@
const shelljs = require('shelljs');
const {resolve} = require('canonical-path');
const sh = require('shelljs');
const {CONTENTS_PATH} = require('../config');
shelljs.cd(resolve(CONTENTS_PATH, 'cli-src'));
shelljs.exec('git clean -Xfd');
shelljs.exec('yarn install');
const cliGitRef = process.argv[2] || 'master'; // Can be a branch, commit or tag.
const pkgContent = JSON.stringify({
dependencies: {
'@angular/cli': `https://github.com/angular/cli-builds#${cliGitRef}`,
},
}, null, 2);
sh.set('-e');
sh.cd(resolve(CONTENTS_PATH, 'cli-src'));
sh.exec('git clean -Xfd');
sh.echo(pkgContent).to('package.json');
sh.exec('yarn install --no-lockfile --non-interactive');