Skip to content

Commit 962a88b

Browse files
ok
1 parent 37fc326 commit 962a88b

33 files changed

Lines changed: 195 additions & 1440 deletions

apps/cli/src/helpers/addons/addons-setup.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import path from "node:path";
2-
import { log } from "@clack/prompts";
32
import fs from "fs-extra";
43
import pc from "picocolors";
54
import type { Frontend, ProjectConfig } from "../../types";
@@ -32,7 +31,7 @@ export async function setupAddons(config: ProjectConfig, isAddCommand = false) {
3231
});
3332

3433
if (isAddCommand) {
35-
log.info(`${pc.yellow("Update your package.json scripts:")}
34+
console.log(`ℹ ${pc.yellow("Update your package.json scripts:")}
3635
3736
${pc.dim("Replace:")} ${pc.yellow('"pnpm -r dev"')} ${pc.dim("→")} ${pc.green('"turbo dev"')}
3837
${pc.dim("Replace:")} ${pc.yellow('"pnpm --filter web dev"')} ${pc.dim(

apps/cli/src/helpers/addons/oxlint-setup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import path from "node:path";
2-
import { spinner } from "@clack/prompts";
32
import { $ } from "bun";
43
import fs from "fs-extra";
54
import type { PackageManager } from "../../types";
65
import { addPackageDependency } from "../../utils/add-package-deps";
76
import { getPackageExecutionCommand } from "../../utils/package-runner";
7+
import { log } from "../../utils/logger";
88

99
export async function setupOxlint(projectDir: string, packageManager: PackageManager) {
1010
await addPackageDependency({
@@ -24,13 +24,13 @@ export async function setupOxlint(projectDir: string, packageManager: PackageMan
2424
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
2525
}
2626

27-
const s = spinner();
27+
log.step("Initializing oxlint and oxfmt...");
2828

2929
const oxlintInitCommand = getPackageExecutionCommand(packageManager, "oxlint@latest --init");
30-
s.start("Initializing oxlint and oxfmt...");
3130
await $`${{ raw: oxlintInitCommand }}`.cwd(projectDir).env({ CI: "true" });
3231

3332
const oxfmtInitCommand = getPackageExecutionCommand(packageManager, "oxfmt@latest --init");
3433
await $`${{ raw: oxfmtInitCommand }}`.cwd(projectDir).env({ CI: "true" });
35-
s.stop("oxlint and oxfmt initialized successfully!");
34+
35+
log.success("oxlint and oxfmt initialized successfully!");
3636
}

apps/cli/src/helpers/addons/starlight-setup.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import path from "node:path";
2-
import { spinner } from "@clack/prompts";
32
import consola from "consola";
43
import { $ } from "bun";
54
import fs from "fs-extra";
65
import pc from "picocolors";
76
import type { ProjectConfig } from "../../types";
87
import { getPackageExecutionCommand } from "../../utils/package-runner";
8+
import { log } from "../../utils/logger";
99

1010
export async function setupStarlight(config: ProjectConfig) {
1111
const { packageManager, projectDir } = config;
12-
const s = spinner();
1312

1413
try {
15-
s.start("Setting up Starlight docs...");
14+
log.step("Setting up Starlight docs...");
1615

1716
const starlightArgs = [
1817
"docs",
@@ -35,9 +34,9 @@ export async function setupStarlight(config: ProjectConfig) {
3534

3635
await $`${{ raw: starlightInitCommand }}`.cwd(appsDir).env({ CI: "true" });
3736

38-
s.stop("Starlight docs setup successfully!");
37+
log.success("Starlight docs setup successfully!");
3938
} catch (error) {
40-
s.stop(pc.red("Failed to set up Starlight docs"));
39+
log.error("Failed to set up Starlight docs");
4140
if (error instanceof Error) {
4241
consola.error(pc.red(error.message));
4342
}

apps/cli/src/helpers/addons/tauri-setup.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import path from "node:path";
2-
import { spinner } from "@clack/prompts";
32
import { consola } from "consola";
43
import { $ } from "bun";
54
import fs from "fs-extra";
65
import pc from "picocolors";
76
import type { ProjectConfig } from "../../types";
87
import { addPackageDependency } from "../../utils/add-package-deps";
98
import { getPackageExecutionCommand } from "../../utils/package-runner";
9+
import { log } from "../../utils/logger";
1010

1111
export async function setupTauri(config: ProjectConfig) {
1212
const { packageManager, frontend, projectDir } = config;
13-
const s = spinner();
1413
const clientPackageDir = path.join(projectDir, "apps/web");
1514

1615
if (!(await fs.pathExists(clientPackageDir))) {
1716
return;
1817
}
1918

2019
try {
21-
s.start("Setting up Tauri desktop app support...");
20+
log.step("Setting up Tauri desktop app support...");
2221

2322
await addPackageDependency({
2423
devDependencies: ["@tauri-apps/cli"],
@@ -80,9 +79,9 @@ export async function setupTauri(config: ProjectConfig) {
8079

8180
await $`${{ raw: tauriInitCommand }}`.cwd(clientPackageDir).env({ CI: "true" });
8281

83-
s.stop("Tauri desktop app support configured successfully!");
82+
log.success("Tauri desktop app support configured successfully!");
8483
} catch (error) {
85-
s.stop(pc.red("Failed to set up Tauri"));
84+
log.error("Failed to set up Tauri");
8685
if (error instanceof Error) {
8786
consola.error(pc.red(error.message));
8887
}

apps/cli/src/helpers/core/add-addons.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import path from "node:path";
2-
import { log } from "@clack/prompts";
32
import pc from "picocolors";
43
import type { AddInput, Addons, ProjectConfig } from "../../types";
54
import { updateBtsConfig } from "../../utils/bts-config";
@@ -74,8 +73,8 @@ export async function addAddonsToProject(
7473
packageManager: config.packageManager,
7574
});
7675
} else if (!input.suppressInstallMessage) {
77-
log.info(
78-
pc.yellow(`Run ${pc.bold(`${config.packageManager} install`)} to install dependencies`),
76+
console.log(
77+
pc.yellow(`Run ${pc.bold(`${config.packageManager} install`)} to install dependencies`),
7978
);
8079
}
8180
} catch (error) {

apps/cli/src/helpers/core/add-deployment.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import path from "node:path";
2-
import { log } from "@clack/prompts";
32
import pc from "picocolors";
43
import type { AddInput, ProjectConfig, ServerDeploy, WebDeploy } from "../../types";
54
import { updateBtsConfig } from "../../utils/bts-config";
@@ -67,13 +66,13 @@ export async function addDeploymentToProject(
6766
};
6867

6968
if (input.webDeploy && input.webDeploy !== "none") {
70-
log.info(
71-
pc.green(`Adding ${input.webDeploy} web deployment to ${config.frontend.join("/")}`),
69+
console.log(
70+
pc.green(`Adding ${input.webDeploy} web deployment to ${config.frontend.join("/")}`),
7271
);
7372
}
7473

7574
if (input.serverDeploy && input.serverDeploy !== "none") {
76-
log.info(pc.green(`Adding ${input.serverDeploy} server deployment`));
75+
console.log(pc.green(`Adding ${input.serverDeploy} server deployment`));
7776
}
7877

7978
await setupDeploymentTemplates(projectDir, config);
@@ -91,8 +90,8 @@ export async function addDeploymentToProject(
9190
packageManager: config.packageManager,
9291
});
9392
} else if (!input.suppressInstallMessage) {
94-
log.info(
95-
pc.yellow(`Run ${pc.bold(`${config.packageManager} install`)} to install dependencies`),
93+
console.log(
94+
pc.yellow(`Run ${pc.bold(`${config.packageManager} install`)} to install dependencies`),
9695
);
9796
}
9897
} catch (error) {

apps/cli/src/helpers/core/create-project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { log } from "@clack/prompts";
21
import fs from "fs-extra";
32
import type { ProjectConfig } from "../../types";
3+
import { log } from "../../utils/logger";
44
import { writeBtsConfig } from "../../utils/bts-config";
55
import { exitWithError } from "../../utils/errors";
66
import { setupCatalogs } from "../../utils/setup-catalogs";

apps/cli/src/helpers/core/git.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { log } from "@clack/prompts";
21
import { $ } from "bun";
32
import pc from "picocolors";
43

@@ -8,7 +7,7 @@ export async function initializeGit(projectDir: string, useGit: boolean) {
87
const gitVersionResult = await $`git --version`.cwd(projectDir).nothrow().quiet();
98

109
if (gitVersionResult.exitCode !== 0) {
11-
log.warn(pc.yellow("Git is not installed"));
10+
console.warn(pc.yellow("Git is not installed"));
1211
return;
1312
}
1413

apps/cli/src/helpers/core/install-dependencies.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { spinner } from "@clack/prompts";
21
import consola from "consola";
32
import { $ } from "bun";
43
import pc from "picocolors";
54
import type { Addons, PackageManager } from "../../types";
5+
import { log } from "../../utils/logger";
66

77
export async function installDependencies({
88
projectDir,
@@ -12,16 +12,14 @@ export async function installDependencies({
1212
packageManager: PackageManager;
1313
addons?: Addons[];
1414
}) {
15-
const s = spinner();
16-
1715
try {
18-
s.start(`Running ${packageManager} install...`);
16+
log.step(`Running ${packageManager} install...`);
1917

2018
await $`${packageManager} install`.cwd(projectDir);
2119

22-
s.stop("Dependencies installed successfully");
20+
log.success("Dependencies installed successfully");
2321
} catch (error) {
24-
s.stop(pc.red("Failed to install dependencies"));
22+
log.error("Failed to install dependencies");
2523
if (error instanceof Error) {
2624
consola.error(pc.red(`Installation error: ${error.message}`));
2725
}

apps/cli/src/helpers/core/project-config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import path from "node:path";
2-
import { log } from "@clack/prompts";
32
import { $ } from "bun";
43
import fs from "fs-extra";
54
import type { ProjectConfig } from "../../types";
@@ -96,7 +95,7 @@ async function updateRootPackageJson(projectDir: string, options: ProjectConfig)
9695
const stdout = await $`${packageManager} -v`.cwd(projectDir).text();
9796
packageJson.packageManager = `${packageManager}@${stdout.trim()}`;
9897
} catch {
99-
log.warn(`Could not determine ${packageManager} version.`);
98+
console.warn(`Could not determine ${packageManager} version.`);
10099
}
101100

102101
if (backend === "convex") {

0 commit comments

Comments
 (0)