diff --git a/arduino-ide-extension/package.json b/arduino-ide-extension/package.json index b5e26543..5730290f 100644 --- a/arduino-ide-extension/package.json +++ b/arduino-ide-extension/package.json @@ -6,6 +6,7 @@ "scripts": { "prepare": "yarn download-cli && yarn download-fwuploader && yarn download-ls && yarn copy-serial-plotter && yarn clean && yarn download-examples && yarn build && yarn test", "clean": "rimraf lib", + "compose-changelog": "node ./scripts/compose-changelog.js", "download-cli": "node ./scripts/download-cli.js", "download-fwuploader": "node ./scripts/download-fwuploader.js", "copy-serial-plotter": "npx ncp ../node_modules/arduino-serial-plotter-webapp ./build/arduino-serial-plotter-webapp", diff --git a/arduino-ide-extension/scripts/compose-changelog.js b/arduino-ide-extension/scripts/compose-changelog.js index a5f73d0c..1a6a7f06 100755 --- a/arduino-ide-extension/scripts/compose-changelog.js +++ b/arduino-ide-extension/scripts/compose-changelog.js @@ -1,7 +1,10 @@ // @ts-check + (async () => { const { Octokit } = require('@octokit/rest'); + const fs = require("fs"); + const path = require("path"); const octokit = new Octokit({ userAgent: 'Arduino IDE compose-changelog.js', @@ -24,7 +27,22 @@ return acc + `# ${item.name}\n\n${body}\n\n---\n\n`; }, ''); - console.log(fullChangelog); + const changelogFile = path.resolve(process.argv[process.argv.length - 1]); + + await fs.writeFile( + changelogFile, + fullChangelog, + { + flag: "w+", + }, + err => { + if (err) { + console.error(err); + process.exit(1); + } + console.log("Changelog written to", changelogFile); + } + ) })(); diff --git a/package.json b/package.json index ebc83f52..46705331 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "i18n:generate": "theia nls-extract -e vscode -f \"+(arduino-ide-extension|browser-app|electron|electron-app|plugins)/**/*.ts?(x)\" -o ./i18n/en.json", "i18n:check": "yarn i18n:generate && git add -N ./i18n && git diff --exit-code ./i18n", "i18n:push": "node ./scripts/i18n/transifex-push.js ./i18n/en.json", - "i18n:pull": "node ./scripts/i18n/transifex-pull.js ./i18n/" + "i18n:pull": "node ./scripts/i18n/transifex-pull.js ./i18n/", + "compose-changelog": "yarn --cwd ./arduino-ide-extension compose-changelog" }, "lint-staged": { "./arduino-ide-extension/**/*.{ts,tsx}": [