@foundrykit/cli 2.0.0 → 2.0.1
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/CHANGELOG.md +8 -0
- package/dist/cli.js +31 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.js +31 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/commands/update.ts +38 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foundrykit/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"glob": "^10.3.10",
|
|
26
26
|
"inquirer": "^9.2.15",
|
|
27
27
|
"node-fetch": "^3.3.0",
|
|
28
|
-
"@foundrykit/types": "
|
|
28
|
+
"@foundrykit/types": "2.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^20.19.9",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"tsup": "^8.0.0",
|
|
36
36
|
"typescript": "^5.9.2",
|
|
37
37
|
"vitest": "^1.2.0",
|
|
38
|
-
"@foundrykit/
|
|
39
|
-
"@foundrykit/
|
|
38
|
+
"@foundrykit/typescript-config": "1.0.5",
|
|
39
|
+
"@foundrykit/eslint-config": "1.0.5"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsup",
|
package/src/commands/update.ts
CHANGED
|
@@ -3,7 +3,7 @@ import chalk from 'chalk';
|
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import { addSingleComponent, type AddOptions } from './add.js';
|
|
6
|
+
import { addSingleComponent, hasConflictingFiles, type AddOptions } from './add.js';
|
|
7
7
|
import { getRegistry } from '../lib/registry.js';
|
|
8
8
|
import type { InstalledComponent } from '@foundrykit/types';
|
|
9
9
|
|
|
@@ -39,12 +39,45 @@ export function updateCommand() {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const config = await fs.readJson(configPath);
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
let installed: Record<string, InstalledComponent> = config.installedComponents ?? {};
|
|
43
|
+
let installedIds = Object.keys(installed);
|
|
44
44
|
|
|
45
45
|
if (installedIds.length === 0) {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
// No tracking data yet — fall back to scanning the filesystem
|
|
47
|
+
console.log(chalk.gray('No install tracking found. Scanning filesystem for installed components...'));
|
|
48
|
+
const registry = getRegistry();
|
|
49
|
+
let allComponents;
|
|
50
|
+
try {
|
|
51
|
+
allComponents = await registry.getComponents();
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error(chalk.red('❌ Failed to fetch registry:'));
|
|
54
|
+
console.error(chalk.red(error instanceof Error ? error.message : String(error)));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const component of allComponents) {
|
|
59
|
+
try {
|
|
60
|
+
const componentData = await registry.getComponent(component.id);
|
|
61
|
+
if (await hasConflictingFiles(componentData, options)) {
|
|
62
|
+
installed[component.id] = {
|
|
63
|
+
id: component.id,
|
|
64
|
+
version: null,
|
|
65
|
+
installedAt: new Date().toISOString(),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
} catch {
|
|
69
|
+
// skip unfetchable components
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
installedIds = Object.keys(installed);
|
|
74
|
+
|
|
75
|
+
if (installedIds.length === 0) {
|
|
76
|
+
console.log(chalk.yellow('No installed components found. Use "foundrykit add" to install components.'));
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
console.log(chalk.gray(`Found ${installedIds.length} installed component(s) via filesystem scan.`));
|
|
48
81
|
}
|
|
49
82
|
|
|
50
83
|
if (options.opt) {
|