@dainprotocol/cli 1.0.30 → 1.0.31
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/commands/build.js +4 -0
- package/dist/commands/config.js +6 -2
- package/dist/commands/start.js +12 -9
- package/package.json +1 -1
package/dist/commands/build.js
CHANGED
|
@@ -148,6 +148,10 @@ function build(options) {
|
|
|
148
148
|
case 11:
|
|
149
149
|
spinner.succeed('Build completed successfully.');
|
|
150
150
|
(0, utils_1.logSuccess)("Project built and ready for ".concat(runtime, " runtime in ").concat(options.watch ? dainDir : outDir, "."));
|
|
151
|
+
// Explicitly exit with success if not in watch mode
|
|
152
|
+
if (!options.watch) {
|
|
153
|
+
process.exit(0);
|
|
154
|
+
}
|
|
151
155
|
return [3 /*break*/, 13];
|
|
152
156
|
case 12:
|
|
153
157
|
error_1 = _a.sent();
|
package/dist/commands/config.js
CHANGED
|
@@ -63,30 +63,34 @@ function config(action, key, value) {
|
|
|
63
63
|
else {
|
|
64
64
|
console.log(JSON.stringify(config_1, null, 2));
|
|
65
65
|
}
|
|
66
|
+
process.exit(0);
|
|
66
67
|
return [3 /*break*/, 6];
|
|
67
68
|
case 3:
|
|
68
69
|
if (!(action === 'edit' && key && value)) return [3 /*break*/, 5];
|
|
69
70
|
if (key === 'runtime' && !['node', 'workers'].includes(value)) {
|
|
70
71
|
(0, utils_1.logError)('Invalid runtime. Use "node" or "workers"');
|
|
71
|
-
|
|
72
|
+
process.exit(1);
|
|
72
73
|
}
|
|
73
74
|
if (key === 'platform-base-url' && !value.startsWith('http')) {
|
|
74
75
|
(0, utils_1.logError)('Invalid platform-base-url. It should start with http:// or https://');
|
|
75
|
-
|
|
76
|
+
process.exit(1);
|
|
76
77
|
}
|
|
77
78
|
config_1[key] = value;
|
|
78
79
|
return [4 /*yield*/, fs_extra_1.default.writeJSON(configPath, config_1, { spaces: 2 })];
|
|
79
80
|
case 4:
|
|
80
81
|
_a.sent();
|
|
81
82
|
(0, utils_1.logSuccess)("Updated ".concat(key, " to ").concat(value));
|
|
83
|
+
process.exit(0);
|
|
82
84
|
return [3 /*break*/, 6];
|
|
83
85
|
case 5:
|
|
84
86
|
(0, utils_1.logError)('Invalid command. Use "view" or "edit <key> <value>"');
|
|
87
|
+
process.exit(1);
|
|
85
88
|
_a.label = 6;
|
|
86
89
|
case 6: return [3 /*break*/, 8];
|
|
87
90
|
case 7:
|
|
88
91
|
error_1 = _a.sent();
|
|
89
92
|
(0, utils_1.logError)('Error accessing configuration', error_1);
|
|
93
|
+
process.exit(1);
|
|
90
94
|
return [3 /*break*/, 8];
|
|
91
95
|
case 8: return [2 /*return*/];
|
|
92
96
|
}
|
package/dist/commands/start.js
CHANGED
|
@@ -6,15 +6,18 @@ var utils_1 = require("../utils");
|
|
|
6
6
|
function start(options) {
|
|
7
7
|
process.env.PORT = options.port;
|
|
8
8
|
var command = "node ".concat((0, utils_1.getDainConfig)()['main-file']);
|
|
9
|
-
(0, child_process_1.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
var child = (0, child_process_1.spawn)('node', [(0, utils_1.getDainConfig)()['main-file']], {
|
|
10
|
+
stdio: 'inherit' // This pipes stdout/stderr directly to parent process
|
|
11
|
+
});
|
|
12
|
+
child.on('error', function (error) {
|
|
13
|
+
console.error("Error: ".concat(error.message));
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
16
|
+
child.on('exit', function (code) {
|
|
17
|
+
if (code !== 0) {
|
|
18
|
+
console.error("Process exited with code ".concat(code));
|
|
19
|
+
process.exit(code || 1);
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
process.exit(0);
|
|
19
22
|
});
|
|
20
23
|
}
|