babel/.yarn-patches/@lerna/pack-directory.patch
Huáng Jùnliàng 3fad7eab9b
Use Yarn 2 (#11962)
* chore: use yarn 2

* chore: remove redundant yarn locks

* chore: remove publishEslintPkg

* chore: remove redundant make bootstrap

* Update .yarnrc.yml

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* chore: use workspace protocol for eslint packages in the root

Co-Authored-By: merceyz <merceyz@users.noreply.github.com>

* chore: pin caniuse-lite versions

Testcases in packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie
depends on specific caniuse-lite versions. We pinned the version here
so we don't have to deal with fixture different in e2e-tests
where all deps will be updated and tested.

* chore: resolve yarn install warnings

* chore: update yarn cache path on circle/travis

* chore: add yarn deduplicate plugin

* chore: deduplicate lock files

* chore: move devDependencies to leaf packages

* chore: remove @yarnpkg/plugin-constraints

* chore: remove unused dedupe options

* test: fix unwanted self reference

* chore: remove output-file-sync dependency

* chore: update browserify to 16.5.2

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
2020-08-25 14:37:30 -04:00

93 lines
3.0 KiB
Diff

diff --git a/lib/pack-directory.js b/lib/pack-directory.js
index d46069c78..2ba6bfea1 100644
--- a/lib/pack-directory.js
+++ b/lib/pack-directory.js
@@ -2,13 +2,13 @@
const path = require("path");
const figgyPudding = require("figgy-pudding");
-const packlist = require("npm-packlist");
const log = require("npmlog");
-const tar = require("tar");
const tempWrite = require("temp-write");
const getPacked = require("@lerna/get-packed");
const Package = require("@lerna/package");
const runLifecycle = require("@lerna/run-lifecycle");
+const util = require("util");
+const exec = util.promisify(require('child_process').exec);
module.exports = packDirectory;
@@ -40,34 +40,23 @@ function packDirectory(_pkg, dir, _opts) {
chain = chain.then(() => pkg.refresh());
}
- chain = chain.then(() => runLifecycle(pkg, "prepack", opts));
- chain = chain.then(() => pkg.refresh());
- chain = chain.then(() => packlist({ path: pkg.contents }));
- chain = chain.then(files =>
- tar.create(
- {
- cwd: pkg.contents,
- prefix: "package/",
- portable: true,
- // Provide a specific date in the 1980s for the benefit of zip,
- // which is confounded by files dated at the Unix epoch 0.
- mtime: new Date("1985-10-26T08:15:00.000Z"),
- gzip: true,
- },
- // NOTE: node-tar does some Magic Stuff depending on prefixes for files
- // specifically with @ signs, so we just neutralize that one
- // and any such future "features" by prepending `./`
- files.map(f => `./${f}`)
- )
+ // We need to call "yarn pack" to remove the "workspace:" protocol from
+ // package.json before publishing
+ chain = chain.then(() => tempWrite("", getTarballName(pkg)));
+ chain = chain.then(tarFilePath =>
+ exec("yarn pack --out " + tarFilePath, { cwd: pkg.location })
+ .then(({ stdout, stderr }) => {
+ const err = stderr.toString();
+ if (err) console.log(err);
+ })
+ .then(() => tarFilePath)
);
- chain = chain.then(stream => tempWrite(stream, getTarballName(pkg)));
chain = chain.then(tarFilePath =>
- getPacked(pkg, tarFilePath).then(packed =>
- Promise.resolve()
- .then(() => runLifecycle(pkg, "postpack", opts))
- .then(() => packed)
- )
+ Promise.resolve()
+ .then(() => pkg.refresh())
+ .then(() => tarFilePath)
);
+ chain = chain.then(tarFilePath => getPacked(pkg, tarFilePath));
return chain;
}
@@ -81,3 +70,7 @@ function getTarballName(pkg) {
return `${name}-${pkg.version}.tgz`;
}
+
+function tap(fn) {
+ return arg => Promise.resolve(fn(arg)).then(() => arg);
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index e00ac73ff..953512b2c 100644
--- a/package.json
+++ b/package.json
@@ -31,9 +31,7 @@
"@lerna/package": "3.16.0",
"@lerna/run-lifecycle": "3.16.2",
"figgy-pudding": "^3.5.1",
- "npm-packlist": "^1.4.4",
"npmlog": "^4.1.2",
- "tar": "^4.4.10",
"temp-write": "^3.4.0"
},
"gitHead": "bb048cb306b5cfcb039aa98f667cf3751cf0ad20"