From cb4eede97c8813672da48973bd92476434bad000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Mon, 15 Feb 2021 10:58:36 +0100 Subject: [PATCH] Fixes `pack` when a workspace dependency has no version (#2479) * Uses 0.0.0 when no workspace version is configured * Adds versions --- .yarn/versions/08c52146.yml | 23 +++++++++++++++++++++++ packages/plugin-pack/sources/index.ts | 3 +-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .yarn/versions/08c52146.yml diff --git a/.yarn/versions/08c52146.yml b/.yarn/versions/08c52146.yml new file mode 100644 index 000000000000..2608826fae09 --- /dev/null +++ b/.yarn/versions/08c52146.yml @@ -0,0 +1,23 @@ +releases: + "@yarnpkg/cli": patch + "@yarnpkg/plugin-pack": patch + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-node-modules" + - "@yarnpkg/plugin-npm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/core" + - "@yarnpkg/doctor" diff --git a/packages/plugin-pack/sources/index.ts b/packages/plugin-pack/sources/index.ts index 4bffe2a89bc7..27c3e833ccf8 100644 --- a/packages/plugin-pack/sources/index.ts +++ b/packages/plugin-pack/sources/index.ts @@ -54,12 +54,11 @@ const beforeWorkspacePacking = (workspace: Workspace, rawManifest: any) => { // For workspace:path/to/workspace and workspace:* we look up the workspace version if (structUtils.areDescriptorsEqual(descriptor, matchingWorkspace.anchoredDescriptor) || range.selector === `*`) - versionToWrite = matchingWorkspace.manifest.version!; + versionToWrite = matchingWorkspace.manifest.version ?? `0.0.0`; else // for workspace:version we simply strip the protocol versionToWrite = range.selector; - rawManifest[dependencyType][structUtils.stringifyIdent(descriptor)] = versionToWrite; } }