generated from CraftionsMC/craftions-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatch.js
58 lines (43 loc) · 1.7 KB
/
patch.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* @author Ben Siebert <[email protected]>
* @copyright (c) 2018-2021 Ben Siebert. All rights reserved.
*/
const fs = require("fs");
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question("What's the new name? ", (newName) => {
rl.question("What is the description? ", (description) => {
const packageJSON = JSON.parse(fs.readFileSync("package.json").toString());
packageJSON.name = "@craftions/" + newName;
packageJSON.description = description;
packageJSON.repository.url = "https://github.com/CraftionsMC/" + newName;
packageJSON.homepage =
"https://github.com/CraftionsMC/" + newName + "#readme";
packageJSON.bugs.url =
"https://github.com/CraftionsMC/" + newName + "/issues";
packageJSON.scripts["docker:build"] = packageJSON.scripts[
"docker:build"
].replace("mctzock/craftions-base", "mctzock/" + newName);
packageJSON.scripts["docker:deploy"] = packageJSON.scripts[
"docker:deploy"
].replace("mctzock/craftions-base", "mctzock/" + newName);
packageJSON.scripts["docker:run"] = packageJSON.scripts[
"docker:run"
].replace("mctzock/craftions-base", "mctzock/" + newName);
packageJSON.scripts["docker:run"] = packageJSON.scripts[
"docker:run"
].replace("craftions-base", newName);
fs.writeFileSync("package.json", JSON.stringify(packageJSON));
let readme = fs.readFileSync("README.MD").toString();
readme = readme.replace(/craftions-base/g, newName);
readme = readme.replace(
/This.is.the.base.of.all.craftions.web.apps\./g,
description
);
fs.writeFileSync("README.MD", readme);
rl.close();
});
});