index.js — ui Source File
Architecture documentation for index.js, a javascript file in the ui codebase.
Entity Profile
Relationship Graph
Source Code
const { execSync } = require("node:child_process");
const crypto = require("node:crypto");
const fs = require("node:fs/promises");
const path = require("node:path");
const toml = require("@iarna/toml");
const PackageJson = require("@npmcli/package-json");
const semver = require("semver");
const cleanupCypressFiles = ({ fileEntries, packageManager }) =>
fileEntries.flatMap(([filePath, content]) => {
const newContent = content.replace(
new RegExp("npx ts-node", "g"),
packageManager.name === "bun" ? "bun" : `${packageManager.exec} ts-node`,
);
return [fs.writeFile(filePath, newContent)];
});
const escapeRegExp = (string) =>
// $& means the whole matched string
string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const getPackageManagerCommand = (packageManager) =>
// Inspired by https://github.com/nrwl/nx/blob/bd9b33eaef0393d01f747ea9a2ac5d2ca1fb87c6/packages/nx/src/utils/package-manager.ts#L38-L103
({
bun: () => ({
exec: "bunx",
lockfile: "bun.lockb",
name: "bun",
run: (script, args) => `bun run ${script} ${args || ""}`,
}),
npm: () => ({
exec: "npx",
lockfile: "package-lock.json",
name: "npm",
run: (script, args) => `npm run ${script} ${args ? `-- ${args}` : ""}`,
}),
pnpm: () => {
const pnpmVersion = getPackageManagerVersion("pnpm");
const includeDoubleDashBeforeArgs = semver.lt(pnpmVersion, "7.0.0");
const useExec = semver.gte(pnpmVersion, "6.13.0");
return {
exec: useExec ? "pnpm exec" : "pnpx",
lockfile: "pnpm-lock.yaml",
name: "pnpm",
run: (script, args) =>
includeDoubleDashBeforeArgs
? `pnpm run ${script} ${args ? `-- ${args}` : ""}`
: `pnpm run ${script} ${args || ""}`,
};
},
yarn: () => ({
exec: "yarn",
lockfile: "yarn.lock",
name: "yarn",
run: (script, args) => `yarn ${script} ${args || ""}`,
}),
})[packageManager]();
// ... (168 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does index.js do?
index.js is a source file in the ui codebase, written in javascript. It belongs to the FrameworkTooling domain, SchemaValidation subdomain.
What functions are defined in index.js?
index.js defines 8 function(s): cleanupCypressFiles, escapeRegExp, getPackageManagerCommand, getPackageManagerVersion, getRandomString, main, removeUnusedDependencies, updatePackageJson.
Where is index.js in the architecture?
index.js is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/remix.init/index.js (domain: FrameworkTooling, subdomain: SchemaValidation, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/remix.init).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free