@changesets+cli+2.16.0.patch 2.48 KB
Newer Older
1
diff --git a/node_modules/@changesets/cli/dist/cli.cjs.dev.js b/node_modules/@changesets/cli/dist/cli.cjs.dev.js
2
index f771824..9ea7f20 100644
3 4
--- a/node_modules/@changesets/cli/dist/cli.cjs.dev.js
+++ b/node_modules/@changesets/cli/dist/cli.cjs.dev.js
5 6 7 8 9 10
@@ -794,7 +794,7 @@ async function publishPackages({
     token: otp,
     isRequired: Promise.resolve(true)
   };
-  const unpublishedPackagesInfo = await getUnpublishedPackages(publicPackages, preState);
+  const unpublishedPackagesInfo = await getUnpublishedPackages(packages, preState);
11
 
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
   if (unpublishedPackagesInfo.length === 0) {
     logger.warn("No unpublished packages to publish");
@@ -810,20 +810,29 @@ async function publishAPackage(pkg, access, twoFactorState, tag) {
   const {
     name,
     version,
-    publishConfig
+    publishConfig,
+    private: isPrivate
   } = pkg.packageJson;
   const localAccess = publishConfig && publishConfig.access;
-  logger.info(`Publishing ${chalk__default['default'].cyan(`"${name}"`)} at ${chalk__default['default'].green(`"${version}"`)}`);
-  const publishDir = publishConfig && publishConfig.directory ? path.join(pkg.dir, publishConfig.directory) : pkg.dir;
-  const publishConfirmation = await publish(name, {
-    cwd: publishDir,
-    access: localAccess || access,
-    tag
-  }, twoFactorState);
+  let published;
31
+
32 33 34 35 36 37 38 39 40 41 42 43
+  if (!isPrivate) {
+    logger.info(`Publishing ${chalk__default['default'].cyan(`"${name}"`)} at ${chalk__default['default'].green(`"${version}"`)}`);
+    const publishDir = publishConfig && publishConfig.directory ? path.join(pkg.dir, publishConfig.directory) : pkg.dir;
+    const publishConfirmation = await publish(name, {
+      cwd: publishDir,
+      access: localAccess || access,
+      tag
+    }, twoFactorState);
+    published = publishConfirmation.published;
+  } else {
+    published = true;
+  }
44
+
45 46 47 48 49 50
   return {
     name,
     newVersion: version,
-    published: publishConfirmation.published
+    published
   };
51 52
 }
 
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
@@ -940,8 +949,14 @@ async function run(cwd, {
     if (tool !== "root") {
       for (const pkg of successful) {
         const tag = `${pkg.name}@${pkg.newVersion}`;
-        logger.log("New tag: ", tag);
-        await git.tag(tag, cwd);
+        const isMissingTag = !(await git.tagExists(tag));
+
+        if (isMissingTag) {
+          logger.log("New tag: ", tag);
+          await git.tag(tag, cwd);
+        } else {
+          logger.log("Skipping existing tag: ", tag);
+        }
       }
     } else {
       const tag = `v${successful[0].newVersion}`;