No staging by default, and project external refs now are prefixed with proj_
This commit is contained in:
@@ -61,7 +61,7 @@ export async function createProject(
|
||||
slug: organizationSlug,
|
||||
},
|
||||
},
|
||||
externalRef: externalRefGenerator(),
|
||||
externalRef: `proj_${externalRefGenerator()}`,
|
||||
version: version === "v3" ? "V3" : "V2",
|
||||
},
|
||||
include: {
|
||||
@@ -75,7 +75,10 @@ export async function createProject(
|
||||
|
||||
// Create the dev and prod environments
|
||||
await createEnvironment(organization, project, "PRODUCTION");
|
||||
await createEnvironment(organization, project, "STAGING");
|
||||
|
||||
if (project.version === "V2") {
|
||||
await createEnvironment(organization, project, "STAGING");
|
||||
}
|
||||
|
||||
for (const member of project.organization.members) {
|
||||
await createEnvironment(organization, project, "DEVELOPMENT", member);
|
||||
|
||||
+3
-11
@@ -2,7 +2,6 @@ import { conform, useForm } from "@conform-to/react";
|
||||
import { parse } from "@conform-to/zod";
|
||||
import { Form, useActionData, useNavigation } from "@remix-run/react";
|
||||
import { ActionFunction, json } from "@remix-run/server-runtime";
|
||||
import { redirect } from "remix-typedjson";
|
||||
import { z } from "zod";
|
||||
import { InlineCode } from "~/components/code/InlineCode";
|
||||
import { PageBody, PageContainer } from "~/components/layout/AppLayout";
|
||||
@@ -11,7 +10,6 @@ import { ClipboardField } from "~/components/primitives/ClipboardField";
|
||||
import { Fieldset } from "~/components/primitives/Fieldset";
|
||||
import { FormButtons } from "~/components/primitives/FormButtons";
|
||||
import { FormError } from "~/components/primitives/FormError";
|
||||
import { Header2 } from "~/components/primitives/Headers";
|
||||
import { Hint } from "~/components/primitives/Hint";
|
||||
import { Input } from "~/components/primitives/Input";
|
||||
import { InputGroup } from "~/components/primitives/InputGroup";
|
||||
@@ -19,15 +17,9 @@ import { Label } from "~/components/primitives/Label";
|
||||
import { NavBar, PageTitle } from "~/components/primitives/PageHeader";
|
||||
import { prisma } from "~/db.server";
|
||||
import { useProject } from "~/hooks/useProject";
|
||||
import { redirectWithErrorMessage, redirectWithSuccessMessage } from "~/models/message.server";
|
||||
import {
|
||||
clearCurrentProjectId,
|
||||
commitCurrentProjectSession,
|
||||
} from "~/services/currentProject.server";
|
||||
import { DeleteProjectService } from "~/services/deleteProject.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
import { redirectWithSuccessMessage } from "~/models/message.server";
|
||||
import { requireUserId } from "~/services/session.server";
|
||||
import { organizationPath, projectPath, v3ProjectPath } from "~/utils/pathBuilder";
|
||||
import { v3ProjectPath } from "~/utils/pathBuilder";
|
||||
|
||||
export function createSchema(
|
||||
constraints: {
|
||||
@@ -126,7 +118,7 @@ export default function Page() {
|
||||
<Fieldset>
|
||||
<InputGroup>
|
||||
<Label>Project ref</Label>
|
||||
<ClipboardField value={`proj_${project.ref}`} variant={"secondary/small"} />
|
||||
<ClipboardField value={project.ref} variant={"secondary/small"} />
|
||||
<Hint>
|
||||
This goes in your{" "}
|
||||
<InlineCode variant="extra-extra-small">trigger.config</InlineCode> file.
|
||||
|
||||
@@ -76,10 +76,17 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
|
||||
return json({ error: "Project not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const devEnvironment = project.environments[0];
|
||||
if (!project.environments.length) {
|
||||
return json(
|
||||
{ error: `Environment "${env}" not found or is unsupported for this project.` },
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
const runtimeEnv = project.environments[0];
|
||||
|
||||
const result: GetProjectEnvResponse = {
|
||||
apiKey: devEnvironment.apiKey,
|
||||
apiKey: runtimeEnv.apiKey,
|
||||
name: project.name,
|
||||
apiUrl: processEnv.APP_ORIGIN,
|
||||
};
|
||||
|
||||
@@ -132,7 +132,8 @@
|
||||
"update-check": "^1.5.4",
|
||||
"url": "^0.11.1",
|
||||
"ws": "^8.12.0",
|
||||
"zod": "3.22.3"
|
||||
"zod": "3.22.3",
|
||||
"zod-validation-error": "^1.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
|
||||
@@ -25,6 +25,7 @@ import { detectPackageNameFromImportPath } from "../utilities/installPackages";
|
||||
import { logger } from "../utilities/logger.js";
|
||||
import { isLoggedIn } from "../utilities/session.js";
|
||||
import { createTaskFileImports, gatherTaskFiles } from "../utilities/taskFiles";
|
||||
import { fromZodError } from "zod-validation-error";
|
||||
|
||||
const DeployCommandOptions = CommonCommandOptions.extend({
|
||||
skipTypecheck: z.boolean().default(false),
|
||||
@@ -116,7 +117,9 @@ export async function deployCommand(dir: string, anyOptions: unknown) {
|
||||
const options = DeployCommandOptions.safeParse(anyOptions);
|
||||
|
||||
if (!options.success) {
|
||||
throw new Error(`Invalid options: ${options.error}`);
|
||||
console.log(fromZodError(options.error).toString());
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (options.data.logLevel) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import { isLoggedIn } from "../utilities/session.js";
|
||||
import { createTaskFileImports, gatherTaskFiles } from "../utilities/taskFiles";
|
||||
import { UncaughtExceptionError } from "../workers/common/errors";
|
||||
import { BackgroundWorker, BackgroundWorkerCoordinator } from "../workers/dev/backgroundWorker.js";
|
||||
import { fromZodError } from "zod-validation-error";
|
||||
|
||||
let apiClient: CliApiClient | undefined;
|
||||
|
||||
@@ -80,7 +81,9 @@ export async function devCommand(dir: string, anyOptions: unknown) {
|
||||
const options = DevCommandOptions.safeParse(anyOptions);
|
||||
|
||||
if (!options.success) {
|
||||
throw new Error(`Invalid options: ${options.error}`);
|
||||
console.log(fromZodError(options.error).toString());
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const authorization = await isLoggedIn();
|
||||
|
||||
Generated
+2
@@ -1111,6 +1111,7 @@ importers:
|
||||
ws: ^8.12.0
|
||||
xdg-app-paths: ^8.3.0
|
||||
zod: 3.22.3
|
||||
zod-validation-error: ^1.5.0
|
||||
dependencies:
|
||||
'@clack/prompts': 0.7.0
|
||||
'@depot/cli': 0.0.1-cli.2.55.0
|
||||
@@ -1170,6 +1171,7 @@ importers:
|
||||
url: 0.11.1
|
||||
ws: 8.12.0
|
||||
zod: 3.22.3
|
||||
zod-validation-error: 1.5.0_zod@3.22.3
|
||||
devDependencies:
|
||||
'@trigger.dev/tsconfig': link:../../config-packages/tsconfig
|
||||
'@types/gradient-string': 1.1.2
|
||||
|
||||
Reference in New Issue
Block a user