create-brainerce-store 1.27.4 → 1.27.5
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/dist/index.js +21 -1
- package/package.json +1 -1
- package/templates/nextjs/base/src/app/account/page.tsx +1 -1
- package/templates/nextjs/base/src/app/auth/callback/page.tsx +2 -1
- package/templates/nextjs/base/src/app/cart/page.tsx +1 -1
- package/templates/nextjs/base/src/app/checkout/page.tsx +1 -1
- package/templates/nextjs/base/src/app/forgot-password/page.tsx +1 -1
- package/templates/nextjs/base/src/app/layout.tsx.ejs +6 -5
- package/templates/nextjs/base/src/app/login/page.tsx +1 -2
- package/templates/nextjs/base/src/app/order-confirmation/page.tsx +1 -1
- package/templates/nextjs/base/src/app/page.tsx +1 -1
- package/templates/nextjs/base/src/app/products/page.tsx +475 -470
- package/templates/nextjs/base/src/app/register/page.tsx +1 -2
- package/templates/nextjs/base/src/app/reset-password/page.tsx +1 -2
- package/templates/nextjs/base/src/app/verify-email/page.tsx +1 -2
- package/templates/nextjs/base/src/components/auth/login-form.tsx +1 -1
- package/templates/nextjs/base/src/components/layout/footer.tsx +1 -1
- package/templates/nextjs/base/src/components/layout/header.tsx +1 -2
- package/templates/nextjs/base/src/components/products/product-card.tsx +1 -2
- package/templates/nextjs/base/src/components/products/recommendation-section.tsx +1 -1
- package/templates/nextjs/base/src/lib/navigation.tsx.ejs +60 -0
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "create-brainerce-store",
|
|
34
|
-
version: "1.27.
|
|
34
|
+
version: "1.27.5",
|
|
35
35
|
description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
|
|
36
36
|
bin: {
|
|
37
37
|
"create-brainerce-store": "dist/index.js"
|
|
@@ -351,6 +351,26 @@ async function scaffold(options) {
|
|
|
351
351
|
import_path.default.join(targetMessages, `${options.language}.json`)
|
|
352
352
|
);
|
|
353
353
|
}
|
|
354
|
+
if (isMultiLocale) {
|
|
355
|
+
const appDir = import_path.default.join(targetDir, "src", "app");
|
|
356
|
+
const localeDir = import_path.default.join(appDir, "[locale]");
|
|
357
|
+
await import_fs_extra.default.ensureDir(localeDir);
|
|
358
|
+
const keepInAppRoot = /* @__PURE__ */ new Set([
|
|
359
|
+
"globals.css",
|
|
360
|
+
"robots.ts",
|
|
361
|
+
"sitemap.ts",
|
|
362
|
+
"api",
|
|
363
|
+
".well-known"
|
|
364
|
+
]);
|
|
365
|
+
const appEntries = await import_fs_extra.default.readdir(appDir, { withFileTypes: true });
|
|
366
|
+
for (const entry of appEntries) {
|
|
367
|
+
if (keepInAppRoot.has(entry.name) || entry.name === "[locale]") continue;
|
|
368
|
+
await import_fs_extra.default.move(
|
|
369
|
+
import_path.default.join(appDir, entry.name),
|
|
370
|
+
import_path.default.join(localeDir, entry.name)
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
354
374
|
if (await import_fs_extra.default.pathExists(themeDir)) {
|
|
355
375
|
const themeCss = import_path.default.join(themeDir, "globals.css");
|
|
356
376
|
if (await import_fs_extra.default.pathExists(themeCss)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
import { useRouter } from '
|
|
4
|
+
import { useRouter } from '@/lib/navigation';
|
|
5
5
|
import type { CustomerProfile, Order } from 'brainerce';
|
|
6
6
|
import { getClient } from '@/lib/brainerce';
|
|
7
7
|
import { useAuth } from '@/providers/store-provider';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { Suspense, useEffect, useState, useRef } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useSearchParams } from 'next/navigation';
|
|
5
|
+
import { useRouter } from '@/lib/navigation';
|
|
5
6
|
import { useAuth } from '@/providers/store-provider';
|
|
6
7
|
import { LoadingSpinner } from '@/components/shared/loading-spinner';
|
|
7
8
|
import { useTranslations } from '@/lib/translations';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Suspense, useEffect, useState, useCallback, useRef } from 'react';
|
|
4
4
|
import { useSearchParams } from 'next/navigation';
|
|
5
5
|
import Image from 'next/image';
|
|
6
|
-
import Link from '
|
|
6
|
+
import { Link } from '@/lib/navigation';
|
|
7
7
|
import type {
|
|
8
8
|
Checkout,
|
|
9
9
|
ShippingRate,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import Link from '
|
|
4
|
+
import { Link } from '@/lib/navigation';
|
|
5
5
|
import { getClient } from '@/lib/brainerce';
|
|
6
6
|
import { LoadingSpinner } from '@/components/shared/loading-spinner';
|
|
7
7
|
import { useTranslations } from '@/lib/translations';
|
|
@@ -42,17 +42,18 @@ export function generateStaticParams() {
|
|
|
42
42
|
return supportedLocales.map((locale) => ({ locale }));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export default function RootLayout({
|
|
45
|
+
export default async function RootLayout({
|
|
46
46
|
children,
|
|
47
47
|
params,
|
|
48
48
|
}: {
|
|
49
49
|
children: React.ReactNode;
|
|
50
|
-
params: { locale: string }
|
|
50
|
+
params: Promise<{ locale: string }>;
|
|
51
51
|
}) {
|
|
52
|
-
const
|
|
52
|
+
const { locale } = await params;
|
|
53
|
+
const dir = getDirection(locale);
|
|
53
54
|
|
|
54
55
|
return (
|
|
55
|
-
<html lang={
|
|
56
|
+
<html lang={locale} dir={dir}>
|
|
56
57
|
<head>
|
|
57
58
|
<script
|
|
58
59
|
type="application/ld+json"
|
|
@@ -60,7 +61,7 @@ export default function RootLayout({
|
|
|
60
61
|
/>
|
|
61
62
|
</head>
|
|
62
63
|
<body className={font.className}>
|
|
63
|
-
<StoreProvider locale={
|
|
64
|
+
<StoreProvider locale={locale}>
|
|
64
65
|
<div className="min-h-screen flex flex-col">
|
|
65
66
|
<Header />
|
|
66
67
|
<main className="flex-1">{children}</main>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { useRouter } from '
|
|
5
|
-
import Link from 'next/link';
|
|
4
|
+
import { useRouter, Link } from '@/lib/navigation';
|
|
6
5
|
import { useAuth } from '@/providers/store-provider';
|
|
7
6
|
import { proxyLogin } from '@/lib/auth';
|
|
8
7
|
import { LoginForm } from '@/components/auth/login-form';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Suspense, useEffect, useState } from 'react';
|
|
4
4
|
import { useSearchParams } from 'next/navigation';
|
|
5
|
-
import Link from '
|
|
5
|
+
import { Link } from '@/lib/navigation';
|
|
6
6
|
import type { WaitForOrderResult, OrderDownloadLink } from 'brainerce';
|
|
7
7
|
import { getClient } from '@/lib/brainerce';
|
|
8
8
|
import { useCart } from '@/providers/store-provider';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
import Link from '
|
|
4
|
+
import { Link } from '@/lib/navigation';
|
|
5
5
|
import type { Product, DiscountBanner } from 'brainerce';
|
|
6
6
|
import { getClient } from '@/lib/brainerce';
|
|
7
7
|
import { useStoreInfo } from '@/providers/store-provider';
|