@rainfw/core 0.2.3 → 0.2.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/cli/index.js CHANGED
@@ -5,6 +5,7 @@ const fs = require("node:fs");
5
5
  const { spawn } = require("node:child_process");
6
6
 
7
7
  const { stripControlChars } = require("./utils/sanitize");
8
+ const { printBanner } = require("./utils/banner");
8
9
 
9
10
  const PACKAGE_JSON = path.join(__dirname, "..", "package.json");
10
11
  const pkg = JSON.parse(fs.readFileSync(PACKAGE_JSON, "utf-8"));
@@ -44,6 +45,8 @@ if (command === "--version" || command === "-v") {
44
45
  process.exit(0);
45
46
  }
46
47
 
48
+ printBanner();
49
+
47
50
  if (!VALID_COMMANDS.includes(command)) {
48
51
  console.error(
49
52
  `[Rain] Error: Unknown command "${stripControlChars(command)}".\n` +
@@ -0,0 +1,14 @@
1
+ const path = require("node:path");
2
+
3
+ const BRAND_COLOR = "\x1b[38;2;101;187;233m";
4
+ const RESET = "\x1b[0m";
5
+ const version = require(path.join(__dirname, "..", "..", "package.json")).version;
6
+
7
+ function printBanner() {
8
+ console.log(
9
+ `\n ${BRAND_COLOR}\u{1F327}\uFE0F rain.js ${version}${RESET}`,
10
+ );
11
+ console.log(`${BRAND_COLOR}${"─".repeat(20)}${RESET}\n`);
12
+ }
13
+
14
+ module.exports = { printBanner, version, BRAND_COLOR, RESET };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainfw/core",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "A TypeScript web framework for Cloudflare Workers",
5
5
  "bin": {
6
6
  "rainjs": "./cli/index.js"
package/scripts/dev.js CHANGED
@@ -2,9 +2,12 @@ const fs = require("node:fs");
2
2
  const path = require("node:path");
3
3
  const { spawn } = require("node:child_process");
4
4
  const { generate, regenerateClient, ROUTES_DIR } = require("./generate");
5
+ const { printBanner } = require("../cli/utils/banner");
5
6
 
6
7
  const SRC_DIR = path.join(process.cwd(), "src");
7
8
 
9
+ printBanner();
10
+
8
11
  generate();
9
12
 
10
13
  let debounceTimer = null;
@@ -2,6 +2,7 @@ const fs = require("node:fs");
2
2
  const path = require("node:path");
3
3
  const { execSync } = require("node:child_process");
4
4
  const ts = require("typescript");
5
+ const { printBanner } = require("../cli/utils/banner");
5
6
 
6
7
  let esbuild;
7
8
  try {
@@ -1133,5 +1134,6 @@ module.exports = {
1133
1134
  };
1134
1135
 
1135
1136
  if (require.main === module) {
1137
+ printBanner();
1136
1138
  generate();
1137
1139
  }