Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Migrate to remix v2 route convention (#1367)
Bogdan Chadkin0095f47fbcab
diff --git a/apps/builder/app/routes/index.tsx b/apps/builder/app/routes/_index.tsxsimilarity index 100%rename from apps/builder/app/routes/index.tsxrename to apps/builder/app/routes/_index.tsxdiff --git a/apps/builder/app/routes/auth/dev.tsx b/apps/builder/app/routes/auth.dev.tsxsimilarity index 100%rename from apps/builder/app/routes/auth/dev.tsxrename to apps/builder/app/routes/auth.dev.tsxdiff --git a/apps/builder/app/routes/auth/github/callback.tsx b/apps/builder/app/routes/auth.github.callback.tsxsimilarity index 100%rename from apps/builder/app/routes/auth/github/callback.tsxrename to apps/builder/app/routes/auth.github.callback.tsxdiff --git a/apps/builder/app/routes/auth/github.tsx b/apps/builder/app/routes/auth.github.tsxsimilarity index 100%rename from apps/builder/app/routes/auth/github.tsxrename to apps/builder/app/routes/auth.github.tsxdiff --git a/apps/builder/app/routes/auth/google/callback.tsx b/apps/builder/app/routes/auth.google.callback.tsxsimilarity index 100%rename from apps/builder/app/routes/auth/google/callback.tsxrename to apps/builder/app/routes/auth.google.callback.tsxdiff --git a/apps/builder/app/routes/auth/google.tsx b/apps/builder/app/routes/auth.google.tsxsimilarity index 100%rename from apps/builder/app/routes/auth/google.tsxrename to apps/builder/app/routes/auth.google.tsxdiff --git a/apps/builder/app/routes/builder/$projectId.tsx b/apps/builder/app/routes/builder.$projectId.tsxsimilarity index 100%rename from apps/builder/app/routes/builder/$projectId.tsxrename to apps/builder/app/routes/builder.$projectId.tsxindex 2c6a10800b..642ddb8b7f 100644--- a/apps/builder/app/routes/builder/$projectId.tsx+++ b/apps/builder/app/routes/builder.$projectId.tsx@@ -4,12 +4,12 @@ import type { LoaderArgs } from "@remix-run/node";import { loadBuildByProjectId } from "@webstudio-is/project-build/server";import { db } from "@webstudio-is/project/server";import { authorizeProject } from "@webstudio-is/trpc-interface/server";+import { loadByProject } from "@webstudio-is/asset-uploader/server";import { createContext } from "~/shared/context.server";import { ErrorMessage } from "~/shared/error";import { sentryException } from "~/shared/sentry";import { getBuildOrigin } from "~/shared/router-utils";import { type BuilderProps, Builder, links } from "~/builder";-import { loadByProject } from "@webstudio-is/asset-uploader/server";export { links };diff --git a/apps/builder/app/routes/dashboard/index.tsx b/apps/builder/app/routes/dashboard._index.tsxsimilarity index 99%rename from apps/builder/app/routes/dashboard/index.tsxrename to apps/builder/app/routes/dashboard._index.tsxindex 4411dae675..b47e4eb487 100644--- a/apps/builder/app/routes/dashboard/index.tsx+++ b/apps/builder/app/routes/dashboard._index.tsx@@ -1,14 +1,15 @@+import type { ComponentProps } from "react";import { useLoaderData, useRouteError } from "@remix-run/react";import type { LoaderArgs } from "@remix-run/node";import { redirect } from "@remix-run/node";+import { dashboardProjectRouter } from "@webstudio-is/dashboard/server";import { Dashboard } from "~/dashboard";import { findAuthenticatedUser } from "~/services/auth.server";import { loginPath } from "~/shared/router-utils";-import type { ComponentProps } from "react";import { sentryException } from "~/shared/sentry";import { ErrorMessage } from "~/shared/error";-import { dashboardProjectRouter } from "@webstudio-is/dashboard/server";import { createContext } from "~/shared/context.server";+export { links } from "~/dashboard";export const loader = async ({diff --git a/apps/builder/app/routes/dashboard/projects.$method.ts b/apps/builder/app/routes/dashboard.projects.$method.tssimilarity index 100%rename from apps/builder/app/routes/dashboard/projects.$method.tsrename to apps/builder/app/routes/dashboard.projects.$method.tsdiff --git a/apps/builder/app/routes/login/index.tsx b/apps/builder/app/routes/login._index.tsxsimilarity index 100%rename from apps/builder/app/routes/login/index.tsxrename to apps/builder/app/routes/login._index.tsxindex e5578062a1..a8de799daf 100644--- a/apps/builder/app/routes/login/index.tsx+++ b/apps/builder/app/routes/login._index.tsx@@ -1,17 +1,17 @@+import type { ComponentProps } from "react";import {type LoaderArgs,type TypedResponse,redirect,json,} from "@remix-run/node";+import { useLoaderData } from "@remix-run/react";import { findAuthenticatedUser } from "~/services/auth.server";import env from "~/env/env.server";import { Login, links } from "~/auth";import { useLoginErrorMessage } from "~/shared/session";import { dashboardPath } from "~/shared/router-utils";import { returnToCookie } from "~/services/cookie.server";-import { useLoaderData } from "@remix-run/react";-import type { ComponentProps } from "react";export { links };diff --git a/apps/builder/app/routes/rest/assets.$projectId.tsx b/apps/builder/app/routes/rest.assets.$projectId.tsxsimilarity index 100%rename from apps/builder/app/routes/rest/assets.$projectId.tsxrename to apps/builder/app/routes/rest.assets.$projectId.tsxindex 02916ab909..5a1475258b 100644--- a/apps/builder/app/routes/rest/assets.$projectId.tsx+++ b/apps/builder/app/routes/rest.assets.$projectId.tsx@@ -1,3 +1,4 @@+import { useEffect } from "react";import type { ActionArgs, LoaderArgs } from "@remix-run/node";import { useActionData } from "@remix-run/react";import type { Asset } from "@webstudio-is/asset-uploader";@@ -6,7 +7,6 @@ import {loadByProject,} from "@webstudio-is/asset-uploader/server";import { toast } from "@webstudio-is/design-system";-import { useEffect } from "react";import type { ActionData } from "~/builder/shared/assets";import { sentryException } from "~/shared/sentry";import { createContext } from "~/shared/context.server";diff --git a/apps/builder/app/routes/rest/authorization-token.$method.ts b/apps/builder/app/routes/rest.authorization-token.$method.tssimilarity index 100%rename from apps/builder/app/routes/rest/authorization-token.$method.tsrename to apps/builder/app/routes/rest.authorization-token.$method.tsdiff --git a/apps/builder/app/routes/rest/patch.ts b/apps/builder/app/routes/rest.patch.tssimilarity index 100%rename from apps/builder/app/routes/rest/patch.tsrename to apps/builder/app/routes/rest.patch.tsdiff --git a/apps/builder/app/routes/rest/project.$projectId.tsx b/apps/builder/app/routes/rest.project.$projectId.tsxsimilarity index 100%rename from apps/builder/app/routes/rest/project.$projectId.tsxrename to apps/builder/app/routes/rest.project.$projectId.tsxdiff --git a/apps/builder/app/routes/rest/project/clone.$domain.ts b/apps/builder/app/routes/rest.project.clone.$domain.tssimilarity index 100%rename from apps/builder/app/routes/rest/project/clone.$domain.tsrename to apps/builder/app/routes/rest.project.clone.$domain.tsindex dc38bb7212..5c6b50e1df 100644--- a/apps/builder/app/routes/rest/project/clone.$domain.ts+++ b/apps/builder/app/routes/rest.project.clone.$domain.ts@@ -1,9 +1,9 @@import { redirect, type LoaderArgs } from "@remix-run/node";import { db as projectDb } from "@webstudio-is/project/server";import type { Project } from "@webstudio-is/project";+import type { AppContext } from "@webstudio-is/trpc-interface/server";import { findAuthenticatedUser } from "~/services/auth.server";import { builderPath, loginPath } from "~/shared/router-utils";-import type { AppContext } from "@webstudio-is/trpc-interface/server";import { createContext } from "~/shared/context.server";const ensureProject = async (diff --git a/apps/builder/app/routes/rest/publish.ts b/apps/builder/app/routes/rest.publish.tssimilarity index 100%rename from apps/builder/app/routes/rest/publish.tsrename to apps/builder/app/routes/rest.publish.tsdiff --git a/apps/builder/app/routes/rest/theme.$setting.ts b/apps/builder/app/routes/rest.theme.$setting.tssimilarity index 100%rename from apps/builder/app/routes/rest/theme.$setting.tsrename to apps/builder/app/routes/rest.theme.$setting.tsdiff --git a/apps/builder/app/routes/s/css.ts b/apps/builder/app/routes/s.css.tssimilarity index 100%rename from apps/builder/app/routes/s/css.tsrename to apps/builder/app/routes/s.css.tsindex f20353066a..147fb911ee 100644--- a/apps/builder/app/routes/s/css.ts+++ b/apps/builder/app/routes/s.css.ts@@ -1,12 +1,12 @@import { type ActionArgs, json } from "@remix-run/node";import { generateCssText } from "@webstudio-is/react-sdk";import { db } from "@webstudio-is/project/server";+import { createCssEngine } from "@webstudio-is/css-engine";import env from "~/env/env.public.server";import { getBuildParams } from "~/shared/router-utils";import { sentryException } from "~/shared/sentry";import { createContext } from "~/shared/context.server";import { loadCanvasData } from "~/shared/db";-import { createCssEngine } from "@webstudio-is/css-engine";import { helperStyles } from "~/canvas/shared/styles";export const loader = async ({ request }: ActionArgs) => {diff --git a/apps/builder/remix.config.js b/apps/builder/remix.config.jsindex 9b0a0a1017..c256712498 100644--- a/apps/builder/remix.config.js+++ b/apps/builder/remix.config.js@@ -35,5 +35,6 @@ module.exports = {future: {v2_errorBoundary: true,+ v2_routeConvention: true,},};diff --git a/packages/eslint-config-custom/index.js b/packages/eslint-config-custom/index.jsindex 7ef259e684..8c27b88e94 100644--- a/packages/eslint-config-custom/index.js+++ b/packages/eslint-config-custom/index.js@@ -32,14 +32,7 @@ module.exports = {"no-unused-vars": "off","@typescript-eslint/no-unused-vars": "off","func-style": ["error", "expression", { allowArrowFunctions: true }],- "unicorn/filename-case": [- "error",- {- case: "kebabCase",- // Remix routes need to contain $variable in the file name- ignore: ["\\$"],- },- ],+ "unicorn/filename-case": ["error", { case: "kebabCase" }],curly: 2,eqeqeq: ["error", "always", { null: "ignore" }],camelcase: [2, { properties: "never" }],@@ -57,4 +50,12 @@ module.exports = {},],},+ overrides: [+ {+ files: ["**/app/routes/**/*.{ts,tsx}"],+ rules: {+ "unicorn/filename-case": "off",+ },+ },+ ],};