Skip to content

Commit a93a6b5

Browse files
committed
Add logs for start command
1 parent d67f823 commit a93a6b5

File tree

5 files changed

+62
-62
lines changed

5 files changed

+62
-62
lines changed

package-lock.json

Lines changed: 39 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"acorn": "^8.10.0",
3030
"acorn-walk": "^8.3.0",
3131
"axios": "^1.2.0",
32+
"chalk": "^4.1.2",
3233
"cors": "^2.8.5",
3334
"dotenv": "^16.1.3",
3435
"escodegen": "^2.1.0",

server.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { argv } = require("yargs");
22
const datastore = require("./src/datastore");
33
const nucleoid = require("./");
44
const cluster = require("./src/cluster");
5+
const chalk = require("chalk");
56

67
if (!argv.debug) {
78
console.debug = () => {};
@@ -12,7 +13,15 @@ if (argv.clear) {
1213
}
1314

1415
nucleoid.start().then(() => {
15-
console.log("Nucleoid runtime is started");
16+
const { id, port } = require("./src/config")();
17+
console.log("");
18+
console.log("---");
19+
console.log("Terminal: " + chalk.blue(`http://localhost:${port.terminal}`));
20+
console.log(
21+
"IDE: " +
22+
chalk.blue(`https://nucleoid.com/ide/${id}/query?mode=terminal`)
23+
);
24+
console.log("");
1625

1726
if (argv.cluster) {
1827
cluster.init();

src/nucleoid.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ const process = require("./process");
44
const _config = require("./config");
55
const { parseFunction } = require("./lang/estree/parser");
66
const { generate } = require("./lang/estree/generator");
7+
const chalk = require("chalk");
78

89
function start(config = {}) {
910
_config.init(config);
11+
12+
console.log("🌿 " + chalk.greenBright("Nucleoid") + " runtime is started");
13+
console.log(chalk.blueBright("🌎 Inspired by Nature\n"));
14+
1015
process.init();
1116

1217
return new Promise((resolve) => {

src/process.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ function init() {
1313
}
1414

1515
const _config = config();
16+
1617
datastore.init(_config);
18+
console.log("[✓] Data Store is initiated");
1719

1820
setImmediate(() => {
1921
datastore.read().forEach(({ $, c, e }) => {
@@ -22,6 +24,8 @@ function init() {
2224
}
2325
});
2426

27+
console.log("[✓] Context is loaded");
28+
2529
const nucleoid = require("../");
2630
require(`${_config.path}/nucleoid.js`)(nucleoid);
2731

@@ -68,9 +72,12 @@ function init() {
6872
}
6973
}
7074

75+
console.log("[✓] Process is running");
76+
7177
if (!test) {
7278
terminal.all("*", (req, res) => res.status(404).end());
7379
terminal.listen(port.terminal);
80+
console.log("[✓] Terminal is ready");
7481
}
7582
});
7683

0 commit comments

Comments
 (0)