Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add node schedule updater (#17181)
* build: add node schedule updater * ci: update generation job
- Loading branch information
Showing
6 changed files
with
41 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import got from 'got'; | ||
import shell from 'shelljs'; | ||
import { updateJsonFile } from './utils.mjs'; | ||
|
||
const dataUrl = | ||
'https://raw.githubusercontent.com/nodejs/LTS/HEAD/schedule.json'; | ||
|
||
await (async () => { | ||
shell.echo('Generating node schedule'); | ||
const { body } = await got(dataUrl); | ||
await updateJsonFile('./data/node-js-schedule.json', body); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import fs from 'fs-extra'; | ||
import shell from 'shelljs'; | ||
|
||
/** | ||
* Update given file with new provided data. | ||
* @param {string} file Path to a data file | ||
* @param {string} newData New data to be written | ||
*/ | ||
export async function updateJsonFile(file, newData) { | ||
try { | ||
shell.echo(`Updating ${file}`); | ||
await fs.writeFile(file, newData); | ||
} catch (e) { | ||
shell.echo(e.toString()); | ||
shell.exit(1); | ||
} | ||
} |