mirror of
https://github.com/atom/atom.git
synced 2026-01-14 09:27:57 -05:00
This commit enables faster, more-reproducible installs of `apm`,
when bootstrapping/building Atom in `ci` mode.
(with `--ci` or env var `CI` set).
This only affects bootstrapping/building Atom; This should
not make any difference to the built Atom app, or to `apm`'s behavior
as a command-line tool/as a component of Atom.
Details:
As of apm 2.6.2, apm respects a `NO_APM_DEDUPE` env var on Windows.
(It was already supported on Linux and macOS before then.)
When set, this env var disables the deduping
normally performed at the end of apm's postinstall script.
This deduping doesn't work properly when installing apm with `npm ci`,
for unknown reasons. (The deduping algorithm deletes many needed
dependencies, without reconstructing a valid tree.)
Now that `apm` supports `NO_APM_DEDUPE` on all platforms,
we can safely allow installing `apm` with `npm ci`
during the bootstrap script.
Now bootstrapping apm in `ci` mode is faster in two ways:
- `npm ci` is generally faster than `npm install` for clean installs.
- Great for actual automated builds ("CI").
- The `npm dedupe` run is now skipped in `ci` mode.
- The `npm dedupe` was of dubious value in any case
- The `npm dedupe` command was also surprisingly slow
We also benefit from the stronger reproducibility of `npm ci`
compared to `npm install` (guaranteed, version-locked dependencies).
20 lines
536 B
JavaScript
20 lines
536 B
JavaScript
'use strict';
|
|
|
|
const childProcess = require('child_process');
|
|
|
|
const CONFIG = require('../config');
|
|
|
|
module.exports = function(ci) {
|
|
if (ci) {
|
|
// Tell apm not to dedupe its own dependencies during its
|
|
// postinstall script. (Deduping during `npm ci` runs is broken.)
|
|
process.env.NO_APM_DEDUPE = 'true';
|
|
}
|
|
console.log('Installing apm');
|
|
childProcess.execFileSync(
|
|
CONFIG.getNpmBinPath(),
|
|
['--global-style', '--loglevel=error', ci ? 'ci' : 'install'],
|
|
{ env: process.env, cwd: CONFIG.apmRootPath }
|
|
);
|
|
};
|