@lmjs/cli 1.0.25 → 1.0.27
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 +54 -61
- package/lib/fcs.js +3 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5,7 +5,6 @@ const fs = require("fs");
|
|
|
5
5
|
const FtpDeploy = require("ftp-deploy");
|
|
6
6
|
const ftpDeploy = new FtpDeploy();
|
|
7
7
|
|
|
8
|
-
// const { exec } = require("child_process");
|
|
9
8
|
const fcs = require("./lib/fcs.js");
|
|
10
9
|
var UglifyJS = require("uglify-js");
|
|
11
10
|
|
|
@@ -125,80 +124,81 @@ async function buildProject(cmds) {
|
|
|
125
124
|
projectPath + path.sep + `src` + path.sep + "css" + path.sep + "bea.css",
|
|
126
125
|
"utf8"
|
|
127
126
|
);
|
|
128
|
-
var
|
|
127
|
+
var indexJs = fs.readFileSync(
|
|
129
128
|
projectPath + path.sep + `src` + path.sep + "index.js",
|
|
130
129
|
"utf8"
|
|
131
130
|
);
|
|
132
131
|
|
|
133
|
-
|
|
134
|
-
projectPath + path.sep + `src` + path.sep + "js" + path.sep + "bea.js",
|
|
135
|
-
"utf8"
|
|
136
|
-
);
|
|
137
|
-
spinner.succeed("Gathering Required Resources");
|
|
138
|
-
var beaCode = "";
|
|
139
|
-
if (cmds.indexOf("--serverless") >= 0) {
|
|
140
|
-
spinner.start("Signing & Securing App..");
|
|
141
|
-
|
|
142
|
-
let r = await API.post("https://www.beaapis.com/1/beajs", {
|
|
143
|
-
data: JSON.stringify(config.apis),
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
let token_ = r.token;
|
|
147
|
-
|
|
148
|
-
if (token_ == "") {
|
|
149
|
-
spinner.fail("Error getting a unique token for production!");
|
|
150
|
-
spinner.fail("Build Failed! Try again later.");
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
beaCode +=
|
|
155
|
-
`
|
|
156
|
-
var _beaTn = "` +
|
|
157
|
-
token_ +
|
|
158
|
-
`";
|
|
159
|
-
`;
|
|
160
|
-
}
|
|
161
|
-
beaCode += kkk;
|
|
162
|
-
spinner.succeed("Signing & Securing App").start("Packing & Cleaning...");
|
|
163
|
-
|
|
164
|
-
beaCode +=
|
|
132
|
+
let vt =
|
|
165
133
|
`
|
|
166
|
-
|
|
167
|
-
|
|
134
|
+
var _vcData = {
|
|
135
|
+
"views": ` +
|
|
168
136
|
JSON.stringify(_views) +
|
|
169
137
|
`,
|
|
170
|
-
|
|
138
|
+
"tpls": ` +
|
|
171
139
|
JSON.stringify(_tpls) +
|
|
172
140
|
`
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
141
|
+
};
|
|
142
|
+
`;
|
|
143
|
+
vt += " " + String(indexJs);
|
|
144
|
+
let f1 = await axios.get("https://s.beacdn.com/beajs/f1", {});
|
|
145
|
+
|
|
146
|
+
spinner
|
|
147
|
+
.succeed("Gathering Required Resources")
|
|
148
|
+
.start("Signing & Securing App..");
|
|
149
|
+
|
|
150
|
+
let r = await API.post("https://www.beaapis.com/1/beajs", {
|
|
151
|
+
data: {
|
|
152
|
+
apis: JSON.stringify(config.apis),
|
|
153
|
+
js: vt,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// spinner.succeed("Signing & Securing App");
|
|
158
|
+
// return;
|
|
159
|
+
|
|
160
|
+
let token_ = r.token;
|
|
161
|
+
let js_ = "";
|
|
162
|
+
|
|
181
163
|
var js2 =
|
|
182
164
|
`
|
|
183
165
|
exports.config = ` +
|
|
184
166
|
JSON.stringify(config) +
|
|
185
167
|
`;
|
|
186
168
|
`;
|
|
187
|
-
|
|
188
|
-
let zode = UglifyJS.minify(beaCode, {
|
|
169
|
+
let configData = UglifyJS.minify(js2, {
|
|
189
170
|
mangle: {
|
|
190
171
|
reserved: ["_vcdata", "_ws"],
|
|
191
172
|
},
|
|
173
|
+
output: {
|
|
174
|
+
beautify: true,
|
|
175
|
+
},
|
|
192
176
|
});
|
|
193
|
-
|
|
177
|
+
|
|
178
|
+
if (cmds.indexOf("--serverless") >= 0) {
|
|
179
|
+
js_ +=
|
|
180
|
+
`
|
|
181
|
+
var _beaTn = "` +
|
|
182
|
+
token_ +
|
|
183
|
+
`";
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
js_ += String(f1.data) + " " + r.js;
|
|
187
|
+
|
|
188
|
+
let js__ = UglifyJS.minify(js_, {
|
|
194
189
|
mangle: {
|
|
190
|
+
toplevel: true,
|
|
195
191
|
reserved: ["_vcdata", "_ws"],
|
|
196
192
|
},
|
|
197
|
-
output: {
|
|
198
|
-
beautify: true,
|
|
199
|
-
},
|
|
200
193
|
});
|
|
201
194
|
|
|
195
|
+
if (token_ == "") {
|
|
196
|
+
spinner.fail("Error getting a unique token for production!");
|
|
197
|
+
spinner.fail("Build Failed! Try again later.");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
spinner.succeed("Signing & Securing App").start("Packing & Cleaning...");
|
|
202
202
|
fcs.rd(dest);
|
|
203
203
|
|
|
204
204
|
spinner.succeed("Packing & Cleaning").start("Writing Files...");
|
|
@@ -239,7 +239,7 @@ async function buildProject(cmds) {
|
|
|
239
239
|
|
|
240
240
|
fs.writeFileSync(
|
|
241
241
|
dest + path.sep + "js" + path.sep + "bea.js",
|
|
242
|
-
String(
|
|
242
|
+
String(js__.code)
|
|
243
243
|
);
|
|
244
244
|
fs.writeFileSync(
|
|
245
245
|
dest + path.sep + "css" + path.sep + "bea.css",
|
|
@@ -318,7 +318,7 @@ async function buildProject(cmds) {
|
|
|
318
318
|
|
|
319
319
|
fs.writeFileSync(
|
|
320
320
|
dest + path.sep + "src" + path.sep + "js" + path.sep + "bea.js",
|
|
321
|
-
String(
|
|
321
|
+
String(String(js__.code))
|
|
322
322
|
);
|
|
323
323
|
fs.writeFileSync(
|
|
324
324
|
dest + path.sep + "src" + path.sep + "css" + path.sep + "bea.css",
|
|
@@ -330,7 +330,7 @@ async function buildProject(cmds) {
|
|
|
330
330
|
.split('<script src="/index.js" type="text/javascript"></script>')
|
|
331
331
|
.join("")
|
|
332
332
|
);
|
|
333
|
-
fs.writeFileSync(dest + path.sep + "config.js", String(
|
|
333
|
+
fs.writeFileSync(dest + path.sep + "config.js", String(configData.code));
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
if (cmds.indexOf("--deploy") >= 0) {
|
|
@@ -390,14 +390,7 @@ async function buildProject(cmds) {
|
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
function clear(isSoft) {
|
|
394
|
-
process.stdout.write(
|
|
395
|
-
isSoft ? '\x1B[H\x1B[2J' : '\x1B[2J\x1B[3J\x1B[H\x1Bc'
|
|
396
|
-
);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
393
|
function startServer() {
|
|
400
|
-
clear();
|
|
401
394
|
nodemon({
|
|
402
395
|
script: path.join(__dirname.toString(), "lib", "app.js"),
|
|
403
396
|
ext: "view,js,css,json,tpl,html",
|
package/lib/fcs.js
CHANGED
|
@@ -233,7 +233,9 @@ var API =
|
|
|
233
233
|
method: m.toString().toLowerCase(),
|
|
234
234
|
url: validURL(u) ? u : (config.apis[a ?? 0].baseURL + u),
|
|
235
235
|
data: d ?? {},
|
|
236
|
-
headers: h ?? config.apis[a ?? 0].headers
|
|
236
|
+
headers: h ?? config.apis[a ?? 0].headers,
|
|
237
|
+
maxContentLength: 100000000,
|
|
238
|
+
maxBodyLength: 1000000000
|
|
237
239
|
});
|
|
238
240
|
return res.data;
|
|
239
241
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmjs/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
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": {
|