Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend)!: Add frontend folder inside packages #376

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 1 addition & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,4 @@ DB_DATABASE=vitnode

# ! Frontend
# NEXT_PUBLIC_GRAPHQL_URL=http://backend:8080
NEXT_PUBLIC_BACKEND_URL=http://localhost:8080


# ! Debug
# NEXT_PUBLIC_DEBUG=true
NEXT_PUBLIC_BACKEND_URL=http://localhost:8080
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
.env
docker
.turbo
tsconfig.tsbuildinfo
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lucide",
"nestjs",
"nextra",
"nprogress",
"sonner",
"Streamable",
"tailwindcss",
Expand Down
8 changes: 1 addition & 7 deletions backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,5 @@
"env": {
"node": true
},
"ignorePatterns": [
".eslintrc.json",
"node_modules",
"uploads",
"dist",
".turbo"
]
"ignorePatterns": ["uploads"]
}
31 changes: 15 additions & 16 deletions backend/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,23 @@ const config: CodegenConfig = {
join(process.cwd(), "..", "frontend", "plugins/**/graphql/**/*.gql")
],
generates: {
[`${join(process.cwd(), "..", "frontend", "utils", "graphql", "hooks.ts")}`]:
{
plugins: [
"typescript",
"typescript-operations",
"typescript-document-nodes"
],
config: {
scalars: {
DateTime: "Date"
},
enumsAsConst: true,
allowEnumStringTypes: true,
namingConvention: {
enumValues: "change-case-all#lowerCase"
}
[`${join(process.cwd(), "..", "frontend", "graphql", "hooks.ts")}`]: {
plugins: [
"typescript",
"typescript-operations",
"typescript-document-nodes"
],
config: {
scalars: {
DateTime: "Date"
},
enumsAsConst: true,
allowEnumStringTypes: true,
namingConvention: {
enumValues: "change-case-all#lowerCase"
}
}
}
}
};

Expand Down
9 changes: 4 additions & 5 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
"graphql": "^16.8.1",
"nodemailer": "^6.9.13",
"react": "^18.3.1",
"reflect-metadata": "^0.1.14",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"sharp": "^0.33.4",
"tar": "^7.2.0",
"ua-parser-js": "^1.0.38"
"ua-parser-js": "^2.0.0-beta.3"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.2",
Expand All @@ -53,7 +53,7 @@
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@swc/cli": "^0.3.12",
"@swc/core": "^1.5.25",
"@swc/core": "^1.5.28",
"@types/bcrypt": "^5.0.2",
"@types/busboy": "^1.5.4",
"@types/cookie-parser": "^1.4.7",
Expand All @@ -72,14 +72,13 @@
"cookie-parser": "^1.4.6",
"cross-env": "^7.0.3",
"dotenv": "^16.4.5",
"drizzle-kit": "^0.22.5",
"drizzle-kit": "^0.22.7",
"drizzle-orm": "^0.31.2",
"eslint": "^8.57.0",
"eslint-config-vitnode": "workspace:*",
"http-errors": "^2.0.0",
"object-path": "^0.11.8",
"pg": "^8.12.0",
"prettier": "^3.3.1",
"react-email": "^2.1.4",
"source-map-support": "^0.5.21",
"ts-loader": "^9.5.1",
Expand Down
2 changes: 1 addition & 1 deletion backend/src/functions/get-user-agent-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import UAParser from "ua-parser-js";
import { UAParser } from "ua-parser-js";

export const getUserAgentData = (userAgent: string) => {
const user_parser = new UAParser(userAgent).getResult();
Expand Down
18 changes: 0 additions & 18 deletions backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,6 @@ async function bootstrap() {
);

await app.listen(process.env.PORT ?? "8080", null, () => {
if (process.env.NEXT_PUBLIC_DEBUG) {
console.warn(
"WARNING: Debug mode is enabled. Do not use this in production."
);
console.log(
"DEBUG ENV: NEXT_PUBLIC_FRONTEND_URL -",
process.env.NEXT_PUBLIC_FRONTEND_URL
);
console.log("DEBUG ENV: DB_HOST -", process.env.DB_HOST);
console.log("DEBUG ENV: DB_PORT -", process.env.DB_PORT);
console.log("DEBUG ENV: DB_PASSWORD -", process.env.DB_PASSWORD);
console.log("DEBUG ENV: DB_DATABASE -", process.env.DB_DATABASE);
console.log(
"DEBUG ENV: LOGIN_TOKEN_SECRET -",
process.env.LOGIN_TOKEN_SECRET
);
}

console.log(
`Application is running on: http://localhost:${process.env.PORT ?? 8080}/graphql`
);
Expand Down
2 changes: 1 addition & 1 deletion backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"sourceMap": true,
"noImplicitAny": false,
"strictNullChecks": false,
"forceConsistentCasingInFileNames": false,
"forceConsistentCasingInFileNames": false, // TODO: Improve this value
"noFallthroughCasesInSwitch": false,
"strictPropertyInitialization": false,
"paths": {
Expand Down
6 changes: 0 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,11 @@ services:
context: .
dockerfile: ./frontend/Dockerfile
args:
- NEXT_PUBLIC_DEBUG=${NEXT_PUBLIC_DEBUG:-false}
- NEXT_PUBLIC_GRAPHQL_URL=${NEXT_PUBLIC_GRAPHQL_URL:-http://backend:8080}
- NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL:-http://localhost:8080}
- NEXT_PUBLIC_FRONTEND_URL=${NEXT_PUBLIC_FRONTEND_URL:-http://localhost:3000}
restart: unless-stopped
command: sh -c "cd frontend && pnpm start:prod"
# environment:
# - NEXT_PUBLIC_DEBUG=${NEXT_PUBLIC_DEBUG:-false}
# - NEXT_PUBLIC_GRAPHQL_URL=${NEXT_PUBLIC_GRAPHQL_URL:-http://backend:8080}
# - NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL:-http://localhost:8080}
# - NEXT_PUBLIC_FRONTEND_URL=${NEXT_PUBLIC_FRONTEND_URL:-http://localhost:3000}
ports:
- "3000:3000"
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion frontend/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/utils/graphql/hooks.ts
/graphql/hooks.ts

# next-pwa
/public/precache.*.*.js
Expand Down
4 changes: 0 additions & 4 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ ARG NEXT_PUBLIC_BACKEND_URL
ENV NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL}
ARG NEXT_PUBLIC_FRONTEND_URL
ENV NEXT_PUBLIC_FRONTEND_URL=${NEXT_PUBLIC_FRONTEND_URL}
ARG NEXT_PUBLIC_DEBUG
ENV NEXT_PUBLIC_DEBUG=${NEXT_PUBLIC_DEBUG}
ENV NEXT_TELEMETRY_DISABLED 1

RUN pnpm turbo build --filter=frontend...
Expand All @@ -57,12 +55,10 @@ WORKDIR /app
# # https://nextjs.org/docs/advanced-features/output-file-tracing
# COPY --from=installer --chown=nextjs:nodejs /app/frontend/.next/standalone ./
# COPY --from=installer --chown=nextjs:nodejs /app/frontend/.next/static ./frontend/.next/static
# COPY --from=installer --chown=nextjs:nodejs /app/frontend/public ./frontend/public
# COPY --from=installer --chown=nextjs:nodejs /app/frontend/config/config.json ./frontend/config/config.json

COPY --from=installer /app/frontend/.next/standalone ./
COPY --from=installer /app/frontend/.next/static ./frontend/.next/static
COPY --from=installer /app/frontend/public ./frontend/public
COPY --from=installer /app/frontend/config/config.json ./frontend/config.json

EXPOSE 3000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Metadata } from "next";
import { getTranslations } from "next-intl/server";

import { CategoriesBlogAdminView } from "@/plugins/blog/admin/views/categories/categories-view";
import { fetcher } from "@/utils/graphql/fetcher";
import { fetcher } from "@/graphql/fetcher";
import {
Admin_Blog_Categories__Show,
Admin_Blog_Categories__ShowQuery,
Admin_Blog_Categories__ShowQueryVariables
} from "@/utils/graphql/hooks";
} from "@/graphql/hooks";
import { Card, CardContent, CardHeader } from "@/components/ui/card";
import { HeaderContent } from "@/components/header-content/header-content";
import { CreateCategoryBlogAdmin } from "@/plugins/blog/admin/views/categories/actions/create";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
ShowCoreFilesSortingColumnEnum,
Admin__Core_Files__ShowQuery,
Admin__Core_Files__ShowQueryVariables
} from "@/utils/graphql/hooks";
} from "@/graphql/hooks";
import {
usePaginationAPISsr,
SearchParamsPagination
} from "@/plugins/core/hooks/utils/use-pagination-api-ssr";
import { fetcher } from "@/utils/graphql/fetcher";
import { fetcher } from "@/graphql/fetcher";
import { FilesAdvancedCoreAdminView } from "@/plugins/admin/views/core/advanced/files/files-advanced-core-adminpview";

const getData = async (variables: Admin__Core_Files__ShowQueryVariables) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import {
ShowCoreLanguagesSortingColumnEnum,
Core_Languages__ShowQuery,
Core_Languages__ShowQueryVariables
} from "@/utils/graphql/hooks";
} from "@/graphql/hooks";
import {
usePaginationAPISsr,
SearchParamsPagination
} from "@/plugins/core/hooks/utils/use-pagination-api-ssr";
import { HeaderContent } from "@/components/header-content/header-content";
import { Card } from "@/components/ui/card";
import { fetcher } from "@/utils/graphql/fetcher";
import { fetcher } from "@/graphql/fetcher";
import { ActionsLangsAdmin } from "@/plugins/admin/views/core/langs/actions/actions";
import { RebuildRequiredAdmin } from "@/plugins/admin/global/rebuild-required";
import { LangsCoreAdminView } from "@/plugins/admin/views/core/langs/langs-core-admin-view";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Metadata } from "next";
import { getTranslations } from "next-intl/server";
import { cn } from "@vitnode/frontend/helpers";

import { cn } from "@/functions/classnames";
import {
Admin__Core_Plugins__Files,
Admin__Core_Plugins__FilesQuery,
Admin__Core_Plugins__FilesQueryVariables
} from "@/utils/graphql/hooks";
import { fetcher } from "@/utils/graphql/fetcher";
} from "@/graphql/hooks";
import { fetcher } from "@/graphql/fetcher";

interface Props {
params: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Metadata } from "next";
import { getTranslations } from "next-intl/server";
import { flattenTree } from "@vitnode/frontend/helpers";

import { HeaderContent } from "@/components/header-content/header-content";
import {
Admin__Core_Plugins__Nav__Show,
Admin__Core_Plugins__Nav__ShowQuery,
Admin__Core_Plugins__Nav__ShowQueryVariables,
ShowAdminNavPluginsObj
} from "@/utils/graphql/hooks";
import { fetcher } from "@/utils/graphql/fetcher";
} from "@/graphql/hooks";
import { fetcher } from "@/graphql/fetcher";
import { NavDevPluginAdminView } from "@/plugins/admin/views/core/plugins/views/dev/nav/nav";
import { CreateNavDevPluginAdmin } from "@/plugins/admin/views/core/plugins/views/dev/nav/actions/create/create";
import { flattenTree } from "@/functions/flatten-tree";
import { Icon } from "@/components/icon/icon";

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
Admin__Core_Plugins__Show__Item,
Admin__Core_Plugins__Show__ItemQuery,
Admin__Core_Plugins__Show__ItemQueryVariables
} from "@/utils/graphql/hooks";
import { fetcher, ErrorType } from "@/utils/graphql/fetcher";
} from "@/graphql/hooks";
import { fetcher, ErrorType } from "@/graphql/fetcher";
import { AdminCoreApiTags } from "@/plugins/admin/api-tags";

export const getPluginDataAdmin = async (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import {
ShowAdminPluginsSortingColumnEnum,
Admin__Core_Plugins__ShowQuery,
Admin__Core_Plugins__ShowQueryVariables
} from "@/utils/graphql/hooks";
} from "@/graphql/hooks";
import {
usePaginationAPISsr,
SearchParamsPagination
} from "@/plugins/core/hooks/utils/use-pagination-api-ssr";
import { HeaderContent } from "@/components/header-content/header-content";
import { Card } from "@/components/ui/card";
import { fetcher } from "@/utils/graphql/fetcher";
import { fetcher } from "@/graphql/fetcher";
import { RebuildRequiredAdmin } from "@/plugins/admin/global/rebuild-required";
import { ActionsPluginsAdmin } from "@/plugins/admin/views/core/plugins/actions/actions";
import { PluginsCoreAdminView } from "@/plugins/admin/views/core/plugins/plugins-admin-view";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { getTranslations } from "next-intl/server";
import { HeaderContent } from "@/components/header-content/header-content";
import { Card } from "@/components/ui/card";
import { EmailSettingsAdminView } from "@/plugins/admin/views/core/settings/email/email-settings-admin-view";
import { fetcher } from "@/utils/graphql/fetcher";
import { fetcher } from "@/graphql/fetcher";
import {
Admin__Core_Email_Settings__Show,
Admin__Core_Email_Settings__ShowQuery,
Admin__Core_Email_Settings__ShowQueryVariables
} from "@/utils/graphql/hooks";
} from "@/graphql/hooks";
import { ActionsEmailSettingsAdmin } from "@/plugins/admin/views/core/settings/email/actions/actions";

const getData = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Core_Main_Settings__Show,
Core_Main_Settings__ShowQuery,
Core_Main_Settings__ShowQueryVariables
} from "@/utils/graphql/hooks";
import { fetcher } from "@/utils/graphql/fetcher";
} from "@/graphql/hooks";
import { fetcher } from "@/graphql/fetcher";
import { GeneralSettingsCoreAdmin } from "@/plugins/admin/views/core/settings/general/main-settings-core-admin";

const getData = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Admin__Core_Manifest_Metadata__Show,
Admin__Core_Manifest_Metadata__ShowQuery,
Admin__Core_Manifest_Metadata__ShowQueryVariables
} from "@/utils/graphql/hooks";
import { fetcher } from "@/utils/graphql/fetcher";
} from "@/graphql/hooks";
import { fetcher } from "@/graphql/fetcher";
import { ManifestMetadataCoreAdminView } from "@/plugins/admin/views/core/settings/metadata/manifest/manifest-metadata-core-view";

const getData = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
Admin__Core_Nav__Show,
Admin__Core_Nav__ShowQuery,
Admin__Core_Nav__ShowQueryVariables
} from "@/utils/graphql/hooks";
import { fetcher } from "@/utils/graphql/fetcher";
} from "@/graphql/hooks";
import { fetcher } from "@/graphql/fetcher";
import { NavAdminView } from "@/plugins/admin/views/core/styles/nav/nav-admin-view";

const getData = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {
ShowAdminThemesSortingColumnEnum,
Admin_Core_Themes__ShowQuery,
Admin_Core_Themes__ShowQueryVariables
} from "@/utils/graphql/hooks";
} from "@/graphql/hooks";
import {
usePaginationAPISsr,
SearchParamsPagination
} from "@/plugins/core/hooks/utils/use-pagination-api-ssr";
import { fetcher } from "@/utils/graphql/fetcher";
import { fetcher } from "@/graphql/fetcher";
import { ThemesAdminView } from "@/plugins/admin/views/core/styles/themes/themes-admin-view";

interface Props {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { cookies } from "next/headers";

import { fetcher } from "@/utils/graphql/fetcher";
import { fetcher } from "@/graphql/fetcher";
import {
Admin__Sessions__Authorization,
Admin__Sessions__AuthorizationQuery,
Admin__Sessions__AuthorizationQueryVariables
} from "@/utils/graphql/hooks";
} from "@/graphql/hooks";

export const getSessionAdminData = async () => {
const cookieStore = cookies();
Expand Down
Loading
Loading