web-ggf 1.0.10 → 2.0.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.
- package/README.md +1 -1
- package/bin/file-helper-8mCRd8gz.js +1 -0
- package/bin/index-D2RdtCtg.js +1 -0
- package/bin/index-DK7oafLf.js +1 -0
- package/bin/index-DO4ucSmr.js +1 -0
- package/bin/index-TZeQiMQl.js +1 -0
- package/bin/index-cJPNUbWu.js +1 -0
- package/bin/index-h2TvLleI.js +1 -0
- package/bin/index.js +2 -0
- package/bin/npm-install-CsYXwCS0.js +1 -0
- package/package.json +3 -3
- package/bin/_chunks/file-helper-CPVdSg32.js +0 -80
- package/bin/_chunks/index-B6tEqrai.js +0 -11
- package/bin/_chunks/index-BaQt8yVT.js +0 -121
- package/bin/_chunks/index-CJwhB9ZM.js +0 -135
- package/bin/_chunks/index-DDL8vi6o.js +0 -133
- package/bin/_chunks/index-m0G5jZTY.js +0 -49
- package/bin/_chunks/npm-install-DR6c952D.js +0 -20
- package/bin/nextjs15/index.js +0 -17
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as n from"fs";import*as e from"path";function r(n){if(c(n))return console.warn(`❎ ${n} is existing`),e.join(process.cwd(),n);for(const e of n.split("/").reduce((n,e,r)=>0===r?[e]:[...n,`${n.slice(-1)[0]}/${e}`],[]))e.includes(".")||(c(e)?console.warn(`${e} is exist`):(console.warn(`${e} is not exist`),t(e)));return e.join(process.cwd(),n)}function o(e){c(e)&&(n.unlinkSync(s(e)),console.warn(`${e} is removed`))}function s(n){return e.join(process.cwd(),n)}function c(e){return n.existsSync(s(e))}function t(e){return n.mkdirSync(s(e),{recursive:!0}),console.warn(`🆗 ${e} directory created`)}function i(e){return JSON.parse(n.readFileSync(e,"utf-8"))}function a({targetPath:e,content:r,fileName:o,option:s}){try{n.writeFileSync(e,r,s),console.warn(`🆗 -> ${o} successfully ${n.existsSync(e)?"updated":"created"}`)}catch(n){console.error("❌ Error creating file:",n)}}export{o as d,r as f,s as g,i as r,a as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as n,w as e}from"./file-helper-8mCRd8gz.js";import"fs";import"path";const t="APP_CONFIG.d.ts";e({targetPath:n(`src/configs/${t}`),content:"export interface AppConfigProps {\n appIndex: string;\n tokens: {\n uid: string;\n secret: string;\n };\n map: {\n googleMapApiKey: string;\n defaultCenter: { lat: number; lng: number };\n defaultZoom: number;\n };\n}\n",fileName:t});const o="APP_CONFIG.ts";e({targetPath:n(`src/configs/${o}`),content:"import type { AppConfigProps } from './APP_CONFIG.d';\n\nexport const APP_CONFIG: AppConfigProps = {\n appIndex: '<app_index>',\n tokens: { uid: '<uid>', secret: '<secret>' },\n map: { googleMapApiKey: '', defaultCenter: { lat: 47.919045645074696, lng: 106.91752910614014 }, defaultZoom: 12 },\n};\n",fileName:o});const r="HOST_CONFIG.d.ts";e({targetPath:n(`src/configs/${r}`),content:"export interface HostConfigProps {\n host: string;\n elastic: {\n host: string;\n username: string;\n password: string;\n };\n}\n",fileName:r});const s="HOST_CONFIG.ts";e({targetPath:n(`src/configs/${s}`),content:"import type { HostConfigProps } from './HOST_CONFIG.d';\n\nexport const HOST_CONFIG: HostConfigProps = {\n host: '<host_url>',\n elastic: {\n host: '<host_url>',\n username: '<username>',\n password: '<password>'\n }\n};\n",fileName:s});const i="MIDDLEWARE_CONFIG.ts";e({targetPath:n(`src/configs/${i}`),content:"import { NextJSAuthMiddleware } from 'web-ggf/nextjs-middleware';\n\nimport { APP_CONFIG } from '@/configs/APP_CONFIG';\nimport { HOST_CONFIG } from '@/configs/HOST_CONFIG';\nimport { STORE_KEY_CONFIG } from '@/configs/STORE_KEY_CONFIG';\n\nexport const middlewareConfig = new NextJSAuthMiddleware({\n userTokenKey: STORE_KEY_CONFIG.USER_TOKEN,\n clientTokenKey: STORE_KEY_CONFIG.CLIENT_TOKEN,\n refreshTokenKey: STORE_KEY_CONFIG.REFRESH_TOKEN,\n appKey: APP_CONFIG.tokens.uid,\n appSecret: APP_CONFIG.tokens.secret,\n host: HOST_CONFIG.host,\n protectedPaths: [/^(\\/\\w{2})?\\/account\\/?/, /^(\\/\\w{2})?\\/checkout\\/address\\/?/, /^(\\/\\w{2})?\\/checkout\\/confirm\\/?/],\n secure: process.env.NODE_ENV === 'production',\n locale: 'mn',\n});\n",fileName:i});const a="STORE_KEY_CONFIG.d.ts";e({targetPath:n(`src/configs/${a}`),content:"export interface StoreKeyConfigProps {\n USER_TOKEN: string;\n REFRESH_TOKEN: string;\n CLIENT_TOKEN: string;\n EXPIRES_IN: string;\n}\n",fileName:a});const p="STORE_KEY_CONFIG.ts";e({targetPath:n(`src/configs/${p}`),content:"import type { StoreKeyConfigProps } from './STORE_KEY_CONFIG.d';\n\nimport { APP_CONFIG } from '@/configs/APP_CONFIG';\n\nexport const STORE_KEY_CONFIG: StoreKeyConfigProps = {\n USER_TOKEN: `${APP_CONFIG.appIndex}_USER_TOKEN`,\n CLIENT_TOKEN: `${APP_CONFIG.appIndex}CLIENT_TOKEN`,\n REFRESH_TOKEN: `${APP_CONFIG.appIndex}REFRESH_TOKEN`,\n EXPIRES_IN: `${APP_CONFIG.appIndex}EXPIRES_IN`,\n};\n",fileName:p});const c="index.css";e({targetPath:n(`src/configs/THEME_CONFIG/${c}`),content:'@plugin "daisyui" {\n /*noinspection CssUnknownProperty*/\n themes: light --default, dark --prefersdark;\n}\n@plugin "daisyui/theme" {\n /*noinspection CssUnknownProperty*/\n default: true;\n name: light;\n --color-primary: #EE3562;\n --color-secondary: teal;\n}\n@plugin "daisyui/theme" {\n /*noinspection CssUnknownProperty*/\n prefersdark: true;\n name: dark;\n --color-primary: #EE3562;\n --color-secondary: teal;\n}\n',fileName:c});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as n,w as e}from"./file-helper-8mCRd8gz.js";import{n as o}from"./npm-install-CsYXwCS0.js";import"fs";import"path";import"child_process";const r="apollo-provider.tsx";e({targetPath:n(`src/utils/${r}`),content:"'use client';\n\nimport { ReactNode } from 'react';\n\nimport cookies from 'js-cookie';\nimport { ApolloWrapper, GenerateMakeClient } from 'web-ggf/apollo-nextjs-wrapper';\n\nimport { HOST_CONFIG } from '@/configs/HOST_CONFIG';\nimport { STORE_KEY_CONFIG } from '@/configs/STORE_KEY_CONFIG';\n\nexport function ApolloProvider({ children }: { children: ReactNode }) {\n return (\n <ApolloWrapper\n makeClient={() =>\n new GenerateMakeClient({\n host: HOST_CONFIG.host,\n getToken: () => {\n const user = cookies.get(STORE_KEY_CONFIG.USER_TOKEN);\n const client = cookies.get(STORE_KEY_CONFIG.CLIENT_TOKEN);\n return user || client || '-';\n },\n })\n }\n >\n <>{children}</>\n </ApolloWrapper>\n );\n}\n",fileName:r}),o([{name:"@apollo/client",version:"^4.1.6"},{name:"@apollo/client-integration-nextjs",version:"^0.14.4"},{name:"rxjs",version:"^7.8.2"},{name:"graphql",version:"^16.13.1"},{name:"apollo-upload-client",version:"^19.0.0"},{name:"@types/apollo-upload-client",version:"^19.0.0",dev:!0}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n}from"./npm-install-CsYXwCS0.js";import{f as e,w as t,g as a,r as s}from"./file-helper-8mCRd8gz.js";import"child_process";import"fs";import"path";n([{name:"@lingui/cli",version:"latest",dev:!0},{name:"@lingui/swc-plugin",version:"5.7.0",dev:!0},{name:"@lingui/loader",version:"latest",dev:!0},{name:"@lingui/react",version:"latest"},{name:"@lingui/core",version:"latest"}]);const i="init-lingui.ts";t({targetPath:e(`src/locales/${i}`),content:"import { setI18n } from '@lingui/react/server';\n\nimport { getI18nInstance } from './lingui-server-instance';\n\nexport type PageLangParam = {\n params: Promise<{ locale: string }>;\n};\n\nexport function initLingui(lang: string) {\n const i18n = getI18nInstance(lang);\n setI18n(i18n);\n return i18n;\n}\n",fileName:i});const l="linqui-client-provider.tsx";t({targetPath:e(`src/utils/${l}`),content:"'use client';\n\nimport { type ReactNode, useState } from 'react';\n\nimport { type Messages, setupI18n } from '@lingui/core';\nimport { I18nProvider } from '@lingui/react';\n\nexport function LinguiClientProvider({\n children,\n initialLocale,\n initialMessages,\n}: {\n children: ReactNode;\n initialLocale: string;\n initialMessages: Messages;\n}) {\n const [i18n] = useState(() =>\n setupI18n({\n locale: initialLocale,\n messages: { [initialLocale]: initialMessages },\n }),\n );\n\n return <I18nProvider i18n={i18n}>{children}</I18nProvider>;\n}\n",fileName:l});const o="lingui.config.js";t({targetPath:e(o),content:"/** @type {import('@lingui/conf').LinguiConfig} */\nmodule.exports = {\n locales: ['en', 'mn'],\n sourceLocale: 'en',\n fallbackLocales: { default: 'en' },\n catalogs: [\n {\n path: 'src/locales/{locale}',\n include: ['src/'],\n },\n ],\n format: 'po',\n orderBy: 'message',\n compileNamespace: 'ts',\n};\n",fileName:o});const c="lingui-server-instance.ts";t({targetPath:e(`src/locales/${c}`),content:"import 'server-only';\n\nimport { I18n, Messages, setupI18n } from '@lingui/core';\n\nimport linguiConfig from '../../lingui.config';\n\nconst { locales } = linguiConfig;\n// optionally use a stricter union type\ntype SupportedLocales = string;\n\nasync function loadCatalog(locale: SupportedLocales): Promise<{\n [k: string]: Messages;\n}> {\n const { messages } = await import(`./${locale}.po`);\n return {\n [locale]: messages,\n };\n}\nconst catalogs = await Promise.all(locales.map(loadCatalog));\n\n// transform array of catalogs into a single object\nexport const allMessages = catalogs.reduce((acc, oneCatalog) => ({ ...acc, ...oneCatalog }), {});\n\ntype AllI18nInstances = { [K in SupportedLocales]: I18n };\n\nexport const allI18nInstances: AllI18nInstances = locales.reduce((acc, locale) => {\n const messages = allMessages[locale] ?? {};\n const i18n = setupI18n({\n locale,\n messages: { [locale]: messages },\n });\n return { ...acc, [locale]: i18n };\n}, {});\n\nexport const getI18nInstance = (locale: SupportedLocales): I18n => {\n if (!allI18nInstances[locale]) {\n console.warn(`No i18n instance found for locale \"${locale}\"`);\n }\n return allI18nInstances[locale] || allI18nInstances['en']!;\n};\n",fileName:c});const r="package.json",g=a(r),p=s(g);p.scripts["lingui:extract:clean"]="lingui extract --clean",p.scripts["lingui:compile:typescript"]="lingui compile --typescript",t({targetPath:g,content:JSON.stringify(p,null,2),fileName:r,option:"utf-8"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as n,w as e,d as t}from"./file-helper-8mCRd8gz.js";import"fs";import"path";const a="page.tsx";e({targetPath:n(`src/app/[locale]/auth/${a}`),content:"export default function AuthPage() {\n return <div>AuthPage</div>;\n}\n",fileName:a});const o="globals.css";e({targetPath:n(`src/app/[locale]/${o}`),content:'@import "tailwindcss";\n@import "../../configs/THEME_CONFIG/index.css";\n',fileName:o});const i="page.tsx";e({targetPath:n(`src/app/[locale]/${i}`),content:"import { t } from '@lingui/core/macro';\n\nimport { initLingui, PageLangParam } from '@/locales/init-lingui';\n\nexport default async function Page({ params }: PageLangParam) {\n const { locale } = await params;\n initLingui(locale);\n\n return (\n <div>\n <p>{t`Hello world`}</p>\n </div>\n );\n}\n",fileName:i});const r="layout.tsx";e({targetPath:n(`src/app/[locale]/${r}`),content:"import { ReactNode } from 'react';\n\nimport { i18n as Lingui18n } from '@lingui/core';\nimport type { Metadata } from 'next';\n\nimport './globals.css';\n\nimport { allMessages } from '@/locales/lingui-server-instance';\nimport { ApolloProvider } from '@/utils/apollo-provider';\nimport { LinguiClientProvider } from '@/utils/linqui-client-provider';\n\nexport default async function RootLayout({ children, params }: Readonly<{ children: ReactNode; params: Promise<{ locale: string }> }>) {\n const { locale } = await params;\n Lingui18n.loadAndActivate({ locale, messages: allMessages[locale] });\n\n return (\n <html lang={locale}>\n <body>\n <LinguiClientProvider initialLocale={locale} initialMessages={allMessages[locale]!}>\n <ApolloProvider>\n <>{children}</>\n </ApolloProvider>\n </LinguiClientProvider>\n </body>\n </html>\n );\n}\n\nexport const metadata: Metadata = {\n title: 'Test title',\n description: 'Test description',\n};\n",fileName:r});const l="middleware.ts";e({targetPath:n(`src/${l}`),content:"import { NextRequest } from 'next/server';\n\nimport { middlewareConfig } from '@/configs/MIDDLEWARE_CONFIG';\n\nexport async function middleware(request: NextRequest) {\n return middlewareConfig.generateResponse(request as never);\n}\n\nexport const config = {\n matcher: '/((?!api|_next/data|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)',\n};\n",fileName:l});const s="next.config.ts";e({targetPath:n(s),content:"import type { NextConfig } from 'next';\n\nconst nextConfig: NextConfig = {\n experimental: {\n swcPlugins: [['@lingui/swc-plugin', {}]],\n },\n webpack: (config) => {\n config.module.rules.push({\n test: /\\.po$/,\n use: {\n loader: '@lingui/loader',\n },\n });\n\n return config;\n },\n};\n\nexport default nextConfig;\n",fileName:s}),t("src/app/page.tsx"),t("src/app/layout.tsx"),t("src/app/favicon.ico"),t("src/app/globals.css");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./npm-install-CsYXwCS0.js";import"child_process";import"fs";e([{name:"web-ggf",version:"latest"},{name:"js-cookie",version:"^3.0.5"},{name:"daisyui",version:"latest",dev:!0},{name:"@types/js-cookie",version:"^3.0.6",dev:!0}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function i(){try{await import("./index-D2RdtCtg.js"),await import("./index-TZeQiMQl.js"),await import("./index-DK7oafLf.js"),await import("./index-DO4ucSmr.js"),await import("./index-cJPNUbWu.js")}catch(i){console.error(i),process.exit(1)}}export{i as nextjs15};
|
package/bin/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{execSync as n}from"child_process";import{existsSync as r}from"fs";const e={npm:{install:"install",devFlag:"-D",pin:"@"},pnpm:{install:"add",devFlag:"-D",pin:"@"},yarn:{install:"add",devFlag:"--dev",pin:"@"},bun:{install:"add",devFlag:"-d",pin:"@"}};function t(n,r){const{install:t,devFlag:i,pin:o}=e[n];return`${n} ${t}${r.dev?` ${i}`:""} ${r.name}${o}${r.version}`}function i(e,i=function(){if(r("pnpm-lock.yaml"))return"pnpm";if(r("yarn.lock"))return"yarn";if(r("package-lock.json"))return"npm";if(r("bun.lockb"))return"bun";try{return n("pnpm --version",{stdio:"ignore"}),"pnpm"}catch{}try{return n("yarn --version",{stdio:"ignore"}),"yarn"}catch{}return"npm"}()){try{for(const r of e)process.stdout.write(`⌛ Installing "${r.name}"...`),n(`${t(i,r)} --silent`,{stdio:"ignore",cwd:process.cwd()}),process.stdout.write(`\r✅ Installed "${r.name}@${r.version}"\n`)}catch(n){console.error("❌ Failed to install dependencies:",n?.message),process.exit(1)}}export{i as n};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-ggf",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"bin": {
|
|
10
|
-
"
|
|
10
|
+
"web-ggf": "./bin/index.js"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
"./apollo-nextjs-client": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"build": "npm run build:client && npm run build:server && npm run build:bin",
|
|
42
42
|
"build:client": "rollup -c rollup.client.config.mjs",
|
|
43
43
|
"build:server": "rollup -c rollup.server.config.mjs",
|
|
44
|
-
"build:bin": "rollup -c rollup.bin.
|
|
44
|
+
"build:bin": "rollup -c rollup.bin.config.mjs",
|
|
45
45
|
"build:watch": "rollup -c rollup.client.config.mjs --watch",
|
|
46
46
|
"prebuild:bin": "rm -rf bin",
|
|
47
47
|
"prebuild": "rm -rf dist",
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var path = require('path');
|
|
5
|
-
|
|
6
|
-
function _interopNamespaceDefault(e) {
|
|
7
|
-
var n = Object.create(null);
|
|
8
|
-
if (e) {
|
|
9
|
-
Object.keys(e).forEach(function (k) {
|
|
10
|
-
if (k !== 'default') {
|
|
11
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return e[k]; }
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
24
|
-
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
25
|
-
|
|
26
|
-
function findOrInitialsFile(pathWithNameExtension) {
|
|
27
|
-
if (isExist(pathWithNameExtension)) {
|
|
28
|
-
console.warn(`❎ ${pathWithNameExtension} is existing`);
|
|
29
|
-
return path__namespace.join(process.cwd(), pathWithNameExtension);
|
|
30
|
-
}
|
|
31
|
-
for (const pathName of pathWithNameExtension.split('/').reduce((acc, cur, idx) => {
|
|
32
|
-
if (idx === 0)
|
|
33
|
-
return [cur];
|
|
34
|
-
return [...acc, `${acc.slice(-1)[0]}/${cur}`];
|
|
35
|
-
}, [])) {
|
|
36
|
-
if (pathName.includes('.'))
|
|
37
|
-
continue;
|
|
38
|
-
if (!isExist(pathName)) {
|
|
39
|
-
console.warn(`${pathName} is not exist`);
|
|
40
|
-
mkdirSync(pathName);
|
|
41
|
-
}
|
|
42
|
-
else
|
|
43
|
-
console.warn(`${pathName} is exist`);
|
|
44
|
-
}
|
|
45
|
-
return path__namespace.join(process.cwd(), pathWithNameExtension);
|
|
46
|
-
}
|
|
47
|
-
function deleteFile(filePath) {
|
|
48
|
-
if (isExist(filePath)) {
|
|
49
|
-
fs__namespace.unlinkSync(getFilePath(filePath));
|
|
50
|
-
console.warn(`${filePath} is removed`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function getFilePath(name) {
|
|
54
|
-
return path__namespace.join(process.cwd(), name);
|
|
55
|
-
}
|
|
56
|
-
function isExist(name) {
|
|
57
|
-
return fs__namespace.existsSync(getFilePath(name));
|
|
58
|
-
}
|
|
59
|
-
function mkdirSync(name) {
|
|
60
|
-
fs__namespace.mkdirSync(getFilePath(name), { recursive: true });
|
|
61
|
-
return console.warn(`🆗 ${name} directory created`);
|
|
62
|
-
}
|
|
63
|
-
function readUtf8File(filePath) {
|
|
64
|
-
return JSON.parse(fs__namespace.readFileSync(filePath, 'utf-8'));
|
|
65
|
-
}
|
|
66
|
-
function writeFileSyncWithLog({ targetPath, content, fileName, option }) {
|
|
67
|
-
try {
|
|
68
|
-
fs__namespace.writeFileSync(targetPath, content, option);
|
|
69
|
-
console.warn(`🆗 -> ${fileName} successfully ${fs__namespace.existsSync(targetPath) ? 'updated' : 'created'}`);
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
console.error('❌ Error creating file:', err);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
exports.deleteFile = deleteFile;
|
|
77
|
-
exports.findOrInitialsFile = findOrInitialsFile;
|
|
78
|
-
exports.getFilePath = getFilePath;
|
|
79
|
-
exports.readUtf8File = readUtf8File;
|
|
80
|
-
exports.writeFileSyncWithLog = writeFileSyncWithLog;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var npmInstall = require('./npm-install-DR6c952D.js');
|
|
4
|
-
require('child_process');
|
|
5
|
-
|
|
6
|
-
npmInstall.npmInstall([
|
|
7
|
-
{ name: 'web-ggf', version: 'latest' },
|
|
8
|
-
{ name: 'js-cookie', version: '^3.0.5' },
|
|
9
|
-
{ name: 'daisyui', version: 'latest', dev: true },
|
|
10
|
-
{ name: '@types/js-cookie', version: '^3.0.6', dev: true },
|
|
11
|
-
]);
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fileHelper = require('./file-helper-CPVdSg32.js');
|
|
4
|
-
require('fs');
|
|
5
|
-
require('path');
|
|
6
|
-
|
|
7
|
-
const fileName$5 = `page.tsx`;
|
|
8
|
-
const targetPath$5 = fileHelper.findOrInitialsFile(`src/app/[locale]/auth/${fileName$5}`);
|
|
9
|
-
const content$5 = `export default function AuthPage() {
|
|
10
|
-
return <div>AuthPage</div>;
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$5, content: content$5, fileName: fileName$5 });
|
|
14
|
-
|
|
15
|
-
const fileName$4 = `globals.css`;
|
|
16
|
-
const targetPath$4 = fileHelper.findOrInitialsFile(`src/app/[locale]/${fileName$4}`);
|
|
17
|
-
const content$4 = `@import "tailwindcss";
|
|
18
|
-
@import "../../configs/THEME_CONFIG/index.css";
|
|
19
|
-
`;
|
|
20
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$4, content: content$4, fileName: fileName$4 });
|
|
21
|
-
|
|
22
|
-
const fileName$3 = `page.tsx`;
|
|
23
|
-
const targetPath$3 = fileHelper.findOrInitialsFile(`src/app/[locale]/${fileName$3}`);
|
|
24
|
-
const content$3 = `import { t } from '@lingui/core/macro';
|
|
25
|
-
|
|
26
|
-
import { initLingui, PageLangParam } from '@/locales/init-lingui';
|
|
27
|
-
|
|
28
|
-
export default async function Page({ params }: PageLangParam) {
|
|
29
|
-
const { locale } = await params;
|
|
30
|
-
initLingui(locale);
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div>
|
|
34
|
-
<p>{t\`Hello world\`}</p>
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$3, content: content$3, fileName: fileName$3 });
|
|
40
|
-
|
|
41
|
-
const fileName$2 = `layout.tsx`;
|
|
42
|
-
const targetPath$2 = fileHelper.findOrInitialsFile(`src/app/[locale]/${fileName$2}`);
|
|
43
|
-
const content$2 = `import { ReactNode } from 'react';
|
|
44
|
-
|
|
45
|
-
import { i18n as Lingui18n } from '@lingui/core';
|
|
46
|
-
import type { Metadata } from 'next';
|
|
47
|
-
|
|
48
|
-
import './globals.css';
|
|
49
|
-
|
|
50
|
-
import { allMessages } from '@/locales/lingui-server-instance';
|
|
51
|
-
import { ApolloProvider } from '@/utils/apollo-provider';
|
|
52
|
-
import { LinguiClientProvider } from '@/utils/linqui-client-provider';
|
|
53
|
-
|
|
54
|
-
export default async function RootLayout({ children, params }: Readonly<{ children: ReactNode; params: Promise<{ locale: string }> }>) {
|
|
55
|
-
const { locale } = await params;
|
|
56
|
-
Lingui18n.loadAndActivate({ locale, messages: allMessages[locale] });
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<html lang={locale}>
|
|
60
|
-
<body>
|
|
61
|
-
<LinguiClientProvider initialLocale={locale} initialMessages={allMessages[locale]!}>
|
|
62
|
-
<ApolloProvider>
|
|
63
|
-
<>{children}</>
|
|
64
|
-
</ApolloProvider>
|
|
65
|
-
</LinguiClientProvider>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export const metadata: Metadata = {
|
|
72
|
-
title: 'Test title',
|
|
73
|
-
description: 'Test description',
|
|
74
|
-
};
|
|
75
|
-
`;
|
|
76
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$2, content: content$2, fileName: fileName$2 });
|
|
77
|
-
|
|
78
|
-
const fileName$1 = `middleware.ts`;
|
|
79
|
-
const targetPath$1 = fileHelper.findOrInitialsFile(`src/${fileName$1}`);
|
|
80
|
-
const content$1 = `import { NextRequest } from 'next/server';
|
|
81
|
-
|
|
82
|
-
import { middlewareConfig } from '@/configs/MIDDLEWARE_CONFIG';
|
|
83
|
-
|
|
84
|
-
export async function middleware(request: NextRequest) {
|
|
85
|
-
return middlewareConfig.generateResponse(request as never);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export const config = {
|
|
89
|
-
matcher: '/((?!api|_next/data|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)',
|
|
90
|
-
};
|
|
91
|
-
`;
|
|
92
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$1, content: content$1, fileName: fileName$1 });
|
|
93
|
-
|
|
94
|
-
const fileName = `next.config.ts`;
|
|
95
|
-
const targetPath = fileHelper.findOrInitialsFile(fileName);
|
|
96
|
-
const content = `import type { NextConfig } from 'next';
|
|
97
|
-
|
|
98
|
-
const nextConfig: NextConfig = {
|
|
99
|
-
experimental: {
|
|
100
|
-
swcPlugins: [['@lingui/swc-plugin', {}]],
|
|
101
|
-
},
|
|
102
|
-
webpack: (config) => {
|
|
103
|
-
config.module.rules.push({
|
|
104
|
-
test: /\\.po$/,
|
|
105
|
-
use: {
|
|
106
|
-
loader: '@lingui/loader',
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
return config;
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export default nextConfig;
|
|
115
|
-
`;
|
|
116
|
-
fileHelper.writeFileSyncWithLog({ targetPath, content, fileName });
|
|
117
|
-
|
|
118
|
-
fileHelper.deleteFile('src/app/page.tsx');
|
|
119
|
-
fileHelper.deleteFile('src/app/layout.tsx');
|
|
120
|
-
fileHelper.deleteFile('src/app/favicon.ico');
|
|
121
|
-
fileHelper.deleteFile('src/app/globals.css');
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var npmInstall = require('./npm-install-DR6c952D.js');
|
|
4
|
-
var fileHelper = require('./file-helper-CPVdSg32.js');
|
|
5
|
-
require('child_process');
|
|
6
|
-
require('fs');
|
|
7
|
-
require('path');
|
|
8
|
-
|
|
9
|
-
npmInstall.npmInstall([
|
|
10
|
-
{ name: '@lingui/cli', version: 'latest', dev: true },
|
|
11
|
-
{ name: '@lingui/swc-plugin', version: '5.7.0', dev: true },
|
|
12
|
-
{ name: '@lingui/loader', version: 'latest', dev: true },
|
|
13
|
-
{ name: '@lingui/react', version: 'latest' },
|
|
14
|
-
{ name: '@lingui/core', version: 'latest' },
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
const fileName$4 = `init-lingui.ts`;
|
|
18
|
-
const targetPath$4 = fileHelper.findOrInitialsFile(`src/locales/${fileName$4}`);
|
|
19
|
-
const content$4 = `import { setI18n } from '@lingui/react/server';
|
|
20
|
-
|
|
21
|
-
import { getI18nInstance } from './lingui-server-instance';
|
|
22
|
-
|
|
23
|
-
export type PageLangParam = {
|
|
24
|
-
params: Promise<{ locale: string }>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export function initLingui(lang: string) {
|
|
28
|
-
const i18n = getI18nInstance(lang);
|
|
29
|
-
setI18n(i18n);
|
|
30
|
-
return i18n;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$4, content: content$4, fileName: fileName$4 });
|
|
34
|
-
|
|
35
|
-
const fileName$3 = `linqui-client-provider.tsx`;
|
|
36
|
-
const targetPath$3 = fileHelper.findOrInitialsFile(`src/utils/${fileName$3}`);
|
|
37
|
-
const content$3 = `'use client';
|
|
38
|
-
|
|
39
|
-
import { type ReactNode, useState } from 'react';
|
|
40
|
-
|
|
41
|
-
import { type Messages, setupI18n } from '@lingui/core';
|
|
42
|
-
import { I18nProvider } from '@lingui/react';
|
|
43
|
-
|
|
44
|
-
export function LinguiClientProvider({
|
|
45
|
-
children,
|
|
46
|
-
initialLocale,
|
|
47
|
-
initialMessages,
|
|
48
|
-
}: {
|
|
49
|
-
children: ReactNode;
|
|
50
|
-
initialLocale: string;
|
|
51
|
-
initialMessages: Messages;
|
|
52
|
-
}) {
|
|
53
|
-
const [i18n] = useState(() =>
|
|
54
|
-
setupI18n({
|
|
55
|
-
locale: initialLocale,
|
|
56
|
-
messages: { [initialLocale]: initialMessages },
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$3, content: content$3, fileName: fileName$3 });
|
|
64
|
-
|
|
65
|
-
const fileName$2 = `lingui.config.js`;
|
|
66
|
-
const targetPath$2 = fileHelper.findOrInitialsFile(fileName$2);
|
|
67
|
-
const content$2 = `/** @type {import('@lingui/conf').LinguiConfig} */
|
|
68
|
-
module.exports = {
|
|
69
|
-
locales: ['en', 'mn'],
|
|
70
|
-
sourceLocale: 'en',
|
|
71
|
-
fallbackLocales: { default: 'en' },
|
|
72
|
-
catalogs: [
|
|
73
|
-
{
|
|
74
|
-
path: 'src/locales/{locale}',
|
|
75
|
-
include: ['src/'],
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
format: 'po',
|
|
79
|
-
orderBy: 'message',
|
|
80
|
-
compileNamespace: 'ts',
|
|
81
|
-
};
|
|
82
|
-
`;
|
|
83
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$2, content: content$2, fileName: fileName$2 });
|
|
84
|
-
|
|
85
|
-
const fileName$1 = `lingui-server-instance.ts`;
|
|
86
|
-
const targetPath$1 = fileHelper.findOrInitialsFile(`src/locales/${fileName$1}`);
|
|
87
|
-
const content$1 = `import 'server-only';
|
|
88
|
-
|
|
89
|
-
import { I18n, Messages, setupI18n } from '@lingui/core';
|
|
90
|
-
|
|
91
|
-
import linguiConfig from '../../lingui.config';
|
|
92
|
-
|
|
93
|
-
const { locales } = linguiConfig;
|
|
94
|
-
// optionally use a stricter union type
|
|
95
|
-
type SupportedLocales = string;
|
|
96
|
-
|
|
97
|
-
async function loadCatalog(locale: SupportedLocales): Promise<{
|
|
98
|
-
[k: string]: Messages;
|
|
99
|
-
}> {
|
|
100
|
-
const { messages } = await import(\`./\${locale}.po\`);
|
|
101
|
-
return {
|
|
102
|
-
[locale]: messages,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
const catalogs = await Promise.all(locales.map(loadCatalog));
|
|
106
|
-
|
|
107
|
-
// transform array of catalogs into a single object
|
|
108
|
-
export const allMessages = catalogs.reduce((acc, oneCatalog) => ({ ...acc, ...oneCatalog }), {});
|
|
109
|
-
|
|
110
|
-
type AllI18nInstances = { [K in SupportedLocales]: I18n };
|
|
111
|
-
|
|
112
|
-
export const allI18nInstances: AllI18nInstances = locales.reduce((acc, locale) => {
|
|
113
|
-
const messages = allMessages[locale] ?? {};
|
|
114
|
-
const i18n = setupI18n({
|
|
115
|
-
locale,
|
|
116
|
-
messages: { [locale]: messages },
|
|
117
|
-
});
|
|
118
|
-
return { ...acc, [locale]: i18n };
|
|
119
|
-
}, {});
|
|
120
|
-
|
|
121
|
-
export const getI18nInstance = (locale: SupportedLocales): I18n => {
|
|
122
|
-
if (!allI18nInstances[locale]) {
|
|
123
|
-
console.warn(\`No i18n instance found for locale "\${locale}"\`);
|
|
124
|
-
}
|
|
125
|
-
return allI18nInstances[locale] || allI18nInstances['en']!;
|
|
126
|
-
};
|
|
127
|
-
`;
|
|
128
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$1, content: content$1, fileName: fileName$1 });
|
|
129
|
-
|
|
130
|
-
const fileName = `package.json`;
|
|
131
|
-
const targetPath = fileHelper.getFilePath(fileName);
|
|
132
|
-
const content = fileHelper.readUtf8File(targetPath);
|
|
133
|
-
content.scripts['lingui:extract:clean'] = `lingui extract --clean`;
|
|
134
|
-
content.scripts['lingui:compile:typescript'] = `lingui compile --typescript`;
|
|
135
|
-
fileHelper.writeFileSyncWithLog({ targetPath, content: JSON.stringify(content, null, 2), fileName, option: 'utf-8' });
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fileHelper = require('./file-helper-CPVdSg32.js');
|
|
4
|
-
require('fs');
|
|
5
|
-
require('path');
|
|
6
|
-
|
|
7
|
-
const fileName$7 = `APP_CONFIG.d.ts`;
|
|
8
|
-
const targetPath$7 = fileHelper.findOrInitialsFile(`src/configs/${fileName$7}`);
|
|
9
|
-
const content$7 = `export interface AppConfigProps {
|
|
10
|
-
appIndex: string;
|
|
11
|
-
tokens: {
|
|
12
|
-
uid: string;
|
|
13
|
-
secret: string;
|
|
14
|
-
};
|
|
15
|
-
map: {
|
|
16
|
-
googleMapApiKey: string;
|
|
17
|
-
defaultCenter: { lat: number; lng: number };
|
|
18
|
-
defaultZoom: number;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$7, content: content$7, fileName: fileName$7 });
|
|
23
|
-
|
|
24
|
-
const fileName$6 = `APP_CONFIG.ts`;
|
|
25
|
-
const targetPath$6 = fileHelper.findOrInitialsFile(`src/configs/${fileName$6}`);
|
|
26
|
-
const content$6 = `import type { AppConfigProps } from './APP_CONFIG.d';
|
|
27
|
-
|
|
28
|
-
export const APP_CONFIG: AppConfigProps = {
|
|
29
|
-
appIndex: '<app_index>',
|
|
30
|
-
tokens: { uid: '<uid>', secret: '<secret>' },
|
|
31
|
-
map: { googleMapApiKey: '', defaultCenter: { lat: 47.919045645074696, lng: 106.91752910614014 }, defaultZoom: 12 },
|
|
32
|
-
};
|
|
33
|
-
`;
|
|
34
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$6, content: content$6, fileName: fileName$6 });
|
|
35
|
-
|
|
36
|
-
const fileName$5 = `HOST_CONFIG.d.ts`;
|
|
37
|
-
const targetPath$5 = fileHelper.findOrInitialsFile(`src/configs/${fileName$5}`);
|
|
38
|
-
const content$5 = `export interface HostConfigProps {
|
|
39
|
-
host: string;
|
|
40
|
-
elastic: {
|
|
41
|
-
host: string;
|
|
42
|
-
username: string;
|
|
43
|
-
password: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$5, content: content$5, fileName: fileName$5 });
|
|
48
|
-
|
|
49
|
-
const fileName$4 = `HOST_CONFIG.ts`;
|
|
50
|
-
const targetPath$4 = fileHelper.findOrInitialsFile(`src/configs/${fileName$4}`);
|
|
51
|
-
const content$4 = `import type { HostConfigProps } from './HOST_CONFIG.d';
|
|
52
|
-
|
|
53
|
-
export const HOST_CONFIG: HostConfigProps = {
|
|
54
|
-
host: '<host_url>',
|
|
55
|
-
elastic: {
|
|
56
|
-
host: '<host_url>',
|
|
57
|
-
username: '<username>',
|
|
58
|
-
password: '<password>'
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
`;
|
|
62
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$4, content: content$4, fileName: fileName$4 });
|
|
63
|
-
|
|
64
|
-
const fileName$3 = `MIDDLEWARE_CONFIG.ts`;
|
|
65
|
-
const targetPath$3 = fileHelper.findOrInitialsFile(`src/configs/${fileName$3}`);
|
|
66
|
-
const content$3 = `import { NextJSAuthMiddleware } from 'web-ggf/nextjs-middleware';
|
|
67
|
-
|
|
68
|
-
import { APP_CONFIG } from '@/configs/APP_CONFIG';
|
|
69
|
-
import { HOST_CONFIG } from '@/configs/HOST_CONFIG';
|
|
70
|
-
import { STORE_KEY_CONFIG } from '@/configs/STORE_KEY_CONFIG';
|
|
71
|
-
|
|
72
|
-
export const middlewareConfig = new NextJSAuthMiddleware({
|
|
73
|
-
userTokenKey: STORE_KEY_CONFIG.USER_TOKEN,
|
|
74
|
-
clientTokenKey: STORE_KEY_CONFIG.CLIENT_TOKEN,
|
|
75
|
-
refreshTokenKey: STORE_KEY_CONFIG.REFRESH_TOKEN,
|
|
76
|
-
appKey: APP_CONFIG.tokens.uid,
|
|
77
|
-
appSecret: APP_CONFIG.tokens.secret,
|
|
78
|
-
host: HOST_CONFIG.host,
|
|
79
|
-
protectedPaths: [/^(\\/\\w{2})?\\/account\\/?/, /^(\\/\\w{2})?\\/checkout\\/address\\/?/, /^(\\/\\w{2})?\\/checkout\\/confirm\\/?/],
|
|
80
|
-
secure: process.env.NODE_ENV === 'production',
|
|
81
|
-
locale: 'mn',
|
|
82
|
-
});
|
|
83
|
-
`;
|
|
84
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$3, content: content$3, fileName: fileName$3 });
|
|
85
|
-
|
|
86
|
-
const fileName$2 = `STORE_KEY_CONFIG.d.ts`;
|
|
87
|
-
const targetPath$2 = fileHelper.findOrInitialsFile(`src/configs/${fileName$2}`);
|
|
88
|
-
const content$2 = `export interface StoreKeyConfigProps {
|
|
89
|
-
USER_TOKEN: string;
|
|
90
|
-
REFRESH_TOKEN: string;
|
|
91
|
-
CLIENT_TOKEN: string;
|
|
92
|
-
EXPIRES_IN: string;
|
|
93
|
-
}
|
|
94
|
-
`;
|
|
95
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$2, content: content$2, fileName: fileName$2 });
|
|
96
|
-
|
|
97
|
-
const fileName$1 = `STORE_KEY_CONFIG.ts`;
|
|
98
|
-
const targetPath$1 = fileHelper.findOrInitialsFile(`src/configs/${fileName$1}`);
|
|
99
|
-
const content$1 = `import type { StoreKeyConfigProps } from './STORE_KEY_CONFIG.d';
|
|
100
|
-
|
|
101
|
-
import { APP_CONFIG } from '@/configs/APP_CONFIG';
|
|
102
|
-
|
|
103
|
-
export const STORE_KEY_CONFIG: StoreKeyConfigProps = {
|
|
104
|
-
USER_TOKEN: \`\${APP_CONFIG.appIndex}_USER_TOKEN\`,
|
|
105
|
-
CLIENT_TOKEN: \`\${APP_CONFIG.appIndex}CLIENT_TOKEN\`,
|
|
106
|
-
REFRESH_TOKEN: \`\${APP_CONFIG.appIndex}REFRESH_TOKEN\`,
|
|
107
|
-
EXPIRES_IN: \`\${APP_CONFIG.appIndex}EXPIRES_IN\`,
|
|
108
|
-
};
|
|
109
|
-
`;
|
|
110
|
-
fileHelper.writeFileSyncWithLog({ targetPath: targetPath$1, content: content$1, fileName: fileName$1 });
|
|
111
|
-
|
|
112
|
-
const fileName = `index.css`;
|
|
113
|
-
const targetPath = fileHelper.findOrInitialsFile(`src/configs/THEME_CONFIG/${fileName}`);
|
|
114
|
-
const content = `@plugin "daisyui" {
|
|
115
|
-
/*noinspection CssUnknownProperty*/
|
|
116
|
-
themes: light --default, dark --prefersdark;
|
|
117
|
-
}
|
|
118
|
-
@plugin "daisyui/theme" {
|
|
119
|
-
/*noinspection CssUnknownProperty*/
|
|
120
|
-
default: true;
|
|
121
|
-
name: light;
|
|
122
|
-
--color-primary: #EE3562;
|
|
123
|
-
--color-secondary: teal;
|
|
124
|
-
}
|
|
125
|
-
@plugin "daisyui/theme" {
|
|
126
|
-
/*noinspection CssUnknownProperty*/
|
|
127
|
-
prefersdark: true;
|
|
128
|
-
name: dark;
|
|
129
|
-
--color-primary: #EE3562;
|
|
130
|
-
--color-secondary: teal;
|
|
131
|
-
}
|
|
132
|
-
`;
|
|
133
|
-
fileHelper.writeFileSyncWithLog({ targetPath, content, fileName });
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fileHelper = require('./file-helper-CPVdSg32.js');
|
|
4
|
-
var npmInstall = require('./npm-install-DR6c952D.js');
|
|
5
|
-
require('fs');
|
|
6
|
-
require('path');
|
|
7
|
-
require('child_process');
|
|
8
|
-
|
|
9
|
-
const fileName = `apollo-provider.tsx`;
|
|
10
|
-
const targetPath = fileHelper.findOrInitialsFile(`src/utils/${fileName}`);
|
|
11
|
-
const content = `'use client';
|
|
12
|
-
|
|
13
|
-
import { ReactNode } from 'react';
|
|
14
|
-
|
|
15
|
-
import cookies from 'js-cookie';
|
|
16
|
-
import { ApolloWrapper, GenerateMakeClient } from 'web-ggf/apollo-nextjs-wrapper';
|
|
17
|
-
|
|
18
|
-
import { HOST_CONFIG } from '@/configs/HOST_CONFIG';
|
|
19
|
-
import { STORE_KEY_CONFIG } from '@/configs/STORE_KEY_CONFIG';
|
|
20
|
-
|
|
21
|
-
export function ApolloProvider({ children }: { children: ReactNode }) {
|
|
22
|
-
return (
|
|
23
|
-
<ApolloWrapper
|
|
24
|
-
makeClient={() =>
|
|
25
|
-
new GenerateMakeClient({
|
|
26
|
-
host: HOST_CONFIG.host,
|
|
27
|
-
getToken: () => {
|
|
28
|
-
const user = cookies.get(STORE_KEY_CONFIG.USER_TOKEN);
|
|
29
|
-
const client = cookies.get(STORE_KEY_CONFIG.CLIENT_TOKEN);
|
|
30
|
-
return user || client || '-';
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
>
|
|
35
|
-
<>{children}</>
|
|
36
|
-
</ApolloWrapper>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
fileHelper.writeFileSyncWithLog({ targetPath, content, fileName });
|
|
41
|
-
|
|
42
|
-
npmInstall.npmInstall([
|
|
43
|
-
{ name: '@apollo/client', version: '^4.1.6' },
|
|
44
|
-
{ name: '@apollo/client-integration-nextjs', version: '^0.14.4' },
|
|
45
|
-
{ name: 'rxjs', version: '^7.8.2' },
|
|
46
|
-
{ name: 'graphql', version: '^16.13.1' },
|
|
47
|
-
{ name: 'apollo-upload-client', version: '^19.0.0' },
|
|
48
|
-
{ name: '@types/apollo-upload-client', version: '^19.0.0', dev: true },
|
|
49
|
-
]);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var child_process = require('child_process');
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
function npmInstall(dependencies) {
|
|
7
|
-
try {
|
|
8
|
-
for (const dep of dependencies) {
|
|
9
|
-
process.stdout.write(`⌛ Installing "${dep.name}"...`);
|
|
10
|
-
child_process.execSync(`npm i${dep.dev ? ' -D' : ''} ${dep.name}@${dep.version} --silent`, { stdio: 'ignore', cwd: process.cwd() });
|
|
11
|
-
process.stdout.write(`\r✅ Installed "${dep.name}@${dep.version}"\n`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
console.error('❌ Failed to install dependencies:', error?.message);
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
exports.npmInstall = npmInstall;
|
package/bin/nextjs15/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const init = process.argv[2];
|
|
5
|
-
console.warn('>>> , init >>>', init);
|
|
6
|
-
if (init !== 'nextjs' || !init) {
|
|
7
|
-
console.error('Invalid init. Usage: npx web-ggf nextjs');
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
function main() {
|
|
11
|
-
Promise.resolve().then(function () { return require('../_chunks/index-B6tEqrai.js'); });
|
|
12
|
-
Promise.resolve().then(function () { return require('../_chunks/index-DDL8vi6o.js'); });
|
|
13
|
-
Promise.resolve().then(function () { return require('../_chunks/index-BaQt8yVT.js'); });
|
|
14
|
-
Promise.resolve().then(function () { return require('../_chunks/index-m0G5jZTY.js'); });
|
|
15
|
-
Promise.resolve().then(function () { return require('../_chunks/index-CJwhB9ZM.js'); });
|
|
16
|
-
}
|
|
17
|
-
main();
|