create-rotor 0.1.2 → 0.2.0

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/index.js CHANGED
@@ -91,7 +91,7 @@ var require_src = __commonJS((exports, module) => {
91
91
 
92
92
  // src/index.ts
93
93
  import { execSync } from "node:child_process";
94
- import { cpSync, existsSync as existsSync2, renameSync, rmSync as rmSync2 } from "node:fs";
94
+ import { cpSync, existsSync as existsSync2, readFileSync as readFileSync2, renameSync, rmSync as rmSync2 } from "node:fs";
95
95
  import { join as join2, resolve } from "node:path";
96
96
 
97
97
  // node_modules/@clack/core/dist/index.mjs
@@ -1206,7 +1206,6 @@ var MODULES = {
1206
1206
  envMarker: "ai"
1207
1207
  }
1208
1208
  };
1209
- var VERSION = "0.1.2";
1210
1209
 
1211
1210
  // src/helpers.ts
1212
1211
  import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
@@ -1333,6 +1332,10 @@ function trimCssShadcn(cssPath) {
1333
1332
  function getTemplatePath() {
1334
1333
  return resolve(import.meta.dirname, "..", "template");
1335
1334
  }
1335
+ function getVersion() {
1336
+ const pkgPath = resolve(import.meta.dirname, "..", "package.json");
1337
+ return JSON.parse(readFileSync2(pkgPath, "utf-8")).version;
1338
+ }
1336
1339
  function validateProjectName(name) {
1337
1340
  if (!name)
1338
1341
  return "Project name is required";
@@ -1344,12 +1347,12 @@ function validateProjectName(name) {
1344
1347
  async function main() {
1345
1348
  const args = process.argv.slice(2);
1346
1349
  if (args.includes("--version") || args.includes("-v")) {
1347
- console.log(VERSION);
1350
+ console.log(getVersion());
1348
1351
  process.exit(0);
1349
1352
  }
1350
1353
  if (args.includes("--help") || args.includes("-h")) {
1351
1354
  console.log(`
1352
- create-rotor v${VERSION}
1355
+ create-rotor v${getVersion()}
1353
1356
 
1354
1357
  Usage: create-rotor [project-name]
1355
1358
 
@@ -1409,6 +1412,14 @@ async function main() {
1409
1412
  Nt("Cancelled.");
1410
1413
  process.exit(0);
1411
1414
  }
1415
+ const installDeps = await Rt({
1416
+ message: "Install dependencies?",
1417
+ initialValue: true
1418
+ });
1419
+ if (Ct(installDeps)) {
1420
+ Nt("Cancelled.");
1421
+ process.exit(0);
1422
+ }
1412
1423
  const s = be();
1413
1424
  s.start("Creating project...");
1414
1425
  const templatePath = getTemplatePath();
@@ -1422,16 +1433,34 @@ async function main() {
1422
1433
  if (!selectedModules.includes("shadcn")) {
1423
1434
  trimCssShadcn(join2(targetDir, "app", "globals.css"));
1424
1435
  }
1436
+ s.stop("Project created!");
1437
+ if (installDeps) {
1438
+ const installSpinner = be();
1439
+ installSpinner.start("Installing dependencies...");
1440
+ try {
1441
+ execSync("bun install", { cwd: targetDir, stdio: "ignore" });
1442
+ installSpinner.stop("Dependencies installed!");
1443
+ } catch {
1444
+ installSpinner.stop('Failed to install dependencies. Run "bun install" manually.');
1445
+ }
1446
+ }
1425
1447
  if (initGit) {
1426
1448
  execSync("git init", { cwd: targetDir, stdio: "ignore" });
1427
1449
  execSync("git add -A", { cwd: targetDir, stdio: "ignore" });
1428
1450
  execSync('git commit -m "init"', { cwd: targetDir, stdio: "ignore" });
1429
1451
  }
1430
- s.stop("Project created!");
1452
+ const steps = [`cd ${projectName}`];
1453
+ if (!installDeps) {
1454
+ steps.push("bun install");
1455
+ }
1456
+ const envPath = join2(targetDir, ".env.example");
1457
+ if (readFileSync2(envPath, "utf-8").trim().length > 0) {
1458
+ steps.push("cp .env.example .env # configure environment variables");
1459
+ }
1460
+ steps.push("bun dev");
1431
1461
  Gt(`Done! Next steps:
1432
1462
 
1433
- cd ${projectName}
1434
- bun install
1435
- bun dev`);
1463
+ ${steps.join(`
1464
+ `)}`);
1436
1465
  }
1437
1466
  main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rotor",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Scaffold Next.js projects with Bun, Tailwind, Biome, and more",
5
5
  "type": "module",
6
6
  "bin": "dist/index.js",
@@ -1,5 +1,10 @@
1
1
  @import 'tailwindcss';
2
2
 
3
+ @theme inline {
4
+ --font-sans: var(--font-geist-sans);
5
+ --font-mono: var(--font-geist-mono);
6
+ }
7
+
3
8
  /* [shadcn] */
4
9
  @theme inline {
5
10
  --color-background: var(--background);
@@ -1,6 +1,17 @@
1
1
  import type { Metadata } from 'next';
2
+ import { Geist, Geist_Mono } from 'next/font/google';
2
3
  import './globals.css';
3
4
 
5
+ const geistSans = Geist({
6
+ variable: '--font-geist-sans',
7
+ subsets: ['latin'],
8
+ });
9
+
10
+ const geistMono = Geist_Mono({
11
+ variable: '--font-geist-mono',
12
+ subsets: ['latin'],
13
+ });
14
+
4
15
  export const metadata: Metadata = {
5
16
  title: '{{PROJECT_NAME}}',
6
17
  description: '',
@@ -13,7 +24,11 @@ export default function RootLayout({
13
24
  }>) {
14
25
  return (
15
26
  <html lang="en">
16
- <body>{children}</body>
27
+ <body
28
+ className={`${geistSans.variable} ${geistMono.variable} antialiased`}
29
+ >
30
+ {children}
31
+ </body>
17
32
  </html>
18
33
  );
19
34
  }
@@ -11,13 +11,13 @@
11
11
  "moduleResolution": "bundler",
12
12
  "resolveJsonModule": true,
13
13
  "isolatedModules": true,
14
- "jsx": "preserve",
14
+ "jsx": "react-jsx",
15
15
  "incremental": true,
16
16
  "plugins": [{ "name": "next" }],
17
17
  "paths": {
18
18
  "@/*": ["./*"]
19
19
  }
20
20
  },
21
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
21
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
22
22
  "exclude": ["node_modules"]
23
23
  }