create-vista-app 0.3.4 → 0.3.6
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/bin/cli.js +9 -31
- package/bin/flash-template/app/index.tsx +1 -1
- package/package.json +1 -1
- package/template/README.md +4 -5
- package/template/app/index.tsx +1 -1
- package/template/components/theme-toggle.tsx +0 -49
- package/template/deploy/.dockerignore +0 -10
- package/template/deploy/Dockerfile +0 -18
- package/template/deploy/netlify.toml +0 -22
- package/template/deploy/render.yaml +0 -16
- package/template/deploy/vercel.json +0 -7
- package/template/deploy/wrangler.toml +0 -19
package/bin/cli.js
CHANGED
|
@@ -50,7 +50,6 @@ const rawArgs = process.argv.slice(2);
|
|
|
50
50
|
const useTypedApiStarter = rawArgs.includes('--typed-api') || rawArgs.includes('--typed');
|
|
51
51
|
const skipInstall = rawArgs.includes('--skip-install');
|
|
52
52
|
const skipGit = rawArgs.includes('--no-git');
|
|
53
|
-
const includeDeployTemplates = !rawArgs.includes('--no-deploy-templates');
|
|
54
53
|
const assumeYes = rawArgs.includes('--yes') || rawArgs.includes('-y');
|
|
55
54
|
const canPrompt = !!(process.stdin.isTTY && process.stdout.isTTY);
|
|
56
55
|
const detectedPackageManager = detectPackageManager();
|
|
@@ -80,7 +79,7 @@ const explicitSrcDir =
|
|
|
80
79
|
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
81
80
|
console.log(`
|
|
82
81
|
Usage:
|
|
83
|
-
${usageCommand} [--typed-api] [--skip-install] [--no-git] [--yes] [--
|
|
82
|
+
${usageCommand} [--typed-api] [--skip-install] [--no-git] [--yes] [--engine <default|flashpack>] [--flashpack] [--default-engine] [--src-dir|--no-src-dir] [--package-manager <npm|pnpm|yarn|bun>] [--npm|--pnpm|--yarn|--bun]
|
|
84
83
|
|
|
85
84
|
Example:
|
|
86
85
|
npx create-vista-app@latest my-vista-app
|
|
@@ -264,14 +263,16 @@ function getCreateCommand(packageManager) {
|
|
|
264
263
|
return 'npx create-vista-app@latest';
|
|
265
264
|
}
|
|
266
265
|
|
|
267
|
-
function copyRecursiveSync(src, dest) {
|
|
266
|
+
function copyRecursiveSync(src, dest, options = {}) {
|
|
267
|
+
const skipNames = options.skipNames || new Set();
|
|
268
268
|
const exists = fs.existsSync(src);
|
|
269
269
|
const stats = exists && fs.statSync(src);
|
|
270
270
|
const isDirectory = exists && stats.isDirectory();
|
|
271
271
|
if (isDirectory) {
|
|
272
272
|
fs.mkdirSync(dest, { recursive: true });
|
|
273
273
|
fs.readdirSync(src).forEach((childItemName) => {
|
|
274
|
-
|
|
274
|
+
if (skipNames.has(childItemName)) return;
|
|
275
|
+
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName), options);
|
|
275
276
|
});
|
|
276
277
|
} else {
|
|
277
278
|
fs.copyFileSync(src, dest);
|
|
@@ -330,7 +331,7 @@ function applyReadmeSelections(projectDir, selectedEngine, useTypedApi, useSrcDi
|
|
|
330
331
|
.replace(/`app\/agents\//g, '`src/app/agents/')
|
|
331
332
|
.replace(
|
|
332
333
|
/```\napp\/\n├── root\.tsx[\s\S]*?vista\.config\.ts\n```/,
|
|
333
|
-
'```\nsrc/\n├── app/\n│ ├── root.tsx # Root layout\n│ ├── index.tsx # Home → /\n│ ├── globals.css\n│ └── about/page.tsx # → /about\
|
|
334
|
+
'```\nsrc/\n├── app/\n│ ├── root.tsx # Root layout\n│ ├── index.tsx # Home → /\n│ ├── globals.css\n│ └── about/page.tsx # → /about\npublic/\nvista.config.ts\n```'
|
|
334
335
|
);
|
|
335
336
|
}
|
|
336
337
|
|
|
@@ -394,24 +395,6 @@ function applySrcDirectoryLayout(projectDir) {
|
|
|
394
395
|
}
|
|
395
396
|
}
|
|
396
397
|
|
|
397
|
-
function applyDeployTemplates(projectDir, options = {}) {
|
|
398
|
-
const deployTemplateDir = path.join(__dirname, '../template/deploy');
|
|
399
|
-
if (!fs.existsSync(deployTemplateDir)) return;
|
|
400
|
-
|
|
401
|
-
const includeAll = Boolean(options.all);
|
|
402
|
-
const defaultFiles = ['render.yaml', 'Dockerfile', '.dockerignore'];
|
|
403
|
-
const optionalFiles = ['wrangler.toml', 'netlify.toml', 'vercel.json'];
|
|
404
|
-
const filesToCopy = includeAll ? [...defaultFiles, ...optionalFiles] : defaultFiles;
|
|
405
|
-
|
|
406
|
-
for (const fileName of filesToCopy) {
|
|
407
|
-
const source = path.join(deployTemplateDir, fileName);
|
|
408
|
-
const target = path.join(projectDir, fileName);
|
|
409
|
-
if (fs.existsSync(source) && !fs.existsSync(target)) {
|
|
410
|
-
fs.copyFileSync(source, target);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
398
|
async function main() {
|
|
416
399
|
const useLocal = rawArgs.includes('--local');
|
|
417
400
|
const currentDir = process.cwd();
|
|
@@ -444,7 +427,7 @@ async function main() {
|
|
|
444
427
|
|
|
445
428
|
// 2. Copy Template
|
|
446
429
|
const templateDir = path.join(__dirname, '../template');
|
|
447
|
-
copyRecursiveSync(templateDir, projectDir);
|
|
430
|
+
copyRecursiveSync(templateDir, projectDir, { skipNames: new Set(['deploy', 'components']) });
|
|
448
431
|
|
|
449
432
|
if (useTypedApiStarter) {
|
|
450
433
|
const typedTemplateDir = path.join(__dirname, '../template-typed');
|
|
@@ -457,14 +440,10 @@ async function main() {
|
|
|
457
440
|
if (selectedEngine === 'flashpack') {
|
|
458
441
|
applyFlashpackStarterTheme(projectDir);
|
|
459
442
|
}
|
|
460
|
-
if (includeDeployTemplates) {
|
|
461
|
-
applyDeployTemplates(projectDir, { all: rawArgs.includes('--deploy-templates-all') });
|
|
462
|
-
console.log('Added deployment templates (render.yaml, Dockerfile).');
|
|
463
|
-
}
|
|
464
443
|
|
|
465
444
|
if (useSrcDir) {
|
|
466
445
|
applySrcDirectoryLayout(projectDir);
|
|
467
|
-
console.log('Using src/ directory layout (src/app
|
|
446
|
+
console.log('Using src/ directory layout (src/app).');
|
|
468
447
|
}
|
|
469
448
|
|
|
470
449
|
console.log('Scaffolding complete.');
|
|
@@ -484,8 +463,7 @@ async function main() {
|
|
|
484
463
|
react: '^19.0.0',
|
|
485
464
|
'react-dom': '^19.0.0',
|
|
486
465
|
'react-server-dom-webpack': '^19.0.0',
|
|
487
|
-
vista: useLocal ? 'file:../packages/vista' : 'npm:@vistagenic/vista@0.3.
|
|
488
|
-
'lucide-react': '^0.468.0',
|
|
466
|
+
vista: useLocal ? 'file:../packages/vista' : 'npm:@vistagenic/vista@0.3.6',
|
|
489
467
|
// CSS build (needed in production for vista build)
|
|
490
468
|
postcss: '^8.0.0',
|
|
491
469
|
tailwindcss: '^4.0.0',
|
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -30,7 +30,6 @@ app/
|
|
|
30
30
|
├── index.tsx # Home → /
|
|
31
31
|
├── globals.css
|
|
32
32
|
└── about/page.tsx # → /about
|
|
33
|
-
components/
|
|
34
33
|
public/
|
|
35
34
|
vista.config.ts
|
|
36
35
|
```
|
|
@@ -53,8 +52,8 @@ Set `VISTA_AI_MODEL`, for example:
|
|
|
53
52
|
|
|
54
53
|
## Learn more
|
|
55
54
|
|
|
56
|
-
- [React app guide](https://
|
|
57
|
-
- [Fullstack guide](https://
|
|
58
|
-
- [AI overview](https://
|
|
59
|
-
- [RAG guide](https://
|
|
55
|
+
- [React app guide](https://vistajs.pages.dev/docs/getting-started/react-app)
|
|
56
|
+
- [Fullstack guide](https://vistajs.pages.dev/docs/getting-started/fullstack-app)
|
|
57
|
+
- [AI overview](https://vistajs.pages.dev/docs/ai/overview)
|
|
58
|
+
- [RAG guide](https://vistajs.pages.dev/docs/ai/rag)
|
|
60
59
|
- [GitHub](https://github.com/Mantitup-Org/vista)
|
package/template/app/index.tsx
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Laptop2, MoonStar, SunMedium } from 'lucide-react';
|
|
4
|
-
import { useTheme, type ThemeMode } from 'vista/theme';
|
|
5
|
-
|
|
6
|
-
const OPTIONS: Array<{
|
|
7
|
-
value: ThemeMode;
|
|
8
|
-
label: string;
|
|
9
|
-
icon: typeof Laptop2;
|
|
10
|
-
}> = [
|
|
11
|
-
{ value: 'system', label: 'System', icon: Laptop2 },
|
|
12
|
-
{ value: 'light', label: 'Light', icon: SunMedium },
|
|
13
|
-
{ value: 'dark', label: 'Dark', icon: MoonStar },
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
interface ThemeToggleProps {
|
|
17
|
-
compact?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function ThemeToggle({ compact = false }: ThemeToggleProps) {
|
|
21
|
-
const { mounted, theme, setTheme } = useTheme();
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div className="inline-flex items-center gap-1 rounded-full border border-border/80 bg-panel-elevated/90 p-1 shadow-[0_10px_30px_rgba(15,23,42,0.08)] backdrop-blur">
|
|
25
|
-
{OPTIONS.map((option) => {
|
|
26
|
-
const Icon = option.icon;
|
|
27
|
-
const isActive = theme === option.value;
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<button
|
|
31
|
-
key={option.value}
|
|
32
|
-
type="button"
|
|
33
|
-
onClick={() => setTheme(option.value)}
|
|
34
|
-
className={`inline-flex items-center justify-center gap-2 rounded-full px-3 py-2 text-xs font-medium transition-colors ${
|
|
35
|
-
isActive
|
|
36
|
-
? 'bg-foreground text-background'
|
|
37
|
-
: 'text-muted-foreground hover:bg-background/80 hover:text-foreground'
|
|
38
|
-
} ${compact ? 'px-2.5' : ''}`}
|
|
39
|
-
aria-pressed={isActive}
|
|
40
|
-
title={mounted ? option.label : undefined}
|
|
41
|
-
>
|
|
42
|
-
<Icon className="h-3.5 w-3.5" />
|
|
43
|
-
{!compact ? <span>{option.label}</span> : null}
|
|
44
|
-
</button>
|
|
45
|
-
);
|
|
46
|
-
})}
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# syntax=docker/dockerfile:1
|
|
2
|
-
|
|
3
|
-
FROM node:20-alpine AS builder
|
|
4
|
-
WORKDIR /app
|
|
5
|
-
COPY package.json package-lock.json* pnpm-lock.yaml* yarn.lock* ./
|
|
6
|
-
RUN npm install --no-audit --no-fund
|
|
7
|
-
COPY . .
|
|
8
|
-
RUN npm run build
|
|
9
|
-
|
|
10
|
-
FROM node:20-alpine AS runner
|
|
11
|
-
WORKDIR /app
|
|
12
|
-
ENV NODE_ENV=production
|
|
13
|
-
ENV PORT=3003
|
|
14
|
-
COPY --from=builder /app/package.json ./package.json
|
|
15
|
-
COPY --from=builder /app/node_modules ./node_modules
|
|
16
|
-
COPY --from=builder /app/.vista ./.vista
|
|
17
|
-
EXPOSE 3003
|
|
18
|
-
CMD ["node", ".vista/standalone/server.js"]
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
[build]
|
|
2
|
-
command = "npm run build"
|
|
3
|
-
publish = ".vista/deploy/netlify"
|
|
4
|
-
functions = "netlify/functions"
|
|
5
|
-
|
|
6
|
-
[functions]
|
|
7
|
-
node_bundler = "none"
|
|
8
|
-
included_files = ["netlify/functions/.vista/**", "netlify/functions/node_modules/**"]
|
|
9
|
-
|
|
10
|
-
[dev]
|
|
11
|
-
command = "npm run dev"
|
|
12
|
-
port = 3003
|
|
13
|
-
|
|
14
|
-
[[redirects]]
|
|
15
|
-
from = "/_vista/*"
|
|
16
|
-
to = "/_vista/:splat"
|
|
17
|
-
status = 200
|
|
18
|
-
|
|
19
|
-
[[redirects]]
|
|
20
|
-
from = "/*"
|
|
21
|
-
to = "/.netlify/functions/ssr"
|
|
22
|
-
status = 200
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
- type: web
|
|
3
|
-
name: my-vista-app
|
|
4
|
-
runtime: node
|
|
5
|
-
region: oregon
|
|
6
|
-
plan: free
|
|
7
|
-
buildCommand: |
|
|
8
|
-
npm install --no-audit --no-fund
|
|
9
|
-
npm run build
|
|
10
|
-
startCommand: npm run start
|
|
11
|
-
envVars:
|
|
12
|
-
- key: NODE_ENV
|
|
13
|
-
value: production
|
|
14
|
-
- key: PORT
|
|
15
|
-
value: "3003"
|
|
16
|
-
healthCheckPath: /
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
name = "my-vista-app"
|
|
2
|
-
compatibility_date = "2026-09-20"
|
|
3
|
-
main = ".vista/deploy/cloudflare/worker.js"
|
|
4
|
-
|
|
5
|
-
[vars]
|
|
6
|
-
VISTA_RUNTIME = "standalone"
|
|
7
|
-
|
|
8
|
-
[[containers]]
|
|
9
|
-
class_name = "VistaSSR"
|
|
10
|
-
image = "./Dockerfile"
|
|
11
|
-
max_instances = 4
|
|
12
|
-
|
|
13
|
-
[[durable_objects.bindings]]
|
|
14
|
-
name = "VISTA_SSR"
|
|
15
|
-
class_name = "VistaSSR"
|
|
16
|
-
|
|
17
|
-
[[migrations]]
|
|
18
|
-
tag = "v1"
|
|
19
|
-
new_sqlite_classes = ["VistaSSR"]
|