@dimah-s3/cli 0.5.0 → 0.6.1

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.
Files changed (63) hide show
  1. package/README.md +11 -7
  2. package/dist/index.js +80 -5
  3. package/dist/index.js.map +1 -1
  4. package/dist/snapshot/transform.js +0 -1
  5. package/dist/snapshot/transform.js.map +1 -1
  6. package/dist/templates/catalog.json +12 -1
  7. package/dist/templates/hono/.env.example +5 -0
  8. package/dist/templates/hono/README.md +33 -0
  9. package/dist/templates/hono/_gitignore +26 -0
  10. package/dist/templates/hono/components.json +27 -0
  11. package/dist/templates/hono/index.html +18 -0
  12. package/dist/templates/hono/package.json +44 -0
  13. package/dist/templates/hono/pnpm-workspace.yaml +10 -0
  14. package/dist/templates/hono/postcss.config.mjs +7 -0
  15. package/dist/templates/hono/src/App.tsx +27 -0
  16. package/dist/templates/hono/src/components/s3-provider.tsx +7 -0
  17. package/dist/templates/hono/src/components/theme-provider.tsx +9 -0
  18. package/dist/templates/hono/src/index.css +132 -0
  19. package/dist/templates/hono/src/lib/s3.ts +11 -0
  20. package/dist/templates/hono/src/main.tsx +23 -0
  21. package/dist/templates/hono/src/server.ts +27 -0
  22. package/dist/templates/hono/src/vite-env.d.ts +1 -0
  23. package/dist/templates/hono/tsconfig.json +23 -0
  24. package/dist/templates/hono/vite.config.ts +21 -0
  25. package/dist/templates/nextjs/README.md +8 -8
  26. package/dist/templates/nextjs/_gitignore +5 -0
  27. package/dist/templates/nextjs/components.json +1 -1
  28. package/dist/templates/nextjs/package.json +4 -4
  29. package/dist/templates/nextjs/pnpm-workspace.yaml +11 -0
  30. package/dist/templates/nextjs/{app → src/app}/page.tsx +2 -3
  31. package/dist/templates/nextjs/src/lib/s3-client.ts +12 -0
  32. package/dist/templates/nextjs/src/lib/utils.ts +1 -0
  33. package/dist/templates/nextjs/tsconfig.json +1 -1
  34. package/dist/templates/vite/.env.example +5 -0
  35. package/dist/templates/vite/README.md +33 -0
  36. package/dist/templates/vite/_gitignore +27 -0
  37. package/dist/templates/vite/components.json +27 -0
  38. package/dist/templates/vite/index.html +18 -0
  39. package/dist/templates/vite/package.json +45 -0
  40. package/dist/templates/vite/pnpm-workspace.yaml +10 -0
  41. package/dist/templates/vite/postcss.config.mjs +7 -0
  42. package/dist/templates/vite/server/index.ts +14 -0
  43. package/dist/templates/vite/server/s3-client.ts +12 -0
  44. package/dist/templates/vite/server/s3.ts +11 -0
  45. package/dist/templates/vite/src/App.tsx +27 -0
  46. package/dist/templates/vite/src/components/s3-provider.tsx +7 -0
  47. package/dist/templates/vite/src/components/theme-provider.tsx +9 -0
  48. package/dist/templates/vite/src/index.css +132 -0
  49. package/dist/templates/vite/src/lib/utils.ts +1 -0
  50. package/dist/templates/vite/src/main.tsx +23 -0
  51. package/dist/templates/vite/src/vite-env.d.ts +1 -0
  52. package/dist/templates/vite/tsconfig.json +22 -0
  53. package/dist/templates/vite/tsconfig.server.json +17 -0
  54. package/dist/templates/vite/vite.config.ts +21 -0
  55. package/package.json +4 -2
  56. /package/dist/templates/{nextjs → hono/src}/lib/s3-client.ts +0 -0
  57. /package/dist/templates/{nextjs → hono/src}/lib/utils.ts +0 -0
  58. /package/dist/templates/nextjs/{app → src/app}/api/s3/[...s3]/route.ts +0 -0
  59. /package/dist/templates/nextjs/{app → src/app}/globals.css +0 -0
  60. /package/dist/templates/nextjs/{app → src/app}/layout.tsx +0 -0
  61. /package/dist/templates/nextjs/{components → src/components}/s3-provider.tsx +0 -0
  62. /package/dist/templates/nextjs/{components → src/components}/theme-provider.tsx +0 -0
  63. /package/dist/templates/nextjs/{lib → src/lib}/s3.ts +0 -0
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "dimah-s3-vite",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "concurrently -k -n api,web -c blue,green \"npm:dev:api\" \"npm:dev:web\"",
8
+ "dev:api": "tsx watch --env-file=.env server/index.ts",
9
+ "dev:web": "vite",
10
+ "build": "vite build",
11
+ "start": "tsx --env-file=.env server/index.ts",
12
+ "preview": "vite preview",
13
+ "check-types": "tsc --noEmit && tsc -p tsconfig.server.json --noEmit"
14
+ },
15
+ "dependencies": {
16
+ "@aws-sdk/client-s3": "^3.1105.0",
17
+ "@base-ui/react": "^1.7.0",
18
+ "@dimah-s3/react": "^0.6.1",
19
+ "@dimah-s3/server": "^0.6.1",
20
+ "@dimah-s3/ui": "^0.6.1",
21
+ "@fuma-translate/react": "^1.0.2",
22
+ "@hono/node-server": "^2.1.0",
23
+ "class-variance-authority": "^0.7.1",
24
+ "cnfast": "^0.1.0",
25
+ "hono": "^4.13.0",
26
+ "lucide-react": "^1.29.0",
27
+ "next-themes": "^0.4.6",
28
+ "react": "^19.2.8",
29
+ "react-dom": "^19.2.8",
30
+ "tw-animate-css": "^1.4.0"
31
+ },
32
+ "devDependencies": {
33
+ "@tailwindcss/postcss": "^4.3.3",
34
+ "@types/node": "^26.1.2",
35
+ "@types/react": "^19.2.18",
36
+ "@types/react-dom": "^19.2.4",
37
+ "@vitejs/plugin-react": "^6.0.5",
38
+ "concurrently": "^10.0.4",
39
+ "shadcn": "^4.16.2",
40
+ "tailwindcss": "^4.3.3",
41
+ "tsx": "^4.23.10",
42
+ "typescript": "^7.0.2",
43
+ "vite": "^8.2.1"
44
+ }
45
+ }
@@ -0,0 +1,10 @@
1
+ # Standalone starter (not part of the dimah-s3 monorepo).
2
+ # pnpm 11+ requires allowBuilds for packages with install scripts.
3
+ allowBuilds:
4
+ esbuild: true
5
+ # Fresh @dimah-s3 publishes are expected from the CLI sync bump.
6
+ minimumReleaseAgeExclude:
7
+ - "@dimah-s3/core"
8
+ - "@dimah-s3/react"
9
+ - "@dimah-s3/server"
10
+ - "@dimah-s3/ui"
@@ -0,0 +1,7 @@
1
+ const config = {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ },
5
+ };
6
+
7
+ export default config;
@@ -0,0 +1,14 @@
1
+ import { serve } from "@hono/node-server";
2
+ import { Hono } from "hono";
3
+ import { toHonoHandler } from "@dimah-s3/server/hono";
4
+ import { s3 } from "./s3.js";
5
+
6
+ const app = new Hono();
7
+
8
+ app.on(["GET", "POST", "DELETE"], "/api/s3/*", toHonoHandler(s3));
9
+
10
+ const port = Number(process.env.PORT ?? 8787);
11
+
12
+ serve({ fetch: app.fetch, port }, () => {
13
+ console.log(`dimah-s3 API listening on http://127.0.0.1:${port}`);
14
+ });
@@ -0,0 +1,12 @@
1
+ import { S3Client } from "@aws-sdk/client-s3";
2
+
3
+ export const s3Client = new S3Client({
4
+ region: process.env.S3_REGION,
5
+ endpoint: process.env.S3_ENDPOINT,
6
+ credentials: {
7
+ accessKeyId: process.env.S3_ACCESS_KEY_ID!,
8
+ secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!,
9
+ },
10
+ });
11
+
12
+ export const defaultBucket = process.env.S3_DEFAULT_BUCKET!;
@@ -0,0 +1,11 @@
1
+ import { dimahS3 } from "@dimah-s3/server";
2
+ import { s3Client, defaultBucket } from "./s3-client.js";
3
+
4
+ export const s3 = dimahS3({
5
+ s3: s3Client,
6
+ defaultBucket,
7
+ upload: { enabled: true },
8
+ download: { enabled: false },
9
+ delete: { enabled: false },
10
+ multipart: { enabled: false },
11
+ });
@@ -0,0 +1,27 @@
1
+ import { UploadButton } from "@dimah-s3/ui";
2
+
3
+ export function App() {
4
+ return (
5
+ <main className="flex min-h-full flex-1 flex-col items-center justify-center gap-8 p-8">
6
+ <div className="text-center">
7
+ <h1 className="text-3xl font-bold tracking-tight">dimah-s3</h1>
8
+ <p className="mt-2 text-muted-foreground">
9
+ Vite starter — pick a file to upload to your bucket
10
+ </p>
11
+ </div>
12
+
13
+ <UploadButton
14
+ objectKey={(file) => `uploads/${Date.now()}-${file.name}`}
15
+ accept={["image/*", ".pdf"]}
16
+ maxFileSize={10 * 1024 * 1024}
17
+ label="Upload file"
18
+ />
19
+
20
+ <p className="max-w-sm text-center text-xs text-muted-foreground">
21
+ Fill the <code className="rounded bg-muted px-1 py-0.5">S3_*</code>{" "}
22
+ values in <code className="rounded bg-muted px-1 py-0.5">.env</code>.
23
+ Browser uploads need bucket CORS.
24
+ </p>
25
+ </main>
26
+ );
27
+ }
@@ -0,0 +1,7 @@
1
+ import { createS3Client } from "@dimah-s3/react";
2
+
3
+ export const { api, S3Provider, useApi } = createS3Client();
4
+
5
+ export function S3ClientProvider({ children }: { children: React.ReactNode }) {
6
+ return <S3Provider>{children}</S3Provider>;
7
+ }
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { ThemeProvider as NextThemesProvider } from "next-themes";
3
+
4
+ export function ThemeProvider({
5
+ children,
6
+ ...props
7
+ }: React.ComponentProps<typeof NextThemesProvider>) {
8
+ return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
9
+ }
@@ -0,0 +1,132 @@
1
+ @import "tailwindcss";
2
+ @import "tw-animate-css";
3
+ @import "shadcn/tailwind.css";
4
+ @import "@dimah-s3/ui/styles.css";
5
+
6
+ @custom-variant dark (&:is(.dark *));
7
+
8
+ @theme inline {
9
+ --font-heading: var(--font-sans);
10
+ --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
11
+ --color-sidebar-ring: var(--sidebar-ring);
12
+ --color-sidebar-border: var(--sidebar-border);
13
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
14
+ --color-sidebar-accent: var(--sidebar-accent);
15
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
16
+ --color-sidebar-primary: var(--sidebar-primary);
17
+ --color-sidebar-foreground: var(--sidebar-foreground);
18
+ --color-sidebar: var(--sidebar);
19
+ --color-chart-5: var(--chart-5);
20
+ --color-chart-4: var(--chart-4);
21
+ --color-chart-3: var(--chart-3);
22
+ --color-chart-2: var(--chart-2);
23
+ --color-chart-1: var(--chart-1);
24
+ --color-ring: var(--ring);
25
+ --color-input: var(--input);
26
+ --color-border: var(--border);
27
+ --color-destructive: var(--destructive);
28
+ --color-accent-foreground: var(--accent-foreground);
29
+ --color-accent: var(--accent);
30
+ --color-muted-foreground: var(--muted-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-secondary-foreground: var(--secondary-foreground);
33
+ --color-secondary: var(--secondary);
34
+ --color-primary-foreground: var(--primary-foreground);
35
+ --color-primary: var(--primary);
36
+ --color-popover-foreground: var(--popover-foreground);
37
+ --color-popover: var(--popover);
38
+ --color-card-foreground: var(--card-foreground);
39
+ --color-card: var(--card);
40
+ --color-foreground: var(--foreground);
41
+ --color-background: var(--background);
42
+ --radius-sm: calc(var(--radius) * 0.6);
43
+ --radius-md: calc(var(--radius) * 0.8);
44
+ --radius-lg: var(--radius);
45
+ --radius-xl: calc(var(--radius) * 1.4);
46
+ --radius-2xl: calc(var(--radius) * 1.8);
47
+ --radius-3xl: calc(var(--radius) * 2.2);
48
+ --radius-4xl: calc(var(--radius) * 2.6);
49
+ }
50
+
51
+ :root {
52
+ --card: oklch(1 0 0);
53
+ --card-foreground: oklch(0.145 0 0);
54
+ --popover: oklch(1 0 0);
55
+ --popover-foreground: oklch(0.145 0 0);
56
+ --primary: oklch(0.205 0 0);
57
+ --primary-foreground: oklch(0.985 0 0);
58
+ --secondary: oklch(0.97 0 0);
59
+ --secondary-foreground: oklch(0.205 0 0);
60
+ --muted: oklch(0.97 0 0);
61
+ --muted-foreground: oklch(0.556 0 0);
62
+ --accent: oklch(0.97 0 0);
63
+ --accent-foreground: oklch(0.205 0 0);
64
+ --destructive: oklch(0.577 0.245 27.325);
65
+ --border: oklch(0.922 0 0);
66
+ --input: oklch(0.922 0 0);
67
+ --ring: oklch(0.708 0 0);
68
+ --chart-1: oklch(0.87 0 0);
69
+ --chart-2: oklch(0.556 0 0);
70
+ --chart-3: oklch(0.439 0 0);
71
+ --chart-4: oklch(0.371 0 0);
72
+ --chart-5: oklch(0.269 0 0);
73
+ --radius: 0.45rem;
74
+ --sidebar: oklch(0.985 0 0);
75
+ --sidebar-foreground: oklch(0.145 0 0);
76
+ --sidebar-primary: oklch(0.205 0 0);
77
+ --sidebar-primary-foreground: oklch(0.985 0 0);
78
+ --sidebar-accent: oklch(0.97 0 0);
79
+ --sidebar-accent-foreground: oklch(0.205 0 0);
80
+ --sidebar-border: oklch(0.922 0 0);
81
+ --sidebar-ring: oklch(0.708 0 0);
82
+ --background: oklch(1 0 0);
83
+ --foreground: oklch(0.145 0 0);
84
+ }
85
+
86
+ .dark {
87
+ --background: oklch(0.145 0 0);
88
+ --foreground: oklch(0.985 0 0);
89
+ --card: oklch(0.205 0 0);
90
+ --card-foreground: oklch(0.985 0 0);
91
+ --popover: oklch(0.205 0 0);
92
+ --popover-foreground: oklch(0.985 0 0);
93
+ --primary: oklch(0.922 0 0);
94
+ --primary-foreground: oklch(0.205 0 0);
95
+ --secondary: oklch(0.269 0 0);
96
+ --secondary-foreground: oklch(0.985 0 0);
97
+ --muted: oklch(0.269 0 0);
98
+ --muted-foreground: oklch(0.708 0 0);
99
+ --accent: oklch(0.269 0 0);
100
+ --accent-foreground: oklch(0.985 0 0);
101
+ --destructive: oklch(0.704 0.191 22.216);
102
+ --border: oklch(1 0 0 / 10%);
103
+ --input: oklch(1 0 0 / 15%);
104
+ --ring: oklch(0.556 0 0);
105
+ --chart-1: oklch(0.87 0 0);
106
+ --chart-2: oklch(0.556 0 0);
107
+ --chart-3: oklch(0.439 0 0);
108
+ --chart-4: oklch(0.371 0 0);
109
+ --chart-5: oklch(0.269 0 0);
110
+ --sidebar: oklch(0.205 0 0);
111
+ --sidebar-foreground: oklch(0.985 0 0);
112
+ --sidebar-primary: oklch(0.488 0.243 264.376);
113
+ --sidebar-primary-foreground: oklch(0.985 0 0);
114
+ --sidebar-accent: oklch(0.269 0 0);
115
+ --sidebar-accent-foreground: oklch(0.985 0 0);
116
+ --sidebar-border: oklch(1 0 0 / 10%);
117
+ --sidebar-ring: oklch(0.556 0 0);
118
+ }
119
+
120
+ @layer base {
121
+ * {
122
+ @apply border-border outline-ring/50;
123
+ }
124
+ html,
125
+ body,
126
+ #root {
127
+ @apply h-full;
128
+ }
129
+ body {
130
+ @apply bg-background text-foreground font-sans antialiased;
131
+ }
132
+ }
@@ -0,0 +1 @@
1
+ export { cn } from "cnfast";
@@ -0,0 +1,23 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { Toaster } from "@dimah-s3/ui";
4
+ import { ThemeProvider } from "@/components/theme-provider";
5
+ import { S3ClientProvider } from "@/components/s3-provider";
6
+ import { App } from "./App";
7
+ import "./index.css";
8
+
9
+ createRoot(document.getElementById("root")!).render(
10
+ <StrictMode>
11
+ <ThemeProvider
12
+ attribute="class"
13
+ defaultTheme="system"
14
+ enableSystem
15
+ disableTransitionOnChange
16
+ >
17
+ <S3ClientProvider>
18
+ <App />
19
+ <Toaster />
20
+ </S3ClientProvider>
21
+ </ThemeProvider>
22
+ </StrictMode>,
23
+ );
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler",
8
+ "jsx": "react-jsx",
9
+ "strict": true,
10
+ "noEmit": true,
11
+ "esModuleInterop": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "resolveJsonModule": true,
15
+ "skipLibCheck": true,
16
+ "paths": {
17
+ "@/*": ["./src/*"]
18
+ }
19
+ },
20
+ "include": ["src", "vite.config.ts"],
21
+ "exclude": ["node_modules", "dist", "server"]
22
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "lib": ["ES2022"],
6
+ "module": "NodeNext",
7
+ "moduleResolution": "NodeNext",
8
+ "strict": true,
9
+ "noEmit": true,
10
+ "esModuleInterop": true,
11
+ "isolatedModules": true,
12
+ "skipLibCheck": true,
13
+ "types": ["node"]
14
+ },
15
+ "include": ["server/**/*.ts"],
16
+ "exclude": ["node_modules"]
17
+ }
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import { resolve } from "node:path";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ resolve: {
8
+ alias: {
9
+ "@": resolve("./src"),
10
+ },
11
+ },
12
+ server: {
13
+ port: 5173,
14
+ proxy: {
15
+ "/api": {
16
+ target: "http://127.0.0.1:8787",
17
+ changeOrigin: true,
18
+ },
19
+ },
20
+ },
21
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimah-s3/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Scaffold dimah-s3 apps from official templates",
5
5
  "keywords": [
6
6
  "s3",
@@ -8,7 +8,9 @@
8
8
  "scaffold",
9
9
  "create",
10
10
  "dimah-s3",
11
- "nextjs"
11
+ "nextjs",
12
+ "vite",
13
+ "hono"
12
14
  ],
13
15
  "author": "Hamidrezakz",
14
16
  "license": "MIT",
File without changes