Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up NPM checkout process #14631

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions scripts/release/prepare-stable-commands/check-out-packages.js
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
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