diff --git a/ee/apps/platform/.npmrc b/ee/apps/platform/.npmrc new file mode 100644 index 000000000..b7e0de10b --- /dev/null +++ b/ee/apps/platform/.npmrc @@ -0,0 +1,4 @@ +//npm.pkg.github.com/:_authToken=${GIT_CREDENTIALS} +@karrio:registry=https://npm.pkg.github.com/ +always-auth=true +legacy-peer-deps=true diff --git a/ee/apps/platform/next.config.mjs b/ee/apps/platform/next.config.mjs index 290dae632..9c4afa5ef 100644 --- a/ee/apps/platform/next.config.mjs +++ b/ee/apps/platform/next.config.mjs @@ -1,37 +1,76 @@ import { withSentryConfig } from "@sentry/nextjs"; import path from "path"; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); /** @type {import('next').NextConfig} */ const nextConfig = { - reactStrictMode: true, - transpilePackages: [ - "@karrio/core", - "@karrio/hooks", - "@karrio/ui", - "@karrio/lib", - "@karrio/types", - "@karrio/insiders", - "@karrio/console", - ], - sentry: { - disableServerWebpackPlugin: true, - disableClientWebpackPlugin: true, - }, - sassOptions: { - includePaths: [path.join("src", "app", "styles")], - }, + reactStrictMode: true, + transpilePackages: [ + "@karrio/core", + "@karrio/hooks", + "@karrio/ui", + "@karrio/lib", + "@karrio/types", + "@karrio/insiders", + "@karrio/console" + ], + sentry: { + disableServerWebpackPlugin: true, + disableClientWebpackPlugin: true, + }, + sassOptions: { + includePaths: [path.join("src", "app", "styles")], + }, + webpack: (config, { isServer }) => { + config.resolve.fallback = { fs: false, net: false, tls: false }; + config.externals.push("pino-pretty", "encoding"); + + // Add module resolution aliases + // config.resolve.alias = { + // ...config.resolve.alias, + // "@karrio/console": path.resolve(__dirname, "../../platform/packages/console/src") + // }; + + // // Add module directories + // config.resolve.modules = [ + // path.resolve(__dirname, "../../platform/packages"), + // "node_modules", + // ...config.resolve.modules || [] + // ]; + + return config; + }, + experimental: { + swcMinify: false, + esmExternals: true + }, + images: { + unoptimized: true + }, + pageExtensions: ['js', 'jsx', 'ts', 'tsx'], + typescript: { + ignoreBuildErrors: true + }, + eslint: { + ignoreDuringBuilds: true + }, + distDir: '.next', + cleanDistDir: true }; const sentryWebpackPluginOptions = { - // Additional config options for the Sentry Webpack plugin. Keep in mind that - // the following options are set automatically, and overriding them is not - // recommended: - // release, url, org, project, authToken, configFile, stripPrefix, - // urlPrefix, include, ignore - - silent: true, // Suppresses all logs - // For all available options, see: - // https://github.com/getsentry/sentry-webpack-plugin#options. + // Additional config options for the Sentry Webpack plugin. Keep in mind that + // the following options are set automatically, and overriding them is not + // recommended: + // release, url, org, project, authToken, configFile, stripPrefix, + // urlPrefix, include, ignore + + silent: true, // Suppresses all logs + // For all available options, see: + // https://github.com/getsentry/sentry-webpack-plugin#options. }; export default withSentryConfig(nextConfig, sentryWebpackPluginOptions); diff --git a/ee/apps/platform/package.json b/ee/apps/platform/package.json index feae8deac..a2b3e7ff5 100644 --- a/ee/apps/platform/package.json +++ b/ee/apps/platform/package.json @@ -26,4 +26,4 @@ "eslint-config-next": "14.2.8", "tsconfig": "*" } -} +} \ No newline at end of file diff --git a/ee/apps/platform/scripts/build.sh b/ee/apps/platform/scripts/build.sh new file mode 100644 index 000000000..fd82478c0 --- /dev/null +++ b/ee/apps/platform/scripts/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -e # Exit on error +set -x # Print commands for debugging + +# Configure git to use HTTPS instead of SSH +git config --global url."https://${GIT_CREDENTIALS}@github.com/".insteadOf "git@github.com:" +git config --global url."https://${GIT_CREDENTIALS}@github.com/karrioapi/".insteadOf "git@github.com:karrioapi/" + +# Configure npm for GitHub packages +echo "//npm.pkg.github.com/:_authToken=${GIT_CREDENTIALS}" >~/.npmrc +echo "@karrio:registry=https://npm.pkg.github.com/" >>~/.npmrc +echo "always-auth=true" >>~/.npmrc +echo "legacy-peer-deps=true" >>~/.npmrc + +# Navigate to root and clean submodules +cd ../../../ +rm -rf ee/insiders ee/platform +git clean -ffdx +git reset --hard HEAD +git submodule deinit -f . +git submodule sync --recursive +git submodule update --init --recursive --force + +# Debug: Print directory structure +echo "Current directory structure:" +ls -la +ls -la ee/platform/packages/console/src/modules/Organizations + +# Install dependencies using workspace resolution +npm install -w @karrio/platform + +# Generate Prisma client +cd ee/platform/packages/console +npx prisma generate + +# Build the platform app using Turbo +cd ../../../apps/platform +export NEXT_TELEMETRY_DISABLED=1 +npm run build --no-cache diff --git a/ee/apps/platform/src/app/(error)/404/page.tsx b/ee/apps/platform/src/app/(error)/404/page.tsx deleted file mode 100644 index 3c139f0f9..000000000 --- a/ee/apps/platform/src/app/(error)/404/page.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from "@karrio/console/modules/Error/404"; diff --git a/ee/apps/platform/src/app/(error)/500/page.tsx b/ee/apps/platform/src/app/(error)/500/page.tsx deleted file mode 100644 index 5770f92f5..000000000 --- a/ee/apps/platform/src/app/(error)/500/page.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from "@karrio/console/modules/Error/500"; diff --git a/ee/apps/platform/src/app/(landing)/layout.tsx b/ee/apps/platform/src/app/(landing)/layout.tsx new file mode 100644 index 000000000..0a96a670a --- /dev/null +++ b/ee/apps/platform/src/app/(landing)/layout.tsx @@ -0,0 +1,17 @@ +'use client'; + +import dynamic from 'next/dynamic'; +import { Suspense } from 'react'; + +const LandingLayout = dynamic(() => import("@karrio/console/layouts/root-layout"), { + ssr: false, + loading: () =>
Loading...
+}); + +export default function Layout({ children }: { children: React.ReactNode }) { + return ( + Loading...}> + {children} + + ); +} diff --git a/ee/apps/platform/src/app/(landing)/page.tsx b/ee/apps/platform/src/app/(landing)/page.tsx index d867c18a3..dcbf5f726 100644 --- a/ee/apps/platform/src/app/(landing)/page.tsx +++ b/ee/apps/platform/src/app/(landing)/page.tsx @@ -1 +1,17 @@ -export { default } from "@karrio/console/modules/Landing"; +'use client'; + +import dynamic from 'next/dynamic'; +import { Suspense } from 'react'; + +const LandingPage = dynamic(() => import("@karrio/console/modules/Landing"), { + ssr: false, + loading: () =>
Loading...
+}); + +export default function Page() { + return ( + Loading...}> + + + ); +} diff --git a/ee/apps/platform/src/app/error.tsx b/ee/apps/platform/src/app/error.tsx index 8d9e34abd..07670071a 100644 --- a/ee/apps/platform/src/app/error.tsx +++ b/ee/apps/platform/src/app/error.tsx @@ -1,2 +1,17 @@ -"use client"; -export { default } from "@karrio/core/components/error"; +"use client"; + +import dynamic from 'next/dynamic'; +import { Suspense } from 'react'; + +const ErrorPage = dynamic(() => import("@karrio/console/modules/Error/500"), { + ssr: false, + loading: () =>
Loading...
+}); + +export default function Error() { + return ( + Loading...}> + + + ); +} diff --git a/ee/apps/platform/src/app/layout.tsx b/ee/apps/platform/src/app/layout.tsx index f5e009d9f..1d3d756ce 100644 --- a/ee/apps/platform/src/app/layout.tsx +++ b/ee/apps/platform/src/app/layout.tsx @@ -1,2 +1,17 @@ import "../styles/globals.css"; -export { default } from "@karrio/console/layouts/root-layout"; +import { Metadata } from "next"; + +export const metadata: Metadata = { + title: "Karrio Platform", + description: "Karrio Platform", +}; + +export default function RootLayout({ children }: { children: React.ReactNode }) { + return ( + + + {children} + + + ); +} diff --git a/ee/apps/platform/src/app/not-found.tsx b/ee/apps/platform/src/app/not-found.tsx index 4e84aaff1..6e8d69685 100644 --- a/ee/apps/platform/src/app/not-found.tsx +++ b/ee/apps/platform/src/app/not-found.tsx @@ -1 +1,17 @@ -export { default } from "@karrio/console/modules/Maintainance"; +'use client'; + +import dynamic from 'next/dynamic'; +import { Suspense } from 'react'; + +const NotFound = dynamic(() => import("@karrio/console/modules/Error/404"), { + ssr: false, + loading: () =>
Loading...
+}); + +export default function Page() { + return ( + Loading...}> + + + ); +} diff --git a/ee/apps/platform/src/app/page.tsx b/ee/apps/platform/src/app/page.tsx index d867c18a3..1fb9eafa5 100644 --- a/ee/apps/platform/src/app/page.tsx +++ b/ee/apps/platform/src/app/page.tsx @@ -1 +1,14 @@ -export { default } from "@karrio/console/modules/Landing"; +import { lazy } from 'react'; + +const LandingPage = lazy(() => import("@karrio/console/modules/Landing")); + +export const dynamic = 'force-dynamic'; +export const revalidate = 0; + +export default function Page() { + return ( +
+ +
+ ); +} diff --git a/ee/apps/platform/vercel.json b/ee/apps/platform/vercel.json new file mode 100644 index 000000000..a72665ad6 --- /dev/null +++ b/ee/apps/platform/vercel.json @@ -0,0 +1,15 @@ +{ + "buildCommand": "chmod +x scripts/build.sh && ./scripts/build.sh", + "outputDirectory": ".next", + "framework": "nextjs", + "git": { + "submodules": true, + "deploymentEnabled": { + "paas-foundation": true + } + }, + "installCommand": "npm install", + "regions": [ + "iad1" + ] +} \ No newline at end of file diff --git a/ee/platform b/ee/platform index 498cfbc2d..d8d27fcbe 160000 --- a/ee/platform +++ b/ee/platform @@ -1 +1 @@ -Subproject commit 498cfbc2d2cefb2d733c3f050380fd78bb5295e9 +Subproject commit d8d27fcbeec098cf7cb8b310b1a9a9fa04dc45d7 diff --git a/package-lock.json b/package-lock.json index 9c6156def..41812ae3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -390,7 +390,7 @@ }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", - "devOptional": true, + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -7132,7 +7132,7 @@ }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.3.0" @@ -7146,7 +7146,7 @@ }, "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { "version": "3.4.3", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -7157,7 +7157,7 @@ }, "node_modules/@eslint-community/regexpp": { "version": "4.10.0", - "devOptional": true, + "dev": true, "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -7184,7 +7184,7 @@ }, "node_modules/@eslint/js": { "version": "8.57.0", - "devOptional": true, + "dev": true, "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -7407,7 +7407,7 @@ }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=12.22" @@ -8810,14 +8810,14 @@ "version": "5.22.0", "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.22.0.tgz", "integrity": "sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==", - "devOptional": true, + "dev": true, "license": "Apache-2.0" }, "node_modules/@prisma/engines": { "version": "5.22.0", "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.22.0.tgz", "integrity": "sha512-UNjfslWhAt06kVL3CjkuYpHAWSO6L4kDCVPegV6itt7nD1kSJavd3vhgAEhjglLJJKEdJ7oIqDJ+yHk6qO8gPA==", - "devOptional": true, + "dev": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { @@ -8831,14 +8831,14 @@ "version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2", "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2.tgz", "integrity": "sha512-2PTmxFR2yHW/eB3uqWtcgRcgAbG1rwG9ZriSvQw+nnb7c4uCr3RAcGMb6/zfE88SKlC1Nj2ziUvc96Z379mHgQ==", - "devOptional": true, + "dev": true, "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { "version": "5.22.0", "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.22.0.tgz", "integrity": "sha512-bkrD/Mc2fSvkQBV5EpoFcZ87AvOgDxbG99488a5cexp5Ccny+UM6MAe/UFkUC0wLYD9+9befNOqGiIJhhq+HbA==", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "dependencies": { "@prisma/debug": "5.22.0", @@ -8850,7 +8850,7 @@ "version": "5.22.0", "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.22.0.tgz", "integrity": "sha512-pHhpQdr1UPFpt+zFfnPazhulaZYCUqeIcPpJViYoq9R+D/yw4fjE+CtnsnKzPYm0ddUbeXUzjGVGIRVgPDCk4Q==", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "dependencies": { "@prisma/debug": "5.22.0" @@ -12944,7 +12944,7 @@ }, "node_modules/@types/react-dom": { "version": "18.3.1", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "@types/react": "*" @@ -13632,6 +13632,7 @@ }, "node_modules/acorn": { "version": "7.4.1", + "dev": true, "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -16950,7 +16951,7 @@ }, "node_modules/deep-is": { "version": "0.1.4", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/deepmerge": { @@ -17308,7 +17309,7 @@ }, "node_modules/doctrine": { "version": "3.0.0", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "dependencies": { "esutils": "^2.0.2" @@ -18475,7 +18476,7 @@ }, "node_modules/eslint": { "version": "8.57.0", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -19554,7 +19555,7 @@ }, "node_modules/eslint/node_modules/@eslint/eslintrc": { "version": "2.1.4", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.12.4", @@ -19576,7 +19577,7 @@ }, "node_modules/eslint/node_modules/@humanwhocodes/config-array": { "version": "0.11.14", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "dependencies": { "@humanwhocodes/object-schema": "^2.0.2", @@ -19589,12 +19590,12 @@ }, "node_modules/eslint/node_modules/@humanwhocodes/object-schema": { "version": "2.0.2", - "devOptional": true, + "dev": true, "license": "BSD-3-Clause" }, "node_modules/eslint/node_modules/acorn": { "version": "8.11.3", - "devOptional": true, + "dev": true, "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -19605,12 +19606,12 @@ }, "node_modules/eslint/node_modules/argparse": { "version": "2.0.1", - "devOptional": true, + "dev": true, "license": "Python-2.0" }, "node_modules/eslint/node_modules/eslint-scope": { "version": "7.2.2", - "devOptional": true, + "dev": true, "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", @@ -19625,7 +19626,7 @@ }, "node_modules/eslint/node_modules/eslint-visitor-keys": { "version": "3.4.3", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -19636,7 +19637,7 @@ }, "node_modules/eslint/node_modules/espree": { "version": "9.6.1", - "devOptional": true, + "dev": true, "license": "BSD-2-Clause", "dependencies": { "acorn": "^8.9.0", @@ -19652,7 +19653,7 @@ }, "node_modules/eslint/node_modules/ignore": { "version": "5.3.0", - "devOptional": true, + "dev": true, "license": "MIT", "engines": { "node": ">= 4" @@ -19660,7 +19661,7 @@ }, "node_modules/eslint/node_modules/js-yaml": { "version": "4.1.0", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -19703,7 +19704,7 @@ }, "node_modules/esquery": { "version": "1.5.0", - "devOptional": true, + "dev": true, "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" @@ -20082,7 +20083,7 @@ }, "node_modules/fast-levenshtein": { "version": "2.0.6", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/fast-redact": { @@ -20177,7 +20178,7 @@ }, "node_modules/file-entry-cache": { "version": "6.0.1", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "flat-cache": "^3.0.4" @@ -20358,7 +20359,7 @@ }, "node_modules/flat-cache": { "version": "3.2.0", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "flatted": "^3.2.9", @@ -20371,7 +20372,7 @@ }, "node_modules/flatted": { "version": "3.2.9", - "devOptional": true, + "dev": true, "license": "ISC" }, "node_modules/follow-redirects": { @@ -20996,7 +20997,7 @@ }, "node_modules/globals": { "version": "13.24.0", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "type-fest": "^0.20.2" @@ -21119,7 +21120,7 @@ }, "node_modules/graphemer": { "version": "1.4.0", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/graphiql": { @@ -23314,7 +23315,7 @@ }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/json5": { @@ -23493,7 +23494,7 @@ }, "node_modules/levn": { "version": "0.4.1", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1", @@ -23668,7 +23669,7 @@ }, "node_modules/lodash.merge": { "version": "4.6.2", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/lodash.snakecase": { @@ -26524,7 +26525,7 @@ }, "node_modules/natural-compare": { "version": "1.4.0", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/negotiator": { @@ -27738,7 +27739,7 @@ }, "node_modules/optionator": { "version": "0.9.3", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "@aashutoshrathi/word-wrap": "^1.2.3", @@ -30066,7 +30067,7 @@ }, "node_modules/prelude-ls": { "version": "1.2.1", - "devOptional": true, + "dev": true, "license": "MIT", "engines": { "node": ">= 0.8.0" @@ -30147,7 +30148,7 @@ "version": "5.22.0", "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.22.0.tgz", "integrity": "sha512-vtpjW3XuYCSnMsNVBjLMNkTj6OZbudcPPTPYHqX0CJfpcdWciI1dM8uHETwmDxxiqEwCIE6WvXucWUetJgfu/A==", - "devOptional": true, + "dev": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { @@ -35334,7 +35335,7 @@ }, "node_modules/type-check": { "version": "0.4.0", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1" @@ -35345,7 +35346,7 @@ }, "node_modules/type-fest": { "version": "0.20.2", - "devOptional": true, + "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" @@ -35445,6 +35446,7 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -37892,34 +37894,6 @@ "@karrio/tsconfig": "*" } }, - "packages/trpc/node_modules/@tanstack/query-core": { - "version": "5.62.15", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.62.15.tgz", - "integrity": "sha512-wT20X14CxcWY8YLJ/1pnsXn/y1Q2uRJZYWW93PWRtZt+3/JlGZyiyTcO4pGnqycnP7CokCROAyatsraosqZsDA==", - "license": "MIT", - "peer": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" - } - }, - "packages/trpc/node_modules/@tanstack/react-query": { - "version": "5.62.15", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.62.15.tgz", - "integrity": "sha512-Ny3xxsOWmEQCFyHiV3CF7t6+QAV+LpBEREiXyllKR4+tStyd8smOAa98ZHmEx0ZNy36M31K8enifB5wTSYAKJw==", - "license": "MIT", - "peer": true, - "dependencies": { - "@tanstack/query-core": "5.62.15" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" - }, - "peerDependencies": { - "react": "^18 || ^19" - } - }, "packages/trpc/node_modules/@trpc/next": { "version": "11.0.0-rc.682", "resolved": "https://registry.npmjs.org/@trpc/next/-/next-11.0.0-rc.682.tgz",