Skip to content

Commit 652ad10

Browse files
committed
update shipjs config
1 parent d0952f3 commit 652ad10

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

ship.config.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
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
1+
import execa from 'execa'
2+
import path from 'path'
3+
import { promise as fs } from 'fs'
74

85
function extractSpecificChangelog(changelog, version) {
96
if (!changelog) {
@@ -31,11 +28,11 @@ async function commitChangelog(current, next) {
3128
)
3229
const matches = regex.exec(stdout.toString())
3330
const head = matches ? matches[1] : stdout
34-
const changelog = await read('./CHANGELOG.md', 'utf8')
35-
return write('./CHANGELOG.md', `${head}\n\n${changelog}`)
31+
const changelog = await fs.readFile('./CHANGELOG.md', 'utf8')
32+
return fs.writeFile('./CHANGELOG.md', `${head}\n\n${changelog}`)
3633
}
3734

38-
module.exports = {
35+
export default {
3936
mergeStrategy: { toSameBranch: ['master'] },
4037
monorepo: {
4138
mainVersionFile: 'package.json',
@@ -77,10 +74,10 @@ module.exports = {
7774
`${releaseType} release v${version}`,
7875
shouldRelease: () => true,
7976
releases: {
80-
extractChangelog: ({ version, dir }) => {
77+
extractChangelog: async ({ version, dir }) => {
8178
const changelogPath = path.resolve(dir, 'CHANGELOG.md')
8279
try {
83-
const changelogFile = fs.readFileSync(changelogPath, 'utf-8').toString()
80+
const changelogFile = fs.readFile(changelogPath, 'utf-8').toString()
8481
const ret = extractSpecificChangelog(changelogFile, version)
8582
return ret
8683
} catch (err) {

0 commit comments

Comments
 (0)