1234567891011121314151617181920212223 |
- "use strict";
- const fs = require("fs");
- const path = require("path");
- let jsonPath = path.resolve(__dirname, "./config.json");
- function replaceText(originalUrl, replaceUrl) {
- let copyContent = fs.readFileSync(originalUrl, "utf8");
- fs.writeFileSync(replaceUrl, copyContent, "utf8");
- }
- function replaceSettings() {
- const str = process.env.PLAT_ENV;
- const commandLines = str.split("-");
- const defaulJsonPath = path.resolve(
- __dirname,
- `./config.${commandLines[0]}.${commandLines[1]}.json`
- );
- replaceText(defaulJsonPath, jsonPath);
- }
- replaceSettings();
|