[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:
parent
a3ecbde2de
commit
992daf5fed
6
packages/kbn-pm/dist/index.js
vendored
6
packages/kbn-pm/dist/index.js
vendored
|
@ -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) {
|
||||
|
|
|
@ -65,6 +65,7 @@ export async function run(argv: string[]) {
|
|||
h: 'help',
|
||||
i: 'include',
|
||||
},
|
||||
boolean: ['prefer-offline', 'frozen-lockfile'],
|
||||
});
|
||||
|
||||
const args = options._;
|
||||
|
|
|
@ -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:'));
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue