mirror of
https://github.com/zhigang1992/yarn.git
synced 2026-06-14 10:19:15 +08:00
**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.
29 lines
926 B
JavaScript
Executable File
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'
|
|
);
|