[kbn/pm] Implement --prefer-offline flag (#25840)

* [kbn/pm/bootstrap] add support for --prefer-offline

* [ci] try to use offline cache of modules

* [yarn] set yarn-offline-mirror directory
This commit is contained in:
Spencer 2018-11-19 15:15:40 -08:00 committed by GitHub
parent a3ecbde2de
commit 992daf5fed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 6 deletions

View file

@ -11064,7 +11064,8 @@ let run = exports.run = (() => {
e: 'exclude',
h: 'help',
i: 'include'
}
},
boolean: ['prefer-offline', 'frozen-lockfile']
});
const args = options._;
if (options.help || args.length === 0) {
@ -12199,8 +12200,7 @@ const BootstrapCommand = exports.BootstrapCommand = {
batchByWorkspace: true
});
const batchedProjects = (0, _projects.topologicallyBatchProjects)(projects, projectGraph);
const frozenLockfile = options['frozen-lockfile'] === true;
const extraArgs = frozenLockfile ? ['--frozen-lockfile'] : [];
const extraArgs = [...(options['frozen-lockfile'] === true ? ['--frozen-lockfile'] : []), ...(options['prefer-offline'] === true ? ['--prefer-offline'] : [])];
_log.log.write(_chalk2.default.bold('\nRunning installs in topological order:'));
for (const batch of batchedProjectsByWorkspace) {
for (const project of batch) {

View file

@ -65,6 +65,7 @@ export async function run(argv: string[]) {
h: 'help',
i: 'include',
},
boolean: ['prefer-offline', 'frozen-lockfile'],
});
const args = options._;

View file

@ -35,8 +35,10 @@ export const BootstrapCommand: ICommand = {
});
const batchedProjects = topologicallyBatchProjects(projects, projectGraph);
const frozenLockfile = options['frozen-lockfile'] === true;
const extraArgs = frozenLockfile ? ['--frozen-lockfile'] : [];
const extraArgs = [
...(options['frozen-lockfile'] === true ? ['--frozen-lockfile'] : []),
...(options['prefer-offline'] === true ? ['--prefer-offline'] : []),
];
log.write(chalk.bold('\nRunning installs in topological order:'));

View file

@ -84,6 +84,11 @@ hash -r
yarnVersion="$(node -e "console.log(String(require('./package.json').engines.yarn || '').replace(/^[^\d]+/,''))")"
npm install -g yarn@^${yarnVersion}
###
### setup yarn offline cache
###
yarn config set yarn-offline-mirror "$cacheDir/yarn-offline-cache"
###
### "install" yarn into this shell
###
@ -95,7 +100,7 @@ hash -r
### install dependencies
###
echo " -- installing node.js dependencies"
yarn kbn bootstrap
yarn kbn bootstrap --prefer-offline
###
### verify no git modifications