Skip to content

Commit

Permalink
feat: add npm pkg alias publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jun 15, 2022
1 parent 8810b82 commit 954f973
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$.noquote = async (...args) => { const q = $.quote; $.quote = v => v; const p = $(...args); p; $.quote = q; return p }

// Git configuration
const {GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, GITHUB_TOKEN} = process.env
const {GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, GITHUB_TOKEN, PKG_ALIAS} = process.env
if (!GITHUB_TOKEN || !GIT_COMMITTER_NAME || !GIT_COMMITTER_EMAIL) {
throw new Error('env.GITHUB_TOKEN, env.GIT_COMMITTER_NAME & env.GIT_COMMITTER_EMAIL must be set')
}
Expand Down Expand Up @@ -132,7 +132,13 @@ ${commits.join('\n')}`).join('\n')
console.log('npm publish to https://registry.npmjs.org')
await $`npm publish --no-git-tag-version --registry=https://registry.npmjs.org`

console.log('npm publish to https://npm.pkg.github.com')
if (PKG_ALIAS) {
console.log(`npm publish ${PKG_ALIAS} to https://registry.npmjs.org`)
await $`echo "\`jq '.name="${PKG_ALIAS}"' package.json\`" > package.json`
await $`npm publish --no-git-tag-version --registry=https://registry.npmjs.org`
}

console.log(`npm publish @${repoName} to https://npm.pkg.github.com`)
await $`echo "\`jq '.name="@${repoName}"' package.json\`" > package.json`
await $`npm publish --no-git-tag-version --registry=https://npm.pkg.github.com`

Expand Down

0 comments on commit 954f973

Please sign in to comment.