-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.js
76 lines (60 loc) · 1.51 KB
/
init.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const fs = require("fs");
/** @type string[] */
var myArgs = process.argv.slice(2);
function updateReleaseYAML() {
const filePath = "./.github/workflows/release.yaml";
/** @type string */
let buff = fs.readFileSync(filePath, {
encoding: "utf-8",
});
buff = buff.replace("Mr. Dharmen's Bot", myArgs[0]);
buff = buff.replace("[email protected]", myArgs[1]);
fs.writeFileSync(filePath, buff, {
encoding: "utf-8",
});
}
function updateLicense() {
const filePath = "./LICENSE";
/** @type string */
let buff = fs.readFileSync(filePath, {
encoding: "utf-8",
});
buff = buff.replace("Dharmen Shah", myArgs[2]);
fs.writeFileSync(filePath, buff, {
encoding: "utf-8",
});
}
function updateCodeOfConduct() {
const filePath = "./CODE_OF_CONDUCT.md";
/** @type string */
let buff = fs.readFileSync(filePath, {
encoding: "utf-8",
});
buff = buff.replace("[email protected]", myArgs[1]);
fs.writeFileSync(filePath, buff, {
encoding: "utf-8",
});
}
function updatePackageJSON() {
const filePath = "./package.json";
/** @type string */
let buff = fs.readFileSync(filePath, {
encoding: "utf-8",
});
buff = buff.replace("1.0.0", "0.0.0");
fs.writeFileSync(filePath, buff, {
encoding: "utf-8",
});
}
function clearChangeLog() {
const filePath = "./CHANGELOG.md";
fs.writeFileSync(filePath, "", {
encoding: "utf-8",
});
}
updateReleaseYAML();
updateLicense();
updateCodeOfConduct();
updatePackageJSON();
clearChangeLog();
fs.unlinkSync("./init.js");