@lazarv/create-react-server 0.0.0-experimental-d003259-20250211-2495688e → 0.0.0-experimental-ff56eae-20250211-fae59462

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/launch.mjs CHANGED
@@ -32,18 +32,21 @@ export async function launch(context) {
32
32
  npm: "npm run dev",
33
33
  pnpm: "pnpm dev",
34
34
  yarn: "yarn dev",
35
+ bun: "bun --bun run dev",
35
36
  };
36
37
 
37
38
  const buildCommand = {
38
39
  npm: "npm run build",
39
40
  pnpm: "pnpm build",
40
41
  yarn: "yarn build",
42
+ bun: "bun --bun run build",
41
43
  };
42
44
 
43
45
  const startCommand = {
44
46
  npm: "npm start",
45
47
  pnpm: "pnpm start",
46
48
  yarn: "yarn start",
49
+ bun: "bun --bun start",
47
50
  };
48
51
 
49
52
  const instructions = () => {
@@ -85,9 +88,12 @@ ${colors.cyan(`docker run --rm -ti -p ${port}:${port} ${projectName}`)}\n`
85
88
  const server = spawn(
86
89
  packageManager,
87
90
  [
91
+ ...(packageManager === "bun" ? ["--bun", "run"] : []),
88
92
  ...(packageManager === "npm" ? ["run"] : []),
89
93
  "dev",
90
- ...(packageManager === "pnpm" ? [] : ["--"]),
94
+ ...(packageManager === "npm" || packageManager === "yarn"
95
+ ? ["--"]
96
+ : []),
91
97
  "--host",
92
98
  context.props.host,
93
99
  "--port",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazarv/create-react-server",
3
- "version": "0.0.0-experimental-d003259-20250211-2495688e",
3
+ "version": "0.0.0-experimental-ff56eae-20250211-fae59462",
4
4
  "bin": {
5
5
  "create-react-server": "index.mjs"
6
6
  },
@@ -21,6 +21,6 @@
21
21
  "picocolors": "^1.1.1",
22
22
  "prettier": "^3.0.0",
23
23
  "ts-morph": "^24.0.0",
24
- "@lazarv/react-server": "0.0.0-experimental-d003259-20250211-0c721374"
24
+ "@lazarv/react-server": "0.0.0-experimental-ff56eae-20250211-fae59462"
25
25
  }
26
26
  }
package/steps/deploy.mjs CHANGED
@@ -11,38 +11,40 @@ export default async (context) => {
11
11
  context.env.options.deploy ??
12
12
  (context.env.hasOptions
13
13
  ? "none"
14
- : await select(
15
- {
16
- message: "Deployment adapter",
17
- choices: [
18
- {
19
- name: "None",
20
- value: "none",
21
- description: "No deployment adapter",
22
- },
23
- new Separator(),
24
- {
25
- name: "Docker",
26
- value: "docker",
27
- description:
28
- "Build a Docker image and deploy to a container registry",
29
- },
30
- {
31
- name: "Vercel",
32
- value: "vercel",
33
- description: "Deploy to Vercel",
34
- },
35
- {
36
- name: "AWS",
37
- value: "aws",
38
- description: "Deploy to AWS Lambda",
39
- disabled: "(coming soon)",
40
- },
41
- ],
42
- theme,
43
- },
44
- context
45
- ));
14
+ : !context.props.custom
15
+ ? "vercel"
16
+ : await select(
17
+ {
18
+ message: "Deployment adapter",
19
+ choices: [
20
+ {
21
+ name: "None",
22
+ value: "none",
23
+ description: "No deployment adapter",
24
+ },
25
+ new Separator(),
26
+ {
27
+ name: "Docker",
28
+ value: "docker",
29
+ description:
30
+ "Build a Docker image and deploy to a container registry",
31
+ },
32
+ {
33
+ name: "Vercel",
34
+ value: "vercel",
35
+ description: "Deploy to Vercel",
36
+ },
37
+ {
38
+ name: "AWS",
39
+ value: "aws",
40
+ description: "Deploy to AWS Lambda",
41
+ disabled: "(coming soon)",
42
+ },
43
+ ],
44
+ theme,
45
+ },
46
+ context
47
+ ));
46
48
 
47
49
  const partials = {
48
50
  ...context.partials,
package/steps/package.mjs CHANGED
@@ -5,22 +5,42 @@ import colors from "picocolors";
5
5
 
6
6
  import { theme } from "../lib/theme.mjs";
7
7
 
8
+ let _isPnpmInstalled = false;
8
9
  const isPnpmInstalled = async () => {
10
+ if (_isPnpmInstalled) return true;
9
11
  try {
10
12
  execSync("pnpm --version", {
11
13
  stdio: "ignore",
12
14
  });
15
+ _isPnpmInstalled = true;
13
16
  return true;
14
17
  } catch {
15
18
  return false;
16
19
  }
17
20
  };
18
21
 
22
+ let _isYarnInstalled = false;
19
23
  const isYarnInstalled = async () => {
24
+ if (_isYarnInstalled) return true;
20
25
  try {
21
26
  execSync("yarn --version", {
22
27
  stdio: "ignore",
23
28
  });
29
+ _isYarnInstalled = true;
30
+ return true;
31
+ } catch {
32
+ return false;
33
+ }
34
+ };
35
+
36
+ let _isBunInstalled = false;
37
+ const isBunInstalled = async () => {
38
+ if (_isBunInstalled) return true;
39
+ try {
40
+ execSync("bun --version", {
41
+ stdio: "ignore",
42
+ });
43
+ _isBunInstalled = true;
24
44
  return true;
25
45
  } catch {
26
46
  return false;
@@ -31,25 +51,39 @@ const lockFilename = {
31
51
  npm: "package-lock.json",
32
52
  pnpm: "pnpm-lock.yaml",
33
53
  yarn: "yarn.lock",
54
+ bun: "bun.lock",
34
55
  };
35
56
 
36
57
  const displayName = {
37
58
  yarn: "Yarn",
59
+ bun: "Bun",
38
60
  };
39
61
 
40
62
  const ciInstallArgs = {
41
63
  npm: "--loglevel notice",
42
64
  pnpm: "--reporter=append-only",
43
65
  yarn: "--no-progress --inline-builds",
66
+ bun: "",
67
+ };
68
+
69
+ const runCommand = {
70
+ npm: "npm run",
71
+ bun: "bun --bun run",
72
+ };
73
+
74
+ const startCommand = {
75
+ npm: "npm start",
76
+ bun: "bun --bun start",
44
77
  };
45
78
 
46
79
  export default async (context) => {
47
80
  const npmUseragent = process.env.npm_config_user_agent;
48
- const defaultPackageManager =
49
- npmUseragent?.includes("pnpm") || !context.props.custom
50
- ? "pnpm"
51
- : npmUseragent?.includes("yarn")
52
- ? "yarn"
81
+ const defaultPackageManager = npmUseragent?.includes("pnpm")
82
+ ? "pnpm"
83
+ : npmUseragent?.includes("yarn")
84
+ ? "yarn"
85
+ : npmUseragent?.includes("bun")
86
+ ? "bun"
53
87
  : "npm";
54
88
  const packageManager = !context.props.custom
55
89
  ? defaultPackageManager
@@ -69,6 +103,11 @@ export default async (context) => {
69
103
  value: "yarn",
70
104
  disabled: !(await isYarnInstalled()) ? "(not installed)" : false,
71
105
  },
106
+ {
107
+ name: "Bun",
108
+ value: "bun",
109
+ disabled: !(await isBunInstalled()) ? "(not installed)" : false,
110
+ },
72
111
  ],
73
112
  theme,
74
113
  },
@@ -94,8 +133,8 @@ export default async (context) => {
94
133
  packageManager: {
95
134
  name: packageManager,
96
135
  lock: lockFilename[packageManager],
97
- run: packageManager === "npm" ? "npm run" : packageManager,
98
- start: packageManager === "npm" ? "npm start" : packageManager,
136
+ run: runCommand[packageManager] ?? packageManager,
137
+ start: startCommand[packageManager] ?? packageManager,
99
138
  install,
100
139
  ciInstallArgs: ciInstallArgs[packageManager],
101
140
  },
@@ -0,0 +1,53 @@
1
+ # Define build argument for port with default value
2
+ ARG PORT=3000
3
+
4
+ # Stage 1: Build
5
+ FROM oven/bun:latest AS builder
6
+
7
+ # Set working directory
8
+ WORKDIR /app
9
+
10
+ # Copy package files first to check for Bun and lock files
11
+ COPY package.json bun.lock ./
12
+
13
+ # Install dependencies using Bun
14
+ RUN --mount=type=cache,target=/root/.bun \
15
+ bun install --frozen-lockfile
16
+
17
+ # Copy source files and .react-server directory
18
+ COPY . .
19
+
20
+ # Build using Bun
21
+ RUN bun --bun run build
22
+
23
+ # Stage 2: Production
24
+ FROM oven/bun:latest AS runner
25
+
26
+ # Forward the build argument
27
+ ARG PORT
28
+ ENV PORT=$PORT
29
+
30
+ # Set working directory
31
+ WORKDIR /app
32
+
33
+ # Copy package files and lock files
34
+ COPY --from=builder /app/package.json /app/bun.lock ./
35
+
36
+ # Install production dependencies using Bun
37
+ RUN --mount=type=cache,target=/root/.bun \
38
+ bun install --production
39
+
40
+ # Copy built files and .react-server directory from builder stage
41
+ COPY --from=builder /app/.react-server ./.react-server
42
+
43
+ # Ensure correct permissions for existing bun user
44
+ RUN chown -R bun:bun /app
45
+
46
+ # Switch to the existing bun user
47
+ USER bun
48
+
49
+ # Expose the port your app runs on
50
+ EXPOSE ${PORT}
51
+
52
+ # Start the application using Bun
53
+ CMD ["bun", "--bun", "start", "--host"]