Skip to content

Commit

Permalink
fix: update release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
shaobeichen committed Nov 1, 2024
1 parent 3269816 commit b6bd561
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ try {
// 获取子文件夹
const folders = fs.readdirSync(npmDir)

// 设置 npm 认证 token
const npmToken = process.env.NPM_TOKEN // 从环境变量中获取 token
if (npmToken) {
const npmrcPath = path.join(__dirname, '../.npmrc')
fs.writeFileSync(npmrcPath, `//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}`)
} else {
if (!npmToken) {
console.error('请设置 NPM_TOKEN 环境变量.')
process.exit(1)
}

execSync(`npm adduser --scope=@grprogress`, {
stdio: 'inherit',
})
// 创建 .npmrc 文件
const npmrcPath = path.join(__dirname, '../.npmrc')
fs.writeFileSync(npmrcPath, `//registry.npmjs.org/:_authToken=${npmToken}`)

// 遍历每个子文件夹
folders.forEach((folder) => {
Expand Down

0 comments on commit b6bd561

Please sign in to comment.