@lmjs/cli 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -12
- package/lib/fcs.js +318 -200
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -16,16 +16,6 @@ const BEA_Libs = {
|
|
|
16
16
|
BEAJS: "https://s.beacdn.com/beajs/latest",
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
function _min(st) {
|
|
20
|
-
for (const key in st) {
|
|
21
|
-
st[key] = st[key].replace(/\/\*[\s\S]*?\*\/|(?<=[^:])\/\/.*|^\/\/.*/g, "");
|
|
22
|
-
st[key] = st[key].replace(/(\r?\n|\n)/g, "");
|
|
23
|
-
st[key] = st[key].replace(/(\t)/g, "");
|
|
24
|
-
st[key] = st[key].replace(/\s\s+/g, " ");
|
|
25
|
-
}
|
|
26
|
-
return st;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
19
|
function processCommands(cmd) {
|
|
30
20
|
var command = cmd ? cmd : process.argv[2];
|
|
31
21
|
if (command == "run" || command == "serve") {
|
|
@@ -143,10 +133,10 @@ async function buildProject(cmds) {
|
|
|
143
133
|
`
|
|
144
134
|
var _vcData = {
|
|
145
135
|
"views": ` +
|
|
146
|
-
JSON.stringify(
|
|
136
|
+
JSON.stringify(_views) +
|
|
147
137
|
`,
|
|
148
138
|
"tpls": ` +
|
|
149
|
-
JSON.stringify(
|
|
139
|
+
JSON.stringify(_tpls) +
|
|
150
140
|
`
|
|
151
141
|
};
|
|
152
142
|
`;
|
package/lib/fcs.js
CHANGED
|
@@ -1,243 +1,361 @@
|
|
|
1
|
-
const axios = require(
|
|
2
|
-
const path = require(
|
|
1
|
+
const axios = require("axios").default;
|
|
2
|
+
const path = require("path");
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
|
|
5
5
|
const BEA_Libs = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
BEACSS: "https://s.beacdn.com/beacss/latest",
|
|
7
|
+
BEAJS: "https://s.beacdn.com/beajs/latest",
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
exports.getAllFiles = getAllFiles;
|
|
11
11
|
exports.ucwords = ucwords;
|
|
12
12
|
|
|
13
|
+
function _mini(st) {
|
|
14
|
+
for (const key in st) {
|
|
15
|
+
st[key] = st[key].replace(/\/\*[\s\S]*?\*\/|(?<=[^:])\/\/.*|^\/\/.*/g, "");
|
|
16
|
+
st[key] = st[key].replace(/(\r?\n|\n)/g, "");
|
|
17
|
+
st[key] = st[key].replace(/(\t)/g, "");
|
|
18
|
+
st[key] = st[key].replace(/\s\s+/g, " ");
|
|
19
|
+
st[key] = st[key].replace(" var ", " ;var ");
|
|
20
|
+
st[key] = st[key].replace(" let ", " ;let ");
|
|
21
|
+
st[key] = st[key].replace(" const ", " ;const ");
|
|
22
|
+
}
|
|
23
|
+
return st;
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
function getAllFiles(dirPath, arrayOfFiles) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
files = fs.readdirSync(dirPath);
|
|
28
|
+
arrayOfFiles = arrayOfFiles || {};
|
|
29
|
+
files.forEach(function (file) {
|
|
30
|
+
if (fs.statSync(dirPath + path.sep + file).isDirectory()) {
|
|
31
|
+
arrayOfFiles = getAllFiles(dirPath + path.sep + file, arrayOfFiles);
|
|
32
|
+
} else {
|
|
33
|
+
let filePath = path.join(dirPath, path.sep, file);
|
|
34
|
+
let fileKey = Buffer.from(
|
|
35
|
+
filePath
|
|
36
|
+
.split(`${process.cwd()}` + path.sep)
|
|
37
|
+
.join("")
|
|
38
|
+
.split("\\")
|
|
39
|
+
.join("/")
|
|
40
|
+
).toString("base64");
|
|
41
|
+
arrayOfFiles[fileKey] = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return _mini(arrayOfFiles);
|
|
26
45
|
}
|
|
27
46
|
|
|
28
47
|
exports.getConfig = function () {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
config = {
|
|
49
|
+
version: "1.0.0.1",
|
|
50
|
+
server: {
|
|
51
|
+
host: "127.0.0.1",
|
|
52
|
+
port: "3000",
|
|
53
|
+
ssl: {
|
|
54
|
+
enabled: false,
|
|
55
|
+
key: "/key.pem",
|
|
56
|
+
cert: "/certificate.cer",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
apis: [
|
|
60
|
+
{
|
|
61
|
+
baseURL: "https://www.beaapis.com/1",
|
|
62
|
+
headers: {
|
|
63
|
+
"X-BEA-Application-ID": "YOUR_APPLICATION_ID",
|
|
64
|
+
"X-BEA-Authorization": "YOUR_REST_API_KEY",
|
|
39
65
|
},
|
|
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
|
-
let configPath = process.cwd() + path.sep + `config.json`;
|
|
68
|
-
if (fs.existsSync(configPath)) {
|
|
69
|
-
config = JSON.parse(fs.readFileSync(configPath, { encoding: 'utf8' }));
|
|
70
|
-
}
|
|
71
|
-
return config;
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
ftp: {
|
|
69
|
+
host: "ftp_host",
|
|
70
|
+
username: "ftp_username",
|
|
71
|
+
password: "ftp_password",
|
|
72
|
+
remotePath: "/",
|
|
73
|
+
concurrency: 4,
|
|
74
|
+
protocol: "ftp",
|
|
75
|
+
port: 21,
|
|
76
|
+
ignore: [],
|
|
77
|
+
syncOption: {
|
|
78
|
+
delete: false,
|
|
79
|
+
ignoreExisting: false,
|
|
80
|
+
skipCreate: false,
|
|
81
|
+
update: true,
|
|
82
|
+
},
|
|
83
|
+
connectTimeout: 30000,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
let configPath = process.cwd() + path.sep + `config.json`;
|
|
87
|
+
if (fs.existsSync(configPath)) {
|
|
88
|
+
config = JSON.parse(fs.readFileSync(configPath, { encoding: "utf8" }));
|
|
89
|
+
}
|
|
90
|
+
return config;
|
|
72
91
|
};
|
|
73
92
|
|
|
74
93
|
function ucwords(str) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
return (str + "").replace(/^([a-z])|\s+([a-z])/g, function ($1) {
|
|
95
|
+
return $1.toUpperCase();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function lw(s) {
|
|
99
|
+
return s.toString().toLowerCase();
|
|
78
100
|
}
|
|
79
|
-
function lw(s) { return s.toString().toLowerCase(); }
|
|
80
101
|
exports.lw = lw;
|
|
81
102
|
|
|
82
103
|
function cd(d) {
|
|
83
|
-
|
|
104
|
+
if (!fs.existsSync(d)) fs.mkdirSync(d);
|
|
84
105
|
}
|
|
85
106
|
exports.cd = cd;
|
|
86
107
|
|
|
87
108
|
function rd(d) {
|
|
88
|
-
|
|
109
|
+
if (fs.existsSync(d)) fs.rmSync(d, { recursive: true, force: true });
|
|
89
110
|
}
|
|
90
111
|
exports.rd = rd;
|
|
91
112
|
|
|
92
113
|
exports.create = function (conf) {
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
fs.writeFileSync(
|
|
147
|
-
|
|
148
|
-
|
|
114
|
+
let t =
|
|
115
|
+
conf.type == "v" || conf.type == "s" || conf.type == "c" ? conf.type : "p";
|
|
116
|
+
let n =
|
|
117
|
+
conf.type == "v" || conf.type == "s" || conf.type == "c"
|
|
118
|
+
? lw(conf.name[0])
|
|
119
|
+
: conf.name.join(" ");
|
|
120
|
+
if (t == "p") {
|
|
121
|
+
var libsPath = `${__dirname}` + path.sep + `files` + path.sep + `libs`;
|
|
122
|
+
var getLibs = false;
|
|
123
|
+
require("dns").resolve("www.google.com", function (err) {
|
|
124
|
+
if (!err) {
|
|
125
|
+
if (!fs.existsSync(libsPath + path.sep + "bea.js")) getLibs = true;
|
|
126
|
+
}
|
|
127
|
+
if (getLibs) {
|
|
128
|
+
axios
|
|
129
|
+
.get(BEA_Libs.BEAJS, {})
|
|
130
|
+
.then((beajs) => {
|
|
131
|
+
axios.get(BEA_Libs.BEACSS, {}).then((beacss) => {
|
|
132
|
+
var libsPath =
|
|
133
|
+
`${__dirname}` + path.sep + `files` + path.sep + `libs`;
|
|
134
|
+
cd(libsPath);
|
|
135
|
+
fs.writeFileSync(
|
|
136
|
+
libsPath + path.sep + "bea.js",
|
|
137
|
+
String(beajs.data)
|
|
138
|
+
);
|
|
139
|
+
fs.writeFileSync(
|
|
140
|
+
libsPath + path.sep + "bea.css",
|
|
141
|
+
String(beacss.data)
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
var filePath = `${process.cwd()}` + path.sep;
|
|
145
|
+
copyDir(
|
|
146
|
+
`${__dirname}` + path.sep + `files` + path.sep + `project`,
|
|
147
|
+
filePath,
|
|
148
|
+
n
|
|
149
|
+
);
|
|
150
|
+
cd(filePath + path.sep + "src");
|
|
151
|
+
cd(filePath + path.sep + "src" + path.sep + "css");
|
|
152
|
+
cd(filePath + path.sep + "src" + path.sep + "images");
|
|
153
|
+
cd(filePath + path.sep + "src" + path.sep + "js");
|
|
154
|
+
let stylesFile =
|
|
155
|
+
filePath +
|
|
156
|
+
path.sep +
|
|
157
|
+
"src" +
|
|
158
|
+
path.sep +
|
|
159
|
+
"css" +
|
|
160
|
+
path.sep +
|
|
161
|
+
`styles.css`;
|
|
162
|
+
let faviconFile =
|
|
163
|
+
filePath + path.sep + "src" + path.sep + `favicon.ico`;
|
|
164
|
+
if (!fs.existsSync(stylesFile))
|
|
165
|
+
fs.writeFileSync(stylesFile, String(""));
|
|
166
|
+
if (!fs.existsSync(faviconFile))
|
|
167
|
+
fs.writeFileSync(faviconFile, String(""));
|
|
168
|
+
|
|
169
|
+
fs.writeFileSync(
|
|
170
|
+
filePath +
|
|
171
|
+
path.sep +
|
|
172
|
+
"src" +
|
|
173
|
+
path.sep +
|
|
174
|
+
"js" +
|
|
175
|
+
path.sep +
|
|
176
|
+
"bea.js",
|
|
177
|
+
String(beajs.data)
|
|
178
|
+
);
|
|
179
|
+
fs.writeFileSync(
|
|
180
|
+
filePath +
|
|
181
|
+
path.sep +
|
|
182
|
+
"src" +
|
|
183
|
+
path.sep +
|
|
184
|
+
"css" +
|
|
185
|
+
path.sep +
|
|
186
|
+
"bea.css",
|
|
187
|
+
String(beacss.data)
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
})
|
|
191
|
+
.catch((err) => {
|
|
192
|
+
// Handle error
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
var filePath = `${process.cwd()}` + path.sep;
|
|
196
|
+
copyDir(
|
|
197
|
+
`${__dirname}` + path.sep + `files` + path.sep + `project`,
|
|
198
|
+
filePath,
|
|
199
|
+
n
|
|
200
|
+
);
|
|
201
|
+
cd(filePath + path.sep + "src");
|
|
202
|
+
cd(filePath + path.sep + "src" + path.sep + "css");
|
|
203
|
+
cd(filePath + path.sep + "src" + path.sep + "images");
|
|
204
|
+
cd(filePath + path.sep + "src" + path.sep + "js");
|
|
205
|
+
let stylesFile =
|
|
206
|
+
filePath +
|
|
207
|
+
path.sep +
|
|
208
|
+
"src" +
|
|
209
|
+
path.sep +
|
|
210
|
+
"css" +
|
|
211
|
+
path.sep +
|
|
212
|
+
`styles.css`;
|
|
213
|
+
let faviconFile =
|
|
214
|
+
filePath + path.sep + "src" + path.sep + `favicon.ico`;
|
|
215
|
+
if (!fs.existsSync(stylesFile))
|
|
216
|
+
fs.writeFileSync(stylesFile, String(""));
|
|
217
|
+
if (!fs.existsSync(faviconFile))
|
|
218
|
+
fs.writeFileSync(faviconFile, String(""));
|
|
219
|
+
|
|
220
|
+
let beajs = Buffer.from(
|
|
221
|
+
fs.readFileSync(libsPath + path.sep + "bea.js").toString()
|
|
222
|
+
);
|
|
223
|
+
let beacss = Buffer.from(
|
|
224
|
+
fs.readFileSync(libsPath + path.sep + "bea.css").toString()
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
fs.writeFileSync(
|
|
228
|
+
filePath + path.sep + "src" + path.sep + "js" + path.sep + "bea.js",
|
|
229
|
+
String(beajs)
|
|
230
|
+
);
|
|
231
|
+
fs.writeFileSync(
|
|
232
|
+
filePath + path.sep + "src" + path.sep + "css" + path.sep + "bea.css",
|
|
233
|
+
String(beacss)
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
} else {
|
|
238
|
+
let file = t == "s" ? "sub_view.view" : t == "c" ? "tpl.tpl" : "view.view";
|
|
239
|
+
let ident = t == "s" ? "SubView" : t == "c" ? "Template" : "View";
|
|
240
|
+
let dir = t == "c" ? "tpls" : "views";
|
|
241
|
+
let ext = t == "c" ? "tpl" : "view";
|
|
242
|
+
let html5 = Buffer.from(
|
|
243
|
+
fs
|
|
244
|
+
.readFileSync(`${__dirname}` + path.sep + `files` + path.sep + file)
|
|
245
|
+
.toString()
|
|
246
|
+
.split("[" + ident + "Name" + "]")
|
|
247
|
+
.join(ucwords(n))
|
|
248
|
+
);
|
|
249
|
+
var filePath =
|
|
250
|
+
`${process.cwd()}` +
|
|
251
|
+
path.sep +
|
|
252
|
+
`src` +
|
|
253
|
+
path.sep +
|
|
254
|
+
dir +
|
|
255
|
+
path.sep +
|
|
256
|
+
`${n}.${ext}`;
|
|
257
|
+
if (fs.existsSync(filePath)) {
|
|
258
|
+
console.log(ident + " already exists:", filePath);
|
|
149
259
|
} else {
|
|
150
|
-
|
|
151
|
-
let ident = t == "s" ? "SubView" : (t == "c" ? "Template" : "View");
|
|
152
|
-
let dir = t == "c" ? "tpls" : "views";
|
|
153
|
-
let ext = t == "c" ? "tpl" : "view";
|
|
154
|
-
let html5 = Buffer.from(fs.readFileSync(`${__dirname}` + path.sep + `files` + path.sep + file).toString().split("[" + ident + 'Name' + "]").join(ucwords(n)));
|
|
155
|
-
var filePath = `${process.cwd()}` + path.sep + `src` + path.sep + dir + path.sep + `${n}.${ext}`;
|
|
156
|
-
if (fs.existsSync(filePath)) {
|
|
157
|
-
console.log(ident + " already exists:", filePath);
|
|
158
|
-
} else {
|
|
159
|
-
fs.writeFileSync(filePath, html5);
|
|
160
|
-
}
|
|
260
|
+
fs.writeFileSync(filePath, html5);
|
|
161
261
|
}
|
|
162
|
-
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
163
264
|
|
|
164
265
|
function copyDir(src, dest, projectName) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
266
|
+
try {
|
|
267
|
+
const entries = fs.readdirSync(src, {
|
|
268
|
+
encoding: "utf8",
|
|
269
|
+
withFileTypes: true,
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
cd(dest);
|
|
273
|
+
|
|
274
|
+
for (let entry of entries) {
|
|
275
|
+
const srcPath = path.join(src.toString(), entry.name.toString());
|
|
276
|
+
const destPath = path.join(dest.toString(), entry.name.toString());
|
|
277
|
+
if (entry.isDirectory()) {
|
|
278
|
+
if (projectName == "_beajsBuild") {
|
|
279
|
+
if (
|
|
280
|
+
entry.name != "tpls" &&
|
|
281
|
+
entry.name != "views" &&
|
|
282
|
+
entry.name != "css" &&
|
|
283
|
+
entry.name != "js"
|
|
284
|
+
)
|
|
285
|
+
copyDir(srcPath, destPath, projectName);
|
|
286
|
+
} else copyDir(srcPath, destPath, projectName);
|
|
287
|
+
} else {
|
|
288
|
+
if (projectName == "_beajsBuild") {
|
|
289
|
+
if (
|
|
290
|
+
projectName == "_beajsBuild" &&
|
|
291
|
+
entry.name != "index.js" &&
|
|
292
|
+
entry.name != "index.html"
|
|
293
|
+
)
|
|
294
|
+
fs.copyFileSync(srcPath, destPath);
|
|
295
|
+
} else {
|
|
296
|
+
if (!fs.existsSync(destPath)) {
|
|
297
|
+
if (projectName) {
|
|
298
|
+
if (entry.name == "index.html") {
|
|
299
|
+
let html5 = Buffer.from(
|
|
300
|
+
fs
|
|
301
|
+
.readFileSync(srcPath)
|
|
302
|
+
.toString()
|
|
303
|
+
.split("[ProjectName]")
|
|
304
|
+
.join(ucwords(projectName))
|
|
305
|
+
);
|
|
306
|
+
fs.writeFileSync(destPath, html5);
|
|
307
|
+
} else fs.copyFileSync(srcPath, destPath);
|
|
308
|
+
} else fs.copyFileSync(srcPath, destPath);
|
|
309
|
+
} else {
|
|
310
|
+
console.log("File already exists:", destPath);
|
|
311
|
+
}
|
|
195
312
|
}
|
|
196
|
-
|
|
197
|
-
console.log(e);
|
|
313
|
+
}
|
|
198
314
|
}
|
|
315
|
+
} catch (e) {
|
|
316
|
+
console.log(e);
|
|
317
|
+
}
|
|
199
318
|
}
|
|
200
319
|
exports.copyDir = copyDir;
|
|
201
320
|
|
|
202
321
|
function validURL(string) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
322
|
+
let url;
|
|
323
|
+
try {
|
|
324
|
+
url = new URL(string);
|
|
325
|
+
} catch (_) {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
210
329
|
}
|
|
211
330
|
|
|
212
331
|
exports.validURL = validURL;
|
|
213
332
|
|
|
214
|
-
var API =
|
|
215
|
-
{
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
333
|
+
var API = {
|
|
334
|
+
get: async function (u, d, h, a) {
|
|
335
|
+
return await this.req(u, d, h, "GET", a);
|
|
336
|
+
},
|
|
337
|
+
put: async function (u, d, h, a) {
|
|
338
|
+
return await this.req(u, d, h, "PUT", a);
|
|
339
|
+
},
|
|
340
|
+
post: async function (u, d, h, a) {
|
|
341
|
+
return await this.req(u, d, h, "POST", a);
|
|
342
|
+
},
|
|
343
|
+
delete: async function (u, d, h, a) {
|
|
344
|
+
return await this.req(u, d, h, "DELETE", a);
|
|
345
|
+
},
|
|
346
|
+
patch: async function (u, d, h, a) {
|
|
347
|
+
return await this.req(u, d, h, "PATCH", a);
|
|
348
|
+
},
|
|
349
|
+
req: async function (u, d, h, m, a) {
|
|
350
|
+
let res = await axios({
|
|
351
|
+
method: m.toString().toLowerCase(),
|
|
352
|
+
url: validURL(u) ? u : config.apis[a ?? 0].baseURL + u,
|
|
353
|
+
data: d ?? {},
|
|
354
|
+
headers: h ?? config.apis[a ?? 0].headers,
|
|
355
|
+
maxContentLength: 100000000,
|
|
356
|
+
maxBodyLength: 1000000000,
|
|
357
|
+
});
|
|
358
|
+
return res.data;
|
|
359
|
+
},
|
|
242
360
|
};
|
|
243
|
-
exports.API = API;
|
|
361
|
+
exports.API = API;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmjs/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "LumenJS is a tiny robust reactive javascript framework for building scalable and high-performant web applications and web user interfaces, be it simple or complex, with standard HTML, CSS and JavaScript",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|