MCPcopy
hub / github.com/haydenbleasel/ultracite / initialize

Function initialize

packages/cli/src/initialize.ts:796–1174  ·  view source on GitHub ↗
(flags?: InitializeFlags)

Source from the content-addressed store, hash-verified

794
795// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: "will fix later"
796export const initialize = async (flags?: InitializeFlags) => {
797 const opts = flags ?? {};
798 const quiet = opts.quiet ?? false;
799
800 if (!quiet) {
801 intro(`Ultracite v${ultraciteVersion} Initialization`);
802 }
803
804 try {
805 let pm: PackageManagerName;
806 let pmInfo: PackageManager;
807
808 if (opts.pm) {
809 pm = assertSupportedPackageManagerName(opts.pm);
810 pmInfo = { command: pm, name: pm };
811 } else {
812 const detected = await detectPackageManager(process.cwd());
813
814 if (!detected) {
815 throw new Error("No package manager specified or detected");
816 }
817
818 if (!quiet && detected.warnings) {
819 for (const warning of detected.warnings) {
820 log.warn(warning);
821 }
822 }
823
824 if (!quiet) {
825 log.info(`Detected lockfile, using ${detected.name}`);
826 }
827 pmInfo = normalizePackageManager(detected);
828 pm = pmInfo.name;
829 }
830
831 let { linter } = opts;
832 if (linter === undefined) {
833 // If quiet mode or other CLI options are provided, default to biome only
834 const hasOtherCliOptions =
835 quiet ||
836 opts.pm ||
837 opts.editors ||
838 opts.agents ||
839 opts.hooks ||
840 opts.integrations !== undefined ||
841 opts.frameworks !== undefined;
842
843 if (hasOtherCliOptions) {
844 linter = "biome";
845 } else {
846 const linterResult = await select({
847 message: "Which linter do you want to use?",
848 options: [
849 {
850 label: "Biome (Recommended)",
851 value: "biome",
852 },
853 {

Callers 2

index.tsFile · 0.90
initialize.test.tsFile · 0.90

Calls 15

normalizePackageManagerFunction · 0.90
detectFrameworksFunction · 0.90
getEditorFileTargetsFunction · 0.90
getAgentFileTargetsFunction · 0.90
updatePackageJsonFunction · 0.90
installDependenciesFunction · 0.85
upsertTsConfigFunction · 0.85
upsertBiomeConfigFunction · 0.85
upsertEslintConfigFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…