teamix-evo 0.6.0 → 0.7.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/dist/core/index.d.ts +56 -1
- package/dist/core/index.js +240 -42
- package/dist/core/index.js.map +1 -1
- package/dist/index.js +160 -186
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/core/index.d.ts
CHANGED
|
@@ -335,6 +335,61 @@ interface RunUiListResult {
|
|
|
335
335
|
*/
|
|
336
336
|
declare function runUiList(options: RunUiListOptions): Promise<RunUiListResult>;
|
|
337
337
|
|
|
338
|
+
interface RunVariantUiAddOptions {
|
|
339
|
+
/** Absolute project root directory. */
|
|
340
|
+
projectRoot: string;
|
|
341
|
+
/** Variant id (e.g. `"opentrek"`). */
|
|
342
|
+
variant: string;
|
|
343
|
+
/** Entry ids to install. */
|
|
344
|
+
ids: string[];
|
|
345
|
+
/** When true, overwrite frozen entries that already exist on disk. */
|
|
346
|
+
overwrite?: boolean;
|
|
347
|
+
/** Override the package name. */
|
|
348
|
+
packageName?: string;
|
|
349
|
+
/**
|
|
350
|
+
* Override resolution of the package root. When set, skips
|
|
351
|
+
* `require.resolve("<packageName>/package.json")`.
|
|
352
|
+
*/
|
|
353
|
+
packageRoot?: string;
|
|
354
|
+
}
|
|
355
|
+
interface RunVariantUiAddResult {
|
|
356
|
+
packageName: string;
|
|
357
|
+
variant: string;
|
|
358
|
+
orderedIds: string[];
|
|
359
|
+
written: number;
|
|
360
|
+
skipped: number;
|
|
361
|
+
npmDependencies: Record<string, string>;
|
|
362
|
+
resources: InstalledResource[];
|
|
363
|
+
}
|
|
364
|
+
/** `teamix-evo biz-ui add <ids...> --variant <name>`. */
|
|
365
|
+
declare function runBizUiAdd(options: RunVariantUiAddOptions): Promise<RunVariantUiAddResult>;
|
|
366
|
+
/** `teamix-evo templates add <ids...> --variant <name>`. */
|
|
367
|
+
declare function runTemplatesAdd(options: RunVariantUiAddOptions): Promise<RunVariantUiAddResult>;
|
|
368
|
+
interface ListVariantUiResult {
|
|
369
|
+
packageName: string;
|
|
370
|
+
variants: Array<{
|
|
371
|
+
name: string;
|
|
372
|
+
displayName: string;
|
|
373
|
+
version: string;
|
|
374
|
+
description?: string;
|
|
375
|
+
}>;
|
|
376
|
+
}
|
|
377
|
+
declare function listBizUiVariants(packageRoot?: string): Promise<ListVariantUiResult>;
|
|
378
|
+
declare function listTemplatesVariants(packageRoot?: string): Promise<ListVariantUiResult>;
|
|
379
|
+
interface ListVariantUiEntriesResult {
|
|
380
|
+
packageName: string;
|
|
381
|
+
variant: string;
|
|
382
|
+
entries: Array<{
|
|
383
|
+
id: string;
|
|
384
|
+
name: string;
|
|
385
|
+
type: string;
|
|
386
|
+
description?: string;
|
|
387
|
+
registryDependencies: string[];
|
|
388
|
+
}>;
|
|
389
|
+
}
|
|
390
|
+
declare function listBizUiEntries(variant: string, packageRoot?: string): Promise<ListVariantUiEntriesResult>;
|
|
391
|
+
declare function listTemplatesEntries(variant: string, packageRoot?: string): Promise<ListVariantUiEntriesResult>;
|
|
392
|
+
|
|
338
393
|
interface RunLintInitOptions {
|
|
339
394
|
/** Absolute project root directory. */
|
|
340
395
|
projectRoot: string;
|
|
@@ -607,4 +662,4 @@ declare function readInstalledManifest(projectRoot: string): Promise<InstalledMa
|
|
|
607
662
|
*/
|
|
608
663
|
declare function writeInstalledManifest(projectRoot: string, manifest: InstalledManifest): Promise<void>;
|
|
609
664
|
|
|
610
|
-
export { DEFAULT_UI_ALIASES, DEFAULT_UI_ICON_LIBRARY, type InstallOptions, type InstallResult, type ListVariantsResult, type RunLintInitOptions, type RunLintInitResult, type RunSkillsAddOptions, type RunSkillsAddResult, type RunSkillsInitOptions, type RunSkillsInitResult, type RunSkillsUpdateOptions, type RunSkillsUpdateResult, type RunTokensInitOptions, type RunTokensInitResult, type RunUiAddOptions, type RunUiAddResult, type RunUiInitOptions, type RunUiInitResult, type RunUiListOptions, type RunUiListResult, type SkillInstallOptions, type SkillInstallResult, type SkillSyncOptions, type SkillSyncResult, type SkillUpdateOptions, type SkillUpdateResult, type UiEntryListItem, type UiInstallOptions, type UiInstallResult, type UpdatePlanItem, ensureTeamixDir, getTeamixDir, installResources, installSkills, installUiEntries, listTokenVariants, loadSkillsData, loadUiData, loadVariantData, readInstalledManifest, readProjectConfig, removeSkillFiles, removeUiFiles, runLintInit, runSkillsAdd, runSkillsInit, runSkillsUpdate, runTokensInit, runUiAdd, runUiInit, runUiList, syncSkillsToIdes, updateSkills, writeInstalledManifest, writeProjectConfig };
|
|
665
|
+
export { DEFAULT_UI_ALIASES, DEFAULT_UI_ICON_LIBRARY, type InstallOptions, type InstallResult, type ListVariantUiEntriesResult, type ListVariantUiResult, type ListVariantsResult, type RunLintInitOptions, type RunLintInitResult, type RunSkillsAddOptions, type RunSkillsAddResult, type RunSkillsInitOptions, type RunSkillsInitResult, type RunSkillsUpdateOptions, type RunSkillsUpdateResult, type RunTokensInitOptions, type RunTokensInitResult, type RunUiAddOptions, type RunUiAddResult, type RunUiInitOptions, type RunUiInitResult, type RunUiListOptions, type RunUiListResult, type RunVariantUiAddOptions, type RunVariantUiAddResult, type SkillInstallOptions, type SkillInstallResult, type SkillSyncOptions, type SkillSyncResult, type SkillUpdateOptions, type SkillUpdateResult, type UiEntryListItem, type UiInstallOptions, type UiInstallResult, type UpdatePlanItem, ensureTeamixDir, getTeamixDir, installResources, installSkills, installUiEntries, listBizUiEntries, listBizUiVariants, listTemplatesEntries, listTemplatesVariants, listTokenVariants, loadSkillsData, loadUiData, loadVariantData, readInstalledManifest, readProjectConfig, removeSkillFiles, removeUiFiles, runBizUiAdd, runLintInit, runSkillsAdd, runSkillsInit, runSkillsUpdate, runTemplatesAdd, runTokensInit, runUiAdd, runUiInit, runUiList, syncSkillsToIdes, updateSkills, writeInstalledManifest, writeProjectConfig };
|
package/dist/core/index.js
CHANGED
|
@@ -455,7 +455,7 @@ async function writeMirrorContent(targetFile, sourceContent, managedRegions, sou
|
|
|
455
455
|
if (matchedRegions.length === 0) {
|
|
456
456
|
if (existing !== sourceContent) {
|
|
457
457
|
logger.warn(
|
|
458
|
-
`Mirror drift detected at ${targetFile} \u2014 overwriting from source. Edit ${sourceFile} (not the mirror) and re-run \`teamix-evo skills sync\`.`
|
|
458
|
+
`Mirror drift detected at ${targetFile} \u2014 overwriting from source. Edit ${sourceFile} (not the mirror) and re-run \`npx teamix-evo@latest skills sync\`.`
|
|
459
459
|
);
|
|
460
460
|
await writeFileSafe(targetFile, sourceContent);
|
|
461
461
|
return sourceContent;
|
|
@@ -557,34 +557,56 @@ async function rewriteSkillSource(skill, options, summary) {
|
|
|
557
557
|
if (skill.template && targetFile2.endsWith(".hbs")) {
|
|
558
558
|
targetFile2 = targetFile2.slice(0, -4);
|
|
559
559
|
}
|
|
560
|
-
const
|
|
560
|
+
const newContent2 = skill.template && entry.endsWith(".hbs") ? renderTemplate(await loadTemplateFile(entry), { ...data, skill }) : await fs5.readFile(entry, "utf-8");
|
|
561
561
|
const exists2 = await fileExists(targetFile2);
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
562
|
+
const written2 = await rewriteSingleFile({
|
|
563
|
+
targetFile: targetFile2,
|
|
564
|
+
newContent: newContent2,
|
|
565
|
+
exists: exists2,
|
|
566
|
+
updateStrategy: skill.updateStrategy,
|
|
567
|
+
managedRegions: skill.managedRegions,
|
|
568
|
+
projectRoot,
|
|
569
|
+
summary
|
|
570
|
+
});
|
|
569
571
|
const relWritten = path7.relative(targetDir, targetFile2);
|
|
570
|
-
records.push(makeSourceRecord(skill, targetFile2,
|
|
572
|
+
records.push(makeSourceRecord(skill, targetFile2, written2, relWritten));
|
|
571
573
|
}
|
|
572
574
|
return records;
|
|
573
575
|
}
|
|
574
576
|
const targetFile = path7.join(targetDir, "SKILL.md");
|
|
575
577
|
const newContent = await renderSkillContent(sourceAbs, skill, data);
|
|
576
578
|
const exists = await fileExists(targetFile);
|
|
577
|
-
|
|
579
|
+
const written = await rewriteSingleFile({
|
|
580
|
+
targetFile,
|
|
581
|
+
newContent,
|
|
582
|
+
exists,
|
|
583
|
+
updateStrategy: skill.updateStrategy,
|
|
584
|
+
managedRegions: skill.managedRegions,
|
|
585
|
+
projectRoot,
|
|
586
|
+
summary
|
|
587
|
+
});
|
|
588
|
+
return [makeSourceRecord(skill, targetFile, written)];
|
|
589
|
+
}
|
|
590
|
+
async function rewriteSingleFile(args) {
|
|
591
|
+
const {
|
|
592
|
+
targetFile,
|
|
593
|
+
newContent,
|
|
594
|
+
exists,
|
|
595
|
+
updateStrategy,
|
|
596
|
+
managedRegions,
|
|
597
|
+
projectRoot,
|
|
598
|
+
summary
|
|
599
|
+
} = args;
|
|
600
|
+
if (updateStrategy === "frozen") {
|
|
578
601
|
if (exists) {
|
|
579
602
|
summary.skipped++;
|
|
580
|
-
|
|
581
|
-
return [makeSourceRecord(skill, targetFile, current2)];
|
|
603
|
+
return await readFileOrNull(targetFile) ?? newContent;
|
|
582
604
|
}
|
|
583
605
|
await writeFileSafe(targetFile, newContent);
|
|
584
606
|
summary.created++;
|
|
585
|
-
return
|
|
607
|
+
return newContent;
|
|
586
608
|
}
|
|
587
|
-
if (
|
|
609
|
+
if (updateStrategy === "regenerable" || !exists) {
|
|
588
610
|
if (exists) {
|
|
589
611
|
await backupFile(targetFile, projectRoot);
|
|
590
612
|
summary.overwritten++;
|
|
@@ -592,11 +614,11 @@ async function rewriteSkillSource(skill, options, summary) {
|
|
|
592
614
|
summary.created++;
|
|
593
615
|
}
|
|
594
616
|
await writeFileSafe(targetFile, newContent);
|
|
595
|
-
return
|
|
617
|
+
return newContent;
|
|
596
618
|
}
|
|
597
619
|
const current = await readFileOrNull(targetFile);
|
|
598
620
|
let merged = current ?? newContent;
|
|
599
|
-
for (const regionId of
|
|
621
|
+
for (const regionId of managedRegions ?? []) {
|
|
600
622
|
const re = new RegExp(
|
|
601
623
|
`<!-- teamix-evo:managed:start id="${escapeRegExp(
|
|
602
624
|
regionId
|
|
@@ -616,10 +638,12 @@ async function rewriteSkillSource(skill, options, summary) {
|
|
|
616
638
|
}
|
|
617
639
|
}
|
|
618
640
|
}
|
|
619
|
-
|
|
620
|
-
|
|
641
|
+
if (merged !== current) {
|
|
642
|
+
await backupFile(targetFile, projectRoot);
|
|
643
|
+
await writeFileSafe(targetFile, merged);
|
|
644
|
+
}
|
|
621
645
|
summary.managed++;
|
|
622
|
-
return
|
|
646
|
+
return merged;
|
|
623
647
|
}
|
|
624
648
|
function escapeRegExp(str) {
|
|
625
649
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -984,7 +1008,7 @@ async function runTokensInit(options) {
|
|
|
984
1008
|
const known = catalog.variants.map((v) => v.name).join(", ");
|
|
985
1009
|
throw new Error(
|
|
986
1010
|
`Unknown variant "${variant}". Available variants: ${known || "(none)"}.
|
|
987
|
-
Run \`teamix-evo tokens list-variants\` to see all options.`
|
|
1011
|
+
Run \`npx teamix-evo@latest tokens list-variants\` to see all options.`
|
|
988
1012
|
);
|
|
989
1013
|
}
|
|
990
1014
|
const existingConfig = await readProjectConfig(projectRoot);
|
|
@@ -1717,8 +1741,176 @@ async function runUiList(options) {
|
|
|
1717
1741
|
};
|
|
1718
1742
|
}
|
|
1719
1743
|
|
|
1720
|
-
// src/core/
|
|
1744
|
+
// src/core/variant-ui-add.ts
|
|
1721
1745
|
import * as path12 from "path";
|
|
1746
|
+
import { createRequire as createRequire4 } from "module";
|
|
1747
|
+
import {
|
|
1748
|
+
loadUiPackageManifest as loadUiPackageManifest2,
|
|
1749
|
+
loadVariantUiPackageCatalog,
|
|
1750
|
+
loadVariantUiPackageManifest
|
|
1751
|
+
} from "@teamix-evo/registry";
|
|
1752
|
+
var require5 = createRequire4(import.meta.url);
|
|
1753
|
+
function resolvePackageRoot3(packageName) {
|
|
1754
|
+
const pkgJsonPath = require5.resolve(`${packageName}/package.json`);
|
|
1755
|
+
return path12.dirname(pkgJsonPath);
|
|
1756
|
+
}
|
|
1757
|
+
async function runVariantUiAdd(packageName, options) {
|
|
1758
|
+
const { projectRoot, variant, ids, overwrite } = options;
|
|
1759
|
+
const fullPackageName = options.packageName ?? `@teamix-evo/${packageName}`;
|
|
1760
|
+
if (ids.length === 0) {
|
|
1761
|
+
throw new Error("At least one entry id must be provided.");
|
|
1762
|
+
}
|
|
1763
|
+
const config = await readProjectConfig(projectRoot);
|
|
1764
|
+
const uiCfg = config?.packages?.ui;
|
|
1765
|
+
if (!config || !uiCfg?.aliases) {
|
|
1766
|
+
throw new Error(
|
|
1767
|
+
`UI not initialized. Run \`teamix-evo ui init\` first \u2014 \`${packageName} add\` writes into the same alias map (business / templates).`
|
|
1768
|
+
);
|
|
1769
|
+
}
|
|
1770
|
+
const packageRoot = options.packageRoot ?? resolvePackageRoot3(fullPackageName);
|
|
1771
|
+
const catalog = await loadVariantUiPackageCatalog(packageRoot);
|
|
1772
|
+
if (!catalog.variants.some((v) => v.name === variant)) {
|
|
1773
|
+
const known = catalog.variants.map((v) => v.name).join(", ");
|
|
1774
|
+
throw new Error(
|
|
1775
|
+
`Variant "${variant}" not found in ${fullPackageName}. Known variants: ${known}. Hint: \`teamix-evo ${packageName} list-variants\` shows all.`
|
|
1776
|
+
);
|
|
1777
|
+
}
|
|
1778
|
+
const variantDir = path12.join(packageRoot, "variants", variant);
|
|
1779
|
+
const variantManifest = await loadVariantUiPackageManifest(variantDir);
|
|
1780
|
+
const knownIds = new Set(variantManifest.entries.map((e) => e.id));
|
|
1781
|
+
const unknown = ids.filter((id) => !knownIds.has(id));
|
|
1782
|
+
if (unknown.length > 0) {
|
|
1783
|
+
throw new Error(
|
|
1784
|
+
`Unknown entry id(s) in ${packageName}#${variant}: ${unknown.map((s) => `"${s}"`).join(", ")}. Run \`teamix-evo ${packageName} list-variants\` to see this package's variants, or \`teamix-evo ${packageName} list --variant ${variant}\` for its entries.`
|
|
1785
|
+
);
|
|
1786
|
+
}
|
|
1787
|
+
const uiPackageRoot = resolvePackageRoot3("@teamix-evo/ui");
|
|
1788
|
+
const uiManifest = await loadUiPackageManifest2(uiPackageRoot);
|
|
1789
|
+
const entryPackageRoot = /* @__PURE__ */ new Map();
|
|
1790
|
+
const mergedEntries = [];
|
|
1791
|
+
for (const e of variantManifest.entries) {
|
|
1792
|
+
entryPackageRoot.set(e.id, variantDir);
|
|
1793
|
+
mergedEntries.push(e);
|
|
1794
|
+
}
|
|
1795
|
+
for (const e of uiManifest.entries) {
|
|
1796
|
+
if (entryPackageRoot.has(e.id)) continue;
|
|
1797
|
+
entryPackageRoot.set(e.id, uiPackageRoot);
|
|
1798
|
+
mergedEntries.push(e);
|
|
1799
|
+
}
|
|
1800
|
+
const adaptedManifest = {
|
|
1801
|
+
schemaVersion: 1,
|
|
1802
|
+
package: "ui",
|
|
1803
|
+
version: variantManifest.version,
|
|
1804
|
+
engines: variantManifest.engines,
|
|
1805
|
+
entries: mergedEntries
|
|
1806
|
+
};
|
|
1807
|
+
const result = await installUiEntries({
|
|
1808
|
+
projectRoot,
|
|
1809
|
+
manifest: adaptedManifest,
|
|
1810
|
+
packageRoot: variantDir,
|
|
1811
|
+
// default for variant entries
|
|
1812
|
+
entryPackageRoot,
|
|
1813
|
+
// ui entries resolve from uiPackageRoot
|
|
1814
|
+
aliases: uiCfg.aliases,
|
|
1815
|
+
requested: ids,
|
|
1816
|
+
skipExisting: !overwrite
|
|
1817
|
+
});
|
|
1818
|
+
const installed = await readInstalledManifest(
|
|
1819
|
+
projectRoot
|
|
1820
|
+
) ?? { schemaVersion: 1, installed: [] };
|
|
1821
|
+
const idx = installed.installed.findIndex(
|
|
1822
|
+
(p) => p.package === fullPackageName && p.variant === variant
|
|
1823
|
+
);
|
|
1824
|
+
const prior = idx >= 0 ? installed.installed[idx] : null;
|
|
1825
|
+
const mergedResources = mergeResources2(
|
|
1826
|
+
prior?.resources ?? [],
|
|
1827
|
+
result.resources
|
|
1828
|
+
);
|
|
1829
|
+
const entry = {
|
|
1830
|
+
package: fullPackageName,
|
|
1831
|
+
variant,
|
|
1832
|
+
version: variantManifest.version,
|
|
1833
|
+
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1834
|
+
resources: mergedResources
|
|
1835
|
+
};
|
|
1836
|
+
if (idx >= 0) installed.installed[idx] = entry;
|
|
1837
|
+
else installed.installed.push(entry);
|
|
1838
|
+
await writeInstalledManifest(projectRoot, installed);
|
|
1839
|
+
return {
|
|
1840
|
+
packageName: fullPackageName,
|
|
1841
|
+
variant,
|
|
1842
|
+
orderedIds: result.orderedIds,
|
|
1843
|
+
written: result.written,
|
|
1844
|
+
skipped: result.skipped,
|
|
1845
|
+
npmDependencies: result.npmDependencies,
|
|
1846
|
+
resources: result.resources
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
function mergeResources2(prior, next) {
|
|
1850
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1851
|
+
for (const r of prior) merged.set(r.id, r);
|
|
1852
|
+
for (const r of next) merged.set(r.id, r);
|
|
1853
|
+
return Array.from(merged.values());
|
|
1854
|
+
}
|
|
1855
|
+
async function runBizUiAdd(options) {
|
|
1856
|
+
return runVariantUiAdd("biz-ui", options);
|
|
1857
|
+
}
|
|
1858
|
+
async function runTemplatesAdd(options) {
|
|
1859
|
+
return runVariantUiAdd("templates", options);
|
|
1860
|
+
}
|
|
1861
|
+
async function listVariantUi(packageName, packageRoot) {
|
|
1862
|
+
const fullPackageName = `@teamix-evo/${packageName}`;
|
|
1863
|
+
const root = packageRoot ?? resolvePackageRoot3(fullPackageName);
|
|
1864
|
+
const catalog = await loadVariantUiPackageCatalog(root);
|
|
1865
|
+
return {
|
|
1866
|
+
packageName: fullPackageName,
|
|
1867
|
+
variants: catalog.variants.map((v) => ({
|
|
1868
|
+
name: v.name,
|
|
1869
|
+
displayName: v.displayName,
|
|
1870
|
+
version: v.version,
|
|
1871
|
+
description: v.description
|
|
1872
|
+
}))
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
async function listBizUiVariants(packageRoot) {
|
|
1876
|
+
return listVariantUi("biz-ui", packageRoot);
|
|
1877
|
+
}
|
|
1878
|
+
async function listTemplatesVariants(packageRoot) {
|
|
1879
|
+
return listVariantUi("templates", packageRoot);
|
|
1880
|
+
}
|
|
1881
|
+
async function listVariantUiEntries(packageName, variant, packageRoot) {
|
|
1882
|
+
const fullPackageName = `@teamix-evo/${packageName}`;
|
|
1883
|
+
const root = packageRoot ?? resolvePackageRoot3(fullPackageName);
|
|
1884
|
+
const catalog = await loadVariantUiPackageCatalog(root);
|
|
1885
|
+
if (!catalog.variants.some((v) => v.name === variant)) {
|
|
1886
|
+
const known = catalog.variants.map((v) => v.name).join(", ");
|
|
1887
|
+
throw new Error(
|
|
1888
|
+
`Variant "${variant}" not found in ${fullPackageName}. Known: ${known}.`
|
|
1889
|
+
);
|
|
1890
|
+
}
|
|
1891
|
+
const variantDir = path12.join(root, "variants", variant);
|
|
1892
|
+
const variantManifest = await loadVariantUiPackageManifest(variantDir);
|
|
1893
|
+
return {
|
|
1894
|
+
packageName: fullPackageName,
|
|
1895
|
+
variant,
|
|
1896
|
+
entries: variantManifest.entries.map((e) => ({
|
|
1897
|
+
id: e.id,
|
|
1898
|
+
name: e.name,
|
|
1899
|
+
type: e.type,
|
|
1900
|
+
description: e.description,
|
|
1901
|
+
registryDependencies: e.registryDependencies ?? []
|
|
1902
|
+
}))
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
async function listBizUiEntries(variant, packageRoot) {
|
|
1906
|
+
return listVariantUiEntries("biz-ui", variant, packageRoot);
|
|
1907
|
+
}
|
|
1908
|
+
async function listTemplatesEntries(variant, packageRoot) {
|
|
1909
|
+
return listVariantUiEntries("templates", variant, packageRoot);
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
// src/core/lint-init.ts
|
|
1913
|
+
import * as path13 from "path";
|
|
1722
1914
|
import * as fs9 from "fs";
|
|
1723
1915
|
import { execa } from "execa";
|
|
1724
1916
|
var ESLINT_CONFIG_CONTENT = `/**
|
|
@@ -1747,8 +1939,8 @@ var ESLINT_DEPS = [
|
|
|
1747
1939
|
var STYLELINT_DEPS = ["@teamix-evo/stylelint-config", "stylelint"];
|
|
1748
1940
|
async function runLintInit(options) {
|
|
1749
1941
|
const { projectRoot, skipInstall } = options;
|
|
1750
|
-
const eslintConfigPath =
|
|
1751
|
-
const stylelintConfigPath =
|
|
1942
|
+
const eslintConfigPath = path13.join(projectRoot, "eslint.config.js");
|
|
1943
|
+
const stylelintConfigPath = path13.join(projectRoot, "stylelint.config.cjs");
|
|
1752
1944
|
const eslintExists = await fileExists(eslintConfigPath);
|
|
1753
1945
|
const stylelintExists = await fileExists(stylelintConfigPath);
|
|
1754
1946
|
if (eslintExists && stylelintExists) {
|
|
@@ -1786,12 +1978,12 @@ async function runLintInit(options) {
|
|
|
1786
1978
|
};
|
|
1787
1979
|
}
|
|
1788
1980
|
function detectPm(projectRoot) {
|
|
1789
|
-
if (fs9.existsSync(
|
|
1790
|
-
if (fs9.existsSync(
|
|
1981
|
+
if (fs9.existsSync(path13.join(projectRoot, "pnpm-lock.yaml"))) return "pnpm";
|
|
1982
|
+
if (fs9.existsSync(path13.join(projectRoot, "yarn.lock"))) return "yarn";
|
|
1791
1983
|
return "npm";
|
|
1792
1984
|
}
|
|
1793
1985
|
async function patchPackageJsonScripts(projectRoot) {
|
|
1794
|
-
const pkgPath =
|
|
1986
|
+
const pkgPath = path13.join(projectRoot, "package.json");
|
|
1795
1987
|
const raw = await readFileOrNull(pkgPath);
|
|
1796
1988
|
if (!raw) return;
|
|
1797
1989
|
let pkg;
|
|
@@ -1818,7 +2010,7 @@ async function patchPackageJsonScripts(projectRoot) {
|
|
|
1818
2010
|
}
|
|
1819
2011
|
|
|
1820
2012
|
// src/core/installer.ts
|
|
1821
|
-
import * as
|
|
2013
|
+
import * as path14 from "path";
|
|
1822
2014
|
import * as fs10 from "fs/promises";
|
|
1823
2015
|
async function installResources(options) {
|
|
1824
2016
|
const { projectRoot, manifest, data, variantDir, packageRoot } = options;
|
|
@@ -1856,7 +2048,7 @@ async function installSingleResource(resource, projectRoot, data, variantDir, pa
|
|
|
1856
2048
|
variantDir,
|
|
1857
2049
|
packageRoot
|
|
1858
2050
|
);
|
|
1859
|
-
const targetPath =
|
|
2051
|
+
const targetPath = path14.join(projectRoot, resource.target);
|
|
1860
2052
|
let content;
|
|
1861
2053
|
if (resource.template) {
|
|
1862
2054
|
const templateContent = await loadTemplateFile(sourcePath);
|
|
@@ -1880,13 +2072,13 @@ async function installRecursiveResource(resource, projectRoot, data, variantDir,
|
|
|
1880
2072
|
variantDir,
|
|
1881
2073
|
packageRoot
|
|
1882
2074
|
);
|
|
1883
|
-
const targetDir =
|
|
2075
|
+
const targetDir = path14.join(projectRoot, resource.target);
|
|
1884
2076
|
const results = [];
|
|
1885
2077
|
await ensureDir(targetDir);
|
|
1886
2078
|
const entries = await walkDir(sourcePath);
|
|
1887
2079
|
for (const entry of entries) {
|
|
1888
|
-
const relPath =
|
|
1889
|
-
let targetFile =
|
|
2080
|
+
const relPath = path14.relative(sourcePath, entry);
|
|
2081
|
+
let targetFile = path14.join(targetDir, relPath);
|
|
1890
2082
|
if (resource.template && targetFile.endsWith(".hbs")) {
|
|
1891
2083
|
targetFile = targetFile.slice(0, -4);
|
|
1892
2084
|
}
|
|
@@ -1899,7 +2091,7 @@ async function installRecursiveResource(resource, projectRoot, data, variantDir,
|
|
|
1899
2091
|
}
|
|
1900
2092
|
await writeFileSafe(targetFile, content);
|
|
1901
2093
|
const hash = computeHash(content);
|
|
1902
|
-
const targetRel =
|
|
2094
|
+
const targetRel = path14.relative(projectRoot, targetFile);
|
|
1903
2095
|
results.push({
|
|
1904
2096
|
id: `${resource.id}:${relPath}`,
|
|
1905
2097
|
target: targetRel,
|
|
@@ -1912,23 +2104,23 @@ async function installRecursiveResource(resource, projectRoot, data, variantDir,
|
|
|
1912
2104
|
}
|
|
1913
2105
|
|
|
1914
2106
|
// src/core/registry-client.ts
|
|
1915
|
-
import * as
|
|
2107
|
+
import * as path15 from "path";
|
|
1916
2108
|
import * as fs11 from "fs/promises";
|
|
1917
|
-
import { createRequire as
|
|
2109
|
+
import { createRequire as createRequire5 } from "module";
|
|
1918
2110
|
import { loadVariantManifest } from "@teamix-evo/registry";
|
|
1919
|
-
var
|
|
1920
|
-
function
|
|
1921
|
-
const pkgJsonPath =
|
|
1922
|
-
return
|
|
2111
|
+
var require6 = createRequire5(import.meta.url);
|
|
2112
|
+
function resolvePackageRoot4(packageName) {
|
|
2113
|
+
const pkgJsonPath = require6.resolve(`${packageName}/package.json`);
|
|
2114
|
+
return path15.dirname(pkgJsonPath);
|
|
1923
2115
|
}
|
|
1924
2116
|
async function loadVariantData(packageName, variant) {
|
|
1925
|
-
const packageRoot =
|
|
1926
|
-
const variantDir =
|
|
2117
|
+
const packageRoot = resolvePackageRoot4(packageName);
|
|
2118
|
+
const variantDir = path15.join(packageRoot, "library", variant);
|
|
1927
2119
|
logger.debug(`Resolved variant dir: ${variantDir}`);
|
|
1928
2120
|
logger.debug(`Package root: ${packageRoot}`);
|
|
1929
2121
|
const manifest = await loadVariantManifest(variantDir);
|
|
1930
2122
|
let data = {};
|
|
1931
|
-
const dataPath =
|
|
2123
|
+
const dataPath = path15.join(variantDir, "_data.json");
|
|
1932
2124
|
try {
|
|
1933
2125
|
const raw = await fs11.readFile(dataPath, "utf-8");
|
|
1934
2126
|
data = JSON.parse(raw);
|
|
@@ -1948,6 +2140,10 @@ export {
|
|
|
1948
2140
|
installResources,
|
|
1949
2141
|
installSkills,
|
|
1950
2142
|
installUiEntries,
|
|
2143
|
+
listBizUiEntries,
|
|
2144
|
+
listBizUiVariants,
|
|
2145
|
+
listTemplatesEntries,
|
|
2146
|
+
listTemplatesVariants,
|
|
1951
2147
|
listTokenVariants,
|
|
1952
2148
|
loadSkillsData,
|
|
1953
2149
|
loadUiData,
|
|
@@ -1956,10 +2152,12 @@ export {
|
|
|
1956
2152
|
readProjectConfig,
|
|
1957
2153
|
removeSkillFiles,
|
|
1958
2154
|
removeUiFiles,
|
|
2155
|
+
runBizUiAdd,
|
|
1959
2156
|
runLintInit,
|
|
1960
2157
|
runSkillsAdd,
|
|
1961
2158
|
runSkillsInit,
|
|
1962
2159
|
runSkillsUpdate,
|
|
2160
|
+
runTemplatesAdd,
|
|
1963
2161
|
runTokensInit,
|
|
1964
2162
|
runUiAdd,
|
|
1965
2163
|
runUiInit,
|