webide-cli 0.0.1 → 0.0.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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/index.js +23 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,6 +31,8 @@ webide -h
31
31
  webide info
32
32
  # 显示当前工作目录
33
33
  webide workdir
34
+ # 检查数据库是否连接正常
35
+ webide checkdb
34
36
  # 添加第三方库
35
37
  webide add <name>
36
38
  # 移除第三方库
package/index.js CHANGED
@@ -65,6 +65,26 @@ program
65
65
  console.log("Current working directory:", process.cwd());
66
66
  });
67
67
 
68
+ program
69
+ .command("checkdb")
70
+ .description("Check if Database connection is working.")
71
+ .action(async () => {
72
+ const load = loading("Checking database connection...");
73
+ try {
74
+ const { data, error } = await bucket.exists('.check');
75
+ if (error) {
76
+ load();
77
+ console.error("Database connection failed:", error.message);
78
+ process.exit(114514);
79
+ }
80
+ load();
81
+ console.log("Database connection is working.");
82
+ } catch (error) {
83
+ load();
84
+ console.error("Database connection failed:", error.message);
85
+ }
86
+ })
87
+
68
88
  program
69
89
  .command('add <name>')
70
90
  .description('Add a new library.')
@@ -182,8 +202,10 @@ program
182
202
  }
183
203
  const load = loading(`Publishing library "${name}" ...`);
184
204
  let totalSize = 0;
205
+ let totalFiles = 0;
185
206
  await upload(libpath);
186
207
  load();
208
+ console.log(`Total files: ${totalFiles}`);
187
209
  console.log(`Total size: ${totalSize} bytes`);
188
210
  console.log(`Library "${name}" published successfully.`);
189
211
 
@@ -198,6 +220,7 @@ program
198
220
  const fileType = path.extname(filePath).substring(1);
199
221
  const fileSize = stats.size;
200
222
  totalSize += fileSize;
223
+ totalFiles++;
201
224
  const fp = filePath.replace(libpath, name).replace(/\\/g, '/');
202
225
  const { data, error } = await bucket.update(fp, fileData, { contentType: fileType });
203
226
  if (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webide-cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A CLI for NEW WebIDE",
5
5
  "keywords": [
6
6
  "WebIDE",