Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
178 changed files
with
28,870 additions
and
16,203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"installCommand": "codesandbox", | ||
"buildCommand": false, | ||
"buildCommand": "codesandbox:build", | ||
"sandboxes": ["7s08o", "vhm64"], | ||
"packages": ["packages/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff --git a/npm-publish.js b/npm-publish.js | ||
index ee6ad133e..6a31d1775 100644 | ||
--- a/npm-publish.js | ||
+++ b/npm-publish.js | ||
@@ -32,6 +32,15 @@ const PublishConfig = figgyPudding( | ||
} | ||
); | ||
|
||
+function stripWorkspaceProtocolFromDeps(deps) { | ||
+ if (!deps) return; | ||
+ for (const [name, version] of Object.entries(deps)) { | ||
+ if (version.startsWith("workspace:")) { | ||
+ deps[name] = version.slice(10); | ||
+ } | ||
+ } | ||
+} | ||
+ | ||
function npmPublish(pkg, tarFilePath, _opts, otpCache) { | ||
const { scope } = npa(pkg.name); | ||
// pass only the package scope to libnpmpublish | ||
@@ -67,6 +76,10 @@ function npmPublish(pkg, tarFilePath, _opts, otpCache) { | ||
manifest.publishConfig.tag = opts.tag; | ||
} | ||
|
||
+ stripWorkspaceProtocolFromDeps(manifest.dependencies); | ||
+ stripWorkspaceProtocolFromDeps(manifest.peerDependencies); | ||
+ stripWorkspaceProtocolFromDeps(manifest.devDependencies); | ||
+ | ||
return otplease(innerOpts => publish(manifest, tarData, innerOpts), opts, otpCache).catch(err => { | ||
opts.log.silly("", err); | ||
opts.log.error(err.code, (err.body && err.body.error) || err.message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/index.js b/index.js | ||
index f860af4d2..27c4ce21d 100644 | ||
--- a/index.js | ||
+++ b/index.js | ||
@@ -57,8 +57,18 @@ class PackageGraph extends Map { | ||
// Yarn decided to ignore https://github.com/npm/npm/pull/15900 and implemented "link:" | ||
// As they apparently have no intention of being compatible, we have to do it for them. | ||
// @see https://github.com/yarnpkg/yarn/issues/4212 | ||
- const spec = graphDependencies[depName].replace(/^link:/, "file:"); | ||
+ let spec = graphDependencies[depName].replace(/^link:/, "file:"); | ||
+ | ||
+ // npa doesn't support the explicit workspace: protocol, supported by | ||
+ // pnpm and Yarn. | ||
+ // https://github.com/lerna/lerna/pull/2450 | ||
+ const explicitWorkspace = /^workspace:/.test(spec); | ||
+ if (explicitWorkspace) { | ||
+ spec = spec.replace(/^workspace:/, ""); | ||
+ } | ||
+ | ||
const resolved = npa.resolve(depName, spec, currentNode.location); | ||
+ resolved.explicitWorkspace = explicitWorkspace; | ||
|
||
if (!depNode) { | ||
// it's an external dependency, store the resolution and bail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/index.js b/index.js | ||
index 67b997073..6e2912e9e 100644 | ||
--- a/index.js | ||
+++ b/index.js | ||
@@ -209,6 +209,11 @@ class Package { | ||
if (resolved.registry || resolved.type === "directory") { | ||
// a version (1.2.3) OR range (^1.2.3) OR directory (file:../foo-pkg) | ||
depCollection[depName] = `${savePrefix}${depVersion}`; | ||
+ | ||
+ // https://github.com/lerna/lerna/pull/2450 | ||
+ if (resolved.explicitWorkspace) { | ||
+ depCollection[depName] = `workspace:${depCollection[depName]}`; | ||
+ } | ||
} else if (resolved.gitCommittish) { | ||
// a git url with matching committish (#v1.2.3 or #1.2.3) | ||
const [tagPrefix] = /^\D*/.exec(resolved.gitCommittish); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/command.js b/command.js | ||
index 4109ff1db..86349e057 100644 | ||
--- a/command.js | ||
+++ b/command.js | ||
@@ -12,6 +12,12 @@ exports.describe = "Bump version of packages changed since the last release."; | ||
|
||
exports.builder = (yargs, composed) => { | ||
const opts = { | ||
+ // THIS IS ONLY USED BY BABEL | ||
+ "exclude-dependents": { | ||
+ describe: "Exclude all transitive dependents.", | ||
+ type: "boolean" | ||
+ }, | ||
+ | ||
"allow-branch": { | ||
describe: "Specify which branches to allow versioning from.", | ||
type: "array", |
Oops, something went wrong.