@nitronjs/framework 0.1.21 → 0.1.22

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 (2) hide show
  1. package/cli/create.js +28 -4
  2. package/package.json +1 -1
package/cli/create.js CHANGED
@@ -32,6 +32,27 @@ function logStep(message, status = "pending") {
32
32
  console.log(` ${icons[status]} ${message}`);
33
33
  }
34
34
 
35
+ function startSpinner(message) {
36
+ if (!process.stdout.isTTY) {
37
+ return () => {};
38
+ }
39
+
40
+ const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
41
+ let i = 0;
42
+ const line = () => ` ${COLORS.yellow}${frames[i]}${COLORS.reset} ${message}`;
43
+
44
+ process.stdout.write(line());
45
+ const timer = setInterval(() => {
46
+ i = (i + 1) % frames.length;
47
+ process.stdout.write(`\r${line()}`);
48
+ }, 120);
49
+
50
+ return () => {
51
+ clearInterval(timer);
52
+ process.stdout.write(`\r${" ".repeat(message.length + 4)}\r`);
53
+ };
54
+ }
55
+
35
56
  function printBanner() {
36
57
  console.log();
37
58
  log("███╗ ██╗██╗████████╗██████╗ ██████╗ ███╗ ██╗ ██╗███████╗", COLORS.cyan);
@@ -150,12 +171,12 @@ function updateEnvFile(projectPath) {
150
171
  function runNpmInstall(projectPath) {
151
172
  return new Promise((resolve, reject) => {
152
173
  const isWindows = process.platform === "win32";
153
- const npm = isWindows ? "npm.cmd" : "npm";
174
+ const npm = isWindows ? (process.env.ComSpec || "cmd.exe") : "npm";
175
+ const npmArgs = isWindows ? ["/d", "/s", "/c", "npm", "install"] : ["install"];
154
176
 
155
- const child = spawn(npm, ["install"], {
177
+ const child = spawn(npm, npmArgs, {
156
178
  cwd: projectPath,
157
- stdio: ["ignore", "pipe", "pipe"],
158
- shell: isWindows
179
+ stdio: ["ignore", "pipe", "pipe"]
159
180
  });
160
181
 
161
182
  let output = "";
@@ -262,10 +283,13 @@ export default async function create(projectName, options = {}) {
262
283
  logStep("APP_KEY generated", "success");
263
284
 
264
285
  logStep("Installing dependencies (this may take a moment)...", "running");
286
+ const stopSpinner = startSpinner("Installing dependencies...");
265
287
  try {
266
288
  await runNpmInstall(projectPath);
289
+ stopSpinner();
267
290
  logStep("Dependencies installed", "success");
268
291
  } catch (error) {
292
+ stopSpinner();
269
293
  logStep("Failed to install dependencies", "error");
270
294
  if (error.output) {
271
295
  log(`${COLORS.dim}${error.output}${COLORS.reset}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitronjs/framework",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "NitronJS is a modern and extensible Node.js MVC framework built on Fastify. It focuses on clean architecture, modular structure, and developer productivity, offering built-in routing, middleware, configuration management, CLI tooling, and native React integration for scalable full-stack applications.",
5
5
  "bin": {
6
6
  "njs": "./cli/njs.js"