create-user.ts — ui Source File
Architecture documentation for create-user.ts, a typescript file in the ui codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR db20f931_84b8_e006_0bc8_794e579c9da5["create-user.ts"] ce9dd226_41a3_f031_caf3_5378288c23c1["node"] db20f931_84b8_e006_0bc8_794e579c9da5 --> ce9dd226_41a3_f031_caf3_5378288c23c1 68608537_712b_6b00_a58e_d98c5a58f163["cookie"] db20f931_84b8_e006_0bc8_794e579c9da5 --> 68608537_712b_6b00_a58e_d98c5a58f163 052778fd_1a4c_7f8d_8295_ec523652ac24["user.server"] db20f931_84b8_e006_0bc8_794e579c9da5 --> 052778fd_1a4c_7f8d_8295_ec523652ac24 a16e75e5_8d49_95a1_3e98_b347fb9dbfb5["session.server"] db20f931_84b8_e006_0bc8_794e579c9da5 --> a16e75e5_8d49_95a1_3e98_b347fb9dbfb5 style db20f931_84b8_e006_0bc8_794e579c9da5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// Use this to create a new user and login with that user
// Simply call this with:
// npx ts-node -r tsconfig-paths/register ./cypress/support/create-user.ts username@example.com,
// and it will log out the cookie value you can use to interact with the server
// as that new user.
import { installGlobals } from "@remix-run/node";
import { parse } from "cookie";
import { createUser } from "~/models/user.server";
import { createUserSession } from "~/session.server";
installGlobals();
async function createAndLogin(email: string) {
if (!email) {
throw new Error("email required for login");
}
if (!email.endsWith("@example.com")) {
throw new Error("All test emails must end in @example.com");
}
const user = await createUser(email, "myreallystrongpassword");
const response = await createUserSession({
request: new Request("test://test"),
userId: user.id,
remember: false,
redirectTo: "/",
});
const cookieValue = response.headers.get("Set-Cookie");
if (!cookieValue) {
throw new Error("Cookie missing from createUserSession response");
}
const parsedCookie = parse(cookieValue);
// we log it like this so our cypress command can parse it out and set it as
// the cookie value.
console.log(
`
<cookie>
${parsedCookie.__session}
</cookie>
`.trim(),
);
}
createAndLogin(process.argv[2]);
Domain
Subdomains
Functions
Dependencies
- cookie
- node
- session.server
- user.server
Source
Frequently Asked Questions
What does create-user.ts do?
create-user.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, SchemaValidation subdomain.
What functions are defined in create-user.ts?
create-user.ts defines 1 function(s): createAndLogin.
What does create-user.ts depend on?
create-user.ts imports 4 module(s): cookie, node, session.server, user.server.
Where is create-user.ts in the architecture?
create-user.ts is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/cypress/support/create-user.ts (domain: FrameworkTooling, subdomain: SchemaValidation, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/cypress/support).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free