diff --git a/package.json b/package.json index 4c2ffaaf..ffa37584 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ "url": "git+https://github.com/kaitranntt/ccs.git" }, "license": "MIT", + "publishConfig": { + "access": "public" + }, "author": { "name": "Tam Nhu Tran (Kai)", "email": "kaitranntt@users.noreply.github.com" diff --git a/scripts/dev-release.sh b/scripts/dev-release.sh index de01bde0..fd5607e8 100755 --- a/scripts/dev-release.sh +++ b/scripts/dev-release.sh @@ -115,7 +115,7 @@ PACKAGE_NAME=$(jq -r '.name' package.json) if npm view "${PACKAGE_NAME}@${VERSION}" version >/dev/null 2>&1; then log_info "npm already has ${PACKAGE_NAME}@${VERSION}, skipping publish" else - npm publish --tag dev + npm publish --tag dev --access public log_info "Published to npm with @dev tag" fi diff --git a/tests/unit/scripts/github/dev-release-workflow.test.ts b/tests/unit/scripts/github/dev-release-workflow.test.ts index b61d79ff..5a2d1d40 100644 --- a/tests/unit/scripts/github/dev-release-workflow.test.ts +++ b/tests/unit/scripts/github/dev-release-workflow.test.ts @@ -60,4 +60,16 @@ describe('dev release workflow', () => { expect(script).toContain('git commit -m "chore(release): ${VERSION}"'); expect(script).not.toContain('git commit -m "chore(release): ${VERSION} [skip ci]"'); }); + + test('publishes dev releases with explicit public access for scoped package', () => { + const packageJsonPath = resolvePath('../../../../package.json'); + const scriptPath = resolvePath('../../../../scripts/dev-release.sh'); + + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); + const script = fs.readFileSync(scriptPath, 'utf8'); + + expect(packageJson.name).toBe('@kaitranntt/ccs'); + expect(packageJson.publishConfig).toEqual({ access: 'public' }); + expect(script).toContain('npm publish --tag dev --access public'); + }); });