Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

Vercel deploy (#17)

Brad Barbin5292661ce9e5
diff --git a/.env.example b/.env.example
index 8f9ddb0456..79e3eab06d 100644
--- a/.env.example
+++ b/.env.example
@@ -3,4 +3,4 @@ SESSION_SECRET="super-duper-s3cret"
SUPABASE_ANON_PUBLIC="************"
SUPABASE_SERVICE_ROLE="***********"
SUPABASE_API_URL="http://localhost:54321"
-SERVER_URL="http://localhost:3000"
\ No newline at end of file
+VERCEL_URL="http://localhost:3000"
\ No newline at end of file
diff --git a/.github/actions/setup-monorepo/action.yml b/.github/actions/dependencies/action.yml
similarity index 100%
rename from .github/actions/setup-monorepo/action.yml
rename to .github/actions/dependencies/action.yml
diff --git a/.github/workflows/deploy.yml b/.github/workflows/supabase-prod.yml
similarity index 93%
rename from .github/workflows/deploy.yml
rename to .github/workflows/supabase-prod.yml
index 74d55129c6..564df58b63 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/supabase-prod.yml
@@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@v3
- name: 📦 Install dependencies
- uses: ./.github/actions/setup-monorepo
+ uses: ./.github/actions/dependencies
- name: 🚀 Sync local database with supabase remote
run: yarn deploy
diff --git a/apps/carbon/app/config/env.ts b/apps/carbon/app/config/env.ts
index 40b92f073a..c7ec72a899 100644
--- a/apps/carbon/app/config/env.ts
+++ b/apps/carbon/app/config/env.ts
@@ -14,7 +14,7 @@ declare global {
interface ProcessEnv {
SUPABASE_URL: string;
SUPABASE_SERVICE_ROLE: string;
- SERVER_URL: string;
+ VERCEL_URL: string;
SUPABASE_ANON_PUBLIC: string;
SESSION_SECRET: string;
SESSION_KEY: string;
@@ -50,7 +50,7 @@ function getEnv(
/**
* Server env
*/
-export const SERVER_URL = getEnv("SERVER_URL");
+export const VERCEL_URL = getEnv("VERCEL_URL");
export const SUPABASE_SERVICE_ROLE = getEnv("SUPABASE_SERVICE_ROLE");
export const SESSION_SECRET = getEnv("SESSION_SECRET");
export const SESSION_KEY = "authenticated";
@@ -76,3 +76,7 @@ export function getBrowserEnv() {
SUPABASE_ANON_PUBLIC,
};
}
+
+export function isVercel() {
+ return VERCEL_URL.includes("vercel.app");
+}
diff --git a/apps/carbon/app/lib/bullmq/bullmq.server.ts b/apps/carbon/app/lib/bullmq/bullmq.server.ts
index 2410f64869..f31889c2a7 100644
--- a/apps/carbon/app/lib/bullmq/bullmq.server.ts
+++ b/apps/carbon/app/lib/bullmq/bullmq.server.ts
@@ -1,6 +1,7 @@
import { redis } from "@carbon/redis";
import type { Processor } from "bullmq";
import { Queue as BullQueue, Worker } from "bullmq";
+import { isVercel } from "~/config/env";
type RegisteredQueue = {
queue: BullQueue;
@@ -14,10 +15,16 @@ declare global {
const registeredQueues =
global.__registeredQueues || (global.__registeredQueues = {});
+const mockQueue = {
+ add: (args: any) => Promise.resolve(),
+ addBulk: (args: any) => Promise.resolve(),
+};
+
export const Queue = <Payload>(
name: string,
handler: Processor<Payload>
): BullQueue<Payload> => {
+ if (isVercel()) return mockQueue as any;
if (registeredQueues[name]) {
return registeredQueues[name].queue;
}
diff --git a/apps/carbon/app/queues/resend-invites.queue.server.ts b/apps/carbon/app/queues/resend-invites.queue.server.ts
index ed8af6880f..3cb1761f68 100644
--- a/apps/carbon/app/queues/resend-invites.queue.server.ts
+++ b/apps/carbon/app/queues/resend-invites.queue.server.ts
@@ -1,3 +1,4 @@
+import { isVercel } from "~/config/env";
import { Queue } from "~/lib/bullmq";
import { getSupabaseServiceRole } from "~/lib/supabase";
import { resendInvite } from "~/services/users";
@@ -8,9 +9,7 @@ export type ResendInvitesQueueData = {
const client = getSupabaseServiceRole();
-export const resendInvitesQueue = Queue<ResendInvitesQueueData>(
- "resendInvites:v1",
- async (job) => {
- await resendInvite(client, job.data.id);
- }
-);
+export const resendInvitesQueue = isVercel();
+Queue<ResendInvitesQueueData>("resendInvites:v1", async (job) => {
+ await resendInvite(client, job.data.id);
+});
diff --git a/apps/carbon/app/routes/_public.tsx b/apps/carbon/app/routes/_public+/_layout.tsx
similarity index 100%
rename from apps/carbon/app/routes/_public.tsx
rename to apps/carbon/app/routes/_public+/_layout.tsx
diff --git a/apps/carbon/app/routes/x.tsx b/apps/carbon/app/routes/x+/_layout.tsx
similarity index 100%
rename from apps/carbon/app/routes/x.tsx
rename to apps/carbon/app/routes/x+/_layout.tsx
diff --git a/apps/carbon/app/routes/x+/account.$userId.attribute.tsx b/apps/carbon/app/routes/x+/account+/$userId.attribute.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/account.$userId.attribute.tsx
rename to apps/carbon/app/routes/x+/account+/$userId.attribute.tsx
diff --git a/apps/carbon/app/routes/x+/account.$userId.delete.attribute.tsx b/apps/carbon/app/routes/x+/account+/$userId.delete.attribute.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/account.$userId.delete.attribute.tsx
rename to apps/carbon/app/routes/x+/account+/$userId.delete.attribute.tsx
diff --git a/apps/carbon/app/routes/x+/account.tsx b/apps/carbon/app/routes/x+/account+/_layout.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/account.tsx
rename to apps/carbon/app/routes/x+/account+/_layout.tsx
diff --git a/apps/carbon/app/routes/x+/account.index.tsx b/apps/carbon/app/routes/x+/account+/index.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/account.index.tsx
rename to apps/carbon/app/routes/x+/account+/index.tsx
diff --git a/apps/carbon/app/routes/x+/account.password.tsx b/apps/carbon/app/routes/x+/account+/password.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/account.password.tsx
rename to apps/carbon/app/routes/x+/account+/password.tsx
diff --git a/apps/carbon/app/routes/x+/account.personal.tsx b/apps/carbon/app/routes/x+/account+/personal.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/account.personal.tsx
rename to apps/carbon/app/routes/x+/account+/personal.tsx
diff --git a/apps/carbon/app/routes/x+/account.profile.tsx b/apps/carbon/app/routes/x+/account+/profile.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/account.profile.tsx
rename to apps/carbon/app/routes/x+/account+/profile.tsx
diff --git a/apps/carbon/app/routes/x+/account.notifications.tsx b/apps/carbon/app/routes/x+/account.notifications.tsx
deleted file mode 100644
index a55ba233d5..0000000000
--- a/apps/carbon/app/routes/x+/account.notifications.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function AccountNotifications() {
- return <p>Profile</p>;
-}
diff --git a/apps/carbon/app/routes/x+/account.security.tsx b/apps/carbon/app/routes/x+/account.security.tsx
deleted file mode 100644
index 29e6066521..0000000000
--- a/apps/carbon/app/routes/x+/account.security.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function AccountSecurity() {
- return <p>Security</p>;
-}
diff --git a/apps/carbon/app/routes/x+/account.settings.tsx b/apps/carbon/app/routes/x+/account.settings.tsx
deleted file mode 100644
index 5a1040ee4c..0000000000
--- a/apps/carbon/app/routes/x+/account.settings.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function AccountSettings() {
- return <p>Settings</p>;
-}
diff --git a/apps/carbon/app/routes/x+/parts.tsx b/apps/carbon/app/routes/x+/parts+/index.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/parts.tsx
rename to apps/carbon/app/routes/x+/parts+/index.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.tsx b/apps/carbon/app/routes/x+/purchasing+/_layout.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.tsx
rename to apps/carbon/app/routes/x+/purchasing+/_layout.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.index.tsx b/apps/carbon/app/routes/x+/purchasing+/index.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.index.tsx
rename to apps/carbon/app/routes/x+/purchasing+/index.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.supplier-types.$supplierTypeId.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.supplier-types.$supplierTypeId.tsx
rename to apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.supplier-types.delete.$supplierTypeId.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.delete.$supplierTypeId.tsx
similarity index 89%
rename from apps/carbon/app/routes/x+/purchasing.supplier-types.delete.$supplierTypeId.tsx
rename to apps/carbon/app/routes/x+/purchasing+/supplier-types.delete.$supplierTypeId.tsx
index 30125e971c..3482046980 100644
--- a/apps/carbon/app/routes/x+/purchasing.supplier-types.delete.$supplierTypeId.tsx
+++ b/apps/carbon/app/routes/x+/purchasing+/supplier-types.delete.$supplierTypeId.tsx
@@ -27,7 +27,7 @@ export async function loader({ request, params }: LoaderArgs) {
);
}
- return json(supplierType);
+ return json({ supplierType: supplierType.data });
}
export async function action({ request, params }: ActionArgs) {
@@ -65,17 +65,17 @@ export async function action({ request, params }: ActionArgs) {
export default function DeleteSupplierTypeRoute() {
const { supplierTypeId } = useParams();
- const { data } = useLoaderData<typeof loader>();
+ const { supplierType } = useLoaderData<typeof loader>();
const navigate = useNavigate();
- if (!supplierTypeId || !data) return null; // TODO - handle this better (404?)
+ if (!supplierTypeId || !supplierType) return null; // TODO - handle this better (404?)
const onCancel = () => navigate("/x/purchasing/supplier-types");
return (
<ConfirmDelete
action={`/x/purchasing/supplier-types/delete/${supplierTypeId}`}
- name={data.name}
- text={`Are you sure you want to delete the supplier type: ${data.name}? This cannot be undone.`}
+ name={supplierType.name}
+ text={`Are you sure you want to delete the supplier type: ${supplierType.name}? This cannot be undone.`}
onCancel={onCancel}
/>
);
diff --git a/apps/carbon/app/routes/x+/purchasing.supplier-types.new.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.supplier-types.new.tsx
rename to apps/carbon/app/routes/x+/purchasing+/supplier-types.new.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.supplier-types.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.supplier-types.tsx
rename to apps/carbon/app/routes/x+/purchasing+/supplier-types.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.contact.$supplierContactId.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.contact.$supplierContactId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.contact.$supplierContactId.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.contact.$supplierContactId.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.contact.delete.$supplierContactId.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.contact.delete.$supplierContactId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.contact.delete.$supplierContactId.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.contact.delete.$supplierContactId.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.contact.new.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.contact.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.contact.new.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.contact.new.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.location.$supplierLocationId.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.location.$supplierLocationId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.location.$supplierLocationId.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.location.$supplierLocationId.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.location.delete.$supplierLocationId.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.location.delete.$supplierLocationId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.location.delete.$supplierLocationId.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.location.delete.$supplierLocationId.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.location.new.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.location.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.location.new.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.location.new.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.$supplierId.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.$supplierId.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.new.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.new.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.new.tsx
diff --git a/apps/carbon/app/routes/x+/purchasing.suppliers.tsx b/apps/carbon/app/routes/x+/purchasing+/suppliers.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/purchasing.suppliers.tsx
rename to apps/carbon/app/routes/x+/purchasing+/suppliers.tsx
diff --git a/apps/carbon/app/routes/x+/resources.tsx b/apps/carbon/app/routes/x+/resources+/_layout.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.tsx
rename to apps/carbon/app/routes/x+/resources+/_layout.tsx
diff --git a/apps/carbon/app/routes/x+/resources.abilities.delete.$abilityId.tsx b/apps/carbon/app/routes/x+/resources+/abilities.delete.$abilityId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.abilities.delete.$abilityId.tsx
rename to apps/carbon/app/routes/x+/resources+/abilities.delete.$abilityId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.abilities.new.tsx b/apps/carbon/app/routes/x+/resources+/abilities.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.abilities.new.tsx
rename to apps/carbon/app/routes/x+/resources+/abilities.new.tsx
diff --git a/apps/carbon/app/routes/x+/resources.abilities.tsx b/apps/carbon/app/routes/x+/resources+/abilities.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.abilities.tsx
rename to apps/carbon/app/routes/x+/resources+/abilities.tsx
diff --git a/apps/carbon/app/routes/x+/resources.ability.$abilityId.employee.$id.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.ability.$abilityId.employee.$id.tsx
rename to apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx
diff --git a/apps/carbon/app/routes/x+/resources.ability.$abilityId.employee.delete.$id.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.delete.$id.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.ability.$abilityId.employee.delete.$id.tsx
rename to apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.delete.$id.tsx
diff --git a/apps/carbon/app/routes/x+/resources.ability.$abilityId.employee.new.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.ability.$abilityId.employee.new.tsx
rename to apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.new.tsx
diff --git a/apps/carbon/app/routes/x+/resources.ability.$abilityId.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.ability.$abilityId.tsx
rename to apps/carbon/app/routes/x+/resources+/ability.$abilityId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attribute.$attributeId.tsx b/apps/carbon/app/routes/x+/resources+/attribute.$attributeId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attribute.$attributeId.tsx
rename to apps/carbon/app/routes/x+/resources+/attribute.$attributeId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attribute.delete.$attributeId.tsx b/apps/carbon/app/routes/x+/resources+/attribute.delete.$attributeId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attribute.delete.$attributeId.tsx
rename to apps/carbon/app/routes/x+/resources+/attribute.delete.$attributeId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attribute.new.tsx b/apps/carbon/app/routes/x+/resources+/attribute.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attribute.new.tsx
rename to apps/carbon/app/routes/x+/resources+/attribute.new.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attributes.$categoryId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attributes.$categoryId.tsx
rename to apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attributes.delete.$categoryId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.delete.$categoryId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attributes.delete.$categoryId.tsx
rename to apps/carbon/app/routes/x+/resources+/attributes.delete.$categoryId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attributes.list.$categoryId.$attributeId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attributes.list.$categoryId.$attributeId.tsx
rename to apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attributes.list.$categoryId.new.tsx b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attributes.list.$categoryId.new.tsx
rename to apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.new.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attributes.list.$categoryId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attributes.list.$categoryId.tsx
rename to apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attributes.new.tsx b/apps/carbon/app/routes/x+/resources+/attributes.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attributes.new.tsx
rename to apps/carbon/app/routes/x+/resources+/attributes.new.tsx
diff --git a/apps/carbon/app/routes/x+/resources.attributes.tsx b/apps/carbon/app/routes/x+/resources+/attributes.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.attributes.tsx
rename to apps/carbon/app/routes/x+/resources+/attributes.tsx
diff --git a/apps/carbon/app/routes/x+/resources.index.tsx b/apps/carbon/app/routes/x+/resources+/index.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.index.tsx
rename to apps/carbon/app/routes/x+/resources+/index.tsx
diff --git a/apps/carbon/app/routes/x+/resources.locations.$locationId.tsx b/apps/carbon/app/routes/x+/resources+/locations.$locationId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.locations.$locationId.tsx
rename to apps/carbon/app/routes/x+/resources+/locations.$locationId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.locations.delete.$locationId.tsx b/apps/carbon/app/routes/x+/resources+/locations.delete.$locationId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.locations.delete.$locationId.tsx
rename to apps/carbon/app/routes/x+/resources+/locations.delete.$locationId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.locations.new.tsx b/apps/carbon/app/routes/x+/resources+/locations.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.locations.new.tsx
rename to apps/carbon/app/routes/x+/resources+/locations.new.tsx
diff --git a/apps/carbon/app/routes/x+/resources.locations.tsx b/apps/carbon/app/routes/x+/resources+/locations.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.locations.tsx
rename to apps/carbon/app/routes/x+/resources+/locations.tsx
diff --git a/apps/carbon/app/routes/x+/resources.people.tsx b/apps/carbon/app/routes/x+/resources+/people.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.people.tsx
rename to apps/carbon/app/routes/x+/resources+/people.tsx
diff --git a/apps/carbon/app/routes/x+/resources.person.$personId.notes.delete.$noteId.tsx b/apps/carbon/app/routes/x+/resources+/person.$personId.notes.delete.$noteId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.person.$personId.notes.delete.$noteId.tsx
rename to apps/carbon/app/routes/x+/resources+/person.$personId.notes.delete.$noteId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.person.$personId.notes.new.tsx b/apps/carbon/app/routes/x+/resources+/person.$personId.notes.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.person.$personId.notes.new.tsx
rename to apps/carbon/app/routes/x+/resources+/person.$personId.notes.new.tsx
diff --git a/apps/carbon/app/routes/x+/resources.person.$personId.tsx b/apps/carbon/app/routes/x+/resources+/person.$personId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.person.$personId.tsx
rename to apps/carbon/app/routes/x+/resources+/person.$personId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.shifts.$shiftId.tsx b/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.shifts.$shiftId.tsx
rename to apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.shifts.delete.$shiftId.tsx b/apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.shifts.delete.$shiftId.tsx
rename to apps/carbon/app/routes/x+/resources+/shifts.delete.$shiftId.tsx
diff --git a/apps/carbon/app/routes/x+/resources.shifts.new.tsx b/apps/carbon/app/routes/x+/resources+/shifts.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.shifts.new.tsx
rename to apps/carbon/app/routes/x+/resources+/shifts.new.tsx
diff --git a/apps/carbon/app/routes/x+/resources.shifts.tsx b/apps/carbon/app/routes/x+/resources+/shifts.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/resources.shifts.tsx
rename to apps/carbon/app/routes/x+/resources+/shifts.tsx
diff --git a/apps/carbon/app/routes/x+/sales.tsx b/apps/carbon/app/routes/x+/sales+/_layout.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.tsx
rename to apps/carbon/app/routes/x+/sales+/_layout.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customer-types.$customerTypeId.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customer-types.$customerTypeId.tsx
rename to apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customer-types.delete.$customerTypeId.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.delete.$customerTypeId.tsx
similarity index 88%
rename from apps/carbon/app/routes/x+/sales.customer-types.delete.$customerTypeId.tsx
rename to apps/carbon/app/routes/x+/sales+/customer-types.delete.$customerTypeId.tsx
index f142ba3add..22165e99c1 100644
--- a/apps/carbon/app/routes/x+/sales.customer-types.delete.$customerTypeId.tsx
+++ b/apps/carbon/app/routes/x+/sales+/customer-types.delete.$customerTypeId.tsx
@@ -26,7 +26,7 @@ export async function loader({ request, params }: LoaderArgs) {
);
}
- return json(customerType);
+ return json({ customerType: customerType.data });
}
export async function action({ request, params }: ActionArgs) {
@@ -64,18 +64,18 @@ export async function action({ request, params }: ActionArgs) {
export default function DeleteCustomerTypeRoute() {
const { customerTypeId } = useParams();
- const { data } = useLoaderData<typeof loader>();
+ const { customerType } = useLoaderData<typeof loader>();
const navigate = useNavigate();
- if (!customerTypeId || !data) return null; // TODO - handle this better (404?)
+ if (!customerTypeId || !customerType) return null; // TODO - handle this better (404?)
const onCancel = () => navigate("/x/sales/customer-types");
return (
<ConfirmDelete
action={`/x/sales/customer-types/delete/${customerTypeId}`}
- name={data.name}
- text={`Are you sure you want to delete the customer type: ${data.name}? This cannot be undone.`}
+ name={customerType.name}
+ text={`Are you sure you want to delete the customer type: ${customerType.name}? This cannot be undone.`}
onCancel={onCancel}
/>
);
diff --git a/apps/carbon/app/routes/x+/sales.customer-types.new.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customer-types.new.tsx
rename to apps/carbon/app/routes/x+/sales+/customer-types.new.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customer-types.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customer-types.tsx
rename to apps/carbon/app/routes/x+/sales+/customer-types.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.$customerId.contact.$customerContactId.tsx b/apps/carbon/app/routes/x+/sales+/customers.$customerId.contact.$customerContactId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.$customerId.contact.$customerContactId.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.$customerId.contact.$customerContactId.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.$customerId.contact.delete.$customerContactId.tsx b/apps/carbon/app/routes/x+/sales+/customers.$customerId.contact.delete.$customerContactId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.$customerId.contact.delete.$customerContactId.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.$customerId.contact.delete.$customerContactId.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.$customerId.contact.new.tsx b/apps/carbon/app/routes/x+/sales+/customers.$customerId.contact.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.$customerId.contact.new.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.$customerId.contact.new.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.$customerId.location.$customerLocationId.tsx b/apps/carbon/app/routes/x+/sales+/customers.$customerId.location.$customerLocationId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.$customerId.location.$customerLocationId.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.$customerId.location.$customerLocationId.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.$customerId.location.delete.$customerLocationId.tsx b/apps/carbon/app/routes/x+/sales+/customers.$customerId.location.delete.$customerLocationId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.$customerId.location.delete.$customerLocationId.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.$customerId.location.delete.$customerLocationId.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.$customerId.location.new.tsx b/apps/carbon/app/routes/x+/sales+/customers.$customerId.location.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.$customerId.location.new.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.$customerId.location.new.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.$customerId.tsx b/apps/carbon/app/routes/x+/sales+/customers.$customerId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.$customerId.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.$customerId.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.new.tsx b/apps/carbon/app/routes/x+/sales+/customers.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.new.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.new.tsx
diff --git a/apps/carbon/app/routes/x+/sales.customers.tsx b/apps/carbon/app/routes/x+/sales+/customers.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.customers.tsx
rename to apps/carbon/app/routes/x+/sales+/customers.tsx
diff --git a/apps/carbon/app/routes/x+/sales.index.tsx b/apps/carbon/app/routes/x+/sales+/index.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/sales.index.tsx
rename to apps/carbon/app/routes/x+/sales+/index.tsx
diff --git a/apps/carbon/app/routes/x+/users.tsx b/apps/carbon/app/routes/x+/users+/_layout.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.tsx
rename to apps/carbon/app/routes/x+/users+/_layout.tsx
diff --git a/apps/carbon/app/routes/x+/users.bulk-edit-permissions.tsx b/apps/carbon/app/routes/x+/users+/bulk-edit-permissions.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.bulk-edit-permissions.tsx
rename to apps/carbon/app/routes/x+/users+/bulk-edit-permissions.tsx
diff --git a/apps/carbon/app/routes/x+/users.customers.new.tsx b/apps/carbon/app/routes/x+/users+/customers.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.customers.new.tsx
rename to apps/carbon/app/routes/x+/users+/customers.new.tsx
diff --git a/apps/carbon/app/routes/x+/users.customers.tsx b/apps/carbon/app/routes/x+/users+/customers.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.customers.tsx
rename to apps/carbon/app/routes/x+/users+/customers.tsx
diff --git a/apps/carbon/app/routes/x+/users.deactivate.tsx b/apps/carbon/app/routes/x+/users+/deactivate.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.deactivate.tsx
rename to apps/carbon/app/routes/x+/users+/deactivate.tsx
diff --git a/apps/carbon/app/routes/x+/users.employee-types.$employeeTypeId.tsx b/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.employee-types.$employeeTypeId.tsx
rename to apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx
diff --git a/apps/carbon/app/routes/x+/users.employee-types.delete.$employeeTypeId.tsx b/apps/carbon/app/routes/x+/users+/employee-types.delete.$employeeTypeId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.employee-types.delete.$employeeTypeId.tsx
rename to apps/carbon/app/routes/x+/users+/employee-types.delete.$employeeTypeId.tsx
diff --git a/apps/carbon/app/routes/x+/users.employee-types.new.tsx b/apps/carbon/app/routes/x+/users+/employee-types.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.employee-types.new.tsx
rename to apps/carbon/app/routes/x+/users+/employee-types.new.tsx
diff --git a/apps/carbon/app/routes/x+/users.employee-types.tsx b/apps/carbon/app/routes/x+/users+/employee-types.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.employee-types.tsx
rename to apps/carbon/app/routes/x+/users+/employee-types.tsx
diff --git a/apps/carbon/app/routes/x+/users.employees.$employeeId.tsx b/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.employees.$employeeId.tsx
rename to apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx
diff --git a/apps/carbon/app/routes/x+/users.employees.new.tsx b/apps/carbon/app/routes/x+/users+/employees.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.employees.new.tsx
rename to apps/carbon/app/routes/x+/users+/employees.new.tsx
diff --git a/apps/carbon/app/routes/x+/users.employees.tsx b/apps/carbon/app/routes/x+/users+/employees.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.employees.tsx
rename to apps/carbon/app/routes/x+/users+/employees.tsx
diff --git a/apps/carbon/app/routes/x+/users.groups.$groupId.tsx b/apps/carbon/app/routes/x+/users+/groups.$groupId.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.groups.$groupId.tsx
rename to apps/carbon/app/routes/x+/users+/groups.$groupId.tsx
diff --git a/apps/carbon/app/routes/x+/users.groups.delete.$groupId.tsx b/apps/carbon/app/routes/x+/users+/groups.delete.$groupId.tsx
similarity index 87%
rename from apps/carbon/app/routes/x+/users.groups.delete.$groupId.tsx
rename to apps/carbon/app/routes/x+/users+/groups.delete.$groupId.tsx
index f1ad912fc9..c9d7eba715 100644
--- a/apps/carbon/app/routes/x+/users.groups.delete.$groupId.tsx
+++ b/apps/carbon/app/routes/x+/users+/groups.delete.$groupId.tsx
@@ -25,7 +25,7 @@ export async function loader({ request, params }: LoaderArgs) {
);
}
- return json(group);
+ return json({ group: group.data });
}
export async function action({ request, params }: ActionArgs) {
@@ -57,18 +57,18 @@ export async function action({ request, params }: ActionArgs) {
export default function DeleteEmployeeTypeRoute() {
const { groupId } = useParams();
- const { data } = useLoaderData<typeof loader>();
+ const { group } = useLoaderData<typeof loader>();
const navigate = useNavigate();
- if (!groupId || !data) return null; // TODO - handle this better (404?)
+ if (!groupId || !group) return null; // TODO - handle this better (404?)
const onCancel = () => navigate("/x/users/groups");
return (
<ConfirmDelete
action={`/x/users/groups/delete/${groupId}`}
- name={data.name}
- text={`Are you sure you want to delete the group: ${data.name}? This cannot be undone.`}
+ name={group.name}
+ text={`Are you sure you want to delete the group: ${group.name}? This cannot be undone.`}
onCancel={onCancel}
/>
);
diff --git a/apps/carbon/app/routes/x+/users.groups.new.tsx b/apps/carbon/app/routes/x+/users+/groups.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.groups.new.tsx
rename to apps/carbon/app/routes/x+/users+/groups.new.tsx
diff --git a/apps/carbon/app/routes/x+/users.groups.tsx b/apps/carbon/app/routes/x+/users+/groups.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.groups.tsx
rename to apps/carbon/app/routes/x+/users+/groups.tsx
diff --git a/apps/carbon/app/routes/x+/users.index.tsx b/apps/carbon/app/routes/x+/users+/index.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.index.tsx
rename to apps/carbon/app/routes/x+/users+/index.tsx
diff --git a/apps/carbon/app/routes/x+/users.resend-invite.tsx b/apps/carbon/app/routes/x+/users+/resend-invite.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.resend-invite.tsx
rename to apps/carbon/app/routes/x+/users+/resend-invite.tsx
diff --git a/apps/carbon/app/routes/x+/users.suppliers.new.tsx b/apps/carbon/app/routes/x+/users+/suppliers.new.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.suppliers.new.tsx
rename to apps/carbon/app/routes/x+/users+/suppliers.new.tsx
diff --git a/apps/carbon/app/routes/x+/users.suppliers.tsx b/apps/carbon/app/routes/x+/users+/suppliers.tsx
similarity index 100%
rename from apps/carbon/app/routes/x+/users.suppliers.tsx
rename to apps/carbon/app/routes/x+/users+/suppliers.tsx
diff --git a/apps/carbon/app/services/auth/auth.server.ts b/apps/carbon/app/services/auth/auth.server.ts
index 60d329a970..b86ecd49bb 100644
--- a/apps/carbon/app/services/auth/auth.server.ts
+++ b/apps/carbon/app/services/auth/auth.server.ts
@@ -4,7 +4,7 @@ import type {
AuthSession as SupabaseAuthSession,
SupabaseClient,
} from "@supabase/supabase-js";
-import { SERVER_URL } from "~/config/env";
+import { VERCEL_URL } from "~/config/env";
import { REFRESH_ACCESS_TOKEN_THRESHOLD } from "~/config/env";
import { getSupabase, getSupabaseServiceRole } from "~/lib/supabase";
import { requireAuthSession, flash } from "~/services/session";
@@ -145,7 +145,7 @@ export async function sendInviteByEmail(
data?: Record<string, unknown>
) {
return getSupabaseServiceRole().auth.admin.inviteUserByEmail(email, {
- redirectTo: `${SERVER_URL}/callback`,
+ redirectTo: `${VERCEL_URL}/callback`,
data,
});
}
@@ -154,7 +154,7 @@ export async function sendMagicLink(email: string) {
return getSupabaseServiceRole().auth.signInWithOtp({
email,
options: {
- emailRedirectTo: `${SERVER_URL}/callback`,
+ emailRedirectTo: `${VERCEL_URL}/callback`,
},
});
}
diff --git a/apps/carbon/package.json b/apps/carbon/package.json
index bc4aca6a4a..346ad4768f 100644
--- a/apps/carbon/package.json
+++ b/apps/carbon/package.json
@@ -14,6 +14,7 @@
"@carbon/database": "*",
"@carbon/logger": "*",
"@carbon/react": "*",
+ "@carbon/redis": "*",
"@carbon/utils": "*",
"@chakra-ui/react": "^2.5.1",
"@chakra-ui/skip-nav": "^2.0.13",
diff --git a/apps/carbon/remix.config.js b/apps/carbon/remix.config.js
index 4a4f6736de..279c2f6c8f 100644
--- a/apps/carbon/remix.config.js
+++ b/apps/carbon/remix.config.js
@@ -1,5 +1,14 @@
+const path = require("node:path");
const { flatRoutes } = require("remix-flat-routes");
-const { getDependenciesToBundle } = require("@remix-run/dev");
+const glob = require("glob");
+
+const packages = glob
+ .sync("packages/**/package.json", {
+ cwd: path.join(__dirname, "..", ".."),
+ ignore: ["**/node_modules/**"],
+ absolute: true,
+ })
+ .map((pkg) => path.dirname(pkg));
module.exports = {
serverBuildTarget: "vercel",
@@ -11,9 +20,7 @@ module.exports = {
assetsBuildDirectory: "public/build",
routes: async (defineRoutes) => {
return flatRoutes("routes", defineRoutes, {
- basePath: "/", // optional base path (defaults to /)
- paramPrefixChar: "$", // optional specify param prefix
- ignoredRouteFiles: [], // same as remix config
+ appDir: path.resolve(__dirname, "app"),
});
},
serverDependenciesToBundle: [
@@ -22,12 +29,5 @@ module.exports = {
"@carbon/react",
"@carbon/utils",
],
- watchPaths: async () => {
- return [
- "../../packages/carbon-react/src/**/*",
- "../../packages/carbon-database/src/**/*",
- "../../packages/carbon-logger/src/**/*",
- "../../packages/carbon-utils/src/**/*",
- ];
- },
+ watchPaths: packages,
};
diff --git a/packages/carbon-database/package.json b/packages/carbon-database/package.json
index 0a69d755e2..5165518426 100644
--- a/packages/carbon-database/package.json
+++ b/packages/carbon-database/package.json
@@ -1,5 +1,5 @@
{
- "version": "1.0.0",
+ "version": "0.0.1",
"name": "@carbon/database",
"private": true,
"license": "MIT",
diff --git a/packages/carbon-database/src/seed/admin.ts b/packages/carbon-database/src/seed/admin.ts
index f7234e89f1..57061e0b3f 100644
--- a/packages/carbon-database/src/seed/admin.ts
+++ b/packages/carbon-database/src/seed/admin.ts
@@ -1,7 +1,7 @@
import { possibleFeatures } from "./features";
const admin = {
- email: "[email protected]",
+ email: "[email protected]",
password: "carbon",
firstName: "Carbon",
lastName: "Admin",
diff --git a/turbo.json b/turbo.json
index 90ed35ddae..b44608ac01 100644
--- a/turbo.json
+++ b/turbo.json
@@ -5,6 +5,10 @@
"outputs": ["dist/**", "build/**", "api/**", "public/build/**"],
"dependsOn": ["^build"]
},
+ "carbon#build": {
+ "dependsOn": ["^build"],
+ "outputs": ["api/index.js", "api/build/**", "public/build/**"]
+ },
"test": {
"outputs": ["coverage/**"],
"dependsOn": []