-
Notifications
You must be signed in to change notification settings - Fork 0
/
wpg.js
134 lines (109 loc) · 3.27 KB
/
wpg.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
const readline = require("readline");
const fs = require("fs");
var pluginName = "";
var today = new Date().getFullYear();
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("What is your wordpress `Plugin` name ? ",(answer)=>{
console.log("--------------------- wordpress plugin generator -------------------------");
pluginName = answer.replace("-", "_");
fs.mkdir(pluginName, function(){
console.log(pluginName+" is create !");
});
fs.mkdir(pluginName+"/languages", function(){
console.log(pluginName+"/languages is create !");
});
fs.mkdir(pluginName+"/includes", function(){
console.log(pluginName+"/includes is create !");
});
fs.mkdir(pluginName+"/admin", function(){
console.log(pluginName+"/admin is create !");
});
fs.mkdir(pluginName+"/admin/js", function(){
console.log(pluginName+"/admin/js is create !");
});
fs.mkdir(pluginName+"/admin/css", function(){
console.log(pluginName+"/admin/js is create !");
});
fs.mkdir(pluginName+"/admin/images", function(){
console.log(pluginName+"/admin/images is create !");
});
fs.mkdir(pluginName+"/public", function(){
console.log(pluginName+"/public is create !");
});
fs.mkdir(pluginName+"/public/js", function(){
console.log(pluginName+"/public/js is create !");
});
fs.mkdir(pluginName+"/public/css", function(){
console.log(pluginName+"/public/css is create !");
});
fs.mkdir(pluginName+"/public/images", function(){
console.log(pluginName+"/public/images is create !");
console.log("--------------------- all file and folder create -------------------------");
});
fs.writeFile(pluginName+"/"+pluginName+".php",
'<?php\n'+
'\n'+
'defined("ABSPATH") or exit();\n'+
'\n'+
'/*\n'+
'Plugin Name: ' + pluginName + '\n'+
'Plugin URI: http://your-website.com\n'+
'Description: plugin description.\n'+
'Author: your name and family\n'+
'Author URI: http://your-personal-website.com\n'+
'Version: 1.0.0\n'+
'License: GPLv2 or later\n'+
'*/\n'+
'\n'+
'register_activation_hook(__FILE__, "' + pluginName + '_active");\n' +
'register_deactivation_hook(__FILE__, "' + pluginName + '_deactive");\n' +
'\n'+
'\n'+
'function ' + pluginName + '_active() {'+
'\n'+
'\n'+
'}'+
'\n'+
'\n'+
'function ' + pluginName + '_deactive() {'+
'\n'+
'\n'+
'}'
);
fs.writeFile(pluginName+"/uninstall.php",
'<?php\n'+
'\n'+
'defined("ABSPATH") or exit();\n'+
'\n'
);
fs.writeFile(pluginName+"/public/css/"+ pluginName + "_style.css",
'\n'+
'/*\n'+
'Style info : your style info\n'+
'Author: your name and family\n'+
'Author URI: http://your-personal-website.com\n'+
'Copyrghit : Copyright your-company-name (c) '+ today +' Copyright Holder All Rights Reserved.\n'+
'*/\n'+
'\n'
);
fs.writeFile(pluginName+"/public/js/" + pluginName + "_app.js",
'"use strict";'
);
fs.writeFile(pluginName+"/admin/css/admin_style.css",
'\n'+
'/*\n'+
'Style info : your style info\n'+
'Author: your name and family\n'+
'Author URI: http://your-personal-website.com\n'+
'Copyrghit : Copyright your-company-name (c) '+ today +' Copyright Holder All Rights Reserved.\n'+
'*/\n'+
'\n'
);
fs.writeFile(pluginName+"/admin/js/admin_js.js",
'"use strict";'
);
rl.close();
});