Skip to content

Commit

Permalink
fix(publish): Remove scripts section (#84)
Browse files Browse the repository at this point in the history
* fix(publish): Remove scripts section

* Commit before removing scripts

* Update pnpm/action-setup

* Remove pnpm version from workflow
  • Loading branch information
lachlancollins committed May 13, 2024
1 parent 4aefe86 commit be41899
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ jobs:
with:
fetch-depth: '0'
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ jobs:
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
Expand Down
27 changes: 18 additions & 9 deletions src/publish/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,24 @@ export const publish = async (options) => {
return
}

console.info()
console.info('Committing changes...')
execSync(`git add -A && git commit -m "${releaseCommitMsg(version)}"`)
console.info(' Committed Changes.')

console.info()
console.info(`Publishing all packages to npm with tag "${npmTag}"`)

// Publish each package
changedPackages.forEach((pkg) => {
changedPackages.forEach(async (pkg) => {
// Remove scripts section
await updatePackageJson(
path.resolve(rootDir, pkg.packageDir, 'package.json'),
(config) => {
config.scripts = {}
},
)

const packageDir = path.join(rootDir, pkg.packageDir)

const cmd = `cd ${packageDir} && pnpm publish --tag ${npmTag} --access=public --no-git-checks`
Expand All @@ -427,26 +440,21 @@ export const publish = async (options) => {
})

console.info()

console.info('Committing changes...')
execSync(`git add -A && git commit -m "${releaseCommitMsg(version)}"`)
console.info()
console.info(' Committed Changes.')

console.info('Pushing changes...')
execSync('git push')
console.info()
console.info(' Changes pushed.')

console.info()
console.info(`Creating new git tag v${version}`)
execSync(`git tag -a -m "v${version}" v${version}`)

console.info()
console.info('Pushing tags...')
execSync('git push --tags')
console.info()
console.info(' Tags pushed.')

if (ghToken) {
console.info()
console.info('Creating github release...')

// Stringify the markdown to escape any quotes
Expand All @@ -459,6 +467,7 @@ export const publish = async (options) => {
console.info(' Github release created.')
}

console.info()
console.info('All done!')
return
}

0 comments on commit be41899

Please sign in to comment.