Files
yarn/scripts/update-dist-manifest.js
Burak Yiğit Kaya 5cfb241cee Update: use a named version folder in NPM tarballs (#4094)
**Summary**

Fixes #3758. Makes the top-level folder in the tar archives have a name like `yarn-vX.Y.Z` instead of `dist` using the `--transform` and `-s` options in `tar` (they are different in GNU and BSD `tar`).

**Test plan**

Run `yarn build-dist` and then `tar -ztvf artifacts/yarn-v1.0.0.tar.gz`. Make sure the output lists all the files under `yarn-v1.0.0` directory.
2017-08-08 10:32:33 +01:00

29 lines
926 B
JavaScript
Executable File

#!/usr/bin/env node
/**
* Generates a `package.json` file for the Yarn distributable. This is based on
* the root package.json, with the following differences:
* - It has an `installationMethod` field that's set to the method used to
* install Yarn (eg. "tar", "brew", "msi")
* - It doesn't include any of the dependencies, as they are bundled in the Yarn
* JS file itself.
*/
const fs = require('fs');
const packageManifestFilename = process.argv[2];
const packageManifest = require(packageManifestFilename);
packageManifest.installationMethod = process.argv[3];
if (!packageManifest.installationMethod) {
throw new Error('You need to specify an installation method.');
}
delete packageManifest.dependencies;
delete packageManifest.devDependencies;
delete packageManifest.scripts;
delete packageManifest.jest;
fs.writeFileSync(
packageManifestFilename,
JSON.stringify(packageManifest, null, 2) + '\n'
);