main() — ui Function Reference
Architecture documentation for the main() function in index.js from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 06dc8a86_19b9_54a6_9bbc_54e7751a3d49["main()"] 5b238b2a_3145_ab1b_7b04_128e9652c323["index.js"] 06dc8a86_19b9_54a6_9bbc_54e7751a3d49 -->|defined in| 5b238b2a_3145_ab1b_7b04_128e9652c323 1dd619bb_a362_c676_8539_96dc8c78ff2d["getPackageManagerCommand()"] 06dc8a86_19b9_54a6_9bbc_54e7751a3d49 -->|calls| 1dd619bb_a362_c676_8539_96dc8c78ff2d f84cf489_e8c0_0c50_3f95_a32b06d1eaf1["getRandomString()"] 06dc8a86_19b9_54a6_9bbc_54e7751a3d49 -->|calls| f84cf489_e8c0_0c50_3f95_a32b06d1eaf1 ebc1a1fb_2351_eb6c_1778_764fbb2a89ac["escapeRegExp()"] 06dc8a86_19b9_54a6_9bbc_54e7751a3d49 -->|calls| ebc1a1fb_2351_eb6c_1778_764fbb2a89ac a367467a_a0b8_9fef_ea64_41909bcb4901["updatePackageJson()"] 06dc8a86_19b9_54a6_9bbc_54e7751a3d49 -->|calls| a367467a_a0b8_9fef_ea64_41909bcb4901 e772ec97_eef3_3fcc_2141_63faa6278954["cleanupCypressFiles()"] 06dc8a86_19b9_54a6_9bbc_54e7751a3d49 -->|calls| e772ec97_eef3_3fcc_2141_63faa6278954 style 06dc8a86_19b9_54a6_9bbc_54e7751a3d49 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/test/fixtures/frameworks/remix-indie-stack/remix.init/index.js lines 103–225
const main = async ({ packageManager, rootDirectory }) => {
const pm = getPackageManagerCommand(packageManager);
const README_PATH = path.join(rootDirectory, "README.md");
const FLY_TOML_PATH = path.join(rootDirectory, "fly.toml");
const EXAMPLE_ENV_PATH = path.join(rootDirectory, ".env.example");
const ENV_PATH = path.join(rootDirectory, ".env");
const DOCKERFILE_PATH = path.join(rootDirectory, "Dockerfile");
const CYPRESS_SUPPORT_PATH = path.join(rootDirectory, "cypress", "support");
const CYPRESS_COMMANDS_PATH = path.join(CYPRESS_SUPPORT_PATH, "commands.ts");
const CREATE_USER_COMMAND_PATH = path.join(
CYPRESS_SUPPORT_PATH,
"create-user.ts",
);
const DELETE_USER_COMMAND_PATH = path.join(
CYPRESS_SUPPORT_PATH,
"delete-user.ts",
);
const REPLACER = "indie-stack-template";
const DIR_NAME = path.basename(rootDirectory);
const SUFFIX = getRandomString(2);
const APP_NAME = (DIR_NAME + "-" + SUFFIX)
// get rid of anything that's not allowed in an app name
.replace(/[^a-zA-Z0-9-_]/g, "-");
const [
prodContent,
readme,
env,
dockerfile,
cypressCommands,
createUserCommand,
deleteUserCommand,
packageJson,
] = await Promise.all([
fs.readFile(FLY_TOML_PATH, "utf-8"),
fs.readFile(README_PATH, "utf-8"),
fs.readFile(EXAMPLE_ENV_PATH, "utf-8"),
fs.readFile(DOCKERFILE_PATH, "utf-8"),
fs.readFile(CYPRESS_COMMANDS_PATH, "utf-8"),
fs.readFile(CREATE_USER_COMMAND_PATH, "utf-8"),
fs.readFile(DELETE_USER_COMMAND_PATH, "utf-8"),
PackageJson.load(rootDirectory),
]);
const newEnv = env.replace(
/^SESSION_SECRET=.*$/m,
`SESSION_SECRET="${getRandomString(16)}"`,
);
const prodToml = toml.parse(prodContent);
prodToml.app = prodToml.app.replace(REPLACER, APP_NAME);
const initInstructions = `
- First run this stack's \`remix.init\` script and commit the changes it makes to your project.
\`\`\`sh
npx remix init
git init # if you haven't already
git add .
git commit -m "Initialize project"
\`\`\`
`;
const newReadme = readme
.replace(new RegExp(escapeRegExp(REPLACER), "g"), APP_NAME)
.replace(initInstructions, "");
const newDockerfile = pm.lockfile
? dockerfile.replace(
new RegExp(escapeRegExp("ADD package.json"), "g"),
`ADD package.json ${pm.lockfile}`,
)
: dockerfile;
updatePackageJson({ APP_NAME, packageJson, packageManager: pm });
await Promise.all([
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does main() do?
main() is a function in the ui codebase, defined in packages/shadcn/test/fixtures/frameworks/remix-indie-stack/remix.init/index.js.
Where is main() defined?
main() is defined in packages/shadcn/test/fixtures/frameworks/remix-indie-stack/remix.init/index.js at line 103.
What does main() call?
main() calls 5 function(s): cleanupCypressFiles, escapeRegExp, getPackageManagerCommand, getRandomString, updatePackageJson.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free