Skip to content

Commit

Permalink
Merge pull request #544 from VitNode/rebuild_frontend_for_next_15
Browse files Browse the repository at this point in the history
perf!: Update to NextJS 15.0.0-canary.177+ & next-intl 3.21.0-canary
  • Loading branch information
aXenDeveloper authored Oct 5, 2024
2 parents a1c10fc + d6e2de1 commit 1e079c8
Show file tree
Hide file tree
Showing 74 changed files with 2,050 additions and 2,160 deletions.
4 changes: 2 additions & 2 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"@nestjs/schedule": "^4.1.1",
"@nestjs/serve-static": "^4.0.2",
"pg": "^8.13.0",
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-dom": "19.0.0-rc-fb9a90fa48-20240614",
"react": "19.0.0-rc-1460d67c-20241003",
"react-dom": "19.0.0-rc-1460d67c-20241003",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1"
},
Expand Down
13 changes: 9 additions & 4 deletions apps/frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# dependencies
/node_modules
/.pnp
.pnp.js
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage
Expand All @@ -24,12 +29,12 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
# env files (can opt-in for commiting if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
next-env.d.ts
8 changes: 1 addition & 7 deletions apps/frontend/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import type { NextConfig } from 'next';
import VitNodeConfig from 'vitnode-frontend/next.config';

// @ts-ignore
const nextConfig: NextConfig = {
logging: {
fetches: {
fullUrl: process.env.NODE_ENV === 'development',
},
},
};
const nextConfig: NextConfig = {};

export default VitNodeConfig(nextConfig);
8 changes: 4 additions & 4 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"dependencies": {
"geist": "^1.3.1",
"lucide-react": "^0.446.0",
"next": "15.0.0-canary.158",
"next-intl": "^3.20.0",
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-dom": "19.0.0-rc-fb9a90fa48-20240614",
"next": "15.0.0-canary.179",
"next-intl": "3.21.0-canary.0",
"react": "19.0.0-rc-1460d67c-20241003",
"react-dom": "19.0.0-rc-1460d67c-20241003",
"react-hook-form": "^7.53.0",
"sonner": "^1.5.0",
"vitnode-frontend": "workspace:*",
Expand Down
30 changes: 30 additions & 0 deletions apps/frontend/src/app/[locale]/(main)/(layout)/(vitnode)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
// ! If you remove this then default page plugin will not work
import React from 'react';
import { TranslationsProvider } from 'vitnode-frontend/components/translations-provider';
import { getSessionData } from 'vitnode-frontend/graphql/get-session-data';
import { generateMetadataDefaultPage } from 'vitnode-frontend/views/theme/views/default-page';

export const generateMetadata = generateMetadataDefaultPage;

export default async function Page() {
const {
core_sessions__authorization: { plugin_default },
} = await getSessionData();

const PageFromTheme = React.lazy(async () =>
import(`@/plugins/${plugin_default}/templates/default-page`).then(
module => ({
default: module.default,
}),
),
);

return (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
<TranslationsProvider namespaces={`${plugin_default}.home`}>
<PageFromTheme />
</TranslationsProvider>
);
}
9 changes: 9 additions & 0 deletions apps/frontend/src/app/[locale]/(main)/(layout)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ThemeLayout } from 'vitnode-frontend/views/theme/layout/theme-layout';

export default function LocaleLayout({
children,
}: {
children: React.ReactNode;
}) {
return <ThemeLayout>{children}</ThemeLayout>;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import { ErrorView } from 'vitnode-frontend/views/theme/views/error/error-view';

export default function Error() {
return <ErrorView code="500" />;
export default function NotFoundPage() {
return <ErrorView code="404" />;
}
File renamed without changes.
11 changes: 6 additions & 5 deletions apps/frontend/src/app/[locale]/(main)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import { TranslationsProvider } from 'vitnode-frontend/components/translations-provider';
import { AuthLayout } from 'vitnode-frontend/views/layout/auth/auth-layout';
import { ThemeLayout } from 'vitnode-frontend/views/theme/layout/theme-layout';

import './global.css';

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<AuthLayout>
<ThemeLayout>{children}</ThemeLayout>
</AuthLayout>
<TranslationsProvider namespaces={[]}>
<AuthLayout>{children}</AuthLayout>
</TranslationsProvider>
);
}
21 changes: 0 additions & 21 deletions apps/frontend/src/app/[locale]/(main)/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
DevPluginAdminLayout,
DevPluginAdminLayoutProps,
generateMetadataDevPluginAdminLayout,
} from 'vitnode-frontend/admin/core/plugins/views/dev/layout/layout';

export const generateMetadata = generateMetadataDevPluginAdminLayout;

export default function Layout(props: DevPluginAdminLayoutProps) {
export default function Layout(
props: React.ComponentProps<typeof DevPluginAdminLayout>,
) {
return <DevPluginAdminLayout {...props} />;
}
12 changes: 5 additions & 7 deletions apps/frontend/src/app/[locale]/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import React from 'react';
import 'vitnode-frontend/admin/css';
import { TranslationsProvider } from 'vitnode-frontend/components/translations-provider';

export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return children;
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<TranslationsProvider namespaces={[]}>{children}</TranslationsProvider>
);
}
7 changes: 3 additions & 4 deletions apps/frontend/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { GeistSans } from 'geist/font/sans';
import {
generateMetadataRootLayout,
RootLayout,
RootLayoutProps,
} from 'vitnode-frontend/views/layout/root-layout';

import './global.css';

export const generateMetadata = generateMetadataRootLayout;

export default function Layout(props: RootLayoutProps) {
export default function Layout(
props: Omit<React.ComponentProps<typeof RootLayout>, 'className'>,
) {
return <RootLayout className={GeistSans.className} {...props} />;
}
13 changes: 13 additions & 0 deletions apps/frontend/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getRequestConfig } from 'next-intl/server';
import { i18nConfigVitNode } from 'vitnode-frontend/i18n';

export default getRequestConfig(async ({ requestLocale }) => {
const config = await i18nConfigVitNode({
pathsToMessagesFromPlugins: async ({ plugin, locale }) => {
return await import(`./plugins/${plugin}/langs/${locale}.json`);
},
requestLocale,
});

return config;
});
13 changes: 0 additions & 13 deletions apps/frontend/src/i18n/request.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@react-email/render": "^1.0.1",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.7.28",
"ai": "^3.4.0",
"ai": "^3.4.9",
"busboy": "^1.6.0",
"cookie-parser": "^1.4.6",
"helmet": "^8.0.0",
Expand Down Expand Up @@ -109,8 +109,8 @@
"express": "^4.21.0",
"graphql": "^16.9.0",
"pg": "^8.13.0",
"react": "19.0.0-rc-e56f4ae3-20240830",
"react-dom": "19.0.0-rc-e56f4ae3-20240830",
"react": "19.0.0-rc-1460d67c-20241003",
"react-dom": "19.0.0-rc-1460d67c-20241003",
"ts-node": "^10.9.2",
"tsup": "^8.3.0",
"typescript": "^5.6.2"
Expand Down
12 changes: 7 additions & 5 deletions packages/backend/src/core/admin/members/show/show.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ export class ShowAdminMembersService {
const where = id
? eq(core_users.id, id)
: and(
or(
ilike(core_users.name, `%${search}%`),
ilike(core_users.email, `%${search}%`),
Number(search) ? eq(core_users.id, Number(search)) : undefined,
),
search
? or(
ilike(core_users.name, `%${search}%`),
ilike(core_users.email, `%${search}%`),
Number(search) ? eq(core_users.id, Number(search)) : undefined,
)
: undefined,
groups && groups.length > 0
? inArray(core_users.group_id, groups)
: undefined,
Expand Down
14 changes: 7 additions & 7 deletions packages/backend/src/core/sessions/sign_in/sign_in.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export class SignInCoreSessionsService {

const device = await this.deviceService.getDevice({ req, res });

if (device.uagent_os === 'Uagent from tests') {
throw new CustomError({
code: 'INVALID_DEVICE',
message:
'We have detected that you are using an invalid device. Please try again.',
});
}
// if (device.uagent_os === 'Uagent from tests') {
// throw new CustomError({
// code: 'INVALID_DEVICE',
// message:
// 'We have detected that you are using an invalid device. Please try again.',
// });
// }

const login_token = this.jwtService.sign(
{
Expand Down
16 changes: 8 additions & 8 deletions packages/create-vitnode-app/helpers/create-packages-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export const createPackagesJSON = ({
},
overrides: packageManager.startsWith('npm')
? {
react: '^19.0.0-rc.0',
'react-dom': '^19.0.0-rc.0',
react: '19.0.0-rc-1460d67c-20241003',
'react-dom': '19.0.0-rc-1460d67c-20241003',
}
: {},
devDependencies: {
Expand Down Expand Up @@ -89,10 +89,10 @@ export const createPackagesJSON = ({
'@hookform/resolvers': '^3.9.0',
geist: '^1.3.1',
'lucide-react': '^0.446.0',
next: '15.0.0-canary.155',
'next-intl': '^3.20.0',
react: '^19.0.0-rc-d6cb4e77-20240911',
'react-dom': '^19.0.0-rc-d6cb4e77-20240911',
next: '15.0.0-canary.179',
'next-intl': '^3.21.0-canary.0',
react: '19.0.0-rc-1460d67c-20241003',
'react-dom': '19.0.0-rc-1460d67c-20241003',
'react-hook-form': '^7.53.0',
sonner: '^1.5.0',
'vitnode-frontend': `^${pkg.version}`,
Expand Down Expand Up @@ -141,8 +141,8 @@ export const createPackagesJSON = ({
'@react-email/components': '^0.0.25',
'class-transformer': '^0.5.1',
'class-validator': '^0.14.1',
react: '^19.0.0-rc.0',
'react-dom': '^19.0.0-rc.0',
react: '19.0.0-rc-1460d67c-20241003',
'react-dom': '19.0.0-rc-1460d67c-20241003',
'reflect-metadata': '^0.2.2',
'vitnode-backend': `^${pkg.version}`,
},
Expand Down
12 changes: 6 additions & 6 deletions packages/eslint-config-typescript-vitnode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@
},
"devDependencies": {
"@types/eslint__js": "^8.42.3",
"eslint": "^9.11.1",
"eslint": "^9.12.0",
"typescript": "^5.6.2"
},
"dependencies": {
"@eslint/js": "^9.11.1",
"@eslint/js": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-perfectionist": "^3.7.0",
"eslint-plugin-perfectionist": "^3.8.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.0",
"globals": "^15.9.0",
"eslint-plugin-react": "^7.37.1",
"globals": "^15.10.0",
"prettier-plugin-tailwindcss": "^0.6.8",
"typescript-eslint": "^8.7.0"
"typescript-eslint": "^8.8.0"
}
}
2 changes: 1 addition & 1 deletion packages/frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dotenv.config({
path: join(process.cwd(), '..', '..', '.env'),
});

const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts');
const withNextIntl = createNextIntlPlugin('./src/i18n.ts');

const nextConfig = config => {
const ENVS = {
Expand Down
Loading

0 comments on commit 1e079c8

Please sign in to comment.