From e9ea7c759f86421f2960496e157a57142e64de3f Mon Sep 17 00:00:00 2001 From: Stephen Zhou Date: Sun, 25 Feb 2024 19:03:14 +0800 Subject: [PATCH] feat!: follow private option, remove disablePublish option --- src/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index 18267a3..196bf29 100644 --- a/src/index.js +++ b/src/index.js @@ -61,10 +61,10 @@ class ReleaseItPnpmPlugin extends Plugin { } async init() { - const { name, version } = readJSON(path.resolve(MANIFEST_PATH)) + const { name, version, private: isPrivate } = readJSON(path.resolve(MANIFEST_PATH)) this.setContext({ name, latestVersion: version }) - const updates = [{ entry: MANIFEST_PATH, name, version, isRoot: true }] + const updates = [{ entry: MANIFEST_PATH, name, version, isPrivate: !!isPrivate }] if (hasAccess(MANIFEST_WORKSPACE_PATH)) { const content = fs.readFileSync(path.resolve(MANIFEST_WORKSPACE_PATH), 'utf8') @@ -82,8 +82,8 @@ class ReleaseItPnpmPlugin extends Plugin { ) for (const entry of entries) { - const { name, version } = readJSON(entry) - updates.push({ entry, name, version }) + const { name, version, private: isPrivate } = readJSON(entry) + updates.push({ entry, name, version, isPrivate: !!isPrivate }) } } @@ -190,7 +190,7 @@ class ReleaseItPnpmPlugin extends Plugin { const tag = this.options.preRelease || DEFAULT_TAG this.setContext({ tag }) - if (!this.options?.disablePublish) + if (updates.some(update => !update.isPrivate)) await this.step({ task: async () => { await this.exec(`pnpm -r publish --access public --no-git-checks --tag ${tag}`)