diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64f76c0..092b4c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: - uses: changesets/action@v1 id: changesets with: - publish: pnpm run publish + publish: node scripts/release.mjs env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 381bfd2..ecfce44 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,6 @@ "main": "index.js", "scripts": { "build": "cross-env NX_DAEMON=false nx run-many -t build --exclude @examples/* @e2e/* --parallel=10", - "publish": "cross-env NX_DAEMON=false nx run-many -t publish --exclude @examples/* @e2e/* --parallel=10", - "prepublishOnly": "pnpm run build", "change": "changeset" }, "author": "", diff --git a/packages/arguments-builder/package.json b/packages/arguments-builder/package.json index 1813166..49f839d 100644 --- a/packages/arguments-builder/package.json +++ b/packages/arguments-builder/package.json @@ -12,7 +12,7 @@ "dev": "modern build -w", "build": "modern build", "test": "jest", - "publish": "npm publish --access public" + "prepublishOnly": "npm run build" }, "dependencies": { "commander": "^12.1.0", diff --git a/scripts/release.mjs b/scripts/release.mjs new file mode 100644 index 0000000..50a4b11 --- /dev/null +++ b/scripts/release.mjs @@ -0,0 +1,18 @@ +import { execSync } from 'node:child_process'; + +const pkgs = JSON.parse(execSync('pnpm recursive list --depth 0 --json').toString()); + +for (const pkg of pkgs) { + if (pkg.private) continue; + + /** + * @type {string[]} + */ + const versions = JSON.parse(execSync(`pnpm info ${pkg.name} versions --json`).toString()); + if (versions.includes(pkg.version)) continue; + + execSync(`NPM_TOKEN=${process.env.NPM_TOKEN} npm publish`, { + cwd: pkg.path, + stdio: 'inherit', + }); +}