Skip to content

Commit

Permalink
Tidy up NPM checkout process (#14631)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Jan 18, 2019
1 parent 177fb76 commit 8c1614a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 35 deletions.
21 changes: 19 additions & 2 deletions scripts/release/prepare-stable-commands/check-out-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const {exec} = require('child-process-promise');
const {existsSync} = require('fs');
const {join} = require('path');
const {logPromise} = require('../utils');
const {execRead, logPromise} = require('../utils');
const theme = require('../theme');

const run = async ({cwd, local, packages, version}) => {
Expand All @@ -31,7 +31,24 @@ const run = async ({cwd, local, packages, version}) => {
// Checkout canary release from NPM for all local packages
for (let i = 0; i < packages.length; i++) {
const packageName = packages[i];
await exec(`npm i ${packageName}@${version}`, {cwd: nodeModulesPath});

// We previously used `npm install` for this,
// but in addition to checking out a lot of transient dependencies that we don't care about–
// the NPM client also added a lot of registry metadata to the package JSONs,
// which we had to remove as a separate step before re-publishing.
// It's easier for us to just download and extract the tarball.
const url = await execRead(
`npm view ${packageName}@${version} dist.tarball`
);
const filePath = join(nodeModulesPath, `${packageName}.tgz`);
const packagePath = join(nodeModulesPath, `${packageName}`);
const tempPackagePath = join(nodeModulesPath, 'package');

// Download packages from NPM and extract them to the expected build locations.
await exec(`curl ${url} > ${filePath}`, {cwd});
await exec(`tar -xvzf ${filePath} -C ${nodeModulesPath}`, {cwd});
await exec(`mv ${tempPackagePath} ${packagePath}`, {cwd});
await exec(`rm ${filePath}`, {cwd});
}
};

Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/release/prepare-stable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const confirmStableVersionNumbers = require('./prepare-stable-commands/confirm-s
const guessStableVersionNumbers = require('./prepare-stable-commands/guess-stable-version-numbers');
const parseParams = require('./prepare-stable-commands/parse-params');
const printPrereleaseSummary = require('./shared-commands/print-prerelease-summary');
const prunePackageRegistryMetadata = require('./prepare-stable-commands/prune-package-registry-metadata');
const testPackagingFixture = require('./shared-commands/test-packaging-fixture');
const testTracingFixture = require('./shared-commands/test-tracing-fixture');
const updateStableVersionNumbers = require('./prepare-stable-commands/update-stable-version-numbers');
Expand All @@ -29,7 +28,6 @@ const run = async () => {
await checkOutPackages(params);
await guessStableVersionNumbers(params, versionsMap);
await confirmStableVersionNumbers(params, versionsMap);
await prunePackageRegistryMetadata(params);
await updateStableVersionNumbers(params, versionsMap);

if (!params.skipTests) {
Expand Down

0 comments on commit 8c1614a

Please sign in to comment.