forked from SAP-samples/cloud-sdk-team-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitialize.js
24 lines (19 loc) · 783 Bytes
/
initialize.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const fs = require("fs");
const yaml = require("js-yaml");
if (process.argv.length !== 3) {
console.error(
"You have not provided a name to set. Usage: npm run init -- <YOUR-APPNAME>"
);
process.exit(1);
}
const name = process.argv.splice(-1)[0];
console.log(`Using ${name} as name...`);
console.log("Setting appname in package.json...");
const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf8"));
packageJson.name = name;
fs.writeFileSync("./package.json", JSON.stringify(packageJson, null, 2) + "\n");
console.log("Setting appname in manifest.yml...");
const manifestYml = yaml.load(fs.readFileSync("./manifest.yml", "utf8"));
manifestYml.applications[0].name = name;
fs.writeFileSync("./manifest.yml", yaml.dump(manifestYml));
console.log("Done!");