@weirdfingers/baseboards 0.9.12 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +187 -204
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3218,8 +3218,8 @@ var require_utils = __commonJS({
|
|
|
3218
3218
|
}
|
|
3219
3219
|
return ind;
|
|
3220
3220
|
}
|
|
3221
|
-
function removeDotSegments(
|
|
3222
|
-
let input =
|
|
3221
|
+
function removeDotSegments(path19) {
|
|
3222
|
+
let input = path19;
|
|
3223
3223
|
const output = [];
|
|
3224
3224
|
let nextSlash = -1;
|
|
3225
3225
|
let len = 0;
|
|
@@ -3418,8 +3418,8 @@ var require_schemes = __commonJS({
|
|
|
3418
3418
|
wsComponent.secure = void 0;
|
|
3419
3419
|
}
|
|
3420
3420
|
if (wsComponent.resourceName) {
|
|
3421
|
-
const [
|
|
3422
|
-
wsComponent.path =
|
|
3421
|
+
const [path19, query] = wsComponent.resourceName.split("?");
|
|
3422
|
+
wsComponent.path = path19 && path19 !== "/" ? path19 : void 0;
|
|
3423
3423
|
wsComponent.query = query;
|
|
3424
3424
|
wsComponent.resourceName = void 0;
|
|
3425
3425
|
}
|
|
@@ -6473,7 +6473,7 @@ import { Command } from "commander";
|
|
|
6473
6473
|
import { readFileSync } from "fs";
|
|
6474
6474
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6475
6475
|
import { dirname, join } from "path";
|
|
6476
|
-
import
|
|
6476
|
+
import chalk14 from "chalk";
|
|
6477
6477
|
|
|
6478
6478
|
// src/commands/up.ts
|
|
6479
6479
|
import { execa as execa3 } from "execa";
|
|
@@ -7774,8 +7774,11 @@ async function up(directory, options) {
|
|
|
7774
7774
|
}
|
|
7775
7775
|
monorepoRoot = detectedRoot;
|
|
7776
7776
|
}
|
|
7777
|
+
const alreadyScaffolded = isScaffolded(dir);
|
|
7777
7778
|
let selectedTemplate;
|
|
7778
|
-
if (
|
|
7779
|
+
if (alreadyScaffolded) {
|
|
7780
|
+
selectedTemplate = options.template || "baseboards";
|
|
7781
|
+
} else if (options.template) {
|
|
7779
7782
|
await validateTemplate(options.template, version);
|
|
7780
7783
|
selectedTemplate = options.template;
|
|
7781
7784
|
} else {
|
|
@@ -7784,7 +7787,7 @@ async function up(directory, options) {
|
|
|
7784
7787
|
const ctx = {
|
|
7785
7788
|
dir,
|
|
7786
7789
|
name,
|
|
7787
|
-
isScaffolded:
|
|
7790
|
+
isScaffolded: alreadyScaffolded,
|
|
7788
7791
|
ports: defaultPorts,
|
|
7789
7792
|
version,
|
|
7790
7793
|
appDev,
|
|
@@ -8701,28 +8704,9 @@ async function clean(directory, options) {
|
|
|
8701
8704
|
}
|
|
8702
8705
|
}
|
|
8703
8706
|
|
|
8704
|
-
// src/commands/update.ts
|
|
8705
|
-
import path14 from "path";
|
|
8706
|
-
import chalk9 from "chalk";
|
|
8707
|
-
async function update(directory, options) {
|
|
8708
|
-
const dir = path14.resolve(process.cwd(), directory);
|
|
8709
|
-
if (!isScaffolded(dir)) {
|
|
8710
|
-
console.error(chalk9.red("\n\u274C Error: Not a Baseboards project"));
|
|
8711
|
-
console.log(chalk9.gray(" Run"), chalk9.cyan("baseboards up"), chalk9.gray("to scaffold a project first."));
|
|
8712
|
-
process.exit(1);
|
|
8713
|
-
}
|
|
8714
|
-
console.log(chalk9.blue.bold("\n\u{1F504} Update Command\n"));
|
|
8715
|
-
console.log(chalk9.yellow("\u26A0\uFE0F This feature is coming soon!"));
|
|
8716
|
-
console.log(chalk9.gray("\nFor now, to update:"));
|
|
8717
|
-
console.log(chalk9.gray("1. Update the CLI:"), chalk9.cyan("npm install -g @weirdfingers/baseboards@latest"));
|
|
8718
|
-
console.log(chalk9.gray("2. Pull new images:"), chalk9.cyan("docker compose pull"));
|
|
8719
|
-
console.log(chalk9.gray("3. Restart:"), chalk9.cyan("baseboards down && baseboards up"));
|
|
8720
|
-
console.log();
|
|
8721
|
-
}
|
|
8722
|
-
|
|
8723
8707
|
// src/commands/upgrade.ts
|
|
8724
|
-
import
|
|
8725
|
-
import
|
|
8708
|
+
import path17 from "path";
|
|
8709
|
+
import chalk11 from "chalk";
|
|
8726
8710
|
import prompts4 from "prompts";
|
|
8727
8711
|
|
|
8728
8712
|
// src/utils/compatibility-checker.ts
|
|
@@ -8731,7 +8715,7 @@ import semver from "semver";
|
|
|
8731
8715
|
// src/utils/compatibility-fetcher.ts
|
|
8732
8716
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
8733
8717
|
import fs10 from "fs-extra";
|
|
8734
|
-
import
|
|
8718
|
+
import path14 from "path";
|
|
8735
8719
|
import os from "os";
|
|
8736
8720
|
import addFormats from "ajv-formats";
|
|
8737
8721
|
|
|
@@ -8794,7 +8778,7 @@ var compatibility_manifest_schema_default = {
|
|
|
8794
8778
|
|
|
8795
8779
|
// src/utils/compatibility-fetcher.ts
|
|
8796
8780
|
var GITHUB_REPO = "weirdfingers/boards";
|
|
8797
|
-
var CACHE_DIR =
|
|
8781
|
+
var CACHE_DIR = path14.join(os.homedir(), ".baseboards", "compatibility");
|
|
8798
8782
|
var ajv = new import_ajv.default({ strict: false });
|
|
8799
8783
|
addFormats(ajv);
|
|
8800
8784
|
var validateManifest = ajv.compile(compatibility_manifest_schema_default);
|
|
@@ -8866,7 +8850,7 @@ async function saveToCache(version, manifest) {
|
|
|
8866
8850
|
}
|
|
8867
8851
|
function getCachePath(version) {
|
|
8868
8852
|
const cleanVersion = version.replace(/^v/, "");
|
|
8869
|
-
return
|
|
8853
|
+
return path14.join(CACHE_DIR, `compatibility-${cleanVersion}.json`);
|
|
8870
8854
|
}
|
|
8871
8855
|
|
|
8872
8856
|
// src/utils/compatibility-checker.ts
|
|
@@ -8918,49 +8902,49 @@ function isVersionAffected(version, affectedRange) {
|
|
|
8918
8902
|
}
|
|
8919
8903
|
|
|
8920
8904
|
// src/commands/upgrade-default.ts
|
|
8921
|
-
import
|
|
8905
|
+
import path15 from "path";
|
|
8922
8906
|
import fs11 from "fs-extra";
|
|
8923
|
-
import
|
|
8907
|
+
import chalk9 from "chalk";
|
|
8924
8908
|
import { execa as execa9 } from "execa";
|
|
8925
8909
|
import ora5 from "ora";
|
|
8926
8910
|
async function upgradeDefaultMode(projectDir, currentVersion, targetVersion) {
|
|
8927
|
-
console.log(
|
|
8911
|
+
console.log(chalk9.blue(`
|
|
8928
8912
|
\u{1F4E6} Upgrading from v${currentVersion} to v${targetVersion}
|
|
8929
8913
|
`));
|
|
8930
8914
|
try {
|
|
8931
|
-
console.log(
|
|
8915
|
+
console.log(chalk9.gray("\u23F8\uFE0F Stopping services..."));
|
|
8932
8916
|
await execAsync3("docker compose --env-file docker/.env down", { cwd: projectDir });
|
|
8933
|
-
console.log(
|
|
8917
|
+
console.log(chalk9.gray("\u2B07\uFE0F Pulling new backend images..."));
|
|
8934
8918
|
await execAsync3("docker compose --env-file docker/.env pull api worker", { cwd: projectDir });
|
|
8935
|
-
console.log(
|
|
8919
|
+
console.log(chalk9.gray("\u{1F4DD} Updating frontend dependencies..."));
|
|
8936
8920
|
await updateWebPackageJson(projectDir, targetVersion);
|
|
8937
|
-
console.log(
|
|
8921
|
+
console.log(chalk9.gray("\u{1F528} Rebuilding frontend image (this may take a few minutes)..."));
|
|
8938
8922
|
await execAsync3("docker compose --env-file docker/.env build web", { cwd: projectDir });
|
|
8939
|
-
console.log(
|
|
8923
|
+
console.log(chalk9.gray("\u2699\uFE0F Updating configuration..."));
|
|
8940
8924
|
await updateEnvVersion(projectDir, targetVersion);
|
|
8941
|
-
console.log(
|
|
8925
|
+
console.log(chalk9.gray("\u{1F680} Starting services..."));
|
|
8942
8926
|
await execAsync3("docker compose --env-file docker/.env up -d", { cwd: projectDir });
|
|
8943
|
-
console.log(
|
|
8927
|
+
console.log(chalk9.gray("\u{1F3E5} Waiting for services to be healthy..."));
|
|
8944
8928
|
await waitForHealth(projectDir, ["db", "cache", "api", "worker", "web"]);
|
|
8945
|
-
console.log(
|
|
8929
|
+
console.log(chalk9.green(`
|
|
8946
8930
|
\u2705 Successfully upgraded to v${targetVersion}!
|
|
8947
8931
|
`));
|
|
8948
8932
|
printUpgradeSuccess(projectDir, targetVersion);
|
|
8949
8933
|
} catch (error) {
|
|
8950
8934
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
8951
|
-
console.error(
|
|
8935
|
+
console.error(chalk9.red(`
|
|
8952
8936
|
\u274C Upgrade failed: ${errorMessage}
|
|
8953
8937
|
`));
|
|
8954
|
-
console.log(
|
|
8955
|
-
console.log(
|
|
8956
|
-
console.log(
|
|
8957
|
-
console.log(
|
|
8958
|
-
console.log(
|
|
8938
|
+
console.log(chalk9.yellow("To rollback:"));
|
|
8939
|
+
console.log(chalk9.gray(` 1. Edit docker/.env and set BACKEND_VERSION=${currentVersion}`));
|
|
8940
|
+
console.log(chalk9.gray(" 2. Run: docker compose pull"));
|
|
8941
|
+
console.log(chalk9.gray(" 3. Run: docker compose build web"));
|
|
8942
|
+
console.log(chalk9.gray(" 4. Run: docker compose up -d\n"));
|
|
8959
8943
|
throw error;
|
|
8960
8944
|
}
|
|
8961
8945
|
}
|
|
8962
8946
|
async function updateWebPackageJson(projectDir, version) {
|
|
8963
|
-
const packageJsonPath =
|
|
8947
|
+
const packageJsonPath = path15.join(projectDir, "web", "package.json");
|
|
8964
8948
|
const packageJson2 = await fs11.readJson(packageJsonPath);
|
|
8965
8949
|
if (packageJson2.dependencies && packageJson2.dependencies["@weirdfingers/boards"]) {
|
|
8966
8950
|
packageJson2.dependencies["@weirdfingers/boards"] = version;
|
|
@@ -8968,7 +8952,7 @@ async function updateWebPackageJson(projectDir, version) {
|
|
|
8968
8952
|
await fs11.writeJson(packageJsonPath, packageJson2, { spaces: 2 });
|
|
8969
8953
|
}
|
|
8970
8954
|
async function updateEnvVersion(projectDir, version) {
|
|
8971
|
-
const envPath =
|
|
8955
|
+
const envPath = path15.join(projectDir, "docker", ".env");
|
|
8972
8956
|
let content = await fs11.readFile(envPath, "utf-8");
|
|
8973
8957
|
content = content.replace(
|
|
8974
8958
|
/^BACKEND_VERSION=.*/m,
|
|
@@ -9011,24 +8995,24 @@ async function waitForHealth(projectDir, services) {
|
|
|
9011
8995
|
} else {
|
|
9012
8996
|
spinner.warn("Services taking longer than expected...");
|
|
9013
8997
|
console.log(
|
|
9014
|
-
|
|
8998
|
+
chalk9.yellow(
|
|
9015
8999
|
"\n\u26A0\uFE0F Health check timeout. Services may still be starting."
|
|
9016
9000
|
)
|
|
9017
9001
|
);
|
|
9018
9002
|
console.log(
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9003
|
+
chalk9.gray(" Run"),
|
|
9004
|
+
chalk9.cyan("baseboards logs"),
|
|
9005
|
+
chalk9.gray("to check progress.")
|
|
9022
9006
|
);
|
|
9023
9007
|
}
|
|
9024
9008
|
}
|
|
9025
9009
|
function printUpgradeSuccess(projectDir, version) {
|
|
9026
|
-
console.log(
|
|
9027
|
-
console.log(
|
|
9028
|
-
console.log(
|
|
9029
|
-
console.log(
|
|
9030
|
-
console.log(
|
|
9031
|
-
console.log(
|
|
9010
|
+
console.log(chalk9.gray(" Your Baseboards installation has been upgraded."));
|
|
9011
|
+
console.log(chalk9.gray(" All services are running and healthy.\n"));
|
|
9012
|
+
console.log(chalk9.gray("Next steps:"));
|
|
9013
|
+
console.log(chalk9.gray(` \u2022 Check release notes: https://github.com/weirdfingers/boards/releases/tag/v${version}`));
|
|
9014
|
+
console.log(chalk9.gray(` \u2022 View logs: baseboards logs ${path15.basename(projectDir)}`));
|
|
9015
|
+
console.log(chalk9.gray(` \u2022 Check status: baseboards status ${path15.basename(projectDir)}
|
|
9032
9016
|
`));
|
|
9033
9017
|
}
|
|
9034
9018
|
async function execAsync3(command, options) {
|
|
@@ -9037,44 +9021,44 @@ async function execAsync3(command, options) {
|
|
|
9037
9021
|
}
|
|
9038
9022
|
|
|
9039
9023
|
// src/commands/upgrade-app-dev.ts
|
|
9040
|
-
import
|
|
9024
|
+
import path16 from "path";
|
|
9041
9025
|
import fs12 from "fs-extra";
|
|
9042
|
-
import
|
|
9026
|
+
import chalk10 from "chalk";
|
|
9043
9027
|
import { execa as execa10 } from "execa";
|
|
9044
9028
|
import ora6 from "ora";
|
|
9045
9029
|
async function upgradeAppDevMode(projectDir, currentVersion, targetVersion) {
|
|
9046
|
-
console.log(
|
|
9030
|
+
console.log(chalk10.blue(`
|
|
9047
9031
|
\u{1F4E6} Upgrading backend from v${currentVersion} to v${targetVersion}
|
|
9048
9032
|
`));
|
|
9049
9033
|
try {
|
|
9050
|
-
console.log(
|
|
9034
|
+
console.log(chalk10.gray("\u23F8\uFE0F Stopping backend services..."));
|
|
9051
9035
|
await execAsync("docker compose --env-file docker/.env down", { cwd: projectDir });
|
|
9052
|
-
console.log(
|
|
9036
|
+
console.log(chalk10.gray("\u2B07\uFE0F Pulling new backend images..."));
|
|
9053
9037
|
await execAsync("docker compose --env-file docker/.env pull api worker", { cwd: projectDir });
|
|
9054
|
-
console.log(
|
|
9038
|
+
console.log(chalk10.gray("\u2699\uFE0F Updating configuration..."));
|
|
9055
9039
|
await updateEnvVersion2(projectDir, targetVersion);
|
|
9056
|
-
console.log(
|
|
9040
|
+
console.log(chalk10.gray("\u{1F680} Starting backend services..."));
|
|
9057
9041
|
await execAsync("docker compose --env-file docker/.env up -d db cache api worker", { cwd: projectDir });
|
|
9058
|
-
console.log(
|
|
9042
|
+
console.log(chalk10.gray("\u{1F3E5} Waiting for backend to be healthy..."));
|
|
9059
9043
|
await waitForHealth2(projectDir, ["db", "cache", "api", "worker"]);
|
|
9060
|
-
console.log(
|
|
9044
|
+
console.log(chalk10.green(`
|
|
9061
9045
|
\u2705 Backend upgraded to v${targetVersion}!
|
|
9062
9046
|
`));
|
|
9063
9047
|
await printAppDevUpgradeInstructions(projectDir, currentVersion, targetVersion);
|
|
9064
9048
|
} catch (error) {
|
|
9065
9049
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
9066
|
-
console.error(
|
|
9050
|
+
console.error(chalk10.red(`
|
|
9067
9051
|
\u274C Upgrade failed: ${errorMessage}
|
|
9068
9052
|
`));
|
|
9069
|
-
console.log(
|
|
9070
|
-
console.log(
|
|
9071
|
-
console.log(
|
|
9072
|
-
console.log(
|
|
9053
|
+
console.log(chalk10.yellow("To rollback:"));
|
|
9054
|
+
console.log(chalk10.gray(` 1. Edit docker/.env and set BACKEND_VERSION=${currentVersion}`));
|
|
9055
|
+
console.log(chalk10.gray(" 2. Run: docker compose --env-file docker/.env pull"));
|
|
9056
|
+
console.log(chalk10.gray(" 3. Run: docker compose --env-file docker/.env up -d db cache api worker\n"));
|
|
9073
9057
|
throw error;
|
|
9074
9058
|
}
|
|
9075
9059
|
}
|
|
9076
9060
|
async function updateEnvVersion2(projectDir, version) {
|
|
9077
|
-
const envPath =
|
|
9061
|
+
const envPath = path16.join(projectDir, "docker", ".env");
|
|
9078
9062
|
let content = await fs12.readFile(envPath, "utf-8");
|
|
9079
9063
|
content = content.replace(
|
|
9080
9064
|
/^BACKEND_VERSION=.*/m,
|
|
@@ -9083,34 +9067,34 @@ async function updateEnvVersion2(projectDir, version) {
|
|
|
9083
9067
|
await fs12.writeFile(envPath, content, "utf-8");
|
|
9084
9068
|
}
|
|
9085
9069
|
async function printAppDevUpgradeInstructions(projectDir, oldVersion, newVersion) {
|
|
9086
|
-
const webDir =
|
|
9070
|
+
const webDir = path16.join(projectDir, "web");
|
|
9087
9071
|
const packageManager = await detectPackageManager(webDir);
|
|
9088
9072
|
const updateCommand = packageManager === "npm" ? `npm install @weirdfingers/boards@${newVersion}` : packageManager === "yarn" ? `yarn upgrade @weirdfingers/boards@${newVersion}` : packageManager === "bun" ? `bun update @weirdfingers/boards@${newVersion}` : `pnpm update @weirdfingers/boards@${newVersion}`;
|
|
9089
|
-
console.log(
|
|
9090
|
-
console.log(
|
|
9091
|
-
console.log(
|
|
9092
|
-
console.log(
|
|
9093
|
-
console.log(
|
|
9073
|
+
console.log(chalk10.yellow("\u26A0\uFE0F Frontend requires manual upgrade:\n"));
|
|
9074
|
+
console.log(chalk10.gray(" 1. Stop your dev server (Ctrl+C if running)\n"));
|
|
9075
|
+
console.log(chalk10.gray(" 2. Update the frontend package:\n"));
|
|
9076
|
+
console.log(chalk10.cyan(` cd ${path16.basename(projectDir)}/web`));
|
|
9077
|
+
console.log(chalk10.cyan(` ${updateCommand}
|
|
9094
9078
|
`));
|
|
9095
|
-
console.log(
|
|
9096
|
-
console.log(
|
|
9079
|
+
console.log(chalk10.gray(" 3. Check for breaking changes:\n"));
|
|
9080
|
+
console.log(chalk10.gray(` https://github.com/weirdfingers/boards/releases/tag/v${newVersion}
|
|
9097
9081
|
`));
|
|
9098
|
-
console.log(
|
|
9099
|
-
console.log(
|
|
9082
|
+
console.log(chalk10.gray(" 4. Restart your dev server:\n"));
|
|
9083
|
+
console.log(chalk10.cyan(` ${packageManager} dev
|
|
9100
9084
|
`));
|
|
9101
9085
|
try {
|
|
9102
9086
|
const { stdout } = await execAsync("git status --porcelain", { cwd: webDir });
|
|
9103
9087
|
if (stdout.trim()) {
|
|
9104
|
-
console.log(
|
|
9105
|
-
console.log(
|
|
9088
|
+
console.log(chalk10.yellow("\u26A0\uFE0F You have uncommitted changes in web/"));
|
|
9089
|
+
console.log(chalk10.gray(" Consider committing before updating dependencies.\n"));
|
|
9106
9090
|
}
|
|
9107
9091
|
} catch (error) {
|
|
9108
|
-
const gitDir =
|
|
9092
|
+
const gitDir = path16.join(webDir, ".git");
|
|
9109
9093
|
if (!fs12.existsSync(gitDir)) {
|
|
9110
|
-
console.log(
|
|
9094
|
+
console.log(chalk10.gray(" Skipping git status check: web/ is not a git repository."));
|
|
9111
9095
|
} else {
|
|
9112
9096
|
console.log(
|
|
9113
|
-
|
|
9097
|
+
chalk10.gray(
|
|
9114
9098
|
" Skipping git status check: git is not available or an error occurred while checking repository status."
|
|
9115
9099
|
)
|
|
9116
9100
|
);
|
|
@@ -9152,61 +9136,61 @@ async function waitForHealth2(projectDir, services) {
|
|
|
9152
9136
|
} else {
|
|
9153
9137
|
spinner.warn("Services taking longer than expected...");
|
|
9154
9138
|
console.log(
|
|
9155
|
-
|
|
9139
|
+
chalk10.yellow(
|
|
9156
9140
|
"\n\u26A0\uFE0F Health check timeout. Services may still be starting."
|
|
9157
9141
|
)
|
|
9158
9142
|
);
|
|
9159
9143
|
console.log(
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9144
|
+
chalk10.gray(" Run"),
|
|
9145
|
+
chalk10.cyan("baseboards logs"),
|
|
9146
|
+
chalk10.gray("to check progress.")
|
|
9163
9147
|
);
|
|
9164
9148
|
}
|
|
9165
9149
|
}
|
|
9166
9150
|
|
|
9167
9151
|
// src/commands/upgrade.ts
|
|
9168
9152
|
async function upgrade(directory, options) {
|
|
9169
|
-
const dir =
|
|
9153
|
+
const dir = path17.resolve(process.cwd(), directory);
|
|
9170
9154
|
if (!isScaffolded(dir)) {
|
|
9171
|
-
console.error(
|
|
9172
|
-
console.log(
|
|
9155
|
+
console.error(chalk11.red("\n\u274C Error: Not a Baseboards project"));
|
|
9156
|
+
console.log(chalk11.gray(" Run"), chalk11.cyan("baseboards up"), chalk11.gray("to scaffold a project first."));
|
|
9173
9157
|
process.exit(1);
|
|
9174
9158
|
}
|
|
9175
9159
|
const currentVersion = await getCurrentVersion(dir);
|
|
9176
9160
|
if (!currentVersion) {
|
|
9177
|
-
console.error(
|
|
9178
|
-
console.log(
|
|
9161
|
+
console.error(chalk11.red("\n\u274C Error: Could not determine current version"));
|
|
9162
|
+
console.log(chalk11.gray(" Check docker/.env for VERSION field"));
|
|
9179
9163
|
process.exit(1);
|
|
9180
9164
|
}
|
|
9181
9165
|
const targetVersion = options.version || await getLatestVersion();
|
|
9182
9166
|
if (currentVersion === targetVersion) {
|
|
9183
|
-
console.log(
|
|
9167
|
+
console.log(chalk11.green(`
|
|
9184
9168
|
\u2705 Already at v${targetVersion}`));
|
|
9185
9169
|
return;
|
|
9186
9170
|
}
|
|
9187
9171
|
const compatCheck = await checkCompatibility(currentVersion, targetVersion);
|
|
9188
9172
|
const mode = await detectProjectMode(dir);
|
|
9189
|
-
console.log(
|
|
9190
|
-
console.log(
|
|
9191
|
-
console.log(
|
|
9192
|
-
console.log(
|
|
9173
|
+
console.log(chalk11.blue("\u{1F4CB} Upgrade Plan:\n"));
|
|
9174
|
+
console.log(chalk11.gray(` Current version: ${currentVersion}`));
|
|
9175
|
+
console.log(chalk11.gray(` Target version: ${targetVersion}`));
|
|
9176
|
+
console.log(chalk11.gray(` Project mode: ${mode}`));
|
|
9193
9177
|
console.log("");
|
|
9194
9178
|
if (mode === "default") {
|
|
9195
|
-
console.log(
|
|
9196
|
-
console.log(
|
|
9197
|
-
console.log(
|
|
9198
|
-
console.log(
|
|
9199
|
-
console.log(
|
|
9200
|
-
console.log(
|
|
9201
|
-
console.log(
|
|
9202
|
-
console.log(
|
|
9179
|
+
console.log(chalk11.gray(" Steps:"));
|
|
9180
|
+
console.log(chalk11.gray(" 1. Stop all services"));
|
|
9181
|
+
console.log(chalk11.gray(" 2. Pull new backend images"));
|
|
9182
|
+
console.log(chalk11.gray(" 3. Update web/package.json"));
|
|
9183
|
+
console.log(chalk11.gray(" 4. Rebuild frontend Docker image"));
|
|
9184
|
+
console.log(chalk11.gray(" 5. Update docker/.env"));
|
|
9185
|
+
console.log(chalk11.gray(" 6. Start services"));
|
|
9186
|
+
console.log(chalk11.gray(" 7. Wait for health checks"));
|
|
9203
9187
|
} else {
|
|
9204
|
-
console.log(
|
|
9205
|
-
console.log(
|
|
9206
|
-
console.log(
|
|
9207
|
-
console.log(
|
|
9208
|
-
console.log(
|
|
9209
|
-
console.log(
|
|
9188
|
+
console.log(chalk11.gray(" Steps:"));
|
|
9189
|
+
console.log(chalk11.gray(" 1. Stop backend services"));
|
|
9190
|
+
console.log(chalk11.gray(" 2. Pull new backend images"));
|
|
9191
|
+
console.log(chalk11.gray(" 3. Update docker/.env"));
|
|
9192
|
+
console.log(chalk11.gray(" 4. Start backend services"));
|
|
9193
|
+
console.log(chalk11.gray(" 5. Print manual frontend update instructions"));
|
|
9210
9194
|
}
|
|
9211
9195
|
console.log("");
|
|
9212
9196
|
if (compatCheck.warnings.length > 0) {
|
|
@@ -9214,18 +9198,18 @@ async function upgrade(directory, options) {
|
|
|
9214
9198
|
console.log("");
|
|
9215
9199
|
}
|
|
9216
9200
|
if (compatCheck.requiredActions.length > 0) {
|
|
9217
|
-
console.log(
|
|
9201
|
+
console.log(chalk11.yellow("\u26A0\uFE0F Required manual actions:"));
|
|
9218
9202
|
compatCheck.requiredActions.forEach((action) => {
|
|
9219
|
-
console.log(
|
|
9203
|
+
console.log(chalk11.gray(` \u2022 ${action}`));
|
|
9220
9204
|
});
|
|
9221
9205
|
console.log("");
|
|
9222
9206
|
}
|
|
9223
9207
|
if (options.dryRun) {
|
|
9224
|
-
console.log(
|
|
9208
|
+
console.log(chalk11.blue("\u{1F50D} Dry run complete - no changes made\n"));
|
|
9225
9209
|
return;
|
|
9226
9210
|
}
|
|
9227
9211
|
if (options.force && compatCheck.breaking) {
|
|
9228
|
-
console.log(
|
|
9212
|
+
console.log(chalk11.yellow("\u26A0\uFE0F --force flag used: skipping confirmation despite breaking changes\n"));
|
|
9229
9213
|
}
|
|
9230
9214
|
if (!options.force && compatCheck.breaking) {
|
|
9231
9215
|
const { proceed } = await prompts4({
|
|
@@ -9235,7 +9219,7 @@ async function upgrade(directory, options) {
|
|
|
9235
9219
|
initial: false
|
|
9236
9220
|
});
|
|
9237
9221
|
if (!proceed) {
|
|
9238
|
-
console.log(
|
|
9222
|
+
console.log(chalk11.gray("\nUpgrade cancelled\n"));
|
|
9239
9223
|
return;
|
|
9240
9224
|
}
|
|
9241
9225
|
}
|
|
@@ -9255,104 +9239,104 @@ async function getLatestVersion() {
|
|
|
9255
9239
|
}
|
|
9256
9240
|
|
|
9257
9241
|
// src/commands/doctor.ts
|
|
9258
|
-
import
|
|
9242
|
+
import path18 from "path";
|
|
9259
9243
|
import fs13 from "fs-extra";
|
|
9260
|
-
import
|
|
9244
|
+
import chalk12 from "chalk";
|
|
9261
9245
|
async function doctor(directory) {
|
|
9262
|
-
const dir =
|
|
9263
|
-
console.log(
|
|
9264
|
-
console.log(
|
|
9265
|
-
console.log(
|
|
9246
|
+
const dir = path18.resolve(process.cwd(), directory);
|
|
9247
|
+
console.log(chalk12.blue.bold("\n\u{1FA7A} Baseboards Diagnostics\n"));
|
|
9248
|
+
console.log(chalk12.cyan("CLI Version:"), getCliVersion());
|
|
9249
|
+
console.log(chalk12.cyan("\n\u{1F4CB} Prerequisites:"));
|
|
9266
9250
|
const prereqs = await checkPrerequisites();
|
|
9267
9251
|
console.log(
|
|
9268
|
-
|
|
9269
|
-
prereqs.node.installed ? prereqs.node.satisfies ?
|
|
9252
|
+
chalk12.gray(" Node.js:"),
|
|
9253
|
+
prereqs.node.installed ? prereqs.node.satisfies ? chalk12.green(`\u2713 v${prereqs.node.version}`) : chalk12.yellow(`\u26A0\uFE0F v${prereqs.node.version} (need v20+)`) : chalk12.red("\u2717 Not installed")
|
|
9270
9254
|
);
|
|
9271
9255
|
console.log(
|
|
9272
|
-
|
|
9273
|
-
prereqs.docker.installed ?
|
|
9256
|
+
chalk12.gray(" Docker:"),
|
|
9257
|
+
prereqs.docker.installed ? chalk12.green(`\u2713 v${prereqs.docker.version}`) : chalk12.red("\u2717 Not installed")
|
|
9274
9258
|
);
|
|
9275
9259
|
if (prereqs.docker.composeVersion) {
|
|
9276
9260
|
console.log(
|
|
9277
|
-
|
|
9278
|
-
|
|
9261
|
+
chalk12.gray(" Docker Compose:"),
|
|
9262
|
+
chalk12.green(`\u2713 v${prereqs.docker.composeVersion}`)
|
|
9279
9263
|
);
|
|
9280
9264
|
} else if (prereqs.docker.installed) {
|
|
9281
|
-
console.log(
|
|
9265
|
+
console.log(chalk12.gray(" Docker Compose:"), chalk12.red("\u2717 Not available"));
|
|
9282
9266
|
}
|
|
9283
|
-
console.log(
|
|
9267
|
+
console.log(chalk12.gray(" Platform:"), prereqs.platform.name);
|
|
9284
9268
|
if (prereqs.platform.isWSL) {
|
|
9285
|
-
console.log(
|
|
9269
|
+
console.log(chalk12.gray(" WSL:"), chalk12.blue("\u2713 Detected"));
|
|
9286
9270
|
}
|
|
9287
|
-
console.log(
|
|
9271
|
+
console.log(chalk12.cyan("\n\u{1F4C2} Project:"));
|
|
9288
9272
|
const scaffolded = isScaffolded(dir);
|
|
9289
9273
|
console.log(
|
|
9290
|
-
|
|
9291
|
-
scaffolded ?
|
|
9274
|
+
chalk12.gray(" Scaffolded:"),
|
|
9275
|
+
scaffolded ? chalk12.green("\u2713 Yes") : chalk12.yellow("\u2717 No")
|
|
9292
9276
|
);
|
|
9293
9277
|
if (scaffolded) {
|
|
9294
|
-
console.log(
|
|
9295
|
-
const webPkg =
|
|
9296
|
-
const apiPkg =
|
|
9297
|
-
const composeFile =
|
|
9278
|
+
console.log(chalk12.gray(" Directory:"), dir);
|
|
9279
|
+
const webPkg = path18.join(dir, "web/package.json");
|
|
9280
|
+
const apiPkg = path18.join(dir, "api/pyproject.toml");
|
|
9281
|
+
const composeFile = path18.join(dir, "compose.yaml");
|
|
9298
9282
|
console.log(
|
|
9299
|
-
|
|
9300
|
-
fs13.existsSync(webPkg) ?
|
|
9283
|
+
chalk12.gray(" Web package:"),
|
|
9284
|
+
fs13.existsSync(webPkg) ? chalk12.green("\u2713") : chalk12.red("\u2717")
|
|
9301
9285
|
);
|
|
9302
9286
|
console.log(
|
|
9303
|
-
|
|
9304
|
-
fs13.existsSync(apiPkg) ?
|
|
9287
|
+
chalk12.gray(" API package:"),
|
|
9288
|
+
fs13.existsSync(apiPkg) ? chalk12.green("\u2713") : chalk12.red("\u2717")
|
|
9305
9289
|
);
|
|
9306
9290
|
console.log(
|
|
9307
|
-
|
|
9308
|
-
fs13.existsSync(composeFile) ?
|
|
9291
|
+
chalk12.gray(" Compose file:"),
|
|
9292
|
+
fs13.existsSync(composeFile) ? chalk12.green("\u2713") : chalk12.red("\u2717")
|
|
9309
9293
|
);
|
|
9310
|
-
console.log(
|
|
9311
|
-
const webEnv =
|
|
9312
|
-
const apiEnv =
|
|
9313
|
-
const dockerEnv =
|
|
9294
|
+
console.log(chalk12.cyan("\n\u{1F510} Environment:"));
|
|
9295
|
+
const webEnv = path18.join(dir, "web/.env");
|
|
9296
|
+
const apiEnv = path18.join(dir, "api/.env");
|
|
9297
|
+
const dockerEnv = path18.join(dir, "docker/.env");
|
|
9314
9298
|
console.log(
|
|
9315
|
-
|
|
9316
|
-
fs13.existsSync(webEnv) ?
|
|
9299
|
+
chalk12.gray(" Web .env:"),
|
|
9300
|
+
fs13.existsSync(webEnv) ? chalk12.green("\u2713") : chalk12.yellow("\u2717 Missing")
|
|
9317
9301
|
);
|
|
9318
9302
|
console.log(
|
|
9319
|
-
|
|
9320
|
-
fs13.existsSync(apiEnv) ?
|
|
9303
|
+
chalk12.gray(" API .env:"),
|
|
9304
|
+
fs13.existsSync(apiEnv) ? chalk12.green("\u2713") : chalk12.yellow("\u2717 Missing")
|
|
9321
9305
|
);
|
|
9322
9306
|
console.log(
|
|
9323
|
-
|
|
9324
|
-
fs13.existsSync(dockerEnv) ?
|
|
9307
|
+
chalk12.gray(" Docker .env:"),
|
|
9308
|
+
fs13.existsSync(dockerEnv) ? chalk12.green("\u2713") : chalk12.yellow("\u2717 Missing")
|
|
9325
9309
|
);
|
|
9326
9310
|
if (fs13.existsSync(apiEnv)) {
|
|
9327
9311
|
const missingKeys = detectMissingProviderKeys(apiEnv);
|
|
9328
9312
|
if (missingKeys.length > 0) {
|
|
9329
9313
|
console.log(
|
|
9330
|
-
|
|
9331
|
-
|
|
9314
|
+
chalk12.gray(" Provider keys:"),
|
|
9315
|
+
chalk12.yellow(`\u26A0\uFE0F ${missingKeys.length} missing`)
|
|
9332
9316
|
);
|
|
9333
|
-
console.log(
|
|
9317
|
+
console.log(chalk12.gray(" Missing:"), missingKeys.map((k) => chalk12.cyan(k)).join(", "));
|
|
9334
9318
|
} else {
|
|
9335
|
-
console.log(
|
|
9319
|
+
console.log(chalk12.gray(" Provider keys:"), chalk12.green("\u2713 Configured"));
|
|
9336
9320
|
}
|
|
9337
9321
|
}
|
|
9338
|
-
console.log(
|
|
9339
|
-
const generatorsYaml =
|
|
9340
|
-
const storageYaml =
|
|
9322
|
+
console.log(chalk12.cyan("\n\u2699\uFE0F Configuration:"));
|
|
9323
|
+
const generatorsYaml = path18.join(dir, "api/config/generators.yaml");
|
|
9324
|
+
const storageYaml = path18.join(dir, "api/config/storage_config.yaml");
|
|
9341
9325
|
console.log(
|
|
9342
|
-
|
|
9343
|
-
fs13.existsSync(generatorsYaml) ?
|
|
9326
|
+
chalk12.gray(" generators.yaml:"),
|
|
9327
|
+
fs13.existsSync(generatorsYaml) ? chalk12.green("\u2713") : chalk12.yellow("\u2717 Missing")
|
|
9344
9328
|
);
|
|
9345
9329
|
console.log(
|
|
9346
|
-
|
|
9347
|
-
fs13.existsSync(storageYaml) ?
|
|
9330
|
+
chalk12.gray(" storage_config.yaml:"),
|
|
9331
|
+
fs13.existsSync(storageYaml) ? chalk12.green("\u2713") : chalk12.yellow("\u2717 Missing")
|
|
9348
9332
|
);
|
|
9349
|
-
const storageDir =
|
|
9333
|
+
const storageDir = path18.join(dir, "data/storage");
|
|
9350
9334
|
console.log(
|
|
9351
|
-
|
|
9352
|
-
fs13.existsSync(storageDir) ?
|
|
9335
|
+
chalk12.gray(" Storage directory:"),
|
|
9336
|
+
fs13.existsSync(storageDir) ? chalk12.green("\u2713") : chalk12.yellow("\u2717 Missing")
|
|
9353
9337
|
);
|
|
9354
9338
|
}
|
|
9355
|
-
console.log(
|
|
9339
|
+
console.log(chalk12.cyan("\n\u{1F4A1} Recommendations:"));
|
|
9356
9340
|
const recommendations = [];
|
|
9357
9341
|
if (!prereqs.node.satisfies) {
|
|
9358
9342
|
recommendations.push("Upgrade Node.js to v20 or higher");
|
|
@@ -9363,18 +9347,18 @@ async function doctor(directory) {
|
|
|
9363
9347
|
recommendations.push("Update Docker to get Compose v2");
|
|
9364
9348
|
}
|
|
9365
9349
|
if (!scaffolded) {
|
|
9366
|
-
recommendations.push("Run " +
|
|
9350
|
+
recommendations.push("Run " + chalk12.cyan("baseboards up") + " to scaffold a project");
|
|
9367
9351
|
}
|
|
9368
9352
|
if (recommendations.length === 0) {
|
|
9369
|
-
console.log(
|
|
9353
|
+
console.log(chalk12.green(" \u2713 Everything looks good!"));
|
|
9370
9354
|
} else {
|
|
9371
|
-
recommendations.forEach((rec) => console.log(
|
|
9355
|
+
recommendations.forEach((rec) => console.log(chalk12.yellow(" \u2022"), rec));
|
|
9372
9356
|
}
|
|
9373
9357
|
console.log();
|
|
9374
9358
|
}
|
|
9375
9359
|
|
|
9376
9360
|
// src/commands/templates.ts
|
|
9377
|
-
import
|
|
9361
|
+
import chalk13 from "chalk";
|
|
9378
9362
|
function formatSize(bytes) {
|
|
9379
9363
|
if (bytes < 1024) {
|
|
9380
9364
|
return `${bytes} B`;
|
|
@@ -9385,22 +9369,22 @@ function formatSize(bytes) {
|
|
|
9385
9369
|
}
|
|
9386
9370
|
}
|
|
9387
9371
|
function displayTemplate(template, isRecommended) {
|
|
9388
|
-
const name =
|
|
9389
|
-
const recommended = isRecommended ?
|
|
9372
|
+
const name = chalk13.bold(template.name);
|
|
9373
|
+
const recommended = isRecommended ? chalk13.cyan(" (recommended)") : "";
|
|
9390
9374
|
console.log(`
|
|
9391
9375
|
${name}${recommended}`);
|
|
9392
9376
|
console.log(` ${template.description}`);
|
|
9393
9377
|
const frameworks = template.frameworks.join(", ");
|
|
9394
|
-
console.log(` ${
|
|
9378
|
+
console.log(` ${chalk13.gray("Frameworks:")} ${frameworks}`);
|
|
9395
9379
|
const features = template.features.join(", ");
|
|
9396
|
-
console.log(` ${
|
|
9380
|
+
console.log(` ${chalk13.gray("Features:")} ${features}`);
|
|
9397
9381
|
const size = formatSize(template.size);
|
|
9398
|
-
console.log(` ${
|
|
9382
|
+
console.log(` ${chalk13.gray("Size:")} ${size}`);
|
|
9399
9383
|
}
|
|
9400
9384
|
async function templates(options) {
|
|
9401
9385
|
try {
|
|
9402
9386
|
if (options.refresh) {
|
|
9403
|
-
console.log(
|
|
9387
|
+
console.log(chalk13.blue("\u{1F504} Clearing cache and refreshing templates...\n"));
|
|
9404
9388
|
await clearCache();
|
|
9405
9389
|
}
|
|
9406
9390
|
const version = options.version || getCliVersion();
|
|
@@ -9410,24 +9394,24 @@ async function templates(options) {
|
|
|
9410
9394
|
} catch (error) {
|
|
9411
9395
|
if (error.message.includes("Failed to fetch")) {
|
|
9412
9396
|
console.error(
|
|
9413
|
-
|
|
9397
|
+
chalk13.red("\n\u274C Network error:"),
|
|
9414
9398
|
"Unable to fetch template list"
|
|
9415
9399
|
);
|
|
9416
9400
|
console.log(
|
|
9417
|
-
|
|
9401
|
+
chalk13.yellow("\n\u{1F4A1} Tip:"),
|
|
9418
9402
|
"Check your internet connection or try again later"
|
|
9419
9403
|
);
|
|
9420
9404
|
process.exit(1);
|
|
9421
9405
|
}
|
|
9422
9406
|
if (error.message.includes("not found")) {
|
|
9423
9407
|
console.error(
|
|
9424
|
-
|
|
9408
|
+
chalk13.red("\n\u274C Version not found:"),
|
|
9425
9409
|
`Version ${version} does not exist`
|
|
9426
9410
|
);
|
|
9427
9411
|
console.log(
|
|
9428
|
-
|
|
9412
|
+
chalk13.yellow("\n\u{1F4A1} Tip:"),
|
|
9429
9413
|
"Check available versions at:",
|
|
9430
|
-
|
|
9414
|
+
chalk13.cyan("https://github.com/weirdfingers/boards/releases")
|
|
9431
9415
|
);
|
|
9432
9416
|
process.exit(1);
|
|
9433
9417
|
}
|
|
@@ -9435,13 +9419,13 @@ async function templates(options) {
|
|
|
9435
9419
|
}
|
|
9436
9420
|
if (!manifest.templates || manifest.templates.length === 0) {
|
|
9437
9421
|
console.log(
|
|
9438
|
-
|
|
9422
|
+
chalk13.yellow("\n\u26A0\uFE0F No templates available for version"),
|
|
9439
9423
|
manifest.version
|
|
9440
9424
|
);
|
|
9441
9425
|
process.exit(0);
|
|
9442
9426
|
}
|
|
9443
9427
|
console.log(
|
|
9444
|
-
|
|
9428
|
+
chalk13.blue.bold(`
|
|
9445
9429
|
\u{1F4E6} Available templates for v${manifest.version}:`)
|
|
9446
9430
|
);
|
|
9447
9431
|
for (const template of manifest.templates) {
|
|
@@ -9450,10 +9434,10 @@ async function templates(options) {
|
|
|
9450
9434
|
}
|
|
9451
9435
|
console.log();
|
|
9452
9436
|
} catch (error) {
|
|
9453
|
-
console.error(
|
|
9437
|
+
console.error(chalk13.red("\n\u274C Error:"), error.message || "Unknown error");
|
|
9454
9438
|
console.error(
|
|
9455
|
-
|
|
9456
|
-
|
|
9439
|
+
chalk13.yellow("\n\u{1F4A1} Try running:"),
|
|
9440
|
+
chalk13.cyan("baseboards doctor")
|
|
9457
9441
|
);
|
|
9458
9442
|
process.exit(1);
|
|
9459
9443
|
}
|
|
@@ -9479,7 +9463,6 @@ program.command("logs").description("View logs from services").argument("[direct
|
|
|
9479
9463
|
).option("-f, --follow", "Follow log output").option("--since <time>", "Show logs since timestamp (e.g., 1h, 30m)").option("--tail <lines>", "Number of lines to show from end", "100").action(logs);
|
|
9480
9464
|
program.command("status").description("Show status of services").argument("[directory]", "Project directory", ".").action(status);
|
|
9481
9465
|
program.command("clean").description("Clean up Docker resources").argument("[directory]", "Project directory", ".").option("--hard", "Remove volumes and images (WARNING: deletes data)").action(clean);
|
|
9482
|
-
program.command("update").description("Update Baseboards to latest version (deprecated - use upgrade)").argument("[directory]", "Project directory", ".").option("--force", "Force update without safety checks").option("--version <version>", "Update to specific version").action(update);
|
|
9483
9466
|
program.command("upgrade").description("Upgrade Baseboards to a specific or latest version").argument("[directory]", "Project directory", ".").option("--version <version>", "Upgrade to specific version (default: latest)").option("--dry-run", "Preview upgrade without making changes").option("--force", "Skip confirmation prompts and compatibility warnings").addHelpText("after", `
|
|
9484
9467
|
Examples:
|
|
9485
9468
|
$ baseboards upgrade Upgrade to latest version
|
|
@@ -9499,18 +9482,18 @@ try {
|
|
|
9499
9482
|
process.exit(1);
|
|
9500
9483
|
}
|
|
9501
9484
|
const err = error;
|
|
9502
|
-
console.error(
|
|
9485
|
+
console.error(chalk14.red("\n\u274C Error:"), err.message || "Unknown error");
|
|
9503
9486
|
if (err.stderr) {
|
|
9504
|
-
console.error(
|
|
9505
|
-
console.error(
|
|
9487
|
+
console.error(chalk14.gray("\nDetails:"));
|
|
9488
|
+
console.error(chalk14.gray(err.stderr));
|
|
9506
9489
|
}
|
|
9507
9490
|
console.error(
|
|
9508
|
-
|
|
9509
|
-
|
|
9491
|
+
chalk14.yellow("\n\u{1F4A1} Try running:"),
|
|
9492
|
+
chalk14.cyan("baseboards doctor")
|
|
9510
9493
|
);
|
|
9511
9494
|
console.error(
|
|
9512
|
-
|
|
9513
|
-
|
|
9495
|
+
chalk14.yellow("\u{1F4D6} Documentation:"),
|
|
9496
|
+
chalk14.cyan("https://baseboards.dev/docs")
|
|
9514
9497
|
);
|
|
9515
9498
|
process.exit(1);
|
|
9516
9499
|
}
|