|
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' |
7 | 4 |
|
8 | 5 | function extractSpecificChangelog(changelog, version) {
|
9 | 6 | if (!changelog) {
|
@@ -31,11 +28,11 @@ async function commitChangelog(current, next) {
|
31 | 28 | )
|
32 | 29 | const matches = regex.exec(stdout.toString())
|
33 | 30 | 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}`) |
36 | 33 | }
|
37 | 34 |
|
38 |
| -module.exports = { |
| 35 | +export default { |
39 | 36 | mergeStrategy: { toSameBranch: ['master'] },
|
40 | 37 | monorepo: {
|
41 | 38 | mainVersionFile: 'package.json',
|
@@ -77,10 +74,10 @@ module.exports = {
|
77 | 74 | `${releaseType} release v${version}`,
|
78 | 75 | shouldRelease: () => true,
|
79 | 76 | releases: {
|
80 |
| - extractChangelog: ({ version, dir }) => { |
| 77 | + extractChangelog: async ({ version, dir }) => { |
81 | 78 | const changelogPath = path.resolve(dir, 'CHANGELOG.md')
|
82 | 79 | try {
|
83 |
| - const changelogFile = fs.readFileSync(changelogPath, 'utf-8').toString() |
| 80 | + const changelogFile = fs.readFile(changelogPath, 'utf-8').toString() |
84 | 81 | const ret = extractSpecificChangelog(changelogFile, version)
|
85 | 82 | return ret
|
86 | 83 | } catch (err) {
|
|
0 commit comments