From 67608a907ed310af9496e8bd5c4d8f9e671f280e Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 11 Oct 2018 11:52:27 +0300 Subject: [PATCH] build(docs-infra): make the git ref for cli command docs configurable (#26391) PR Close #26391 --- aio/content/cli-src/.gitignore | 4 +++- aio/content/cli-src/package.json | 5 ----- .../cli-docs-package/extract-cli-commands.js | 19 ++++++++++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) delete mode 100644 aio/content/cli-src/package.json diff --git a/aio/content/cli-src/.gitignore b/aio/content/cli-src/.gitignore index 7255efa0bc..c5245735cb 100644 --- a/aio/content/cli-src/.gitignore +++ b/aio/content/cli-src/.gitignore @@ -1 +1,3 @@ -yarn.lock \ No newline at end of file +/node_modules +package.json +yarn.lock diff --git a/aio/content/cli-src/package.json b/aio/content/cli-src/package.json deleted file mode 100644 index d5bcd7f65c..0000000000 --- a/aio/content/cli-src/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "@angular/cli": "https://github.com/angular/cli-builds#master" - } -} diff --git a/aio/tools/transforms/cli-docs-package/extract-cli-commands.js b/aio/tools/transforms/cli-docs-package/extract-cli-commands.js index fc755c8c9e..13eed58796 100644 --- a/aio/tools/transforms/cli-docs-package/extract-cli-commands.js +++ b/aio/tools/transforms/cli-docs-package/extract-cli-commands.js @@ -1,7 +1,16 @@ -const shelljs = require('shelljs'); -const {resolve} = require('canonical-path'); +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');