diff options
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | packages/bun-cli-darwin-x64/package.json | 2 | ||||
-rw-r--r-- | packages/bun-cli/package.json | 2 | ||||
-rw-r--r-- | src/cli/create_command.zig | 11 |
4 files changed, 22 insertions, 8 deletions
@@ -421,8 +421,6 @@ At the time of writing, `bun create react app` runs ~11x faster on my local comp #### Usage -By default, templates are downloaded from folders inside `examples/` in Bun's GitHub repo. Running `bun create react ./local-path` downloads the `react` folder from `examples/react`. - Create a new Next.js project: ```bash @@ -447,6 +445,16 @@ To see a list of examples, run: bun create ``` +Format: + +```bash +bun create github-user/repo-name destination +bun create local-example-or-remote-example destination +bun create /absolute/path/to-template-folder destination +bun create https://github.com/github-user/repo-name destination +bun create github.com/github-user/repo-name destination +``` + Note: you don't need `bun create` to use Bun. You don't need any configuration at all. This command exists to make it a little easier. ##### Local templates @@ -569,6 +577,9 @@ ELSE IF local template 3. Copy files recursively using the fastest system calls available (on macOS `fcopyfile` and Linux, `copy_file_range`). Do not copy or traverse into `node_modules` folder if exists (this alone makes it faster than `cp`) 4. Parse the `package.json` (again!), update `name` to be `${basename(destination)}`, remove the `bun-create` section from the `package.json` and save the updated `package.json` to disk. + - IF Next.js is detected, add `bun-framework-next` to the list of imports + - IF Create React App is detected, add the entry point in /src/index.{js,jsx,ts,tsx} to `public/index.html` + - IF Relay is detected, add `bun-macro-relay` so that Relay works 5. Auto-detect the npm client, preferring `pnpm`, `yarn` (v1), and lastly `npm` 6. Run any tasks defined in `"bun-create": { "preinstall" }` with the npm client 7. Run `${npmClient} install` unless `--no-install` is passed OR no dependencies are in package.json diff --git a/packages/bun-cli-darwin-x64/package.json b/packages/bun-cli-darwin-x64/package.json index cd2458201..0561c0a1d 100644 --- a/packages/bun-cli-darwin-x64/package.json +++ b/packages/bun-cli-darwin-x64/package.json @@ -4,5 +4,5 @@ }, "name": "bun-cli-darwin-x64", "repository": "https://github.com/jarred-sumner/bun", - "version": "0.0.35" + "version": "0.0.36" } diff --git a/packages/bun-cli/package.json b/packages/bun-cli/package.json index 8f08568ee..1906e8c2f 100644 --- a/packages/bun-cli/package.json +++ b/packages/bun-cli/package.json @@ -9,5 +9,5 @@ "postinstall": "node postinstall.js", "prepublishOnly": "rm -rf ./bin/bun; chmod +x ./reset-bin.js; cp ./reset-bin.js ./bin/bun" }, - "version": "0.0.35" + "version": "0.0.36" } diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig index cc486b4a6..688c2e6a0 100644 --- a/src/cli/create_command.zig +++ b/src/cli/create_command.zig @@ -1467,10 +1467,12 @@ pub const CreateCommand = struct { std.os.ftruncate(package_json_file.?.handle, written + 1) catch {}; - if (needs.bun_bun_for_nextjs) { - try postinstall_tasks.append(ctx.allocator, InjectionPrefill.bun_bun_for_nextjs_task); - } else if (bun_bun_for_react_scripts) { - try postinstall_tasks.append(ctx.allocator, try std.fmt.allocPrint(ctx.allocator, "bun bun {s}", .{create_react_app_entry_point_path})); + if (!create_options.skip_install) { + if (needs.bun_bun_for_nextjs) { + try postinstall_tasks.append(ctx.allocator, InjectionPrefill.bun_bun_for_nextjs_task); + } else if (bun_bun_for_react_scripts) { + try postinstall_tasks.append(ctx.allocator, try std.fmt.allocPrint(ctx.allocator, "bun bun {s}", .{create_react_app_entry_point_path})); + } } } } @@ -1669,6 +1671,7 @@ pub const CreateCommand = struct { \\ <b><cyan>cd {s}<r> \\ <b><cyan>bun<r> \\ + \\ , .{ filesystem.relativeTo(destination), }); |