webide-cli 0.0.1-beta.0 → 0.0.1-beta.2
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 +27 -2
- package/init.js +6 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const path = require('path');
|
|
|
7
7
|
const readline = require('readline');
|
|
8
8
|
|
|
9
9
|
const termCols = process.stdout.columns;
|
|
10
|
+
const termRows = process.stdout.rows;
|
|
10
11
|
|
|
11
12
|
const SUPABASE_URL = "https://dbmp-xbgmorqeur6oh81z.database.nocode.cn";
|
|
12
13
|
const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzQ2OTc5MjAwLCJleHAiOjE5MDQ3NDU2MDB9.11QbQ5OW_m10vblDXAlw1Qq7Dve5Swzn12ILo7-9IXY";
|
|
@@ -16,6 +17,10 @@ const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
|
|
16
17
|
const bucket = supabase.storage.from(FILE_BUCKET);
|
|
17
18
|
|
|
18
19
|
const workdir = process.cwd();
|
|
20
|
+
const workspacedir = process.env.WEBIDE_WORKSPACE;
|
|
21
|
+
const webideVersionName = process.env.WEBIDE_VERSION_NAME || 'Unknown';
|
|
22
|
+
const webideVersionCode = process.env.WEBIDE_VERSION_CODE || 'Unknown';
|
|
23
|
+
|
|
19
24
|
|
|
20
25
|
program
|
|
21
26
|
.name('webide')
|
|
@@ -29,6 +34,20 @@ program
|
|
|
29
34
|
console.log("Welcome to WebIDE CLI!");
|
|
30
35
|
});
|
|
31
36
|
|
|
37
|
+
program
|
|
38
|
+
.command('info')
|
|
39
|
+
.description('Show environment information.')
|
|
40
|
+
.action(() => {
|
|
41
|
+
console.log("WebIDE CLI Information:");
|
|
42
|
+
console.log(" Version:", version);
|
|
43
|
+
console.log(" WebIDE Version Name:", webideVersionName);
|
|
44
|
+
console.log(" WebIDE Version Code:", webideVersionCode);
|
|
45
|
+
console.log(" Working directory:", workdir);
|
|
46
|
+
console.log(" Workspace directory:", workspacedir);
|
|
47
|
+
console.log(" Terminal columns:", termCols);
|
|
48
|
+
console.log(" Terminal rows:", termRows);
|
|
49
|
+
});
|
|
50
|
+
|
|
32
51
|
program
|
|
33
52
|
.command('workdir')
|
|
34
53
|
.description('Show current working directory.')
|
|
@@ -56,13 +75,19 @@ program
|
|
|
56
75
|
let load2 = loading(downloadingTip);
|
|
57
76
|
const libJsonData = await getFile(libname + "/lib.json");
|
|
58
77
|
const libJson = JSON.parse(await libJsonData.text());
|
|
59
|
-
const { name, author, description, version } = libJson;
|
|
78
|
+
const { name, author, description, version, imports } = libJson;
|
|
60
79
|
load2();
|
|
61
80
|
console.log(`Library info: `);
|
|
62
81
|
console.log(` Name: ${name}`);
|
|
63
82
|
console.log(` Version: ${version}`);
|
|
64
83
|
console.log(` Author: ${author || 'Unknown'}`);
|
|
65
84
|
console.log(` Description: ${description || 'No description'}`);
|
|
85
|
+
if (imports && imports.length > 0) {
|
|
86
|
+
console.log(` Imports:`);
|
|
87
|
+
for (let i = 0; i < imports.length; i++) {
|
|
88
|
+
console.log(` ${path.join(workdir, 'libs', libname, imports[i])}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
66
91
|
load2 = loading(downloadingTip);
|
|
67
92
|
await download(libname, path.join(workdir, 'libs', libname));
|
|
68
93
|
load2();
|
|
@@ -130,7 +155,7 @@ async function getFile(path) {
|
|
|
130
155
|
return data;
|
|
131
156
|
}
|
|
132
157
|
|
|
133
|
-
|
|
158
|
+
function loading(msg) {
|
|
134
159
|
const spinnerChars = ['⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
135
160
|
const terminalWidth = process.stdout.columns;
|
|
136
161
|
let i = 0;
|
package/init.js
CHANGED
|
@@ -5,8 +5,13 @@ const platform = os.platform();
|
|
|
5
5
|
const arch = os.arch();
|
|
6
6
|
const workdir = process.cwd();
|
|
7
7
|
const bindir = "/usr/bin/";
|
|
8
|
+
const minVersion = 23;
|
|
8
9
|
|
|
9
|
-
if (platform === "linux" && arch === "arm64") {
|
|
10
|
+
if (platform === "linux" && arch === "arm64" && process.env.WEBIDE_VERSION_CODE) {
|
|
11
|
+
if (Number(process.env.WEBIDE_VERSION_CODE) < minVersion) {
|
|
12
|
+
console.error("The version is too low, must >= " + minVersion);
|
|
13
|
+
process.exit(114514);
|
|
14
|
+
}
|
|
10
15
|
fs.writeFile(bindir + "webide", `#!/bin/bash
|
|
11
16
|
node ${workdir}/index.js "$@"
|
|
12
17
|
`).then(() => {
|