@squadbase/vantage-template 0.1.0 → 0.1.1-dev1.3f269fd

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.
@@ -12,17 +12,17 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@squadbase/react": "^0.1.0",
15
- "@squadbase/vantage": "0.6.1",
16
- "@squadbase/vantage-sdk": "0.1.1",
15
+ "@squadbase/vantage": "0.6.2-dev1.b332e5a",
16
+ "@squadbase/vantage-sdk": "0.1.1-dev1.28afad5",
17
17
  "date-fns": "^4.1.0",
18
18
  "lucide-react": "^0.468.0",
19
- "react": "^19.2.7",
20
- "react-dom": "^19.2.7"
19
+ "react": "^19.3.1",
20
+ "react-dom": "^19.3.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.15.0",
24
- "@types/react": "^19.2.0",
25
- "@types/react-dom": "^19.2.0",
24
+ "@types/react": "^19.3.0",
25
+ "@types/react-dom": "^19.3.0",
26
26
  "typescript": "~5.7.0"
27
27
  }
28
28
  }
@@ -3,3 +3,4 @@ version: "1"
3
3
  build:
4
4
  framework: squadbase-vantage
5
5
  runtime: node20
6
+ package_manager: bun
@@ -1,6 +1,6 @@
1
1
  import type { ComponentProps } from "react"
2
2
  import { SquadbaseProvider } from "@squadbase/react"
3
- import { Link, Outlet, useCurrentRoute, useRoutes } from "@squadbase/vantage/router"
3
+ import { Link, Outlet, useCurrentRoute, useNavigate, useRoutes } from "@squadbase/vantage/router"
4
4
  import { AppShell } from "@squadbase/vantage/components"
5
5
  import type { NavGroup } from "@squadbase/vantage/components"
6
6
 
@@ -50,6 +50,7 @@ function useNavGroups(): NavGroup[] {
50
50
  * 「Something went wrong」のままリロードするまで残る。
51
51
  */
52
52
  export default function RootLayout() {
53
+ const navigate = useNavigate()
53
54
  return (
54
55
  <SquadbaseProvider>
55
56
  <AppShell
@@ -57,6 +58,7 @@ export default function RootLayout() {
57
58
  groups={useNavGroups()}
58
59
  actions={<UserCard />}
59
60
  linkComponent={RouterLink}
61
+ onNavigate={(href) => navigate({ to: href })}
60
62
  >
61
63
  <BuildRecovery>
62
64
  <Outlet />
@@ -17,6 +17,7 @@ export const page = definePage({
17
17
  title: "Dashboard",
18
18
  description: "Sample data — replace with your own to get started.",
19
19
  navLabel: "Home",
20
+ placeholder: true,
20
21
  })
21
22
 
22
23
  const METRICS = [
@@ -65,14 +66,18 @@ const CHARTS = [
65
66
  ]
66
67
 
67
68
  export default function HomePage() {
69
+ // `data-vantage-sample` marks this page as the untouched template sample (the coding
70
+ // agent looks for it). Remove it together with the sample content.
71
+ const sampleNote = navigator.language.startsWith("ja")
72
+ ? "サンプルデータです。お手元のデータに置き換えて始めましょう。"
73
+ : "Sample data — replace with your own to get started."
74
+
68
75
  return (
69
76
  <PageShell>
70
77
  <PageShellHeader>
71
78
  <PageShellHeading>
72
79
  <PageShellTitle>Dashboard</PageShellTitle>
73
- <PageShellDescription>
74
- Sample data — replace with your own to get started.
75
- </PageShellDescription>
80
+ <PageShellDescription data-vantage-sample="home">{sampleNote}</PageShellDescription>
76
81
  </PageShellHeading>
77
82
  </PageShellHeader>
78
83
 
@@ -17,6 +17,15 @@
17
17
  /* --radius: 0.625rem; */
18
18
  }
19
19
 
20
+ /* Page typeface. Latin system faces first, then Japanese system faces so kana and
21
+ kanji do not fall back to a thin locale default. Put a Latin webfont in front if
22
+ you add one, but keep the Japanese families. */
23
+ body {
24
+ font-family:
25
+ ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans",
26
+ "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
27
+ }
28
+
20
29
  /* vantage-template:chart-preset — regenerated by `chart`; edits here are lost */
21
30
  :root {
22
31
  --chart-1: var(--color-blue-600);
package/dist/index.js CHANGED
@@ -1022,27 +1022,36 @@ function initProject(options) {
1022
1022
  applyChartPreset(targetDir, options.chart);
1023
1023
  log("cyan", ` chart preset: ${options.chart}`);
1024
1024
  }
1025
+ const packageManager = isBunAvailable() ? "bun" : "npm";
1025
1026
  if (options.skipInstall) {
1026
1027
  log("green", "\nProject initialized successfully!");
1027
1028
  log("dim", "\nNext steps:");
1028
- log("dim", " npm install");
1029
- log("dim", " npm run dev");
1029
+ log("dim", ` ${packageManager} install`);
1030
+ log("dim", ` ${packageManager} run dev`);
1030
1031
  return;
1031
1032
  }
1032
- log("green", "\nInstalling dependencies...");
1033
- const install = spawnSync("npm", ["install"], {
1033
+ log("green", `
1034
+ Installing dependencies with ${packageManager}...`);
1035
+ const install = spawnSync(packageManager, ["install"], {
1034
1036
  cwd: targetDir,
1035
1037
  stdio: "inherit",
1036
1038
  shell: process.platform === "win32"
1037
1039
  });
1038
1040
  if (install.error || install.status !== 0) {
1039
1041
  log("red", "\nDependency installation failed.");
1040
- log("yellow", "Run 'npm install' manually in the project directory.");
1042
+ log("yellow", `Run '${packageManager} install' manually in the project directory.`);
1041
1043
  process.exit(1);
1042
1044
  }
1043
1045
  log("green", "\nProject initialized successfully!");
1044
1046
  log("dim", "\nNext steps:");
1045
- log("dim", " npm run dev");
1047
+ log("dim", ` ${packageManager} run dev`);
1048
+ }
1049
+ function isBunAvailable() {
1050
+ const probe = spawnSync("bun", ["--version"], {
1051
+ stdio: "ignore",
1052
+ shell: process.platform === "win32"
1053
+ });
1054
+ return !probe.error && probe.status === 0;
1046
1055
  }
1047
1056
 
1048
1057
  // src/commands/list.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squadbase/vantage-template",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-dev1.3f269fd",
4
4
  "description": "CLI tool for initializing and customizing Squadbase Vantage projects.",
5
5
  "keywords": [
6
6
  "squadbase",
@@ -42,7 +42,7 @@
42
42
  "type-check": "tsc",
43
43
  "agents": "node scripts/build-agents.cjs",
44
44
  "agents:check": "node scripts/build-agents.cjs --check",
45
- "template:install": "npm --prefix template ci",
45
+ "template:install": "bun install --cwd template --frozen-lockfile",
46
46
  "template:build": "npm --prefix template run build",
47
47
  "prepublishOnly": "npm run agents:check && npm run build",
48
48
  "release": "npm publish --@squadbase:registry=https://registry.npmjs.org",
@@ -111,7 +111,7 @@ function DashboardBody({ data }: { data: KpiSummary }) {
111
111
  {data.kpis.map((kpi) => {
112
112
  const { label, icon: Icon, format } = KPI_META[kpi.id]
113
113
  return (
114
- <DashboardCard key={kpi.id}>
114
+ <DashboardCard key={kpi.id} data-sq-ref={kpi.id}>
115
115
  <DashboardCardHeader>
116
116
  <DashboardCardTitle className="text-muted-foreground">
117
117
  {label}
@@ -141,11 +141,11 @@ function DashboardBody({ data }: { data: KpiSummary }) {
141
141
  })}
142
142
  </div>
143
143
 
144
- <DashboardCardPreset title="Trend" description="Values over the selected period">
144
+ <DashboardCardPreset data-sq-ref="trend" title="Trend" description="Values over the selected period">
145
145
  <EChart option={trendOption(data.trend)} height="320px" />
146
146
  </DashboardCardPreset>
147
147
 
148
- <DashboardCardPreset title="Top items" description="Ranked by value">
148
+ <DashboardCardPreset data-sq-ref="top-items" title="Top items" description="Ranked by value">
149
149
  <TopItemsTable data={data.topItems} />
150
150
  </DashboardCardPreset>
151
151
  </>
@@ -111,7 +111,7 @@ function DashboardBody({ data }: { data: KpiSummary }) {
111
111
  {data.kpis.map((kpi) => {
112
112
  const { label, icon: Icon, format } = KPI_META[kpi.id]
113
113
  return (
114
- <DashboardCard key={kpi.id}>
114
+ <DashboardCard key={kpi.id} data-sq-ref={kpi.id}>
115
115
  <DashboardCardHeader>
116
116
  <DashboardCardTitle className="text-muted-foreground">
117
117
  {label}
@@ -141,11 +141,11 @@ function DashboardBody({ data }: { data: KpiSummary }) {
141
141
  })}
142
142
  </div>
143
143
 
144
- <DashboardCardPreset title="トレンド" description="選択期間の値">
144
+ <DashboardCardPreset data-sq-ref="trend" title="トレンド" description="選択期間の値">
145
145
  <EChart option={trendOption(data.trend)} height="320px" />
146
146
  </DashboardCardPreset>
147
147
 
148
- <DashboardCardPreset title="上位項目" description="値で並べ替え">
148
+ <DashboardCardPreset data-sq-ref="top-items" title="上位項目" description="値で並べ替え">
149
149
  <TopItemsTable data={data.topItems} />
150
150
  </DashboardCardPreset>
151
151
  </>