Skip to content

Commit

Permalink
feat: pnpm publish
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Feb 15, 2024
1 parent 907fc21 commit 5e4003a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ import { parse } from 'yaml'

const require = module.createRequire(import.meta.url)

const prompts = {
publish: {
type: 'confirm',
message: () => 'Are you sure you want to publish? (pnpm -r publish --access public --no-git-checks)',
},
}

class ReleaseItPnpmPlugin extends Plugin {
constructor(...args) {
super(...args)
this.registerPrompts(prompts)
}

static disablePlugin() {
return 'npm'
}
Expand Down Expand Up @@ -49,10 +61,20 @@ class ReleaseItPnpmPlugin extends Plugin {
if (version && version !== newVersion && !isPrivate && name) {
this.log.info(`Bumping version for ${name} from ${version} to ${newVersion}`)
pkg.version = newVersion
// fs.writeFileSync(absPath, JSON.stringify(pkg, null, 2))
fs.writeFileSync(absPath, JSON.stringify(pkg, null, 2))
}
}
}

async release() {
await this.step({
task: async () => {
await this.exec('pnpm -r publish --access public --no-git-checks')
},
label: 'Publishing packages',
prompt: 'publish',
})
}
}

export default ReleaseItPnpmPlugin

0 comments on commit 5e4003a

Please sign in to comment.