Skip to content

Commit

Permalink
chore: 调整打包脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
renzp94 committed Apr 28, 2024
1 parent e83e79f commit cc2c9bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@renzp/utils",
"version": "0.0.6",
"version": "0.0.7",
"exports": {
"./array": "./src/array.ts",
"./has": "./src/has.ts",
Expand Down
7 changes: 4 additions & 3 deletions scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ const getEntrypoints = async () => {
* 打包
*/
export const build = async () => {
// biome-ignore lint/suspicious/noConsoleLog: <explanation>
console.log('📦 打包中...')
await rmDist()
const entrypoints = await getEntrypoints()
return await Bun.build({
Expand Down Expand Up @@ -81,7 +79,8 @@ const getExports = async () => {
*/
export const jsrPublish = async () => {
const pkg = await Bun.file('./package.json').json()
const jsr = await Bun.file('./jsr.json').json()
const hasJsrJson = await exists('./jsr.json')
const jsr = hasJsrJson ? await Bun.file('./jsr.json').json() : {}

if (jsr.version === pkg.version) {
// biome-ignore lint/suspicious/noConsoleLog: <explanation>
Expand All @@ -98,4 +97,6 @@ export const jsrPublish = async () => {

await Bun.write('./jsr.json', JSON.stringify(jsrConfig, null, 2))
await Bun.$`bunx jsr publish --allow-dirty`
await Bun.$`git add jsr.json`
await Bun.$`git commit -m "chore(jsr:${jsrConfig.version}): published"`
}
2 changes: 2 additions & 0 deletions scripts/pub-all.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { build, jsrPublish, npmPublish } from './common'

// biome-ignore lint/suspicious/noConsoleLog: <explanation>
console.log('📦 打包中...')
const result = await build()

if (result.success) {
Expand Down

0 comments on commit cc2c9bd

Please sign in to comment.