@doswiftly/cli 0.1.24 → 0.2.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 (98) hide show
  1. package/dist/commands/check.js +2 -2
  2. package/dist/commands/deploy.d.ts.map +1 -1
  3. package/dist/commands/deploy.js +8 -5
  4. package/dist/commands/deploy.js.map +1 -1
  5. package/dist/commands/dev.d.ts +13 -0
  6. package/dist/commands/dev.d.ts.map +1 -1
  7. package/dist/commands/dev.js +155 -63
  8. package/dist/commands/dev.js.map +1 -1
  9. package/dist/commands/doctor.d.ts.map +1 -1
  10. package/dist/commands/doctor.js +3 -4
  11. package/dist/commands/doctor.js.map +1 -1
  12. package/dist/commands/init.d.ts.map +1 -1
  13. package/dist/commands/init.js +271 -166
  14. package/dist/commands/init.js.map +1 -1
  15. package/dist/commands/sdk.d.ts +1 -1
  16. package/dist/commands/sdk.js +3 -3
  17. package/dist/commands/sdk.js.map +1 -1
  18. package/dist/commands/template.d.ts.map +1 -1
  19. package/dist/commands/template.js +4 -31
  20. package/dist/commands/template.js.map +1 -1
  21. package/dist/commands/verify.js +5 -5
  22. package/dist/commands/verify.js.map +1 -1
  23. package/dist/index.js +2 -3
  24. package/dist/index.js.map +1 -1
  25. package/dist/lib/i18n.d.ts +12 -0
  26. package/dist/lib/i18n.d.ts.map +1 -1
  27. package/dist/lib/i18n.js +24 -0
  28. package/dist/lib/i18n.js.map +1 -1
  29. package/dist/lib/proxy-server.d.ts +22 -6
  30. package/dist/lib/proxy-server.d.ts.map +1 -1
  31. package/dist/lib/proxy-server.js +174 -75
  32. package/dist/lib/proxy-server.js.map +1 -1
  33. package/package.json +1 -1
  34. package/dist/commands/types.d.ts +0 -5
  35. package/dist/commands/types.d.ts.map +0 -1
  36. package/dist/commands/types.js +0 -82
  37. package/dist/commands/types.js.map +0 -1
  38. package/templates/storefront-minimal/.env.example +0 -10
  39. package/templates/storefront-minimal/.github/workflows/build-template.yml +0 -119
  40. package/templates/storefront-minimal/app/globals.css +0 -18
  41. package/templates/storefront-minimal/app/layout.tsx +0 -26
  42. package/templates/storefront-minimal/app/page.tsx +0 -93
  43. package/templates/storefront-minimal/lib/graphql-client.ts +0 -23
  44. package/templates/storefront-minimal/next.config.ts +0 -15
  45. package/templates/storefront-minimal/open-next.config.ts +0 -3
  46. package/templates/storefront-minimal/package.json +0 -30
  47. package/templates/storefront-minimal/postcss.config.mjs +0 -5
  48. package/templates/storefront-minimal/tailwind.config.ts +0 -14
  49. package/templates/storefront-minimal/tsconfig.json +0 -27
  50. package/templates/storefront-minimal/wrangler.toml +0 -24
  51. package/templates/storefront-nextjs/.env.example +0 -68
  52. package/templates/storefront-nextjs/.github/workflows/build-template.yml +0 -119
  53. package/templates/storefront-nextjs/README.md +0 -524
  54. package/templates/storefront-nextjs/app/account/orders/page.tsx +0 -216
  55. package/templates/storefront-nextjs/app/account/page.tsx +0 -167
  56. package/templates/storefront-nextjs/app/auth/login/page.tsx +0 -135
  57. package/templates/storefront-nextjs/app/auth/register/page.tsx +0 -212
  58. package/templates/storefront-nextjs/app/cart/page.tsx +0 -263
  59. package/templates/storefront-nextjs/app/categories/[slug]/page.tsx +0 -200
  60. package/templates/storefront-nextjs/app/categories/page.tsx +0 -58
  61. package/templates/storefront-nextjs/app/checkout/page.tsx +0 -351
  62. package/templates/storefront-nextjs/app/collections/[slug]/page.tsx +0 -158
  63. package/templates/storefront-nextjs/app/collections/page.tsx +0 -61
  64. package/templates/storefront-nextjs/app/globals.css +0 -98
  65. package/templates/storefront-nextjs/app/layout.tsx +0 -39
  66. package/templates/storefront-nextjs/app/page.tsx +0 -136
  67. package/templates/storefront-nextjs/app/products/[slug]/page.tsx +0 -119
  68. package/templates/storefront-nextjs/app/products/page.tsx +0 -107
  69. package/templates/storefront-nextjs/app/search/page.tsx +0 -127
  70. package/templates/storefront-nextjs/components/auth/auth-guard.tsx +0 -94
  71. package/templates/storefront-nextjs/components/commerce/add-to-cart-button.tsx +0 -77
  72. package/templates/storefront-nextjs/components/commerce/cart-icon.tsx +0 -29
  73. package/templates/storefront-nextjs/components/commerce/currency-selector.tsx +0 -217
  74. package/templates/storefront-nextjs/components/commerce/pagination.tsx +0 -62
  75. package/templates/storefront-nextjs/components/commerce/product-actions.tsx +0 -135
  76. package/templates/storefront-nextjs/components/commerce/product-filters.tsx +0 -109
  77. package/templates/storefront-nextjs/components/commerce/product-price.tsx +0 -375
  78. package/templates/storefront-nextjs/components/commerce/search-input.tsx +0 -178
  79. package/templates/storefront-nextjs/components/commerce/sort-select.tsx +0 -64
  80. package/templates/storefront-nextjs/components/commerce/variant-selector.tsx +0 -210
  81. package/templates/storefront-nextjs/components/layout/footer.tsx +0 -107
  82. package/templates/storefront-nextjs/components/layout/header.tsx +0 -104
  83. package/templates/storefront-nextjs/components/providers.tsx +0 -62
  84. package/templates/storefront-nextjs/lib/auth/routes.ts +0 -52
  85. package/templates/storefront-nextjs/lib/currency.tsx +0 -140
  86. package/templates/storefront-nextjs/lib/format.ts +0 -159
  87. package/templates/storefront-nextjs/lib/graphql-queries.ts +0 -629
  88. package/templates/storefront-nextjs/lib/hooks.ts +0 -30
  89. package/templates/storefront-nextjs/middleware.ts +0 -80
  90. package/templates/storefront-nextjs/next.config.ts +0 -37
  91. package/templates/storefront-nextjs/open-next.config.ts +0 -3
  92. package/templates/storefront-nextjs/package.dev.json +0 -30
  93. package/templates/storefront-nextjs/package.json +0 -32
  94. package/templates/storefront-nextjs/package.json.template +0 -32
  95. package/templates/storefront-nextjs/postcss.config.mjs +0 -8
  96. package/templates/storefront-nextjs/tailwind.config.ts +0 -111
  97. package/templates/storefront-nextjs/tsconfig.json +0 -27
  98. package/templates/storefront-nextjs/wrangler.toml +0 -24
@@ -1,80 +0,0 @@
1
- import { NextResponse } from "next/server";
2
- import type { NextRequest } from "next/server";
3
- import {
4
- protectedRoutes,
5
- guestOnlyRoutes,
6
- AUTH_COOKIE_NAME,
7
- redirects,
8
- matchesRoute,
9
- } from "@/lib/auth/routes";
10
-
11
- /**
12
- * Authentication Middleware
13
- *
14
- * Security Model (3 layers):
15
- * 1. Middleware (this file) - Fast redirect based on cookie existence (UX layer)
16
- * 2. AuthGuard component - Client-side validation via useAuth hook
17
- * 3. GraphQL Backend - Ultimate security (validates token on every request)
18
- *
19
- * IMPORTANT: This middleware checks cookie EXISTENCE, not VALIDITY.
20
- * Token validation happens in:
21
- * - AuthGuard (client-side via useAuth hook)
22
- * - GraphQL API (server-side, ultimate security)
23
- *
24
- * Why this approach?
25
- * - Middleware runs on Edge Runtime (fast, but limited capabilities)
26
- * - Cannot make GraphQL requests to validate token
27
- * - Provides instant redirect without waiting for client hydration
28
- * - Prevents flash of protected content for unauthenticated users
29
- *
30
- * @see lib/auth/routes.ts - SSOT for route configuration
31
- * @see components/auth/auth-guard.tsx - Client-side auth protection
32
- */
33
- export function middleware(request: NextRequest) {
34
- const { pathname } = request.nextUrl;
35
- const token = request.cookies.get(AUTH_COOKIE_NAME)?.value;
36
- const hasToken = Boolean(token);
37
-
38
- // Protected routes - redirect to login if no token
39
- if (matchesRoute(pathname, protectedRoutes)) {
40
- if (!hasToken) {
41
- const loginUrl = new URL(redirects.unauthenticated, request.url);
42
- // Preserve the original URL for redirect after login
43
- loginUrl.searchParams.set("redirect", pathname);
44
- return NextResponse.redirect(loginUrl);
45
- }
46
- }
47
-
48
- // Guest-only routes - redirect to account if has token
49
- if (matchesRoute(pathname, guestOnlyRoutes)) {
50
- if (hasToken) {
51
- return NextResponse.redirect(
52
- new URL(redirects.authenticated, request.url)
53
- );
54
- }
55
- }
56
-
57
- return NextResponse.next();
58
- }
59
-
60
- /**
61
- * Matcher configuration
62
- *
63
- * Only run middleware on routes that need auth checks.
64
- * This improves performance by skipping static assets, API routes, etc.
65
- *
66
- * Update this when adding new protected or guest-only route groups.
67
- */
68
- export const config = {
69
- matcher: [
70
- /*
71
- * Match all request paths except:
72
- * - _next/static (static files)
73
- * - _next/image (image optimization files)
74
- * - favicon.ico (favicon file)
75
- * - public folder files (images, etc.)
76
- * - API routes (handled separately)
77
- */
78
- "/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
79
- ],
80
- };
@@ -1,37 +0,0 @@
1
- import type { NextConfig } from 'next';
2
-
3
- const nextConfig: NextConfig = {
4
- // Enable React strict mode for better development experience
5
- reactStrictMode: true,
6
-
7
- // Image optimization configuration
8
- images: {
9
- remotePatterns: [
10
- {
11
- protocol: 'https',
12
- hostname: '**.doswiftly.pl',
13
- },
14
- {
15
- protocol: 'https',
16
- hostname: 'images.unsplash.com',
17
- },
18
- ],
19
- },
20
-
21
- // Experimental features
22
- experimental: {
23
- // Enable server actions
24
- serverActions: {
25
- bodySizeLimit: '2mb',
26
- },
27
- },
28
-
29
- // Environment variables validation
30
- env: {
31
- NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
32
- NEXT_PUBLIC_PROJECT_ID: process.env.NEXT_PUBLIC_PROJECT_ID,
33
- NEXT_PUBLIC_SHOP_SLUG: process.env.NEXT_PUBLIC_SHOP_SLUG,
34
- },
35
- };
36
-
37
- export default nextConfig;
@@ -1,3 +0,0 @@
1
- import { defineCloudflareConfig } from "@opennextjs/cloudflare";
2
-
3
- export default defineCloudflareConfig({});
@@ -1,30 +0,0 @@
1
- {
2
- "name": "test-storefront",
3
- "version": "0.1.0",
4
- "private": true,
5
- "scripts": {
6
- "dev": "next dev",
7
- "build": "next build",
8
- "start": "next start",
9
- "lint": "next lint"
10
- },
11
- "dependencies": {
12
- "@doswiftly/storefront-sdk": "file:../../../commerce-sdk",
13
- "graphql-request": "^7.1.2",
14
- "graphql": "^16.10.0",
15
- "next": "latest",
16
- "react": "^19",
17
- "react-dom": "^19",
18
- "lucide-react": "latest"
19
- },
20
- "devDependencies": {
21
- "@types/node": "latest",
22
- "@types/react": "latest",
23
- "@types/react-dom": "latest",
24
- "typescript": "latest",
25
- "@tailwindcss/postcss": "latest",
26
- "tailwindcss": "latest",
27
- "eslint": "latest",
28
- "eslint-config-next": "latest"
29
- }
30
- }
@@ -1,32 +0,0 @@
1
- {
2
- "name": "{{PROJECT_NAME}}",
3
- "version": "0.1.0",
4
- "private": true,
5
- "scripts": {
6
- "dev": "next dev",
7
- "build": "next build",
8
- "build:cf": "opennextjs-cloudflare build",
9
- "start": "next start",
10
- "lint": "next lint"
11
- },
12
- "dependencies": {
13
- "@doswiftly/storefront-sdk": "{{SDK_VERSION}}",
14
- "graphql-request": "^7.1.2",
15
- "graphql": "^16.10.0",
16
- "next": "^15.1.9",
17
- "react": "^19",
18
- "react-dom": "^19",
19
- "lucide-react": "latest"
20
- },
21
- "devDependencies": {
22
- "@opennextjs/cloudflare": "^1.0.0",
23
- "@types/node": "latest",
24
- "@types/react": "latest",
25
- "@types/react-dom": "latest",
26
- "typescript": "latest",
27
- "@tailwindcss/postcss": "latest",
28
- "tailwindcss": "latest",
29
- "eslint": "latest",
30
- "eslint-config-next": "^15.1.9"
31
- }
32
- }
@@ -1,32 +0,0 @@
1
- {
2
- "name": "{{PROJECT_NAME}}",
3
- "version": "0.1.0",
4
- "private": true,
5
- "scripts": {
6
- "dev": "next dev",
7
- "build": "next build",
8
- "start": "next start",
9
- "lint": "next lint"
10
- },
11
- "dependencies": {
12
- "@doswiftly/storefront-sdk": "{{SDK_VERSION}}",
13
- "@tanstack/react-query": "^5.62.7",
14
- "graphql-request": "^7.1.2",
15
- "graphql": "^16.10.0",
16
- "next": "latest",
17
- "react": "^19",
18
- "react-dom": "^19",
19
- "lucide-react": "latest",
20
- "zustand": "^5.0.2"
21
- },
22
- "devDependencies": {
23
- "@types/node": "latest",
24
- "@types/react": "latest",
25
- "@types/react-dom": "latest",
26
- "typescript": "latest",
27
- "@tailwindcss/postcss": "latest",
28
- "tailwindcss": "latest",
29
- "eslint": "latest",
30
- "eslint-config-next": "latest"
31
- }
32
- }
@@ -1,8 +0,0 @@
1
- /** @type {import('postcss-load-config').Config} */
2
- const config = {
3
- plugins: {
4
- "@tailwindcss/postcss": {},
5
- },
6
- };
7
-
8
- export default config;
@@ -1,111 +0,0 @@
1
- import type { Config } from 'tailwindcss';
2
-
3
- const config: Config = {
4
- content: [
5
- './pages/**/*.{js,ts,jsx,tsx,mdx}',
6
- './components/**/*.{js,ts,jsx,tsx,mdx}',
7
- './app/**/*.{js,ts,jsx,tsx,mdx}',
8
- ],
9
- theme: {
10
- extend: {
11
- colors: {
12
- // Primary brand color - customize for your store
13
- primary: {
14
- DEFAULT: 'rgb(var(--primary) / <alpha-value>)',
15
- foreground: 'rgb(var(--primary-foreground) / <alpha-value>)',
16
- 50: '#eff6ff',
17
- 100: '#dbeafe',
18
- 200: '#bfdbfe',
19
- 300: '#93c5fd',
20
- 400: '#60a5fa',
21
- 500: '#3b82f6',
22
- 600: '#2563eb',
23
- 700: '#1d4ed8',
24
- 800: '#1e40af',
25
- 900: '#1e3a8a',
26
- 950: '#172554',
27
- },
28
- // Secondary color for accents
29
- secondary: {
30
- DEFAULT: 'rgb(var(--secondary) / <alpha-value>)',
31
- foreground: 'rgb(var(--secondary-foreground) / <alpha-value>)',
32
- },
33
- // Accent color for highlights
34
- accent: {
35
- DEFAULT: 'rgb(var(--accent) / <alpha-value>)',
36
- foreground: 'rgb(var(--accent-foreground) / <alpha-value>)',
37
- },
38
- // Background and foreground
39
- background: 'rgb(var(--background) / <alpha-value>)',
40
- foreground: 'rgb(var(--foreground) / <alpha-value>)',
41
- // Muted colors for subtle elements
42
- muted: {
43
- DEFAULT: 'rgb(var(--muted) / <alpha-value>)',
44
- foreground: 'rgb(var(--muted-foreground) / <alpha-value>)',
45
- },
46
- // Border color
47
- border: 'rgb(var(--border) / <alpha-value>)',
48
- // Ring color for focus states
49
- ring: 'rgb(var(--ring) / <alpha-value>)',
50
- },
51
- borderRadius: {
52
- lg: 'var(--radius)',
53
- md: 'calc(var(--radius) - 2px)',
54
- sm: 'calc(var(--radius) - 4px)',
55
- },
56
- fontFamily: {
57
- sans: ['Inter', 'system-ui', 'sans-serif'],
58
- },
59
- container: {
60
- center: true,
61
- padding: {
62
- DEFAULT: '1rem',
63
- sm: '2rem',
64
- lg: '4rem',
65
- xl: '5rem',
66
- '2xl': '6rem',
67
- },
68
- },
69
- // Commerce-specific spacing
70
- spacing: {
71
- '18': '4.5rem',
72
- '88': '22rem',
73
- '128': '32rem',
74
- },
75
- // Product card aspect ratios
76
- aspectRatio: {
77
- 'product': '4 / 5',
78
- 'product-wide': '16 / 9',
79
- 'product-square': '1 / 1',
80
- },
81
- // Animation for cart and interactions
82
- animation: {
83
- 'slide-in': 'slideIn 0.3s ease-out',
84
- 'slide-out': 'slideOut 0.3s ease-in',
85
- 'fade-in': 'fadeIn 0.2s ease-out',
86
- 'bounce-subtle': 'bounceSubtle 0.5s ease-out',
87
- },
88
- keyframes: {
89
- slideIn: {
90
- '0%': { transform: 'translateX(100%)' },
91
- '100%': { transform: 'translateX(0)' },
92
- },
93
- slideOut: {
94
- '0%': { transform: 'translateX(0)' },
95
- '100%': { transform: 'translateX(100%)' },
96
- },
97
- fadeIn: {
98
- '0%': { opacity: '0' },
99
- '100%': { opacity: '1' },
100
- },
101
- bounceSubtle: {
102
- '0%, 100%': { transform: 'scale(1)' },
103
- '50%': { transform: 'scale(1.05)' },
104
- },
105
- },
106
- },
107
- },
108
- plugins: [],
109
- };
110
-
111
- export default config;
@@ -1,27 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2017",
4
- "lib": ["dom", "dom.iterable", "esnext"],
5
- "allowJs": true,
6
- "skipLibCheck": true,
7
- "strict": true,
8
- "noEmit": true,
9
- "esModuleInterop": true,
10
- "module": "esnext",
11
- "moduleResolution": "bundler",
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "jsx": "preserve",
15
- "incremental": true,
16
- "plugins": [
17
- {
18
- "name": "next"
19
- }
20
- ],
21
- "paths": {
22
- "@/*": ["./*"]
23
- }
24
- },
25
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26
- "exclude": ["node_modules"]
27
- }
@@ -1,24 +0,0 @@
1
- #:schema node_modules/wrangler/config-schema.json
2
-
3
- name = "storefront-template-{{PROJECT_NAME}}"
4
- main = ".open-next/worker.js"
5
- compatibility_date = "2024-09-23"
6
- compatibility_flags = ["nodejs_compat"]
7
-
8
- # Assets directory for static files
9
- assets = { directory = ".open-next/assets", binding = "ASSETS" }
10
-
11
- # Cloudflare Images binding for Next.js /_next/image optimization
12
- [images]
13
- binding = "IMAGES"
14
-
15
- # Observability — logs persisted in Cloudflare Dashboard
16
- [observability]
17
- enabled = true
18
- head_sampling_rate = 1
19
-
20
- [observability.logs]
21
- enabled = true
22
- head_sampling_rate = 1
23
- persist = true
24
- invocation_logs = true