next-vite-router 1.1.0 → 1.1.1

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/dist/cli.cjs +24 -28
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -47,7 +47,7 @@ function detectPackageManager() {
47
47
  case "pnpm":
48
48
  return {
49
49
  name: "pnpm",
50
- createProjectCommand: (projectName, template) => `pnpm create vite@latest ${projectName} --template ${template} --no-rolldown`,
50
+ createProjectCommand: (projectName, template) => `pnpm create vite@latest ${projectName} --template ${template} --no-interactive`,
51
51
  addDepsCommand: (deps) => `pnpm add ${deps.join(" ")}`,
52
52
  addDevDepsCommand: (deps) => `pnpm add -D ${deps.join(" ")}`,
53
53
  installCommand: "pnpm install"
@@ -55,7 +55,7 @@ function detectPackageManager() {
55
55
  case "bun":
56
56
  return {
57
57
  name: "bun",
58
- createProjectCommand: (projectName, template) => `bun create vite ${projectName} --template=${template} --no-rolldown`,
58
+ createProjectCommand: (projectName, template) => `bun create vite ${projectName} --template=${template} --no-interactive`,
59
59
  addDepsCommand: (deps) => `bun add ${deps.join(" ")}`,
60
60
  addDevDepsCommand: (deps) => `bun add -d ${deps.join(" ")}`,
61
61
  installCommand: "bun install"
@@ -63,7 +63,7 @@ function detectPackageManager() {
63
63
  case "yarn":
64
64
  return {
65
65
  name: "yarn",
66
- createProjectCommand: (projectName, template) => `yarn create vite ${projectName} --template=${template} --no-rolldown`,
66
+ createProjectCommand: (projectName, template) => `yarn create vite ${projectName} --template=${template} --no-interactive`,
67
67
  addDepsCommand: (deps) => `yarn add ${deps.join(" ")}`,
68
68
  addDevDepsCommand: (deps) => `yarn add -D ${deps.join(" ")}`,
69
69
  installCommand: "yarn install"
@@ -72,7 +72,7 @@ function detectPackageManager() {
72
72
  default:
73
73
  return {
74
74
  name: "npm",
75
- createProjectCommand: (projectName, template) => `npm create vite@latest ${projectName} -- --template ${template} --no-rolldown`,
75
+ createProjectCommand: (projectName, template) => `npm create vite@latest ${projectName} -- --template ${template} --no-interactive`,
76
76
  addDepsCommand: (deps) => `npm install ${deps.join(" ")}`,
77
77
  addDevDepsCommand: (deps) => `npm install -D ${deps.join(" ")}`,
78
78
  installCommand: "npm install"
@@ -126,10 +126,17 @@ const logger = {
126
126
  }
127
127
  };
128
128
  function getViteConfigPath(projectDir) {
129
- const tsPath = path.join(projectDir, "vite.config.ts");
130
- const jsPath = path.join(projectDir, "vite.config.js");
131
- if (fs.existsSync(tsPath)) return tsPath;
132
- if (fs.existsSync(jsPath)) return jsPath;
129
+ for (const fileName of [
130
+ "vite.config.ts",
131
+ "vite.config.mts",
132
+ "vite.config.cts",
133
+ "vite.config.js",
134
+ "vite.config.mjs",
135
+ "vite.config.cjs"
136
+ ]) {
137
+ const configPath = path.join(projectDir, fileName);
138
+ if (fs.existsSync(configPath)) return configPath;
139
+ }
133
140
  return null;
134
141
  }
135
142
  function readViteConfig(projectDir) {
@@ -225,19 +232,12 @@ function createMainTSX(projectDir, useSrc) {
225
232
  const content = `import { StrictMode } from 'react';
226
233
  import { createRoot } from 'react-dom/client';
227
234
  import { BrowserRouter } from "react-router-dom";
228
- import { generateRoutes, useRoutes } from 'virtual:next-vite-router';
229
-
230
- const routes = generateRoutes();
231
-
232
- export default function App() {
233
- const element = useRoutes(routes);
234
- return element;
235
- }
235
+ import { Router } from 'virtual:next-vite-router';
236
236
 
237
237
  createRoot(document.getElementById('root')!).render(
238
238
  <StrictMode>
239
239
  <BrowserRouter>
240
- <App />
240
+ <Router />
241
241
  </BrowserRouter>
242
242
  </StrictMode>,
243
243
  );
@@ -463,12 +463,11 @@ const init = new commander.Command().name("init").description(
463
463
  name: "template",
464
464
  message: "Select a template:",
465
465
  choices: [
466
- { title: "React + TypeScript", value: "react-ts" },
466
+ { title: "React + TypeScript (Recommended)", value: "react-ts" },
467
467
  {
468
468
  title: "React + TypeScript (React Compiler)",
469
469
  value: "react-compiler-ts"
470
- },
471
- { title: "React + SWC (Recommended)", value: "react-swc-ts" }
470
+ }
472
471
  ],
473
472
  initial: 0
474
473
  },
@@ -512,13 +511,10 @@ const init = new commander.Command().name("init").description(
512
511
  const useTailwind = tailwindResponse.useTailwind;
513
512
  const createCommand = pm.createProjectCommand(projectName, variant);
514
513
  logger.info(`Creating project "${projectName}" using ${pm.name}...`);
515
- try {
516
- child_process.execSync(createCommand, {
517
- stdio: ["pipe", "inherit", "inherit"],
518
- input: "n\n"
519
- });
520
- } catch (error) {
521
- }
514
+ child_process.execSync(createCommand, {
515
+ stdio: ["pipe", "inherit", "inherit"],
516
+ input: "n\n"
517
+ });
522
518
  logger.info("Installing dependencies...");
523
519
  child_process.execSync(pm.installCommand, { stdio: "inherit", cwd: projectName });
524
520
  logger.info(
@@ -539,7 +535,7 @@ const init = new commander.Command().name("init").description(
539
535
  Project "${projectName}" is ready!
540
536
  `);
541
537
  });
542
- const version = "1.1.0";
538
+ const version = "1.1.1";
543
539
  const pkg = {
544
540
  version
545
541
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-vite-router",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Next.js-like file-based routing for React + Vite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",