Skip to content

Commit cde167c

Browse files
author
Jarred Sumner
committed
Revert "Add Tanstack Start to bun init (#24648)"
Adding a 260 KB bun header image is not a good use of binary size This reverts commit 830fd9b.
1 parent 6ce419d commit cde167c

File tree

15 files changed

+11
-758
lines changed

15 files changed

+11
-758
lines changed

src/cli/init/README-tanstack.default.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/cli/init_command.zig

Lines changed: 11 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ pub const InitCommand = struct {
228228
const @"tsconfig.json" = @embedFile("init/tsconfig.default.json");
229229
const @"README.md" = @embedFile("init/README.default.md");
230230
const @"README2.md" = @embedFile("init/README2.default.md");
231-
const @"README-tanstack.md" = @embedFile("init/README-tanstack.default.md");
232231

233232
/// Create a new asset file, overriding anything that already exists. Known
234233
/// assets will have their contents pre-populated; otherwise the file will be empty.
@@ -383,10 +382,6 @@ pub const InitCommand = struct {
383382
template = .react_tailwind_shadcn;
384383
prev_flag_was_react = false;
385384
auto_yes = true;
386-
} else if ((template == .react_blank and prev_flag_was_react and strings.eqlComptime(arg, "tanstack") or strings.eqlComptime(arg, "--react=tanstack")) or strings.eqlComptime(arg, "r=tanstack")) {
387-
template = .react_tanstack;
388-
prev_flag_was_react = false;
389-
auto_yes = true;
390385
} else {
391386
prev_flag_was_react = false;
392387
}
@@ -590,14 +585,12 @@ pub const InitCommand = struct {
590585
default,
591586
tailwind,
592587
shadcn_tailwind,
593-
tanstack,
594588

595589
pub fn fmt(self: @This()) []const u8 {
596590
return switch (self) {
597591
.default => "<blue>Default (blank)<r>",
598592
.tailwind => "<magenta>TailwindCSS<r>",
599593
.shadcn_tailwind => "<green>Shadcn + TailwindCSS<r>",
600-
.tanstack => "<yellow>TanStack Start<r>",
601594
};
602595
}
603596
});
@@ -606,7 +599,6 @@ pub const InitCommand = struct {
606599
.default => .react_blank,
607600
.tailwind => .react_tailwind,
608601
.shadcn_tailwind => .react_tailwind_shadcn,
609-
.tanstack => .react_tanstack,
610602
};
611603
},
612604
.blank => template = .blank,
@@ -621,7 +613,7 @@ pub const InitCommand = struct {
621613
}
622614

623615
switch (template) {
624-
inline .react_blank, .react_tailwind, .react_tailwind_shadcn, .react_tanstack => |t| {
616+
inline .react_blank, .react_tailwind, .react_tailwind_shadcn => |t| {
625617
try t.@"write files and run `bun dev`"(alloc);
626618
return;
627619
},
@@ -799,7 +791,7 @@ pub const InitCommand = struct {
799791

800792
switch (template) {
801793
.blank, .typescript_library => {
802-
Template.createAgentRule(template);
794+
Template.createAgentRule();
803795

804796
if (package_json_file != null and !did_load_package_json) {
805797
Output.prettyln(" + <r><d>package.json<r>", .{});
@@ -918,32 +910,13 @@ const DependencyGroup = struct {
918910
} ++ tailwind.dependencies[0..tailwind.dependencies.len].*,
919911
.devDependencies = &[_]DependencyNeeded{} ++ tailwind.devDependencies[0..tailwind.devDependencies.len].*,
920912
};
921-
922-
pub const tanstack = DependencyGroup{
923-
.dependencies = &[_]DependencyNeeded{
924-
.{ .name = "@tailwindcss/vite", .version = "^4.1.17" },
925-
.{ .name = "@tanstack/react-router", .version = "^1.135.2" },
926-
.{ .name = "@tanstack/react-start", .version = "^1.135.2" },
927-
.{ .name = "react", .version = "^19.2.0" },
928-
.{ .name = "react-dom", .version = "^19.2.0" },
929-
.{ .name = "tailwindcss", .version = "^4.1.17" },
930-
},
931-
.devDependencies = &[_]DependencyNeeded{
932-
.{ .name = "@types/react", .version = "^19.2.3" },
933-
.{ .name = "@types/react-dom", .version = "^19.2.3" },
934-
.{ .name = "@vitejs/plugin-react", .version = "^5.1.0" },
935-
.{ .name = "vite", .version = "^7.2.2" },
936-
.{ .name = "vite-tsconfig-paths", .version = "^5.1.4" },
937-
} ++ blank.devDependencies[0..1].*,
938-
};
939913
};
940914

941915
const Template = enum {
942916
blank,
943917
react_blank,
944918
react_tailwind,
945919
react_tailwind_shadcn,
946-
react_tanstack,
947920
typescript_library,
948921
const TemplateFile = struct {
949922
path: [:0]const u8,
@@ -958,7 +931,7 @@ const Template = enum {
958931
}
959932
pub fn isReact(this: Template) bool {
960933
return switch (this) {
961-
.react_blank, .react_tailwind, .react_tailwind_shadcn, .react_tanstack => true,
934+
.react_blank, .react_tailwind, .react_tailwind_shadcn => true,
962935
else => false,
963936
};
964937
}
@@ -986,7 +959,6 @@ const Template = enum {
986959
.react_blank => DependencyGroup.react,
987960
.react_tailwind => DependencyGroup.tailwind,
988961
.react_tailwind_shadcn => DependencyGroup.shadcn,
989-
.react_tanstack => DependencyGroup.tanstack,
990962
.typescript_library => DependencyGroup.blank,
991963
};
992964
}
@@ -997,7 +969,6 @@ const Template = enum {
997969
.react_blank => "bun-react-template",
998970
.react_tailwind => "bun-react-tailwind-template",
999971
.react_tailwind_shadcn => "bun-react-tailwind-shadcn-template",
1000-
.react_tanstack => "bun-tanstack-start-template",
1001972
};
1002973
}
1003974
pub fn scripts(this: Template) []const []const u8 {
@@ -1015,16 +986,13 @@ const Template = enum {
1015986
"build",
1016987
"NODE_ENV=production bun .",
1017988
},
1018-
.react_tanstack => &.{ "dev", "bun --bun vite dev", "build", "bun --bun vite build", "serve", "bun --bun vite preview" },
1019989
};
1020990

1021991
return s;
1022992
}
1023993

1024994
const agent_rule = @embedFile("../init/rule.md");
1025-
const agent_rule_tanstack = @embedFile("../init/rule-tanstack.md");
1026995
const cursor_rule = TemplateFile{ .path = ".cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc", .contents = agent_rule };
1027-
const cursor_rule_tanstack = TemplateFile{ .path = ".cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc", .contents = agent_rule_tanstack };
1028996
const cursor_rule_path_to_claude_md = "../../CLAUDE.md";
1029997

1030998
fn isClaudeCodeInstalled() bool {
@@ -1044,12 +1012,12 @@ const Template = enum {
10441012
return bun.which(pathbuffer, bun.env_var.PATH.get() orelse return false, bun.fs.FileSystem.instance.top_level_dir, "claude") != null;
10451013
}
10461014

1047-
pub fn createAgentRule(this: Template) void {
1015+
pub fn createAgentRule() void {
10481016
var @"create CLAUDE.md" = Template.isClaudeCodeInstalled() and
10491017
// Never overwrite CLAUDE.md
10501018
!bun.sys.exists("CLAUDE.md");
10511019

1052-
if (this.getCursorRule()) |template_file| {
1020+
if (Template.getCursorRule()) |template_file| {
10531021
var did_create_agent_rule = false;
10541022

10551023
// If both Cursor & Claude is installed, make the cursor rule a
@@ -1085,13 +1053,9 @@ const Template = enum {
10851053
// If cursor is not installed but claude code is installed, then create the CLAUDE.md.
10861054
if (@"create CLAUDE.md") {
10871055
// In this case, the frontmatter from the cursor rule is not helpful so let's trim it out.
1088-
const rule_to_use = switch (this) {
1089-
.react_tanstack => agent_rule_tanstack,
1090-
else => agent_rule,
1091-
};
1092-
const end_of_frontmatter = if (bun.strings.lastIndexOf(rule_to_use, "---\n")) |start| start + "---\n".len else 0;
1056+
const end_of_frontmatter = if (bun.strings.lastIndexOf(agent_rule, "---\n")) |start| start + "---\n".len else 0;
10931057

1094-
InitCommand.Assets.createNew("CLAUDE.md", rule_to_use[end_of_frontmatter..]) catch {};
1058+
InitCommand.Assets.createNew("CLAUDE.md", agent_rule[end_of_frontmatter..]) catch {};
10951059
}
10961060
}
10971061

@@ -1128,12 +1092,9 @@ const Template = enum {
11281092

11291093
return false;
11301094
}
1131-
fn getCursorRule(this: Template) ?*const TemplateFile {
1095+
fn getCursorRule() ?*const TemplateFile {
11321096
if (isCursorInstalled()) {
1133-
return switch (this) {
1134-
.react_tanstack => &cursor_rule_tanstack,
1135-
else => &cursor_rule,
1136-
};
1097+
return &cursor_rule;
11371098
}
11381099

11391100
return null;
@@ -1207,36 +1168,17 @@ const Template = enum {
12071168
};
12081169
};
12091170

1210-
const ReactTanstack = struct {
1211-
const files: []const TemplateFile = &.{
1212-
.{ .path = "package.json", .contents = @embedFile("../init/react-tanstack/package.json") },
1213-
.{ .path = "tsconfig.json", .contents = @embedFile("../init/react-tanstack/tsconfig.json") },
1214-
.{ .path = "vite.config.ts", .contents = @embedFile("../init/react-tanstack/vite.config.ts") },
1215-
.{ .path = "styles.css", .contents = @embedFile("../init/react-tanstack/styles.css") },
1216-
.{ .path = "README.md", .contents = InitCommand.Assets.@"README-tanstack.md" },
1217-
.{ .path = ".gitignore", .contents = InitCommand.Assets.@".gitignore", .can_skip_if_exists = true },
1218-
.{ .path = "src/router.tsx", .contents = @embedFile("../init/react-tanstack/src/router.tsx") },
1219-
.{ .path = "src/routes/__root.tsx", .contents = @embedFile("../init/react-tanstack/src/routes/__root.tsx") },
1220-
.{ .path = "src/routes/index.tsx", .contents = @embedFile("../init/react-tanstack/src/routes/index.tsx") },
1221-
.{ .path = "src/routes/stats.tsx", .contents = @embedFile("../init/react-tanstack/src/routes/stats.tsx") },
1222-
.{ .path = "src/routeTree.gen.ts", .contents = @embedFile("../init/react-tanstack/src/routeTree.gen.ts") },
1223-
.{ .path = "public/header.webp", .contents = @embedFile("../init/react-tanstack/public/header.webp") },
1224-
.{ .path = "public/favicon.ico", .contents = @embedFile("../init/react-tanstack/public/favicon.ico") },
1225-
};
1226-
};
1227-
12281171
pub fn files(this: Template) []const TemplateFile {
12291172
return switch (this) {
12301173
.react_blank => ReactBlank.files,
12311174
.react_tailwind => ReactTailwind.files,
12321175
.react_tailwind_shadcn => ReactShadcn.files,
1233-
.react_tanstack => ReactTanstack.files,
12341176
else => &.{.{ &.{}, &.{} }},
12351177
};
12361178
}
12371179

12381180
pub fn @"write files and run `bun dev`"(comptime this: Template, allocator: std.mem.Allocator) !void {
1239-
this.createAgentRule();
1181+
Template.createAgentRule();
12401182

12411183
inline for (comptime this.files()) |file| {
12421184
const path = file.path;
@@ -1276,22 +1218,10 @@ const Template = enum {
12761218

12771219
_ = try install.spawnAndWait();
12781220

1279-
var cwd_buf: bun.PathBuffer = undefined;
1280-
const cwd_path = switch (bun.sys.getcwd(&cwd_buf)) {
1281-
.result => |p| p,
1282-
.err => |e| {
1283-
Output.err(e, "failed to get current working directory", .{});
1284-
Global.exit(1);
1285-
},
1286-
};
1287-
const dir_name = std.fs.path.basename(cwd_path);
1288-
12891221
Output.prettyln(
12901222
\\
12911223
\\✨ New project configured!
12921224
\\
1293-
\\<d>cd {s}<r>
1294-
\\
12951225
\\<b><cyan>Development<r><d> - full-stack dev server with hot reload<r>
12961226
\\
12971227
\\ <cyan><b>bun dev<r>
@@ -1306,7 +1236,7 @@ const Template = enum {
13061236
\\
13071237
\\<blue>Happy bunning! 🐇<r>
13081238
\\
1309-
, .{dir_name});
1239+
, .{});
13101240

13111241
Output.flush();
13121242
}

src/init/react-tanstack/package.json

Lines changed: 0 additions & 28 deletions
This file was deleted.
-14.7 KB
Binary file not shown.
-269 KB
Binary file not shown.

0 commit comments

Comments
 (0)