Skip to content

Commit

Permalink
[6.x] [kbn/pm] Implement --prefer-offline flag (#25840) (#25898)
Browse files Browse the repository at this point in the history
Backports the following commits to 6.x:
 - [kbn/pm] Implement --prefer-offline flag  (#25840)
  • Loading branch information
Spencer authored Nov 20, 2018
1 parent ee53e4c commit 2bb70a9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-pm/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export async function run(argv: string[]) {
h: 'help',
i: 'include',
},
boolean: ['prefer-offline', 'frozen-lockfile'],
});

const args = options._;
Expand Down
6 changes: 4 additions & 2 deletions packages/kbn-pm/src/commands/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:'));

Expand Down
7 changes: 6 additions & 1 deletion src/dev/ci_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
###
Expand All @@ -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
Expand Down

0 comments on commit 2bb70a9

Please sign in to comment.