bejamas 0.5.0 → 0.6.0
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/README.md +10 -1
- package/dist/{generate-mdx-Bd_qGcMg.js → generate-mdx-Cb8rPipn.js} +2 -2
- package/dist/{generate-mdx-Bd_qGcMg.js.map → generate-mdx-Cb8rPipn.js.map} +1 -1
- package/dist/index.js +121 -59
- package/dist/index.js.map +1 -1
- package/dist/{utils-BEqgES6q.js → utils-Dmd3Tydo.js} +146 -52
- package/dist/utils-Dmd3Tydo.js.map +1 -0
- package/package.json +3 -2
- package/src/tailwind.css +20 -0
- package/dist/utils-BEqgES6q.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as PRESET_MENU_COLORS, A as SEMANTIC_ICON_NAMES, B as getFontValue, C as BEJAMAS_COMPONENTS_SCHEMA_URL, D as ICON_LIBRARIES, E as resolveRegistryUrl, F as RTL_LANGUAGE_VALUES, G as normalizeDesignSystemConfig, H as getRadiusValue, I as designSystemConfigSchema, J as PRESET_CHART_COLORS, K as DEFAULT_PRESET_CONFIG, L as getDocumentDirection, M as getSemanticIconNameFromLucidePath, N as renderSemanticIconSvgWithAttributeString, O as buildRegistryTheme, P as DEFAULT_DESIGN_SYSTEM_CONFIG, Q as PRESET_MENU_ACCENTS, R as getDocumentLanguage, S as highlighter, T as buildUiUrl, U as getStyleDefaultRadius, V as getHeadingFontValue, W as getStyleId, X as PRESET_FONT_HEADINGS, Y as PRESET_FONTS, Z as PRESET_ICON_LIBRARIES, _ as findCommonRoot, at as encodePreset, b as getProjectInfo, d as parseJsDocMetadata, et as PRESET_RADII, g as spinner, it as decodePreset, j as getSemanticIconNameFromLucideExport, k as ICON_LIBRARY_COLLECTIONS, nt as PRESET_THEMES, o as extractFrontmatter, ot as isPresetCode, p as resolveUiRoot, q as PRESET_BASE_COLORS, rt as V1_CHART_COLOR_MAP, st as fonts, tt as PRESET_STYLES, v as getConfig, w as BASE_COLORS, x as logger, y as getWorkspaceConfig, z as getFontPackageName } from "./utils-
|
|
2
|
+
import { $ as PRESET_MENU_COLORS, A as SEMANTIC_ICON_NAMES, B as getFontValue, C as BEJAMAS_COMPONENTS_SCHEMA_URL, D as ICON_LIBRARIES, E as resolveRegistryUrl, F as RTL_LANGUAGE_VALUES, G as normalizeDesignSystemConfig, H as getRadiusValue, I as designSystemConfigSchema, J as PRESET_CHART_COLORS, K as DEFAULT_PRESET_CONFIG, L as getDocumentDirection, M as getSemanticIconNameFromLucidePath, N as renderSemanticIconSvgWithAttributeString, O as buildRegistryTheme, P as DEFAULT_DESIGN_SYSTEM_CONFIG, Q as PRESET_MENU_ACCENTS, R as getDocumentLanguage, S as highlighter, T as buildUiUrl, U as getStyleDefaultRadius, V as getHeadingFontValue, W as getStyleId, X as PRESET_FONT_HEADINGS, Y as PRESET_FONTS, Z as PRESET_ICON_LIBRARIES, _ as findCommonRoot, at as encodePreset, b as getProjectInfo, d as parseJsDocMetadata, et as PRESET_RADII, g as spinner, it as decodePreset, j as getSemanticIconNameFromLucideExport, k as ICON_LIBRARY_COLLECTIONS, nt as PRESET_THEMES, o as extractFrontmatter, ot as isPresetCode, p as resolveUiRoot, q as PRESET_BASE_COLORS, rt as V1_CHART_COLOR_MAP, st as fonts, tt as PRESET_STYLES, v as getConfig, w as BASE_COLORS, x as logger, y as getWorkspaceConfig, z as getFontPackageName } from "./utils-Dmd3Tydo.js";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { createRequire } from "module";
|
|
5
5
|
import path, { extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -61,6 +61,15 @@ const STARLIGHT_HEAD_RELATIVE_PATH = "apps/docs/src/components/Head.astro";
|
|
|
61
61
|
const ASTRO_FONT_PROVIDERS = ["fontsource", "google"];
|
|
62
62
|
const ASTRO_FONTSOURCE_FONT_NAMES = /* @__PURE__ */ new Set(["geist", "geist-mono"]);
|
|
63
63
|
const MANAGED_BODY_FONT_CLASSES = /* @__PURE__ */ new Set(["font-mono", "font-serif"]);
|
|
64
|
+
function parseStringArray(source) {
|
|
65
|
+
if (!source) return void 0;
|
|
66
|
+
try {
|
|
67
|
+
const parsed = JSON.parse(source);
|
|
68
|
+
return Array.isArray(parsed) && parsed.length > 0 && parsed.every((value) => typeof value === "string") ? parsed : void 0;
|
|
69
|
+
} catch {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
64
73
|
function compactSource$1(source) {
|
|
65
74
|
return source.replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
|
|
66
75
|
}
|
|
@@ -81,7 +90,7 @@ function upsertImport(source, moduleName, importedName, fallbackNames = []) {
|
|
|
81
90
|
return `${importLine}\n${source}`;
|
|
82
91
|
}
|
|
83
92
|
function buildAstroConfigFontBlock(fontsToSerialize) {
|
|
84
|
-
const body = fontsToSerialize.length === 0 ? "" : `\n${fontsToSerialize.map((font) => ` {\n provider: fontProviders.${font.provider}(),\n name: ${JSON.stringify(font.name)},\n cssVariable: ${JSON.stringify(font.cssVariable)},\n subsets: ${JSON.stringify(font.subsets)},\n },`).join("\n")}\n`;
|
|
93
|
+
const body = fontsToSerialize.length === 0 ? "" : `\n${fontsToSerialize.map((font) => ` {\n provider: fontProviders.${font.provider}(),\n name: ${JSON.stringify(font.name)},\n cssVariable: ${JSON.stringify(font.cssVariable)},\n${font.weights ? ` weights: ${JSON.stringify(font.weights)},\n` : ""} subsets: ${JSON.stringify(font.subsets)},\n },`).join("\n")}\n`;
|
|
85
94
|
return `${ASTRO_CONFIG_BLOCK_START}\n/** @type {NonNullable<import("astro").AstroUserConfig["fonts"]>} */\nconst ${ASTRO_FONT_CONSTANT} = [${body}];\n${ASTRO_CONFIG_BLOCK_END}`;
|
|
86
95
|
}
|
|
87
96
|
function buildAstroLayoutFontBlock(fontsToSerialize) {
|
|
@@ -116,19 +125,14 @@ function parseManagedAstroFonts(source) {
|
|
|
116
125
|
const cssVariable = entry.match(/cssVariable:\s*"([^"]+)"/)?.[1];
|
|
117
126
|
const provider = entry.match(/provider:\s*fontProviders\.([a-z]+)\(\)/)?.[1];
|
|
118
127
|
const subsetsSource = entry.match(/subsets:\s*(\[[^\]]*\])/s)?.[1];
|
|
128
|
+
const weights = parseStringArray(entry.match(/weights:\s*(\[[^\]]*\])/s)?.[1]);
|
|
119
129
|
if (!name || !cssVariable || !provider || !ASTRO_FONT_PROVIDERS.includes(provider)) return null;
|
|
120
|
-
let subsets = ["latin"];
|
|
121
|
-
if (subsetsSource) try {
|
|
122
|
-
const parsed = JSON.parse(subsetsSource);
|
|
123
|
-
if (Array.isArray(parsed) && parsed.length > 0 && parsed.every((value) => typeof value === "string")) subsets = parsed;
|
|
124
|
-
} catch {
|
|
125
|
-
subsets = ["latin"];
|
|
126
|
-
}
|
|
127
130
|
return {
|
|
128
131
|
name,
|
|
129
132
|
cssVariable,
|
|
130
133
|
provider,
|
|
131
|
-
subsets
|
|
134
|
+
subsets: parseStringArray(subsetsSource) ?? ["latin"],
|
|
135
|
+
...weights && { weights }
|
|
132
136
|
};
|
|
133
137
|
}).filter((value) => value !== null);
|
|
134
138
|
}
|
|
@@ -232,7 +236,8 @@ function toManagedAstroFont(fontName) {
|
|
|
232
236
|
name: font.title?.replace(/\s+\(Heading\)$/, "") ?? font.font.import.replace(/_/g, " "),
|
|
233
237
|
cssVariable: font.font.variable,
|
|
234
238
|
provider: ASTRO_FONTSOURCE_FONT_NAMES.has(normalized) ? "fontsource" : "google",
|
|
235
|
-
subsets: normalizeManagedAstroFontSubsets(font.font.subsets)
|
|
239
|
+
subsets: normalizeManagedAstroFontSubsets(font.font.subsets),
|
|
240
|
+
...font.font.weight?.length && { weights: [...font.font.weight] }
|
|
236
241
|
};
|
|
237
242
|
}
|
|
238
243
|
function mergeManagedAstroFonts(currentFonts, nextFont) {
|
|
@@ -676,10 +681,17 @@ function transformStarterPageToI18n(source) {
|
|
|
676
681
|
if (!match) return source;
|
|
677
682
|
return compactSource(match.i18nSource);
|
|
678
683
|
}
|
|
679
|
-
|
|
684
|
+
/**
|
|
685
|
+
* Astro's <Font> defines the font variables outside any cascade layer, so it
|
|
686
|
+
* beats Tailwind's theme layer. The body font therefore needs no theme line
|
|
687
|
+
* (without a <Font>, Tailwind's default stack applies), and the heading font
|
|
688
|
+
* falls back to the body font until a heading <Font> defines it.
|
|
689
|
+
*/
|
|
690
|
+
function upsertThemeInlineFont(source, fontVariable = "--font-sans") {
|
|
680
691
|
const pattern = /@theme inline\s*\{[\s\S]*?\n\}/m;
|
|
692
|
+
const declarations = ` --font-heading: var(--font-heading, var(${fontVariable}));`;
|
|
681
693
|
if (!pattern.test(source)) {
|
|
682
|
-
const block = `@theme inline {\n${
|
|
694
|
+
const block = `@theme inline {\n${declarations}\n}`;
|
|
683
695
|
const customVariantIndex = source.indexOf("@custom-variant");
|
|
684
696
|
if (customVariantIndex !== -1) {
|
|
685
697
|
const nextLineIndex = source.indexOf("\n", customVariantIndex);
|
|
@@ -688,9 +700,7 @@ function upsertThemeInlineFont(source, fontVariable) {
|
|
|
688
700
|
return `${block}\n\n${source.trimStart()}`;
|
|
689
701
|
}
|
|
690
702
|
return source.replace(pattern, (block) => {
|
|
691
|
-
|
|
692
|
-
const declarations = [fontVariable ? ` ${fontVariable}: var(${fontVariable});` : null, " --font-heading: var(--font-heading);"].filter(Boolean).join("\n");
|
|
693
|
-
return withoutManagedFonts.replace("@theme inline {\n", `@theme inline {\n${declarations}\n`);
|
|
703
|
+
return block.replace(/\n\s*--font-(sans|serif|mono|heading):[^\n]+/g, "").replace(/\n\s*--bejamas-font-family:[^\n]+/g, "").replace(/@theme inline\s*\{\n?/, "@theme inline {\n").replace("@theme inline {\n", `@theme inline {\n${declarations}\n`);
|
|
694
704
|
});
|
|
695
705
|
}
|
|
696
706
|
function upsertBaseLayerHtmlFont(source, fontClass) {
|
|
@@ -706,7 +716,7 @@ function transformDesignSystemCss(source, config, themeVars) {
|
|
|
706
716
|
function transformDesignSystemThemeCss(source, config, themeVars) {
|
|
707
717
|
const effectiveThemeVars = themeVars ?? buildRegistryTheme(config).cssVars;
|
|
708
718
|
const rootVars = {
|
|
709
|
-
...Object.fromEntries(Object.entries(effectiveThemeVars.theme ?? {}).filter(([key]) => key !== "bejamas-font-family")),
|
|
719
|
+
...Object.fromEntries(Object.entries(effectiveThemeVars.theme ?? {}).filter(([key]) => key !== "bejamas-font-family" && key !== "font-heading")),
|
|
710
720
|
...effectiveThemeVars.light ?? {}
|
|
711
721
|
};
|
|
712
722
|
const darkVars = { ...effectiveThemeVars.dark ?? {} };
|
|
@@ -870,7 +880,7 @@ async function patchLayoutFile(filepath, config) {
|
|
|
870
880
|
}
|
|
871
881
|
const nextLanguage = getDocumentLanguage(config);
|
|
872
882
|
const nextDirection = getDocumentDirection(config);
|
|
873
|
-
let next = current.replace(/<html([^>]*?)
|
|
883
|
+
let next = current.replace(/<html([^>]*?)\slang="[^"]*"([^>]*)>/, "<html$1$2>").replace(/<html([^>]*?)\sdir="[^"]*"([^>]*)>/, "<html$1$2>");
|
|
874
884
|
next = next.replace(/<html([^>]*)>/, `<html$1 lang="${nextLanguage}"${config.rtl ? ` dir="${nextDirection}"` : ""}>`);
|
|
875
885
|
if (next !== current) await fs.writeFile(filepath, next, "utf8");
|
|
876
886
|
}
|
|
@@ -1363,20 +1373,33 @@ async function copyTemplateFromGitHub(templateDirName, projectPath) {
|
|
|
1363
1373
|
failures.join("\n")
|
|
1364
1374
|
].join("\n"));
|
|
1365
1375
|
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1376
|
+
/** A valid npm package name derived from the project's folder name. */
|
|
1377
|
+
function toPackageName(projectName) {
|
|
1378
|
+
return path$1.basename(projectName).toLowerCase().replace(/[^a-z0-9._~-]+/g, "-").replace(/^[._-]+|-+$/g, "") || "my-app";
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Fit the template's manifests to this project: the root package takes the
|
|
1382
|
+
* project's name (the template's `astro` shadows the real `astro` package in a
|
|
1383
|
+
* workspace), and every `bejamas` dependency points at the running CLI version,
|
|
1384
|
+
* or at `BEJAMAS_PACKAGE_OVERRIDE` when testing a local build.
|
|
1385
|
+
*/
|
|
1386
|
+
async function applyProjectPackageMetadata(projectPath, { projectName, bejamasVersion = BEJAMAS_PACKAGE_METADATA.version, bejamasOverride = process.env.BEJAMAS_PACKAGE_OVERRIDE }) {
|
|
1387
|
+
const bejamasSpec = bejamasOverride ? `file:${bejamasOverride.replace(/\\/g, "/")}` : bejamasVersion && `^${bejamasVersion}`;
|
|
1388
|
+
const rootPackageJson = path$1.resolve(projectPath, "package.json");
|
|
1369
1389
|
const packageJsonPaths = await fg("**/package.json", {
|
|
1370
1390
|
cwd: projectPath,
|
|
1371
1391
|
absolute: true,
|
|
1372
1392
|
ignore: ["**/node_modules/**"]
|
|
1373
1393
|
});
|
|
1374
|
-
const normalizedOverride = bejamasPackageOverride.replace(/\\/g, "/");
|
|
1375
1394
|
await Promise.all(packageJsonPaths.map(async (packageJsonPath) => {
|
|
1376
1395
|
const packageJson = await fs.readJson(packageJsonPath);
|
|
1377
1396
|
let changed = false;
|
|
1378
|
-
|
|
1379
|
-
packageJson
|
|
1397
|
+
if (path$1.resolve(packageJsonPath) === rootPackageJson) {
|
|
1398
|
+
packageJson.name = toPackageName(projectName);
|
|
1399
|
+
changed = true;
|
|
1400
|
+
}
|
|
1401
|
+
for (const field of ["dependencies", "devDependencies"]) if (bejamasSpec && packageJson[field]?.bejamas) {
|
|
1402
|
+
packageJson[field].bejamas = bejamasSpec;
|
|
1380
1403
|
changed = true;
|
|
1381
1404
|
}
|
|
1382
1405
|
if (changed) await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
@@ -1442,6 +1465,7 @@ async function createProject(options) {
|
|
|
1442
1465
|
process.exit(1);
|
|
1443
1466
|
}
|
|
1444
1467
|
await createProjectFromTemplate(projectPath, {
|
|
1468
|
+
projectName,
|
|
1445
1469
|
templateKey: template,
|
|
1446
1470
|
packageManager,
|
|
1447
1471
|
cwd: options.cwd
|
|
@@ -1464,7 +1488,7 @@ async function createProjectFromTemplate(projectPath, options) {
|
|
|
1464
1488
|
await copyTemplateFromGitHub(templateDirName, projectPath);
|
|
1465
1489
|
}
|
|
1466
1490
|
await removeEmptyTemplateI18nDirs(projectPath);
|
|
1467
|
-
await
|
|
1491
|
+
await applyProjectPackageMetadata(projectPath, { projectName: options.projectName });
|
|
1468
1492
|
await execa(options.packageManager, ["install"], { cwd: projectPath });
|
|
1469
1493
|
try {
|
|
1470
1494
|
const { stdout } = await execa("git", ["rev-parse", "--is-inside-work-tree"], { cwd: projectPath });
|
|
@@ -1730,34 +1754,50 @@ async function repairUiPackageExports(uiDir, packageRoot) {
|
|
|
1730
1754
|
}
|
|
1731
1755
|
|
|
1732
1756
|
//#endregion
|
|
1733
|
-
//#region src/utils/
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
}
|
|
1741
|
-
function getNpmExecutable() {
|
|
1742
|
-
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
1743
|
-
}
|
|
1744
|
-
function buildPinnedShadcnInvocation(shadcnArgs) {
|
|
1757
|
+
//#region src/utils/pinned-npm-exec.ts
|
|
1758
|
+
/**
|
|
1759
|
+
* Run a package's bin at an exact version through `npm exec`, in a prefix of
|
|
1760
|
+
* its own so the user's project dependencies never interfere.
|
|
1761
|
+
*/
|
|
1762
|
+
function definePinnedPackage({ name, version, bin, prefixDir }) {
|
|
1763
|
+
const execPrefix = path.join(os$1.tmpdir(), prefixDir, version);
|
|
1764
|
+
const spec = `${name}@${version}`;
|
|
1745
1765
|
return {
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1766
|
+
version,
|
|
1767
|
+
spec,
|
|
1768
|
+
execPrefix,
|
|
1769
|
+
async ensureExecPrefix() {
|
|
1770
|
+
await fs$1.mkdir(execPrefix, { recursive: true });
|
|
1771
|
+
return execPrefix;
|
|
1772
|
+
},
|
|
1773
|
+
invocation(args) {
|
|
1774
|
+
return {
|
|
1775
|
+
cmd: process.platform === "win32" ? "npm.cmd" : "npm",
|
|
1776
|
+
args: [
|
|
1777
|
+
"exec",
|
|
1778
|
+
"--yes",
|
|
1779
|
+
"--prefix",
|
|
1780
|
+
execPrefix,
|
|
1781
|
+
`--package=${spec}`,
|
|
1782
|
+
"--",
|
|
1783
|
+
bin,
|
|
1784
|
+
...args
|
|
1785
|
+
],
|
|
1786
|
+
source: "isolated"
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1758
1789
|
};
|
|
1759
1790
|
}
|
|
1760
1791
|
|
|
1792
|
+
//#endregion
|
|
1793
|
+
//#region src/utils/shadcn-cli.ts
|
|
1794
|
+
const PINNED_SHADCN = definePinnedPackage({
|
|
1795
|
+
name: "shadcn",
|
|
1796
|
+
version: "4.21.0",
|
|
1797
|
+
bin: "shadcn",
|
|
1798
|
+
prefixDir: "bejamas-shadcn"
|
|
1799
|
+
});
|
|
1800
|
+
|
|
1761
1801
|
//#endregion
|
|
1762
1802
|
//#region src/utils/shadcn-command.ts
|
|
1763
1803
|
function extractPassthroughArgs(rawArgv, commandName) {
|
|
@@ -1769,8 +1809,8 @@ function extractPassthroughArgs(rawArgv, commandName) {
|
|
|
1769
1809
|
return rest.slice(doubleDashIndex + 1);
|
|
1770
1810
|
}
|
|
1771
1811
|
async function runShadcnCommand({ cwd, args, env }) {
|
|
1772
|
-
await
|
|
1773
|
-
const invocation =
|
|
1812
|
+
await PINNED_SHADCN.ensureExecPrefix();
|
|
1813
|
+
const invocation = PINNED_SHADCN.invocation(args);
|
|
1774
1814
|
await execa(invocation.cmd, invocation.args, {
|
|
1775
1815
|
cwd,
|
|
1776
1816
|
env: {
|
|
@@ -1795,14 +1835,13 @@ function resolveDesignSystemConfig(options) {
|
|
|
1795
1835
|
rtlLanguage
|
|
1796
1836
|
}));
|
|
1797
1837
|
}
|
|
1798
|
-
const baseColor = options.baseColor ?? DEFAULT_DESIGN_SYSTEM_CONFIG.baseColor;
|
|
1799
1838
|
return normalizeDesignSystemConfig(designSystemConfigSchema.parse({
|
|
1800
1839
|
...DEFAULT_DESIGN_SYSTEM_CONFIG,
|
|
1801
1840
|
template: options.template ?? DEFAULT_DESIGN_SYSTEM_CONFIG.template,
|
|
1802
1841
|
rtl: options.rtl ?? false,
|
|
1803
1842
|
rtlLanguage,
|
|
1804
|
-
baseColor,
|
|
1805
|
-
theme:
|
|
1843
|
+
baseColor: options.baseColor ?? DEFAULT_DESIGN_SYSTEM_CONFIG.baseColor,
|
|
1844
|
+
theme: options.baseColor ?? DEFAULT_DESIGN_SYSTEM_CONFIG.theme
|
|
1806
1845
|
}));
|
|
1807
1846
|
}
|
|
1808
1847
|
function buildInitUrl(config, themeRef, env = process.env) {
|
|
@@ -1925,7 +1964,7 @@ function extractOptionsForShadcnInit(rawArgv, cmd) {
|
|
|
1925
1964
|
}
|
|
1926
1965
|
return forwarded;
|
|
1927
1966
|
}
|
|
1928
|
-
const init = new Command().name("init").description("initialize your project and install dependencies").argument("[components...]", "names, url or local path to component").option("-t, --template <template>", "the template to use. (astro, astro-monorepo, astro-with-component-docs-monorepo)").option("-b, --base-color <base-color>",
|
|
1967
|
+
const init = new Command().name("init").description("initialize your project and install dependencies").argument("[components...]", "names, url or local path to component").option("-t, --template <template>", "the template to use. (astro, astro-monorepo, astro-with-component-docs-monorepo)").option("-b, --base-color <base-color>", `the base color to use. (${BASE_COLORS.map((color) => color.name).join(", ")})`, void 0).option("-p, --preset <preset>", "the encoded create preset to use").option("--theme-ref <theme-ref>", "the custom theme ref to use").option("-y, --yes", "skip confirmation prompt.", false).option("-d, --defaults", "use default configuration.", false).option("-f, --force", "force overwrite of existing configuration.", false).option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd()).option("-s, --silent", "mute output.", false).option("--src-dir", "use the src directory when creating a new project.", false).option("--no-src-dir", "do not use the src directory when creating a new project.").option("--css-variables", "use css variables for theming.", true).option("--no-css-variables", "do not use css variables for theming.").option("--no-base-style", "do not install the base shadcn style.").option("--rtl", "enable right-to-left output", false).option("--lang <lang>", "set the RTL language. (ar, fa, he)").option("--reinstall", "re-install existing UI components. Enabled by default for preset switching.").option("--no-reinstall", "do not re-install existing UI components during preset switching.").action(async (_components, opts, cmd) => {
|
|
1929
1968
|
try {
|
|
1930
1969
|
await runInit({
|
|
1931
1970
|
...opts,
|
|
@@ -2184,7 +2223,7 @@ async function generateDocs({ cwd, outDir, verbose }) {
|
|
|
2184
2223
|
if (process.env.BEJAMAS_DOCS_CWD) logger.info(`Docs CWD: ${process.env.BEJAMAS_DOCS_CWD}`);
|
|
2185
2224
|
if (process.env.BEJAMAS_DOCS_OUT_DIR) logger.info(`Docs out: ${process.env.BEJAMAS_DOCS_OUT_DIR}`);
|
|
2186
2225
|
}
|
|
2187
|
-
const mod = await import("./generate-mdx-
|
|
2226
|
+
const mod = await import("./generate-mdx-Cb8rPipn.js");
|
|
2188
2227
|
if (typeof mod.runDocsGenerator === "function") await mod.runDocsGenerator();
|
|
2189
2228
|
else throw new Error("Failed to load docs generator. Export 'runDocsGenerator' not found.");
|
|
2190
2229
|
} catch (err) {
|
|
@@ -2822,9 +2861,9 @@ async function addComponents(cwd, packages, forwardedOptions, isVerbose, isSilen
|
|
|
2822
2861
|
...process.env,
|
|
2823
2862
|
REGISTRY_URL: resolveRegistryUrl()
|
|
2824
2863
|
};
|
|
2825
|
-
await
|
|
2864
|
+
await PINNED_SHADCN.ensureExecPrefix();
|
|
2826
2865
|
const shadcnArgs = buildShadcnAddArgs(packages, forwardedOptions);
|
|
2827
|
-
const invocation =
|
|
2866
|
+
const invocation = PINNED_SHADCN.invocation(shadcnArgs);
|
|
2828
2867
|
if (isVerbose) logger.info(`[bejamas-ui] ${invocation.cmd} ${invocation.args.join(" ")}`);
|
|
2829
2868
|
const registrySpinner = spinner("Checking registry.", { silent: isSilent });
|
|
2830
2869
|
registrySpinner.start();
|
|
@@ -3937,10 +3976,32 @@ function handlePresetError(error) {
|
|
|
3937
3976
|
process.exit(1);
|
|
3938
3977
|
}
|
|
3939
3978
|
|
|
3979
|
+
//#endregion
|
|
3980
|
+
//#region ../bench/package.json
|
|
3981
|
+
var version = "0.1.0";
|
|
3982
|
+
|
|
3983
|
+
//#endregion
|
|
3984
|
+
//#region src/commands/bench.ts
|
|
3985
|
+
const PINNED_BENCH = definePinnedPackage({
|
|
3986
|
+
name: "@bejamas/bench",
|
|
3987
|
+
version,
|
|
3988
|
+
bin: "bejamas-bench",
|
|
3989
|
+
prefixDir: "bejamas-bench"
|
|
3990
|
+
});
|
|
3991
|
+
const bench = new Command().name("bench").description("compare an original site with its ported version (runs @bejamas/bench)").usage("--original <url> --ported <url> [options]").argument("[args...]", "run `bejamas bench --help` for all options").helpOption(false).allowUnknownOption().passThroughOptions().allowExcessArguments().action(async (args) => {
|
|
3992
|
+
await PINNED_BENCH.ensureExecPrefix();
|
|
3993
|
+
const invocation = PINNED_BENCH.invocation(args);
|
|
3994
|
+
const result = await execa(invocation.cmd, invocation.args, {
|
|
3995
|
+
stdio: "inherit",
|
|
3996
|
+
reject: false
|
|
3997
|
+
});
|
|
3998
|
+
process.exit(result.exitCode ?? 2);
|
|
3999
|
+
});
|
|
4000
|
+
|
|
3940
4001
|
//#endregion
|
|
3941
4002
|
//#region src/index.ts
|
|
3942
4003
|
const pkg = createRequire(import.meta.url)("../package.json");
|
|
3943
|
-
const program = new Command().name("bejamas").description("bejamas/ui cli").configureHelp({ helpWidth: Math.min(100, process.stdout.columns || 100) }).version(pkg.version, "-v, --version", "output the version number");
|
|
4004
|
+
const program = new Command().name("bejamas").description("bejamas/ui cli").configureHelp({ helpWidth: Math.min(100, process.stdout.columns || 100) }).version(pkg.version, "-v, --version", "output the version number").enablePositionalOptions();
|
|
3944
4005
|
program.addCommand(init);
|
|
3945
4006
|
program.addCommand(add);
|
|
3946
4007
|
program.addCommand(apply);
|
|
@@ -3949,6 +4010,7 @@ program.addCommand(info);
|
|
|
3949
4010
|
program.addCommand(docs);
|
|
3950
4011
|
program.addCommand(docsBuild);
|
|
3951
4012
|
program.addCommand(docsCheck);
|
|
4013
|
+
program.addCommand(bench);
|
|
3952
4014
|
program.parse(process.argv);
|
|
3953
4015
|
|
|
3954
4016
|
//#endregion
|