-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
71 lines (62 loc) · 2 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
#!/usr/bin/env node
const { program } = require('commander');
const fs = require('fs');
const readline = require('readline');
program
.command('generate')
.description('Generate a new file for the extension')
.action(() => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question('Extension name: ', (name) => {
rl.question('About: ', (about) => {
rl.question('Author: ', (author) => {
rl.question('Version: ', (version) => {
rl.question('web_url: ', (web_url) => {
rl.question('icon: ', (icon) => {
const filePath = "manifest.json"; // Use the provided filename as the file path
const content = `
{
"manifest_version": 3,
"name": "${name}",
"version": "${version}",
"author": "${author}",
"description": "${about}",
"icons": {
"128": "${icon}"
},
"launch": {
"web_url": "${web_url}"
},
"content_scripts":[
{
"matches": ["<all_urls>"],
"js": ["script.js"]
}
]
}
`;
fs.writeFile(filePath, content, (error) => {
if (error) {
console.error('An error occurred while generating the files:', error);
} else {
fs.writeFile("script.js","//Write your Java script here", (error)=>{
if(error){
console.error('An error occurred while generating the files:', error);
}else{
console.log('File generated successfully.');
}
})
}
rl.close();
});
});
});
});
});
});
});
});
program.parse(process.argv);