Skip to content

Commit 7581417

Browse files
committed
Revert "update shipjs config"
This reverts commit fcd186e.
1 parent fcd186e commit 7581417

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"@intlify/shared": "^9.1.9",
3333
"chalk": "^4.1.0",
3434
"debug": "^4.3.2",
35-
"execa": "^5.1.1",
3635
"glob": "^7.2.0",
3736
"pathe": "^0.2.0",
3837
"yargs": "^17.2.0"

pnpm-lock.yaml

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ship.config.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import execa from 'execa'
2-
import { promises as fs, writeFile } from 'fs'
3-
import path from 'pathe'
4-
5-
const dirname = path.dirname(new URL(import.meta.url).pathname)
6-
7-
async function readJson(path) {
8-
const data = await fs.readFile(path, 'utf8')
9-
return JSON.parse(data)
10-
}
1+
const execa = require(require.resolve('execa'))
2+
const { promisify } = require('util')
3+
const fs = require('fs')
4+
const path = require('path')
5+
const read = promisify(fs.readFile)
6+
const write = fs.writeFileSync
117

128
function extractSpecificChangelog(changelog, version) {
139
if (!changelog) {
@@ -35,17 +31,17 @@ async function commitChangelog(current, next) {
3531
)
3632
const matches = regex.exec(stdout.toString())
3733
const head = matches ? matches[1] : stdout
38-
const changelog = await fs.readFile('./CHANGELOG.md', 'utf8')
39-
return writeFile('./CHANGELOG.md', `${head}\n\n${changelog}`)
34+
const changelog = await read('./CHANGELOG.md', 'utf8')
35+
return write('./CHANGELOG.md', `${head}\n\n${changelog}`)
4036
}
4137

4238
module.exports = {
4339
mergeStrategy: { toSameBranch: ['master'] },
4440
monorepo: undefined,
4541
updateChangelog: false,
4642
beforeCommitChanges: ({ nextVersion, exec, dir }) => {
47-
return new Promise(async resolve => {
48-
const pkg = await readJson(path.relative(dirname, './package.json'))
43+
return new Promise(resolve => {
44+
const pkg = require('./package.json')
4945
commitChangelog(pkg.version, nextVersion).then(resolve)
5046
})
5147
},
@@ -55,10 +51,10 @@ module.exports = {
5551
`${releaseType} release v${version}`,
5652
shouldRelease: () => true,
5753
releases: {
58-
extractChangelog: async ({ version, dir }) => {
54+
extractChangelog: ({ version, dir }) => {
5955
const changelogPath = path.resolve(dir, 'CHANGELOG.md')
6056
try {
61-
const changelogFile = await fs.readFile(changelogPath, 'utf8')
57+
const changelogFile = fs.readFileSync(changelogPath, 'utf-8').toString()
6258
const ret = extractSpecificChangelog(changelogFile, version)
6359
return ret
6460
} catch (err) {

0 commit comments

Comments
 (0)