diff --git a/.dockerignore b/.dockerignore index 6a89b14..ef39094 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,6 @@ target/ web/node_modules web/dist -webnext/node_modules -webnext/dist .volumes/ .github/ docs/ diff --git a/.github/workflows/lint-web.yml b/.github/workflows/lint-web.yml index d03a049..9066cab 100644 --- a/.github/workflows/lint-web.yml +++ b/.github/workflows/lint-web.yml @@ -32,16 +32,16 @@ jobs: with: node-version: 24 - name: install deps - working-directory: ./webnext + working-directory: ./web run: | npm i -g pnpm pnpm i --frozen-lockfile - name: Build translations - working-directory: ./webnext + working-directory: ./web run: pnpm dlx @inlang/paraglide-js compile --project ./project.inlang --outdir ./src/paraglide - name: Lint - working-directory: ./webnext + working-directory: ./web run: pnpm lint - name: Audit - working-directory: ./webnext + working-directory: ./web run: pnpm audit --prod diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index daff50b..69770ab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -122,15 +122,15 @@ jobs: with: node-version: 24 cache: "pnpm" - cache-dependency-path: ./webnext/pnpm-lock.yaml + cache-dependency-path: ./web/pnpm-lock.yaml - name: Install frontend dependencies run: pnpm install --ignore-scripts --frozen-lockfile - working-directory: webnext + working-directory: web - name: Build frontend run: pnpm build - working-directory: webnext + working-directory: web - name: Build release binary uses: actions-rs/cargo@v1 diff --git a/.gitmodules b/.gitmodules index 0fb6816..5617041 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "web/src/shared/defguard-ui"] path = web/src/shared/defguard-ui url = git@github.com:DefGuard/ui.git -[submodule "webnext/src/shared/defguard-ui"] - path = webnext/src/shared/defguard-ui - url = git@github.com:DefGuard/ui.git diff --git a/Dockerfile b/Dockerfile index fd2dab7..ac05b0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ FROM node:24-alpine AS web WORKDIR /app -COPY webnext/package.json webnext/pnpm-lock.yaml ./ +COPY web/package.json web/pnpm-lock.yaml ./ RUN npm i -g pnpm RUN pnpm install --ignore-scripts --frozen-lockfile -COPY webnext/ . +COPY web/ . RUN pnpm build FROM rust:1 AS chef @@ -28,7 +28,7 @@ COPY --from=planner /build/recipe.json recipe.json RUN cargo chef cook --release --recipe-path recipe.json # build project -COPY --from=web /app/dist ./webnext/dist +COPY --from=web /app/dist ./web/dist RUN apt-get update && apt-get -y install protobuf-compiler libprotobuf-dev COPY Cargo.toml Cargo.lock build.rs ./ # for vergen diff --git a/README.md b/README.md index 7e93dad..49d52c8 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ cargo run To run webapp dev server: ```bash -cd webnext/ +cd web/ pnpm install pnpm run dev ``` diff --git a/src/assets.rs b/src/assets.rs index aef1571..b229dfd 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -16,7 +16,7 @@ pub async fn index() -> impl IntoResponse { } #[derive(Embed)] -#[folder = "webnext/"] +#[folder = "web/"] #[include = "dist/*"] struct WebAsset; diff --git a/web/.editorconfig b/web/.editorconfig index e24ee12..73f4103 100644 --- a/web/.editorconfig +++ b/web/.editorconfig @@ -7,22 +7,5 @@ insert_final_newline = true indent_style = space indent_size = 2 -[*.{ts,tsx}] -indent_style = space -indent_size = 2 +[*.{ts,tsx,js,jsx,scss,html,json,yaml}] rulers = 90 - -[*.{scss}] -indent_style = space -indent_size = 2 -rulers = 90 - -[*.{html}] -indent_style = space -indent_size = 2 -rulers = 90 - -[*.{json,yaml}] -indent_style = space -indent_size = 2 -rulers = 80 diff --git a/web/.env.template b/web/.env.template new file mode 100644 index 0000000..5b9b47d --- /dev/null +++ b/web/.env.template @@ -0,0 +1,2 @@ +VITE_UPDATE_BASE_URL="/update/api" +UPDATE_TARGET_URL="" diff --git a/webnext/.gitattributes b/web/.gitattributes similarity index 100% rename from webnext/.gitattributes rename to web/.gitattributes diff --git a/web/.gitignore b/web/.gitignore index 402e11d..b3ee71f 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -8,11 +8,11 @@ pnpm-debug.log* lerna-debug.log* node_modules -./node_modules -./node_modules/* dist dist-ssr *.local +project.inlang/cache +.env.development # Editor directories and files .vscode/* @@ -24,3 +24,4 @@ dist-ssr *.njsproj *.sln *.sw? +.tanstack diff --git a/web/.npmrc b/web/.npmrc deleted file mode 100644 index fa4e095..0000000 --- a/web/.npmrc +++ /dev/null @@ -1 +0,0 @@ -strict-peer-dependencies=false \ No newline at end of file diff --git a/web/.nvmrc b/web/.nvmrc deleted file mode 100644 index 19f23bc..0000000 --- a/web/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v24.4 diff --git a/web/.prettierignore b/web/.prettierignore index 13a3107..74dbecd 100644 --- a/web/.prettierignore +++ b/web/.prettierignore @@ -1,2 +1,4 @@ /src/i18n/*.ts /src/i18n/*.tsx +/src/**/*.tsx +/src/**/*.ts diff --git a/web/.prettierrc b/web/.prettierrc index 9a50f22..71a0f32 100644 --- a/web/.prettierrc +++ b/web/.prettierrc @@ -3,5 +3,6 @@ "tabWidth": 2, "singleQuote": true, "useTabs": false, - "printWidth": 90 + "printWidth": 90, + "endOfLine": "lf" } diff --git a/webnext/.stylelintrc.json b/web/.stylelintrc.json similarity index 100% rename from webnext/.stylelintrc.json rename to web/.stylelintrc.json diff --git a/web/.typesafe-i18n.json b/web/.typesafe-i18n.json deleted file mode 100644 index dd9526a..0000000 --- a/web/.typesafe-i18n.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "adapter": "react", - "$schema": "https://unpkg.com/typesafe-i18n@5.26.2/schema/typesafe-i18n.json" -} diff --git a/webnext/.vscode/extensions.json b/web/.vscode/extensions.json similarity index 100% rename from webnext/.vscode/extensions.json rename to web/.vscode/extensions.json diff --git a/web/README.md b/web/README.md deleted file mode 100644 index 2a528fa..0000000 --- a/web/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Defguard client frontend - -## Development - -### Install pnpm -```bash -npm i -g pnpm -``` -### Install dependencies -```bash -pnpm install -``` -### Start dev server -```bash -pnpm dev -``` - -## Building -### After installing deps -```bash -pnpm build -``` diff --git a/web/biome.json b/web/biome.json index 920639d..b583f36 100644 --- a/web/biome.json +++ b/web/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.2.2/schema.json", + "$schema": "https://biomejs.dev/schemas/2.2.4/schema.json", "vcs": { "enabled": false, "clientKind": "git", @@ -9,90 +9,53 @@ "ignoreUnknown": false, "includes": [ "src/**", - "!src/i18n/*.ts", - "!src/i18n/*.tsx", - "!src/i18n/i18n-util", - "!dist" + "!src/messages", + "!src/paraglide/**/*.js", + "!src/routeTree.gen.ts" ] }, "formatter": { "enabled": true, "formatWithErrors": false, - "indentStyle": "space", - "indentWidth": 2, - "lineEnding": "lf", - "lineWidth": 90, "attributePosition": "auto", "bracketSameLine": false, "bracketSpacing": true, "expand": "auto", - "useEditorconfig": true, - "includes": ["./src/**"] + "lineEnding": "lf", + "lineWidth": 90, + "indentStyle": "space", + "useEditorconfig": true }, "linter": { "enabled": true, "rules": { "recommended": true, "a11y": "off", - "complexity": { - "noBannedTypes": "error", - "noUselessTypeConstraint": "error" - }, "correctness": { - "noChildrenProp": "error", - "noPrecisionLoss": "error", - "noUnusedVariables": "error", - "useExhaustiveDependencies": "error", - "useHookAtTopLevel": "error", - "useJsxKeyInIterable": "error", "useUniqueElementIds": "off" }, - "security": { - "noDangerouslySetInnerHtmlWithChildren": "error" - }, "style": { - "noNamespace": "error", - "noNonNullAssertion": "error", - "useArrayLiterals": "error", - "useAsConstAssertion": "error", - "useBlockStatements": "off", - "useLiteralEnumMembers": "off" + "useLiteralEnumMembers": "off", + "useBlockStatements": "off" }, "suspicious": { - "noCommentText": "error", - "noDuplicateJsxProps": "error", - "noExplicitAny": "error", - "noExtraNonNullAssertion": "error", - "noMisleadingInstantiator": "error", - "noUnsafeDeclarationMerging": "error", "noArrayIndexKey": "off" } - }, - "includes": ["src/**"] + } }, "javascript": { "formatter": { + "quoteStyle": "single", "jsxQuoteStyle": "double", "quoteProperties": "asNeeded", "trailingCommas": "all", "semicolons": "always", "arrowParentheses": "always", - "bracketSameLine": false, - "quoteStyle": "single", "attributePosition": "auto", + "bracketSameLine": false, "bracketSpacing": true } }, - "html": { - "formatter": { - "selfCloseVoidElements": "always" - } - }, - "overrides": [ - { - "includes": ["**/*.js"] - } - ], "assist": { "enabled": true, "actions": { diff --git a/web/index.html b/web/index.html index 2f94d84..e2df960 100644 --- a/web/index.html +++ b/web/index.html @@ -4,15 +4,80 @@
-