boardui 0.4.0 → 0.4.2
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 +79 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -139,7 +139,7 @@ import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, rm
|
|
|
139
139
|
import { homedir, hostname } from "os";
|
|
140
140
|
import path2 from "path";
|
|
141
141
|
var LICENSE_API = "https://api.lemonsqueezy.com/v1/licenses";
|
|
142
|
-
var PRO_PRODUCT_IDS = /* @__PURE__ */ new Set([1220683]);
|
|
142
|
+
var PRO_PRODUCT_IDS = /* @__PURE__ */ new Set([1220683, 1268490]);
|
|
143
143
|
function configRoot() {
|
|
144
144
|
if (process.env.XDG_CONFIG_HOME) return process.env.XDG_CONFIG_HOME;
|
|
145
145
|
if (process.platform === "win32" && process.env.APPDATA) return process.env.APPDATA;
|
|
@@ -216,7 +216,25 @@ async function activateLicense(licenseKey) {
|
|
|
216
216
|
seatsUsed: data.license_key?.activation_usage ?? 1,
|
|
217
217
|
seatLimit: data.license_key?.activation_limit ?? 0,
|
|
218
218
|
productName: data.meta?.product_name ?? "BoardUI Pro",
|
|
219
|
-
warning: data.meta && !PRO_PRODUCT_IDS.has(data.meta.product_id) ? `This key belongs to "${data.meta.product_name}", not BoardUI Pro \u2014 pro installs
|
|
219
|
+
warning: data.meta && !PRO_PRODUCT_IDS.has(data.meta.product_id) ? `This key belongs to "${data.meta.product_name}", which this CLI version does not recognize as BoardUI Pro. The server has the final say \u2014 if pro installs are refused, update the CLI (npx boardui@latest) or contact hi@boardui.com.` : void 0
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
async function validateStoredLicense() {
|
|
223
|
+
const license = getLicense();
|
|
224
|
+
if (!license) return null;
|
|
225
|
+
const fields = { license_key: license.licenseKey };
|
|
226
|
+
if (license.instanceId) fields.instance_id = license.instanceId;
|
|
227
|
+
const data = await licenseApi("validate", fields);
|
|
228
|
+
if (!data.valid) {
|
|
229
|
+
return { valid: false, error: data.error ?? "This license key is not valid." };
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
valid: true,
|
|
233
|
+
status: data.license_key?.status,
|
|
234
|
+
seatsUsed: data.license_key?.activation_usage,
|
|
235
|
+
seatLimit: data.license_key?.activation_limit,
|
|
236
|
+
productName: data.meta?.product_name,
|
|
237
|
+
unknownProduct: data.meta ? !PRO_PRODUCT_IDS.has(data.meta.product_id) : void 0
|
|
220
238
|
};
|
|
221
239
|
}
|
|
222
240
|
async function deactivateLicense() {
|
|
@@ -1218,7 +1236,23 @@ ${proItem.example}
|
|
|
1218
1236
|
if (installable.length === 0) {
|
|
1219
1237
|
return text(proPitch(lockedPro));
|
|
1220
1238
|
}
|
|
1221
|
-
const
|
|
1239
|
+
const proNamesSet = new Set(pro.items.map((item) => item.name));
|
|
1240
|
+
let items;
|
|
1241
|
+
let proFailure = null;
|
|
1242
|
+
try {
|
|
1243
|
+
items = await resolveItems(installable);
|
|
1244
|
+
} catch (error) {
|
|
1245
|
+
const freeSubset = installable.filter((name) => !proNamesSet.has(name));
|
|
1246
|
+
const proSubset = installable.filter((name) => proNamesSet.has(name));
|
|
1247
|
+
if (proSubset.length === 0) throw error;
|
|
1248
|
+
proFailure = { names: proSubset, message: error.message };
|
|
1249
|
+
if (freeSubset.length === 0) {
|
|
1250
|
+
return errorText(
|
|
1251
|
+
`Pro item${proSubset.length === 1 ? "" : "s"} (${proSubset.join(", ")}) could not be fetched: ${proFailure.message}`
|
|
1252
|
+
);
|
|
1253
|
+
}
|
|
1254
|
+
items = await resolveItems(freeSubset);
|
|
1255
|
+
}
|
|
1222
1256
|
const targetRoot = sourceRoot(project);
|
|
1223
1257
|
const report = writeFiles(collectWrites(items, targetRoot, project.cwd), overwrite);
|
|
1224
1258
|
const assets = await downloadAssets(items, targetRoot, overwrite);
|
|
@@ -1233,7 +1267,7 @@ ${proItem.example}
|
|
|
1233
1267
|
});
|
|
1234
1268
|
}
|
|
1235
1269
|
const lines = [
|
|
1236
|
-
`
|
|
1270
|
+
`Resolved ${items.length} item${items.length === 1 ? "" : "s"} (${items.map((item) => item.name).join(", ")}) into ${targetRoot}: ${written} file${written === 1 ? "" : "s"} written, ${report.skipped.length} already present and untouched.`,
|
|
1237
1271
|
"",
|
|
1238
1272
|
...report.created.map((relPath) => ` created ${relPath}`),
|
|
1239
1273
|
...report.overwritten.map((relPath) => ` overwrote ${relPath}`),
|
|
@@ -1263,6 +1297,13 @@ ${proItem.example}
|
|
|
1263
1297
|
NOT installed (pro, no license): ${lockedPro.map((item) => item.name).join(", ")}.
|
|
1264
1298
|
|
|
1265
1299
|
${proPitch(lockedPro)}`;
|
|
1300
|
+
}
|
|
1301
|
+
if (proFailure) {
|
|
1302
|
+
result += `
|
|
1303
|
+
|
|
1304
|
+
---
|
|
1305
|
+
|
|
1306
|
+
NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proFailure.message}`;
|
|
1266
1307
|
}
|
|
1267
1308
|
return text(result);
|
|
1268
1309
|
}
|
|
@@ -1303,6 +1344,9 @@ ${proPitch(lockedPro)}`;
|
|
|
1303
1344
|
source: "mcp"
|
|
1304
1345
|
});
|
|
1305
1346
|
}
|
|
1347
|
+
const staleStylesheet = ["app/globals.css", "src/app/globals.css"].find(
|
|
1348
|
+
(rel) => existsSync6(path7.join(project.cwd, rel))
|
|
1349
|
+
);
|
|
1306
1350
|
const lines = [
|
|
1307
1351
|
`BoardUI initialized in ${project.cwd}.`,
|
|
1308
1352
|
...project.isNextJs ? [] : [
|
|
@@ -1320,7 +1364,11 @@ ${proPitch(lockedPro)}`;
|
|
|
1320
1364
|
"Finish the wiring:",
|
|
1321
1365
|
'1. Import the BoardUI stylesheet in the root layout (app/layout.tsx): import "@/styles/globals.css"; \u2014 replacing the default create-next-app "./globals.css" import.',
|
|
1322
1366
|
'2. Make sure PostCSS uses Tailwind v4 (postcss.config.mjs): export default { plugins: { "@tailwindcss/postcss": {} } };',
|
|
1323
|
-
'3. Install components with install_components, e.g. ["button", "select", "date-picker"].'
|
|
1367
|
+
'3. Install components with install_components, e.g. ["button", "select", "date-picker"].',
|
|
1368
|
+
...staleStylesheet ? [
|
|
1369
|
+
"",
|
|
1370
|
+
`Note: ${staleStylesheet} is create-next-app's stylesheet, superseded by styles/globals.css \u2014 once step 1's import is swapped, that file is safe to delete.`
|
|
1371
|
+
] : []
|
|
1324
1372
|
];
|
|
1325
1373
|
return text(lines.join("\n") + aliasWarning(project));
|
|
1326
1374
|
}
|
|
@@ -1384,10 +1432,13 @@ ${proPitch(lockedPro)}`;
|
|
|
1384
1432
|
},
|
|
1385
1433
|
safe(async ({ licenseKey }) => {
|
|
1386
1434
|
const result = await activateLicense(licenseKey.trim());
|
|
1387
|
-
const lines = [
|
|
1435
|
+
const lines = result.warning ? [
|
|
1436
|
+
`License key activated and stored (product: ${result.productName}).`,
|
|
1437
|
+
`Warning: ${result.warning}`,
|
|
1438
|
+
...result.seatLimit > 0 ? [`Seats in use: ${result.seatsUsed}/${result.seatLimit}.`] : []
|
|
1439
|
+
] : [
|
|
1388
1440
|
`License activated for ${result.productName}. Pro installs are unlocked on this machine.`,
|
|
1389
1441
|
...result.seatLimit > 0 ? [`Seats in use: ${result.seatsUsed}/${result.seatLimit}.`] : [],
|
|
1390
|
-
...result.warning ? [`Warning: ${result.warning}`] : [],
|
|
1391
1442
|
"",
|
|
1392
1443
|
'Try it: install_components with a pro item, e.g. ["agent-progress"].'
|
|
1393
1444
|
];
|
|
@@ -1398,7 +1449,7 @@ ${proPitch(lockedPro)}`;
|
|
|
1398
1449
|
"license_status",
|
|
1399
1450
|
{
|
|
1400
1451
|
title: "Check Pro license status",
|
|
1401
|
-
description: "
|
|
1452
|
+
description: "Validates the stored BoardUI Pro license against Lemon Squeezy (product, status, seats) \u2014 not just whether a key file exists. Key is shown masked.",
|
|
1402
1453
|
annotations: { readOnlyHint: true }
|
|
1403
1454
|
},
|
|
1404
1455
|
safe(async () => {
|
|
@@ -1408,8 +1459,27 @@ ${proPitch(lockedPro)}`;
|
|
|
1408
1459
|
`No Pro license on this machine. Pro items need a one-time purchase: ${PRICING_URL} \u2014 if the user already purchased, ask for their license key and call activate_license.`
|
|
1409
1460
|
);
|
|
1410
1461
|
}
|
|
1462
|
+
let validation;
|
|
1463
|
+
try {
|
|
1464
|
+
validation = await validateStoredLicense();
|
|
1465
|
+
} catch {
|
|
1466
|
+
return text(
|
|
1467
|
+
`A license key is stored (${maskKey(license.licenseKey)}) but the license server could not be reached to validate it. Pro installs validate server-side on every download, so try one to find out.`
|
|
1468
|
+
);
|
|
1469
|
+
}
|
|
1470
|
+
if (!validation || !validation.valid) {
|
|
1471
|
+
return text(
|
|
1472
|
+
`A license key is stored (${maskKey(license.licenseKey)}) but Lemon Squeezy rejects it: ${validation?.error ?? "not valid"}. Ask the user to re-check the key from their receipt, or contact hi@boardui.com.`
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1475
|
+
const seats = validation.seatLimit && validation.seatLimit > 0 ? ` Seats: ${validation.seatsUsed}/${validation.seatLimit}.` : "";
|
|
1476
|
+
if (validation.unknownProduct) {
|
|
1477
|
+
return text(
|
|
1478
|
+
`License key ${maskKey(license.licenseKey)} is valid and ${validation.status} for "${validation.productName}", which this CLI version does not recognize as BoardUI Pro.${seats} The server has the final say \u2014 try a pro install; if it is refused, update the CLI or contact hi@boardui.com.`
|
|
1479
|
+
);
|
|
1480
|
+
}
|
|
1411
1481
|
return text(
|
|
1412
|
-
`Pro license
|
|
1482
|
+
`Pro license valid and ${validation.status}: ${maskKey(license.licenseKey)} ("${validation.productName}").${seats} Pro components and templates install like free ones.`
|
|
1413
1483
|
);
|
|
1414
1484
|
})
|
|
1415
1485
|
);
|