diff --git a/src/index.js b/src/index.js index f87395e..00bf54e 100644 --- a/src/index.js +++ b/src/index.js @@ -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' } @@ -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