Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions lib/prepare_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import path from 'node:path';
import { promises as fs, existsSync, readFileSync } from 'node:fs';

import semver from 'semver';
import { replaceInFile } from 'replace-in-file';

import { forceRunAsync, runAsync, runSync } from './run.js';
import { writeJson, readJson } from './file.js';
Expand Down Expand Up @@ -518,11 +517,24 @@ export default class ReleasePreparation extends Session {
async updateREPLACEMEs() {
const { newVersion } = this;

await replaceInFile({
files: 'doc/api/*.md',
from: /REPLACEME/g,
to: `v${newVersion}`
});
const promises = [];
for await (const file of fs.glob('doc/api/*.md')) {
promises.push(fs.open(file, 'r+').then(async fd => {
try {
const fileContent = await fd.readFile('utf-8');
if (fileContent.includes('REPLACEME')) {
const { bytesWritten } =
await fd.write(fileContent.replaceAll('REPLACEME', `v${newVersion}`), 0, 'utf-8');
await fd.truncate(bytesWritten);
}
// eslint-disable-next-line promise/always-return
} finally {
// TODO: replace with `using` syntax when dropping support for Node.js 22
await fd.close();
}
}));
}
await Promise.all(promises);
}

async updateMainChangelog() {
Expand Down
33 changes: 0 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"lodash": "^4.17.21",
"log-symbols": "^7.0.0",
"ora": "^9.0.0",
"replace-in-file": "^8.3.0",
"semver": "^7.7.1",
"smol-toml": "^1.7.0",
"undici": "^8.3.0",
Expand Down
Loading