@foundrykit/cli 2.0.12 ā 3.1.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 +94 -6
- package/dist/cli.js +2327 -671
- package/dist/cli.js.map +1 -1
- package/dist/index.js +2327 -671
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
- package/schema.json +60 -0
- package/.turbo/turbo-type-check.log +0 -4
- package/CHANGELOG.md +0 -254
- package/docs/DEPENDENCY_RESOLUTION.md +0 -201
- package/postcss.config.mjs +0 -6
- package/src/commands/add.ts +0 -1069
- package/src/commands/doctor.ts +0 -130
- package/src/commands/init.ts +0 -928
- package/src/commands/list.ts +0 -167
- package/src/commands/update.ts +0 -323
- package/src/index.ts +0 -34
- package/src/lib/constants.ts +0 -42
- package/src/lib/registry.ts +0 -627
- package/tests/dependency-resolution.test.ts +0 -579
- package/tsconfig.json +0 -11
- package/tsconfig.lint.json +0 -8
- package/tsup.config.ts +0 -16
package/src/commands/doctor.ts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import fs from 'fs-extra';
|
|
5
|
-
import { DEFAULT_REGISTRY_URL } from '../lib/constants.js';
|
|
6
|
-
import { loadConfig } from './add.js';
|
|
7
|
-
|
|
8
|
-
interface CheckResult {
|
|
9
|
-
label: string;
|
|
10
|
-
ok: boolean;
|
|
11
|
-
detail: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function doctorCommand() {
|
|
15
|
-
return new Command('doctor')
|
|
16
|
-
.description('Check project health and configuration')
|
|
17
|
-
.action(async () => {
|
|
18
|
-
console.log(chalk.blue('š Checking project health...'));
|
|
19
|
-
|
|
20
|
-
const results: CheckResult[] = [];
|
|
21
|
-
|
|
22
|
-
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
23
|
-
const hasPackageJson = await fs.pathExists(packageJsonPath);
|
|
24
|
-
results.push({
|
|
25
|
-
label: 'package.json',
|
|
26
|
-
ok: hasPackageJson,
|
|
27
|
-
detail: hasPackageJson
|
|
28
|
-
? 'Project manifest found'
|
|
29
|
-
: 'Run this command in a project root',
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
let packageJson: {
|
|
33
|
-
dependencies?: Record<string, string>;
|
|
34
|
-
devDependencies?: Record<string, string>;
|
|
35
|
-
} | null = null;
|
|
36
|
-
if (hasPackageJson) {
|
|
37
|
-
packageJson = await fs.readJson(packageJsonPath);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const hasNext =
|
|
41
|
-
!!packageJson &&
|
|
42
|
-
!!(packageJson.dependencies?.next || packageJson.devDependencies?.next);
|
|
43
|
-
results.push({
|
|
44
|
-
label: 'Framework',
|
|
45
|
-
ok: hasNext,
|
|
46
|
-
detail: hasNext
|
|
47
|
-
? 'Next.js dependency detected'
|
|
48
|
-
: 'FoundryKit currently expects a Next.js project',
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const configPath = path.join(process.cwd(), 'foundrykit.config.json');
|
|
52
|
-
const hasConfig = await fs.pathExists(configPath);
|
|
53
|
-
results.push({
|
|
54
|
-
label: 'FoundryKit config',
|
|
55
|
-
ok: hasConfig,
|
|
56
|
-
detail: hasConfig
|
|
57
|
-
? 'foundrykit.config.json found'
|
|
58
|
-
: 'Run "foundrykit init" to create the configuration file',
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
let config: Awaited<ReturnType<typeof loadConfig>> | null = null;
|
|
62
|
-
if (hasConfig) {
|
|
63
|
-
try {
|
|
64
|
-
config = await loadConfig();
|
|
65
|
-
const hasRequiredPaths =
|
|
66
|
-
!!config.paths?.utils &&
|
|
67
|
-
!!config.paths?.primitives &&
|
|
68
|
-
!!config.paths?.components &&
|
|
69
|
-
!!config.paths?.blocks &&
|
|
70
|
-
!!config.paths?.animations;
|
|
71
|
-
|
|
72
|
-
results.push({
|
|
73
|
-
label: 'Config shape',
|
|
74
|
-
ok: hasRequiredPaths,
|
|
75
|
-
detail: hasRequiredPaths
|
|
76
|
-
? 'Required install paths are configured'
|
|
77
|
-
: 'Configuration is missing one or more required install paths',
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const registryUrl = config.registry || DEFAULT_REGISTRY_URL;
|
|
81
|
-
try {
|
|
82
|
-
const response = await fetch(`${registryUrl}/registry`, {
|
|
83
|
-
headers: { Accept: 'application/json' },
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
results.push({
|
|
87
|
-
label: 'Registry',
|
|
88
|
-
ok: response.ok,
|
|
89
|
-
detail: response.ok
|
|
90
|
-
? `Registry reachable at ${registryUrl}`
|
|
91
|
-
: `Registry returned ${response.status} ${response.statusText}`,
|
|
92
|
-
});
|
|
93
|
-
} catch (error) {
|
|
94
|
-
results.push({
|
|
95
|
-
label: 'Registry',
|
|
96
|
-
ok: false,
|
|
97
|
-
detail: `Unable to reach ${registryUrl}: ${
|
|
98
|
-
error instanceof Error ? error.message : 'Unknown error'
|
|
99
|
-
}`,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
} catch (error) {
|
|
103
|
-
results.push({
|
|
104
|
-
label: 'Config shape',
|
|
105
|
-
ok: false,
|
|
106
|
-
detail: `Failed to read foundrykit.config.json: ${
|
|
107
|
-
error instanceof Error ? error.message : 'Unknown error'
|
|
108
|
-
}`,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
for (const result of results) {
|
|
114
|
-
const icon = result.ok ? chalk.green('ā
') : chalk.red('ā');
|
|
115
|
-
console.log(`${icon} ${result.label}: ${result.detail}`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const hasFailures = results.some(result => !result.ok);
|
|
119
|
-
if (hasFailures) {
|
|
120
|
-
console.log(
|
|
121
|
-
chalk.yellow(
|
|
122
|
-
'\nā ļø Found issues that should be resolved before continuing.'
|
|
123
|
-
)
|
|
124
|
-
);
|
|
125
|
-
process.exit(1);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
console.log(chalk.green('\nā
All checks passed!'));
|
|
129
|
-
});
|
|
130
|
-
}
|