bluedither 1.0.2 → 1.0.4
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/cli/commands/extract.js +52 -27
- package/package.json +1 -1
package/cli/commands/extract.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* bluedither extract [dir] [--validate]
|
|
3
3
|
*
|
|
4
|
-
* Validates theme directory completeness.
|
|
5
|
-
* Full Paper extraction is planned for Phase 5.
|
|
4
|
+
* Validates theme directory completeness using bluedither.config.json paths.
|
|
6
5
|
*/
|
|
7
6
|
|
|
8
7
|
import { readFileSync, existsSync } from 'fs';
|
|
9
|
-
import { resolve
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
|
-
|
|
12
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
import { resolve } from 'path';
|
|
13
9
|
|
|
14
10
|
export default async function extract(args) {
|
|
15
11
|
if (args.includes('--help')) {
|
|
@@ -30,27 +26,52 @@ export default async function extract(args) {
|
|
|
30
26
|
|
|
31
27
|
console.log(`Checking theme package in: ${dir}\n`);
|
|
32
28
|
|
|
29
|
+
// Read config to get actual paths
|
|
30
|
+
const configPath = resolve(dir, 'bluedither.config.json');
|
|
31
|
+
if (!existsSync(configPath)) {
|
|
32
|
+
console.error('✗ No bluedither.config.json found.');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
37
|
+
|
|
33
38
|
const required = [
|
|
34
|
-
{ path:
|
|
35
|
-
{ path:
|
|
36
|
-
{ path:
|
|
37
|
-
{ path:
|
|
38
|
-
{ path:
|
|
39
|
-
{ path:
|
|
40
|
-
{ path: 'theme/shaders/bluedither-shader.js', label: 'Shader module' },
|
|
41
|
-
{ path: 'theme/shaders/paper-shaders-bundle.js', label: 'Shader bundle' },
|
|
42
|
-
{ path: 'skill.md', label: 'Skill instructions' },
|
|
39
|
+
{ path: config.tokens, label: 'Tokens' },
|
|
40
|
+
{ path: config.defaults, label: 'Default tokens' },
|
|
41
|
+
{ path: config.schema, label: 'Token schema' },
|
|
42
|
+
{ path: config.structure, label: 'Structure contract' },
|
|
43
|
+
{ path: config.rules, label: 'Design rules' },
|
|
44
|
+
{ path: config.skill, label: 'Skill instructions' },
|
|
43
45
|
{ path: 'bluedither.config.json', label: 'Package manifest' },
|
|
44
46
|
];
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
// Add shader sources if present
|
|
49
|
+
if (config.shaderSources) {
|
|
50
|
+
for (const s of config.shaderSources) {
|
|
51
|
+
required.push({ path: s, label: `Shader source (${s})` });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Template directory
|
|
56
|
+
for (const tmplPath of ['theme/template/index.html', 'template/index.html']) {
|
|
57
|
+
if (existsSync(resolve(dir, tmplPath))) {
|
|
58
|
+
required.push({ path: tmplPath, label: 'HTML template' });
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const optional = [];
|
|
64
|
+
if (config.tuner) optional.push({ path: config.tuner, label: 'Tuner bundle' });
|
|
65
|
+
if (config.shaders) {
|
|
66
|
+
for (const s of config.shaders) {
|
|
67
|
+
optional.push({ path: s, label: `Shader bundle (${s})` });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (config.generators) {
|
|
71
|
+
for (const gen of ['vanilla.md', 'react.md', 'vue.md', 'svelte.md']) {
|
|
72
|
+
optional.push({ path: `${config.generators}${gen}`, label: `${gen.replace('.md', '')} generator` });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
54
75
|
|
|
55
76
|
let allPresent = true;
|
|
56
77
|
|
|
@@ -70,8 +91,8 @@ export default async function extract(args) {
|
|
|
70
91
|
// Schema validation
|
|
71
92
|
if (doValidate) {
|
|
72
93
|
console.log('\nSchema validation:');
|
|
73
|
-
const schemaPath = resolve(dir,
|
|
74
|
-
const tokensPath = resolve(dir,
|
|
94
|
+
const schemaPath = resolve(dir, config.schema);
|
|
95
|
+
const tokensPath = resolve(dir, config.tokens);
|
|
75
96
|
|
|
76
97
|
if (!existsSync(schemaPath) || !existsSync(tokensPath)) {
|
|
77
98
|
console.log(' ✗ Cannot validate: schema or tokens file missing');
|
|
@@ -92,8 +113,12 @@ export default async function extract(args) {
|
|
|
92
113
|
allPresent = false;
|
|
93
114
|
}
|
|
94
115
|
} catch (e) {
|
|
95
|
-
|
|
96
|
-
|
|
116
|
+
if (e.code === 'ERR_MODULE_NOT_FOUND' || e.code === 'MODULE_NOT_FOUND') {
|
|
117
|
+
console.log(' – Skipped (ajv not installed)');
|
|
118
|
+
} else {
|
|
119
|
+
console.log(` ✗ Validation error: ${e.message}`);
|
|
120
|
+
allPresent = false;
|
|
121
|
+
}
|
|
97
122
|
}
|
|
98
123
|
}
|
|
99
124
|
}
|