Created
May 7, 2020 19:17
-
-
Save doug2k1/0b5c6383c63377ddf398ac385d0fdd8d to your computer and use it in GitHub Desktop.
Create JSON from template
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
{ | |
"name": "Test", | |
"baseURL": "__baseURL__", | |
"otherBaseURL": "__baseURL__" | |
} |
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
const fs = require("fs") | |
async function create(baseURL) { | |
const tmpl = await fs.promises.readFile("./config-template.json", "utf-8") | |
const contents = tmpl.replace(/__baseURL__/g, baseURL) | |
await fs.promises.writeFile("./config.json", contents) | |
} | |
create("http://localhost:5000") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment