@solongate/proxy 0.1.3 → 0.1.4
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/dist/create.js +32 -16
- package/dist/index.js +668 -547
- package/package.json +1 -1
package/dist/create.js
CHANGED
|
@@ -190,14 +190,28 @@ dist/
|
|
|
190
190
|
`
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
|
|
193
|
+
function withSpinner(message, fn) {
|
|
194
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
195
|
+
let i = 0;
|
|
196
|
+
const id = setInterval(() => {
|
|
197
|
+
process.stderr.write(`\r ${frames[i++ % frames.length]} ${message}`);
|
|
198
|
+
}, 80);
|
|
195
199
|
try {
|
|
196
|
-
|
|
200
|
+
fn();
|
|
201
|
+
clearInterval(id);
|
|
202
|
+
process.stderr.write(`\r \u2713 ${message}
|
|
203
|
+
`);
|
|
197
204
|
} catch {
|
|
198
|
-
|
|
205
|
+
clearInterval(id);
|
|
206
|
+
process.stderr.write(`\r \u2717 ${message} \u2014 failed
|
|
207
|
+
`);
|
|
199
208
|
}
|
|
200
209
|
}
|
|
210
|
+
function installDeps(dir) {
|
|
211
|
+
withSpinner("Installing dependencies...", () => {
|
|
212
|
+
execSync("npm install", { cwd: dir, stdio: "pipe" });
|
|
213
|
+
});
|
|
214
|
+
}
|
|
201
215
|
async function main() {
|
|
202
216
|
const opts = parseCreateArgs(process.argv);
|
|
203
217
|
const dir = resolve(opts.name);
|
|
@@ -227,18 +241,20 @@ async function main() {
|
|
|
227
241
|
installDeps(dir);
|
|
228
242
|
log("");
|
|
229
243
|
}
|
|
230
|
-
|
|
231
|
-
log(
|
|
232
|
-
log(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
const W = 46;
|
|
245
|
+
const line = (s) => log(` \u2502 ${s.padEnd(W)} \u2502`);
|
|
246
|
+
log(` \u250C${"\u2500".repeat(W + 2)}\u2510`);
|
|
247
|
+
line("Project created!");
|
|
248
|
+
line("");
|
|
249
|
+
line(`cd ${opts.name}`);
|
|
250
|
+
line("");
|
|
251
|
+
line("npm run build # Build");
|
|
252
|
+
line("npm run dev # Dev mode (tsx)");
|
|
253
|
+
line("npm start # Run built server");
|
|
254
|
+
line("");
|
|
255
|
+
line("Set your API key:");
|
|
256
|
+
line("export SOLONGATE_API_KEY=sg_live_xxx");
|
|
257
|
+
log(` \u2514${"\u2500".repeat(W + 2)}\u2518`);
|
|
242
258
|
log("");
|
|
243
259
|
}
|
|
244
260
|
main().catch((err) => {
|