@rootnative/cli 0.0.0-alpha.5 → 0.0.0-alpha.7
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.mjs +92 -51
- package/llms.txt +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -224,7 +224,7 @@ function getInstallCommand(pm, packages) {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// src/lib/installer.ts
|
|
227
|
-
import
|
|
227
|
+
import path6 from "path";
|
|
228
228
|
import { execa } from "execa";
|
|
229
229
|
import fs4 from "fs-extra";
|
|
230
230
|
|
|
@@ -289,6 +289,7 @@ async function fetchFileContent(config, filePath) {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// src/lib/resolver.ts
|
|
292
|
+
import path4 from "path";
|
|
292
293
|
async function resolveComponents(config, requestedNames) {
|
|
293
294
|
const resolved = /* @__PURE__ */ new Map();
|
|
294
295
|
const utilsRegistry = await fetchUtilsRegistry(config);
|
|
@@ -321,9 +322,11 @@ function buildResult(resolved, utilsRegistry) {
|
|
|
321
322
|
optionalDeps[pkg] = version;
|
|
322
323
|
}
|
|
323
324
|
}
|
|
325
|
+
const utilFileNames = {};
|
|
324
326
|
for (const utilName of utilSet) {
|
|
325
327
|
const utilEntry = utilsRegistry[utilName];
|
|
326
328
|
if (utilEntry) {
|
|
329
|
+
utilFileNames[utilName] = path4.basename(utilEntry.file);
|
|
327
330
|
for (const [pkg, version] of Object.entries(utilEntry.dependencies)) {
|
|
328
331
|
optionalDeps[pkg] = version;
|
|
329
332
|
}
|
|
@@ -332,6 +335,7 @@ function buildResult(resolved, utilsRegistry) {
|
|
|
332
335
|
return {
|
|
333
336
|
components,
|
|
334
337
|
utils: Array.from(utilSet).sort(),
|
|
338
|
+
utilFileNames,
|
|
335
339
|
npmDependencies: npmDeps,
|
|
336
340
|
optionalNpmDependencies: optionalDeps
|
|
337
341
|
};
|
|
@@ -341,16 +345,44 @@ function getComponentNames(result) {
|
|
|
341
345
|
}
|
|
342
346
|
|
|
343
347
|
// src/lib/transform.ts
|
|
348
|
+
import path5 from "path";
|
|
344
349
|
var SINGLE_LINE_IMPORT_REGEX = /((?:import|export)\s+(?:type\s+)?(?:\{[^}]*\}|\*\s+as\s+\w+|[\w,\s]+)\s+from\s+)(['"])([^'"]+)\2/g;
|
|
345
350
|
var MULTI_LINE_IMPORT_REGEX = /((?:import|export)\s+(?:type\s+)?\{[\s\S]*?\}\s+from\s+)(['"])([^'"]+)\2/g;
|
|
346
351
|
var SHARED_ROOT_MODULES = /* @__PURE__ */ new Set(["safe-area"]);
|
|
352
|
+
function isPrefixAlias(alias) {
|
|
353
|
+
return !alias.startsWith(".");
|
|
354
|
+
}
|
|
355
|
+
function buildSpecifier(alias, rest, componentsAlias, componentName) {
|
|
356
|
+
if (isPrefixAlias(alias)) {
|
|
357
|
+
return `${alias}/${rest}`;
|
|
358
|
+
}
|
|
359
|
+
const fromDir = path5.posix.join(
|
|
360
|
+
toPosix(stripRelativePrefix(componentsAlias)),
|
|
361
|
+
componentName
|
|
362
|
+
);
|
|
363
|
+
const target = path5.posix.join(toPosix(stripRelativePrefix(alias)), rest);
|
|
364
|
+
const relative = path5.posix.relative(fromDir, target);
|
|
365
|
+
return relative.startsWith(".") ? relative : `./${relative}`;
|
|
366
|
+
}
|
|
367
|
+
function stripRelativePrefix(alias) {
|
|
368
|
+
return alias.replace(/^\.\//, "");
|
|
369
|
+
}
|
|
370
|
+
function toPosix(value) {
|
|
371
|
+
return value.replace(/\\/g, "/");
|
|
372
|
+
}
|
|
347
373
|
function transformImports(source, options) {
|
|
348
|
-
const { config, installedComponents } = options;
|
|
374
|
+
const { config, componentName, installedComponents } = options;
|
|
349
375
|
const componentsAlias = config.aliases.components;
|
|
350
376
|
const libAlias = config.aliases.lib;
|
|
351
377
|
function rewriteImport(match, prefix, quote, importPath) {
|
|
352
378
|
if (importPath === "@rootnative/utils") {
|
|
353
|
-
|
|
379
|
+
const specifier = buildSpecifier(
|
|
380
|
+
libAlias,
|
|
381
|
+
"rootnative-utils",
|
|
382
|
+
componentsAlias,
|
|
383
|
+
componentName
|
|
384
|
+
);
|
|
385
|
+
return `${prefix}${quote}${specifier}${quote}`;
|
|
354
386
|
}
|
|
355
387
|
if (importPath.startsWith("@rootnative/core")) {
|
|
356
388
|
return match;
|
|
@@ -367,7 +399,13 @@ function transformImports(source, options) {
|
|
|
367
399
|
const targetComponent = extractComponentName(importPath);
|
|
368
400
|
if (targetComponent && installedComponents.includes(targetComponent)) {
|
|
369
401
|
const restOfPath = importPath.replace(/^\.\.\//, "");
|
|
370
|
-
|
|
402
|
+
const specifier = buildSpecifier(
|
|
403
|
+
componentsAlias,
|
|
404
|
+
restOfPath,
|
|
405
|
+
componentsAlias,
|
|
406
|
+
componentName
|
|
407
|
+
);
|
|
408
|
+
return `${prefix}${quote}${specifier}${quote}`;
|
|
371
409
|
}
|
|
372
410
|
}
|
|
373
411
|
return match;
|
|
@@ -410,7 +448,7 @@ async function installComponents(options) {
|
|
|
410
448
|
await generateBarrel(resolution, utilsRegistry, libDir);
|
|
411
449
|
spinner.succeed("Utility files copied");
|
|
412
450
|
for (const { entry } of resolution.components) {
|
|
413
|
-
const componentDir =
|
|
451
|
+
const componentDir = path6.join(componentsDir, entry.name);
|
|
414
452
|
const exists = await fs4.pathExists(componentDir);
|
|
415
453
|
if (exists && !force) {
|
|
416
454
|
logger.warn(
|
|
@@ -423,14 +461,14 @@ async function installComponents(options) {
|
|
|
423
461
|
await fs4.ensureDir(componentDir);
|
|
424
462
|
for (const filePath of entry.files) {
|
|
425
463
|
const content = await fetchFileContent(config, filePath);
|
|
426
|
-
const fileName =
|
|
464
|
+
const fileName = path6.basename(filePath);
|
|
427
465
|
const transformed = transformImports(content, {
|
|
428
466
|
config,
|
|
429
467
|
componentName: entry.name,
|
|
430
468
|
installedComponents: allComponentNames
|
|
431
469
|
});
|
|
432
470
|
await fs4.writeFile(
|
|
433
|
-
|
|
471
|
+
path6.join(componentDir, fileName),
|
|
434
472
|
transformed,
|
|
435
473
|
"utf-8"
|
|
436
474
|
);
|
|
@@ -461,8 +499,8 @@ async function copyUtilFiles(config, resolution, utilsRegistry, libDir) {
|
|
|
461
499
|
const utilEntry = utilsRegistry[utilName];
|
|
462
500
|
if (!utilEntry) continue;
|
|
463
501
|
const content = await fetchFileContent(config, utilEntry.file);
|
|
464
|
-
const fileName =
|
|
465
|
-
await fs4.writeFile(
|
|
502
|
+
const fileName = path6.basename(utilEntry.file);
|
|
503
|
+
await fs4.writeFile(path6.join(libDir, fileName), content, "utf-8");
|
|
466
504
|
}
|
|
467
505
|
}
|
|
468
506
|
async function generateBarrel(resolution, utilsRegistry, libDir) {
|
|
@@ -483,14 +521,14 @@ async function generateBarrel(resolution, utilsRegistry, libDir) {
|
|
|
483
521
|
utilTypeExports
|
|
484
522
|
);
|
|
485
523
|
await fs4.writeFile(
|
|
486
|
-
|
|
524
|
+
path6.join(libDir, "rootnative-utils.ts"),
|
|
487
525
|
barrelContent,
|
|
488
526
|
"utf-8"
|
|
489
527
|
);
|
|
490
528
|
}
|
|
491
529
|
function collectDepsToInstall(resolution, cwd) {
|
|
492
530
|
const deps = [];
|
|
493
|
-
const pkgPath =
|
|
531
|
+
const pkgPath = path6.resolve(cwd, "package.json");
|
|
494
532
|
let existingDeps = {};
|
|
495
533
|
try {
|
|
496
534
|
const pkg = fs4.readJSONSync(pkgPath);
|
|
@@ -541,7 +579,10 @@ async function addCommand(componentNames, cwd, options) {
|
|
|
541
579
|
if (resolution.utils.length > 0) {
|
|
542
580
|
logger.break();
|
|
543
581
|
console.log(chalk2.bold("Utilities to copy:"));
|
|
544
|
-
|
|
582
|
+
const fileNames = resolution.utils.map(
|
|
583
|
+
(u) => resolution.utilFileNames[u] ?? u
|
|
584
|
+
);
|
|
585
|
+
console.log(` ${fileNames.join(", ")}`);
|
|
545
586
|
}
|
|
546
587
|
const npmDeps = Object.keys(resolution.npmDependencies);
|
|
547
588
|
const optionalDeps = Object.keys(resolution.optionalNpmDependencies);
|
|
@@ -589,7 +630,7 @@ async function addCommand(componentNames, cwd, options) {
|
|
|
589
630
|
}
|
|
590
631
|
|
|
591
632
|
// src/commands/create.ts
|
|
592
|
-
import
|
|
633
|
+
import path7 from "path";
|
|
593
634
|
import chalk3 from "chalk";
|
|
594
635
|
import { execa as execa2 } from "execa";
|
|
595
636
|
import fs5 from "fs-extra";
|
|
@@ -779,7 +820,7 @@ async function createCommand(name, options = {}) {
|
|
|
779
820
|
}
|
|
780
821
|
packageManager = value;
|
|
781
822
|
}
|
|
782
|
-
const targetDir =
|
|
823
|
+
const targetDir = path7.resolve(process.cwd(), projectName);
|
|
783
824
|
if (await fs5.pathExists(targetDir)) {
|
|
784
825
|
if (options.yes) {
|
|
785
826
|
logger.warn(`Directory ${chalk3.bold(projectName)} already exists.`);
|
|
@@ -804,7 +845,7 @@ async function createCommand(name, options = {}) {
|
|
|
804
845
|
spinner.start();
|
|
805
846
|
try {
|
|
806
847
|
for (const dir of templateConfig.dirs) {
|
|
807
|
-
await fs5.ensureDir(
|
|
848
|
+
await fs5.ensureDir(path7.join(targetDir, dir));
|
|
808
849
|
}
|
|
809
850
|
for (const file of templateConfig.textFiles) {
|
|
810
851
|
let content = await fetchText(`${templateBaseUrl}/${file}`);
|
|
@@ -829,18 +870,18 @@ async function createCommand(name, options = {}) {
|
|
|
829
870
|
}
|
|
830
871
|
content = JSON.stringify(appJson, null, 2) + "\n";
|
|
831
872
|
}
|
|
832
|
-
await fs5.outputFile(
|
|
873
|
+
await fs5.outputFile(path7.join(targetDir, file), content);
|
|
833
874
|
}
|
|
834
875
|
for (const file of TEMPLATE_OPTIONAL_TEXT_FILES) {
|
|
835
876
|
const content = await fetchTextOptional(`${templateBaseUrl}/${file}`);
|
|
836
877
|
if (content !== null) {
|
|
837
|
-
await fs5.outputFile(
|
|
878
|
+
await fs5.outputFile(path7.join(targetDir, file), content);
|
|
838
879
|
}
|
|
839
880
|
}
|
|
840
881
|
for (const file of TEMPLATE_BINARY_FILES) {
|
|
841
882
|
const buffer = await fetchBinary(`${templateBaseUrl}/${file}`);
|
|
842
883
|
if (buffer) {
|
|
843
|
-
await fs5.outputFile(
|
|
884
|
+
await fs5.outputFile(path7.join(targetDir, file), buffer);
|
|
844
885
|
}
|
|
845
886
|
}
|
|
846
887
|
spinner.succeed("Project created");
|
|
@@ -889,7 +930,7 @@ async function createCommand(name, options = {}) {
|
|
|
889
930
|
}
|
|
890
931
|
|
|
891
932
|
// src/commands/doctor.ts
|
|
892
|
-
import
|
|
933
|
+
import path8 from "path";
|
|
893
934
|
import chalk4 from "chalk";
|
|
894
935
|
import fs6 from "fs-extra";
|
|
895
936
|
function logCheck(status, message) {
|
|
@@ -927,7 +968,7 @@ async function doctorCommand(cwd) {
|
|
|
927
968
|
logCheck("fail", "Not a React Native or Expo project");
|
|
928
969
|
issues++;
|
|
929
970
|
}
|
|
930
|
-
const pkgPath =
|
|
971
|
+
const pkgPath = path8.resolve(cwd, "package.json");
|
|
931
972
|
if (await fs6.pathExists(pkgPath)) {
|
|
932
973
|
const pkg = await fs6.readJSON(pkgPath);
|
|
933
974
|
const allDeps = {
|
|
@@ -942,7 +983,7 @@ async function doctorCommand(cwd) {
|
|
|
942
983
|
issues++;
|
|
943
984
|
}
|
|
944
985
|
}
|
|
945
|
-
const corePkgPath =
|
|
986
|
+
const corePkgPath = path8.resolve(
|
|
946
987
|
cwd,
|
|
947
988
|
"node_modules",
|
|
948
989
|
"@rootnative",
|
|
@@ -973,7 +1014,7 @@ async function doctorCommand(cwd) {
|
|
|
973
1014
|
const dirs = await fs6.readdir(componentsDir);
|
|
974
1015
|
const componentDirs = [];
|
|
975
1016
|
for (const dir of dirs) {
|
|
976
|
-
const fullPath =
|
|
1017
|
+
const fullPath = path8.join(componentsDir, dir);
|
|
977
1018
|
const stat = await fs6.stat(fullPath);
|
|
978
1019
|
if (stat.isDirectory()) {
|
|
979
1020
|
componentDirs.push(dir);
|
|
@@ -982,7 +1023,7 @@ async function doctorCommand(cwd) {
|
|
|
982
1023
|
if (componentDirs.length > 0) {
|
|
983
1024
|
let integrityOk = true;
|
|
984
1025
|
for (const dir of componentDirs) {
|
|
985
|
-
const indexPath =
|
|
1026
|
+
const indexPath = path8.join(componentsDir, dir, "index.ts");
|
|
986
1027
|
if (!await fs6.pathExists(indexPath)) {
|
|
987
1028
|
logCheck("warn", `Component ${dir} is missing index.ts`);
|
|
988
1029
|
integrityOk = false;
|
|
@@ -1007,7 +1048,7 @@ async function doctorCommand(cwd) {
|
|
|
1007
1048
|
);
|
|
1008
1049
|
}
|
|
1009
1050
|
const libDir = resolveAliasPath(config.aliases.lib, cwd);
|
|
1010
|
-
const barrelPath =
|
|
1051
|
+
const barrelPath = path8.join(libDir, "rootnative-utils.ts");
|
|
1011
1052
|
if (await fs6.pathExists(barrelPath)) {
|
|
1012
1053
|
logCheck("pass", "Utility barrel file present");
|
|
1013
1054
|
} else {
|
|
@@ -1019,8 +1060,8 @@ async function doctorCommand(cwd) {
|
|
|
1019
1060
|
}
|
|
1020
1061
|
}
|
|
1021
1062
|
}
|
|
1022
|
-
const nodeModules =
|
|
1023
|
-
const inertiaPkgPath =
|
|
1063
|
+
const nodeModules = path8.resolve(cwd, "node_modules");
|
|
1064
|
+
const inertiaPkgPath = path8.join(
|
|
1024
1065
|
nodeModules,
|
|
1025
1066
|
"@rootnative",
|
|
1026
1067
|
"inertia",
|
|
@@ -1037,7 +1078,7 @@ async function doctorCommand(cwd) {
|
|
|
1037
1078
|
issues++;
|
|
1038
1079
|
}
|
|
1039
1080
|
for (const peer of REQUIRED_BARREL_PEERS) {
|
|
1040
|
-
if (await fs6.pathExists(
|
|
1081
|
+
if (await fs6.pathExists(path8.join(nodeModules, peer.name))) {
|
|
1041
1082
|
logCheck("pass", `${peer.name} installed`);
|
|
1042
1083
|
continue;
|
|
1043
1084
|
}
|
|
@@ -1046,7 +1087,7 @@ async function doctorCommand(cwd) {
|
|
|
1046
1087
|
issues++;
|
|
1047
1088
|
}
|
|
1048
1089
|
const safeAreaInstalled = await fs6.pathExists(
|
|
1049
|
-
|
|
1090
|
+
path8.join(nodeModules, "react-native-safe-area-context")
|
|
1050
1091
|
);
|
|
1051
1092
|
if (safeAreaInstalled) {
|
|
1052
1093
|
logCheck("pass", "react-native-safe-area-context installed");
|
|
@@ -1057,7 +1098,7 @@ async function doctorCommand(cwd) {
|
|
|
1057
1098
|
);
|
|
1058
1099
|
}
|
|
1059
1100
|
const vectorIconsInstalled = await fs6.pathExists(
|
|
1060
|
-
|
|
1101
|
+
path8.join(nodeModules, "@expo", "vector-icons")
|
|
1061
1102
|
);
|
|
1062
1103
|
if (vectorIconsInstalled) {
|
|
1063
1104
|
logCheck("pass", "@expo/vector-icons installed");
|
|
@@ -1083,7 +1124,7 @@ import { execa as execa3 } from "execa";
|
|
|
1083
1124
|
import prompts3 from "prompts";
|
|
1084
1125
|
|
|
1085
1126
|
// src/lib/llm-docs.ts
|
|
1086
|
-
import
|
|
1127
|
+
import path9 from "path";
|
|
1087
1128
|
import fs7 from "fs-extra";
|
|
1088
1129
|
var CLAUDE_MD = "CLAUDE.md";
|
|
1089
1130
|
var POINTER_MARKER = "@rootnative/components/llms.txt";
|
|
@@ -1099,7 +1140,7 @@ This project uses RootNative UI (\`@rootnative/*\`). LLM-optimized docs:
|
|
|
1099
1140
|
Prefer the \`node_modules\` copies \u2014 they match the installed version exactly.
|
|
1100
1141
|
`;
|
|
1101
1142
|
async function ensureLlmDocsPointer(cwd) {
|
|
1102
|
-
const filePath =
|
|
1143
|
+
const filePath = path9.join(cwd, CLAUDE_MD);
|
|
1103
1144
|
if (!await fs7.pathExists(filePath)) {
|
|
1104
1145
|
await fs7.outputFile(filePath, `# CLAUDE.md
|
|
1105
1146
|
|
|
@@ -1311,7 +1352,7 @@ async function initCommand(cwd, options = {}) {
|
|
|
1311
1352
|
}
|
|
1312
1353
|
|
|
1313
1354
|
// src/commands/list.ts
|
|
1314
|
-
import
|
|
1355
|
+
import path10 from "path";
|
|
1315
1356
|
import chalk6 from "chalk";
|
|
1316
1357
|
import fs8 from "fs-extra";
|
|
1317
1358
|
async function listCommand(cwd) {
|
|
@@ -1339,7 +1380,7 @@ async function listCommand(cwd) {
|
|
|
1339
1380
|
` ${chalk6.dim("-".repeat(70))}`
|
|
1340
1381
|
);
|
|
1341
1382
|
for (const component of registryIndex.components) {
|
|
1342
|
-
const componentDir =
|
|
1383
|
+
const componentDir = path10.join(componentsDir, component.name);
|
|
1343
1384
|
const installed = await fs8.pathExists(componentDir);
|
|
1344
1385
|
const status = installed ? chalk6.green("installed") : chalk6.dim("-");
|
|
1345
1386
|
const nameDisplay = installed ? chalk6.green(component.name) : component.name;
|
|
@@ -1360,7 +1401,7 @@ function padEnd(str, length) {
|
|
|
1360
1401
|
}
|
|
1361
1402
|
|
|
1362
1403
|
// src/commands/update.ts
|
|
1363
|
-
import
|
|
1404
|
+
import path11 from "path";
|
|
1364
1405
|
import chalk8 from "chalk";
|
|
1365
1406
|
import fs9 from "fs-extra";
|
|
1366
1407
|
import prompts4 from "prompts";
|
|
@@ -1512,7 +1553,7 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1512
1553
|
targetNames = componentNames;
|
|
1513
1554
|
const missing = [];
|
|
1514
1555
|
for (const name of targetNames) {
|
|
1515
|
-
const dir =
|
|
1556
|
+
const dir = path11.join(componentsDir, name);
|
|
1516
1557
|
if (!await fs9.pathExists(dir)) {
|
|
1517
1558
|
missing.push(name);
|
|
1518
1559
|
}
|
|
@@ -1536,7 +1577,7 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1536
1577
|
resolveSpinner.succeed("Registry fetched");
|
|
1537
1578
|
const componentDiffs = [];
|
|
1538
1579
|
for (const { entry } of resolution.components) {
|
|
1539
|
-
const componentDir =
|
|
1580
|
+
const componentDir = path11.join(componentsDir, entry.name);
|
|
1540
1581
|
if (!await fs9.pathExists(componentDir)) {
|
|
1541
1582
|
componentDiffs.push({
|
|
1542
1583
|
name: entry.name,
|
|
@@ -1547,8 +1588,8 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1547
1588
|
}
|
|
1548
1589
|
const diffs = [];
|
|
1549
1590
|
for (const filePath of entry.files) {
|
|
1550
|
-
const fileName =
|
|
1551
|
-
const localPath =
|
|
1591
|
+
const fileName = path11.basename(filePath);
|
|
1592
|
+
const localPath = path11.join(componentDir, fileName);
|
|
1552
1593
|
const remoteContent = await fetchFileContent(config, filePath);
|
|
1553
1594
|
const transformed = transformImports(remoteContent, {
|
|
1554
1595
|
config,
|
|
@@ -1568,8 +1609,8 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1568
1609
|
for (const utilName of resolution.utils) {
|
|
1569
1610
|
const utilEntry = utilsRegistry[utilName];
|
|
1570
1611
|
if (!utilEntry) continue;
|
|
1571
|
-
const fileName =
|
|
1572
|
-
const localPath =
|
|
1612
|
+
const fileName = path11.basename(utilEntry.file);
|
|
1613
|
+
const localPath = path11.join(libDir, fileName);
|
|
1573
1614
|
const remoteContent = await fetchFileContent(config, utilEntry.file);
|
|
1574
1615
|
let localContent = "";
|
|
1575
1616
|
if (await fs9.pathExists(localPath)) {
|
|
@@ -1585,7 +1626,7 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1585
1626
|
}
|
|
1586
1627
|
}
|
|
1587
1628
|
const newBarrel = generateUtilsBarrel(resolution.utils, utilExports);
|
|
1588
|
-
const barrelPath =
|
|
1629
|
+
const barrelPath = path11.join(libDir, "rootnative-utils.ts");
|
|
1589
1630
|
let oldBarrel = "";
|
|
1590
1631
|
if (await fs9.pathExists(barrelPath)) {
|
|
1591
1632
|
oldBarrel = await fs9.readFile(barrelPath, "utf-8");
|
|
@@ -1651,7 +1692,7 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1651
1692
|
const applySpinner = createSpinner("Applying updates...");
|
|
1652
1693
|
applySpinner.start();
|
|
1653
1694
|
for (const comp of changedComponents) {
|
|
1654
|
-
const componentDir =
|
|
1695
|
+
const componentDir = path11.join(componentsDir, comp.name);
|
|
1655
1696
|
await fs9.ensureDir(componentDir);
|
|
1656
1697
|
if (comp.diffs.length === 0) {
|
|
1657
1698
|
const entry = resolution.components.find(
|
|
@@ -1660,14 +1701,14 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1660
1701
|
if (!entry) continue;
|
|
1661
1702
|
for (const filePath of entry.entry.files) {
|
|
1662
1703
|
const content = await fetchFileContent(config, filePath);
|
|
1663
|
-
const fileName =
|
|
1704
|
+
const fileName = path11.basename(filePath);
|
|
1664
1705
|
const transformed = transformImports(content, {
|
|
1665
1706
|
config,
|
|
1666
1707
|
componentName: comp.name,
|
|
1667
1708
|
installedComponents: allComponentNames
|
|
1668
1709
|
});
|
|
1669
1710
|
await fs9.writeFile(
|
|
1670
|
-
|
|
1711
|
+
path11.join(componentDir, fileName),
|
|
1671
1712
|
transformed,
|
|
1672
1713
|
"utf-8"
|
|
1673
1714
|
);
|
|
@@ -1678,7 +1719,7 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1678
1719
|
if (!diff.hasChanges) continue;
|
|
1679
1720
|
const newContent = diff.lines.filter((l) => l.type !== "remove").map((l) => l.content).join("\n");
|
|
1680
1721
|
await fs9.writeFile(
|
|
1681
|
-
|
|
1722
|
+
path11.join(componentDir, diff.fileName),
|
|
1682
1723
|
newContent,
|
|
1683
1724
|
"utf-8"
|
|
1684
1725
|
);
|
|
@@ -1688,7 +1729,7 @@ async function updateCommand(componentNames, cwd, options) {
|
|
|
1688
1729
|
for (const diff of changedUtils) {
|
|
1689
1730
|
if (!diff.hasChanges) continue;
|
|
1690
1731
|
const newContent = diff.lines.filter((l) => l.type !== "remove").map((l) => l.content).join("\n");
|
|
1691
|
-
const filePath =
|
|
1732
|
+
const filePath = path11.join(
|
|
1692
1733
|
libDir,
|
|
1693
1734
|
// diff.fileName is like "lib/color.ts" — strip the "lib/" prefix
|
|
1694
1735
|
diff.fileName.replace(/^lib\//, "")
|
|
@@ -1709,10 +1750,10 @@ async function getInstalledComponents(componentsDir) {
|
|
|
1709
1750
|
const entries = await fs9.readdir(componentsDir);
|
|
1710
1751
|
const components = [];
|
|
1711
1752
|
for (const entry of entries) {
|
|
1712
|
-
const fullPath =
|
|
1753
|
+
const fullPath = path11.join(componentsDir, entry);
|
|
1713
1754
|
const stat = await fs9.stat(fullPath);
|
|
1714
1755
|
if (stat.isDirectory()) {
|
|
1715
|
-
const indexPath =
|
|
1756
|
+
const indexPath = path11.join(fullPath, "index.ts");
|
|
1716
1757
|
if (await fs9.pathExists(indexPath)) {
|
|
1717
1758
|
components.push(entry);
|
|
1718
1759
|
}
|
|
@@ -1722,7 +1763,7 @@ async function getInstalledComponents(componentsDir) {
|
|
|
1722
1763
|
}
|
|
1723
1764
|
|
|
1724
1765
|
// src/commands/upgrade.ts
|
|
1725
|
-
import
|
|
1766
|
+
import path12 from "path";
|
|
1726
1767
|
import chalk9 from "chalk";
|
|
1727
1768
|
import { execa as execa4 } from "execa";
|
|
1728
1769
|
import fs10 from "fs-extra";
|
|
@@ -1738,7 +1779,7 @@ async function fetchLatestFromNpm(packageName) {
|
|
|
1738
1779
|
return response.json();
|
|
1739
1780
|
}
|
|
1740
1781
|
function getInstalledPackageInfo(cwd, packageName) {
|
|
1741
|
-
const pkgPath =
|
|
1782
|
+
const pkgPath = path12.resolve(
|
|
1742
1783
|
cwd,
|
|
1743
1784
|
"node_modules",
|
|
1744
1785
|
...packageName.split("/"),
|
|
@@ -1778,7 +1819,7 @@ function diffPeerDeps(current, latest) {
|
|
|
1778
1819
|
return { added, changed, removed };
|
|
1779
1820
|
}
|
|
1780
1821
|
function getProjectDeps(cwd) {
|
|
1781
|
-
const pkgPath =
|
|
1822
|
+
const pkgPath = path12.resolve(cwd, "package.json");
|
|
1782
1823
|
try {
|
|
1783
1824
|
const pkg = fs10.readJSONSync(pkgPath);
|
|
1784
1825
|
return {
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @rootnative/cli — CLI for RootNative UI
|
|
2
2
|
|
|
3
|
-
> Version: 0.0.0-alpha.
|
|
3
|
+
> Version: 0.0.0-alpha.7
|
|
4
4
|
> Binary: `rootnative`
|
|
5
5
|
> Requirements: Node >=18
|
|
6
6
|
|
|
@@ -47,7 +47,7 @@ Creates `rootnative.json`:
|
|
|
47
47
|
"$schema": "https://rootnative.github.io/ui/schema.json",
|
|
48
48
|
"aliases": { "components": "@/components/ui", "lib": "@/lib" },
|
|
49
49
|
"registryUrl": "https://raw.githubusercontent.com/rootnative/ui",
|
|
50
|
-
"registryVersion": "v0.0.0-alpha.
|
|
50
|
+
"registryVersion": "v0.0.0-alpha.7"
|
|
51
51
|
}
|
|
52
52
|
```
|
|
53
53
|
|