slicejs-cli 4.4.0 → 4.6.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.
Files changed (51) hide show
  1. package/client.js +192 -82
  2. package/commands/Print.js +158 -164
  3. package/commands/build/build.js +27 -1
  4. package/commands/buildProduction/buildProduction.js +42 -71
  5. package/commands/bundle/bundle.js +65 -60
  6. package/commands/docs/agents.js +260 -0
  7. package/commands/docs/events.js +365 -0
  8. package/commands/docs/index.js +123 -0
  9. package/commands/doctor/doctor.js +99 -12
  10. package/commands/export/checkExport.js +163 -0
  11. package/commands/export/clientRedirects.js +72 -0
  12. package/commands/export/copyDist.js +180 -0
  13. package/commands/export/export.js +236 -0
  14. package/commands/export/files.js +33 -0
  15. package/commands/export/hosts/cloudflare.js +48 -0
  16. package/commands/export/hosts/github.js +31 -0
  17. package/commands/export/hosts/index.js +69 -0
  18. package/commands/export/hosts/netlify.js +42 -0
  19. package/commands/export/hosts/nginx.js +73 -0
  20. package/commands/export/hosts/none.js +23 -0
  21. package/commands/export/hosts/s3.js +24 -0
  22. package/commands/export/hosts/shared.js +62 -0
  23. package/commands/export/hosts/vercel.js +69 -0
  24. package/commands/export/outDir.js +91 -0
  25. package/commands/export/prerender.js +121 -0
  26. package/commands/getComponent/getComponent.js +44 -40
  27. package/commands/init/init.js +32 -22
  28. package/commands/lint/lint.js +2 -2
  29. package/commands/lint/types.js +1 -1
  30. package/commands/listComponents/listComponents.js +205 -172
  31. package/commands/seo/check.js +7 -4
  32. package/commands/seo/images.js +77 -22
  33. package/commands/seo/sitemap.js +6 -3
  34. package/commands/seo/support.js +62 -0
  35. package/commands/setup/lint.js +1 -1
  36. package/commands/skill/skill.js +2 -2
  37. package/commands/startServer/startServer.js +60 -21
  38. package/commands/startServer/watchServer.js +3 -3
  39. package/commands/translator/check.js +32 -0
  40. package/commands/translator/init.js +125 -0
  41. package/commands/translator/scan.js +444 -0
  42. package/commands/typecheck/typecheck.js +2 -2
  43. package/commands/types/types.js +22 -3
  44. package/commands/utils/VersionChecker.js +14 -14
  45. package/commands/utils/bundling/BundleGenerator.js +45 -27
  46. package/commands/utils/bundling/DependencyAnalyzer.js +1007 -976
  47. package/commands/utils/componentCatalog.js +120 -0
  48. package/commands/utils/publicEnv.js +74 -0
  49. package/commands/utils/sliceConfigSchema.js +34 -0
  50. package/commands/utils/updateManager.js +12 -12
  51. package/package.json +22 -23
@@ -3,6 +3,7 @@ import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
  import ora from 'ora';
5
5
  import Print from '../Print.js';
6
+ import { generateDocs } from '../docs/index.js';
6
7
  import { getProjectRoot, getApiPath, getSrcPath, getPath } from '../utils/PathHelper.js';
7
8
  import { execSync } from 'child_process';
8
9
  import {
@@ -104,6 +105,9 @@ node_modules/
104
105
  # Production build output (slice build)
105
106
  dist/
106
107
 
108
+ # Static export output (slice export)
109
+ dist-static/
110
+
107
111
  # Local environment overrides
108
112
  .env
109
113
  .env.*
@@ -241,7 +245,7 @@ export default async function initializeProject(options = {}) {
241
245
  fwSpinner.warn('Install did not run; using the slicejs-web-framework already in this project');
242
246
  } else {
243
247
  fwSpinner.fail('Failed to install slicejs-web-framework');
244
- Print.error('slice init:', err.message);
248
+ Print.error(`slice init: ${err.message}`);
245
249
  const retry = installCommand(packageManager, latestVersion ? `slicejs-web-framework@${latestVersion}` : 'slicejs-web-framework');
246
250
  Print.info(`Retry with: ${retry}`);
247
251
  return;
@@ -283,8 +287,8 @@ export default async function initializeProject(options = {}) {
283
287
  if (fs.existsSync(path.join(destinationApi, 'index.js'))) throw new Error(`api/index.js already exists: ${path.join(destinationApi, 'index.js')}`);
284
288
  if (fs.existsSync(destinationSrc)) throw new Error(`The "src" directory already exists: ${destinationSrc}`);
285
289
  } catch (error) {
286
- Print.error('Validating destination directories:', error.message);
287
- console.error(error.stack);
290
+ Print.error(`Validating destination directories: ${error.message}`);
291
+ Print.stack(error);
288
292
  return;
289
293
  }
290
294
 
@@ -299,7 +303,7 @@ export default async function initializeProject(options = {}) {
299
303
  } catch (error) {
300
304
  apiSpinner.fail('Error creating api/index.js');
301
305
  Print.error(error.message);
302
- console.error(error.stack);
306
+ Print.stack(error);
303
307
  return;
304
308
  }
305
309
 
@@ -351,7 +355,7 @@ export default async function initializeProject(options = {}) {
351
355
  } catch (error) {
352
356
  srcSpinner.fail('Error creating source structure');
353
357
  Print.error(error.message);
354
- console.error(error.stack);
358
+ Print.stack(error);
355
359
  return;
356
360
  }
357
361
 
@@ -484,38 +488,44 @@ export default async function initializeProject(options = {}) {
484
488
  }
485
489
 
486
490
  await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2), 'utf8');
487
- pkgSpinner.succeed('Package scripts configured successfully');
488
-
489
- Print.title('New recommended commands:');
490
- console.log(` ${packageManager} run dev - Start development server`);
491
- console.log(` ${packageManager} run get - Install components`);
492
- console.log(` ${packageManager} run browse - Browse components`);
491
+ pkgSpinner.succeed('Package scripts configured');
493
492
  } catch (error) {
494
493
  pkgSpinner.fail('Failed to configure npm scripts');
495
494
  Print.error(error.message);
496
- console.error(error.stack);
495
+ Print.stack(error);
496
+ }
497
+
498
+ // 5. SEED THE AGENT DOCUMENTATION
499
+ const docsSpinner = ora('Documenting the project for agents...').start();
500
+ try {
501
+ await generateDocs({ projectRoot, target: 'all' });
502
+ docsSpinner.succeed('AGENTS.md, category guides, types and event docs created');
503
+ } catch (error) {
504
+ docsSpinner.warn('Project created, but the agent docs could not be generated');
505
+ Print.error(`Documentation error: ${error.message}`);
497
506
  }
498
507
 
499
508
  const projectName = path.basename(process.cwd());
500
509
 
501
510
  const failedCount = [...visualResults, ...serviceResults].filter(r => !r.success).length;
502
511
  if (failedCount > 0) {
503
- Print.warning(`${failedCount} component(s) failed to install — run "${packageManager} run get -- <name>" to retry`);
512
+ const suffix = failedCount === 1 ? '' : 's';
513
+ Print.warning(`${failedCount} component${suffix} failed to install. Retry with "${packageManager} run get -- <name>".`);
504
514
  }
505
515
 
506
- Print.success(`Project initialized successfully in "${projectName}/"`);
516
+ Print.success(`Project initialized in ${projectName}/`);
507
517
  Print.newLine();
508
- Print.title('Next steps:');
518
+ Print.title('Next steps');
509
519
  console.log(` cd ${projectName}`);
510
- console.log(` ${packageManager} run dev - Start development server`);
511
- console.log(` ${packageManager} run browse - View available components`);
512
- console.log(` ${packageManager} run get -- Button - Install specific components`);
513
- console.log(` ${packageManager} run sync - Update all components to latest versions`);
514
- console.log(` slice setup lint --with-types - ESLint, type checking and the generated types`);
520
+ console.log(` ${packageManager} run dev Start the development server`);
521
+ console.log(` ${packageManager} run browse Browse registry components`);
522
+ console.log(` ${packageManager} run get -- Button Add a component`);
523
+ console.log(` ${packageManager} run sync Update installed components`);
524
+ console.log(' npx slicejs-cli setup lint --with-types ESLint, type checking and generated types');
515
525
 
516
526
  } catch (error) {
517
- Print.error('Unexpected error initializing project:', error.message);
518
- console.error(error.stack);
527
+ Print.error(`Unexpected error initializing project: ${error.message}`);
528
+ Print.stack(error);
519
529
  }
520
530
  }
521
531
 
@@ -36,7 +36,7 @@ export default async function lintCommand(options = {}, projectRoot) {
36
36
  const types = await runTypeRefresh(projectRoot, options);
37
37
  if (types) reportTypesRefresh(types, projectRoot);
38
38
  } catch (error) {
39
- Print.error('Could not refresh the generated types:', error.message);
39
+ Print.error(`Could not refresh the generated types: ${error.message}`);
40
40
  process.exitCode = 1;
41
41
  }
42
42
  }
@@ -61,7 +61,7 @@ export default async function lintCommand(options = {}, projectRoot) {
61
61
  });
62
62
 
63
63
  if (result.error) {
64
- Print.error('Could not run ESLint:', result.error.message);
64
+ Print.error(`Could not run ESLint: ${result.error.message}`);
65
65
  process.exitCode = 1;
66
66
  return false;
67
67
  }
@@ -77,7 +77,7 @@ export function reportTypesRefresh(types, projectRoot) {
77
77
  Print.info('Using tsconfig.json; the generated declarations are not added to it.');
78
78
  break;
79
79
  case 'editor_config_error':
80
- Print.warning('Could not update jsconfig.json:', types.jsconfigError || 'unknown error');
80
+ Print.warning(`Could not update jsconfig.json: ${types.jsconfigError || 'unknown error'}`);
81
81
  break;
82
82
  default:
83
83
  break;
@@ -1,172 +1,205 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import Table from 'cli-table3';
4
- import chalk from 'chalk';
5
- import Print from '../Print.js';
6
- import { getSrcPath, getComponentsJsPath, getConfigPath } from '../utils/PathHelper.js';
7
-
8
- /**
9
- * Loads configuration from sliceConfig.json
10
- * @returns {object} - Configuration object
11
- */
12
- const loadConfig = () => {
13
- try {
14
- const configPath = getConfigPath(import.meta.url);
15
- if (!fs.existsSync(configPath)) {
16
- Print.error('sliceConfig.json not found');
17
- Print.info('Run "slice init" to initialize your project');
18
- return null;
19
- }
20
- const rawData = fs.readFileSync(configPath, 'utf-8');
21
- return JSON.parse(rawData);
22
- } catch (error) {
23
- Print.error(`Failed to load configuration: ${error.message}`);
24
- Print.info('Check that sliceConfig.json is valid JSON');
25
- return null;
26
- }
27
- };
28
-
29
- /**
30
- * Lists files in a given folder, filtering only .js files
31
- * @param {string} folderPath - Path of the folder to read
32
- * @returns {string[]} - List of found files
33
- */
34
- const listComponents = (folderPath) => {
35
- try {
36
- if (!fs.existsSync(folderPath)) {
37
- return [];
38
- }
39
- const result = fs.readdirSync(folderPath);
40
- return result;
41
- } catch (error) {
42
- Print.error(`Failed to read directory ${folderPath}: ${error.message}`);
43
- return [];
44
- }
45
- };
46
-
47
- /**
48
- * Counts files in a component directory
49
- */
50
- const countComponentFiles = (componentPath) => {
51
- try {
52
- if (!fs.existsSync(componentPath)) return 0;
53
- const files = fs.readdirSync(componentPath);
54
- return files.filter(f => fs.statSync(path.join(componentPath, f)).isFile()).length;
55
- } catch {
56
- return 0;
57
- }
58
- };
59
-
60
- /**
61
- * Gets components dynamically from sliceConfig.json
62
- * @returns {object} - Component mapping with their category
63
- */
64
- const getComponents = () => {
65
- const config = loadConfig();
66
- if (!config) return {};
67
-
68
- const folderSuffix = 'src'; // Always use 'src' for development
69
- const componentPaths = config.paths?.components || {};
70
- let allComponents = new Map();
71
-
72
- Object.entries(componentPaths).forEach(([category, { path: folderPath }]) => {
73
- const cleanFolderPath = folderPath ? folderPath.replace(/^[/\\]+/, '') : '';
74
- const fullPath = getSrcPath(import.meta.url, cleanFolderPath);
75
- const files = listComponents(fullPath);
76
-
77
- files.forEach(file => {
78
- const componentPath = path.join(fullPath, file);
79
- if (fs.statSync(componentPath).isDirectory()) {
80
- const fileCount = countComponentFiles(componentPath);
81
- allComponents.set(file, { category, files: fileCount });
82
- }
83
- });
84
- });
85
-
86
- return Object.fromEntries(allComponents);
87
- };
88
-
89
- function listComponentsReal() {
90
- try {
91
- // Get components dynamically
92
- const components = getComponents();
93
-
94
- if (Object.keys(components).length === 0) {
95
- Print.warning('No components found in your project');
96
- Print.info('Create your first component with "slice component create"');
97
- return;
98
- }
99
-
100
- // Create table with cli-table3
101
- const table = new Table({
102
- head: [
103
- chalk.cyan.bold('Component'),
104
- chalk.cyan.bold('Category'),
105
- chalk.cyan.bold('Files')
106
- ],
107
- colWidths: [30, 20, 10],
108
- style: {
109
- head: [],
110
- border: ['gray']
111
- }
112
- });
113
-
114
- // Group by category for better visualization
115
- const byCategory = {};
116
- Object.entries(components).forEach(([name, data]) => {
117
- if (!byCategory[data.category]) {
118
- byCategory[data.category] = [];
119
- }
120
- byCategory[data.category].push({ name, files: data.files });
121
- });
122
-
123
- // Add rows to the table
124
- Object.entries(byCategory).forEach(([category, comps]) => {
125
- comps.forEach((comp, index) => {
126
- if (index === 0) {
127
- // First row of the category
128
- table.push([
129
- chalk.bold(comp.name),
130
- chalk.yellow(category),
131
- comp.files.toString()
132
- ]);
133
- } else {
134
- // Rest of components in the category
135
- table.push([
136
- chalk.bold(comp.name),
137
- chalk.gray('″'), // Ditto mark
138
- comp.files.toString()
139
- ]);
140
- }
141
- });
142
- });
143
-
144
- Print.newLine();
145
- Print.title('📦 Local Components');
146
- Print.newLine();
147
- console.log(table.toString());
148
- Print.newLine();
149
- Print.info(`Total: ${Object.keys(components).length} component${Object.keys(components).length !== 1 ? 's' : ''} found`);
150
-
151
- // Path where components.js will be generated
152
- const outputPath = getComponentsJsPath(import.meta.url);
153
-
154
- // Ensure the directory exists
155
- const outputDir = path.dirname(outputPath);
156
- if (!fs.existsSync(outputDir)) {
157
- fs.mkdirSync(outputDir, { recursive: true });
158
- }
159
-
160
- // Generate components.js file with detected components
161
- const componentsForExport = Object.fromEntries(
162
- Object.entries(components).map(([name, data]) => [name, data.category])
163
- );
164
- fs.writeFileSync(outputPath, `const components = ${JSON.stringify(componentsForExport, null, 2)};\n\nexport default components;\n`);
165
-
166
- } catch (error) {
167
- Print.error(`Failed to list components: ${error.message}`);
168
- Print.info('Make sure your project structure is correct');
169
- }
170
- }
171
-
172
- export default listComponentsReal;
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ import Print from '../Print.js';
5
+ import { getSrcPath, getComponentsJsPath, getConfigPath } from '../utils/PathHelper.js';
6
+
7
+ /**
8
+ * Loads configuration from sliceConfig.json
9
+ * @returns {object|null}
10
+ */
11
+ const loadConfig = () => {
12
+ try {
13
+ const configPath = getConfigPath(import.meta.url);
14
+ if (!fs.existsSync(configPath)) {
15
+ Print.error('sliceConfig.json not found');
16
+ Print.info('Run "slice init" to initialize your project');
17
+ return null;
18
+ }
19
+ return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
20
+ } catch (error) {
21
+ Print.error(`Failed to load configuration: ${error.message}`);
22
+ Print.info('Check that sliceConfig.json is valid JSON');
23
+ return null;
24
+ }
25
+ };
26
+
27
+ const listDirectories = (folderPath) => {
28
+ try {
29
+ if (!fs.existsSync(folderPath)) return [];
30
+ return fs.readdirSync(folderPath);
31
+ } catch (error) {
32
+ Print.error(`Failed to read directory ${folderPath}: ${error.message}`);
33
+ return [];
34
+ }
35
+ };
36
+
37
+ const countFiles = (componentPath) => {
38
+ try {
39
+ if (!fs.existsSync(componentPath)) return 0;
40
+ return fs.readdirSync(componentPath).filter((file) =>
41
+ fs.statSync(path.join(componentPath, file)).isFile()
42
+ ).length;
43
+ } catch {
44
+ return 0;
45
+ }
46
+ };
47
+
48
+ /**
49
+ * Scans sliceConfig.paths.components and returns the live component catalog.
50
+ * @returns {Record<string, {category: string, files: number}>}
51
+ */
52
+ const getComponents = () => {
53
+ const config = loadConfig();
54
+ if (!config) return {};
55
+
56
+ const components = new Map();
57
+ for (const [category, meta] of Object.entries(config.paths?.components || {})) {
58
+ const cleanPath = meta?.path ? meta.path.replace(/^[/\\]+/, '') : '';
59
+ const fullPath = getSrcPath(import.meta.url, cleanPath);
60
+ for (const entry of listDirectories(fullPath)) {
61
+ const componentPath = path.join(fullPath, entry);
62
+ if (fs.existsSync(componentPath) && fs.statSync(componentPath).isDirectory()) {
63
+ components.set(entry, { category, files: countFiles(componentPath) });
64
+ }
65
+ }
66
+ }
67
+
68
+ return Object.fromEntries(
69
+ Object.entries(Object.fromEntries(components)).sort(([a], [b]) => a.localeCompare(b))
70
+ );
71
+ };
72
+
73
+ function writeRegistry(components) {
74
+ const outputPath = getComponentsJsPath(import.meta.url);
75
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true });
76
+ const registry = Object.fromEntries(
77
+ Object.entries(components).map(([name, data]) => [name, data.category])
78
+ );
79
+ fs.writeFileSync(
80
+ outputPath,
81
+ `const components = ${JSON.stringify(registry, null, 2)};\n\nexport default components;\n`
82
+ );
83
+ }
84
+
85
+ function groupByCategory(components) {
86
+ const grouped = new Map();
87
+ for (const [name, data] of Object.entries(components)) {
88
+ if (!grouped.has(data.category)) grouped.set(data.category, []);
89
+ grouped.get(data.category).push(name);
90
+ }
91
+ return new Map(
92
+ [...grouped.entries()]
93
+ .map(([category, names]) => [category, names.sort((a, b) => a.localeCompare(b))])
94
+ .sort(([a], [b]) => a.localeCompare(b))
95
+ );
96
+ }
97
+
98
+ function wrapNames(names, indent = ' ') {
99
+ const width = Math.max(40, (process.stdout.columns || 80) - indent.length);
100
+ const lines = [];
101
+ let current = '';
102
+ for (const name of names) {
103
+ const next = current ? `${current}, ${name}` : name;
104
+ if (next.length > width && current) {
105
+ lines.push(current);
106
+ current = name;
107
+ } else {
108
+ current = next;
109
+ }
110
+ }
111
+ if (current) lines.push(current);
112
+ return lines.map((line) => `${indent}${line}`);
113
+ }
114
+
115
+ function printCompact(components, grouped) {
116
+ const names = Object.keys(components);
117
+ if (names.length === 0) {
118
+ Print.warning('No components found in your project');
119
+ Print.info('Create your first component with "slice component create"');
120
+ return;
121
+ }
122
+
123
+ Print.newLine();
124
+ console.log(chalk.bold('Local components'));
125
+ Print.newLine();
126
+
127
+ for (const [category, categoryNames] of grouped) {
128
+ const sample = categoryNames.slice(0, 4).join(', ');
129
+ const more = categoryNames.length > 4 ? ` +${categoryNames.length - 4} more` : '';
130
+ console.log(
131
+ ` ${chalk.cyan.bold(category.padEnd(16))} ${chalk.gray(String(categoryNames.length).padStart(3))} ${chalk.white(sample)}${chalk.gray(more)}`
132
+ );
133
+ }
134
+
135
+ Print.newLine();
136
+ Print.info(`Total: ${names.length} component${names.length === 1 ? '' : 's'} in ${grouped.size} categor${grouped.size === 1 ? 'y' : 'ies'}`);
137
+ Print.info('Use "slice component list --all" for every component, or --category <name> to narrow it.');
138
+ }
139
+
140
+ function printAll(components, grouped) {
141
+ const names = Object.keys(components);
142
+ if (names.length === 0) {
143
+ Print.warning('No components found in your project');
144
+ Print.info('Create your first component with "slice component create"');
145
+ return;
146
+ }
147
+
148
+ Print.newLine();
149
+ console.log(chalk.bold('Local components'));
150
+ for (const [category, categoryNames] of grouped) {
151
+ Print.newLine();
152
+ console.log(` ${chalk.cyan.bold(category)} ${chalk.gray(`(${categoryNames.length})`)}`);
153
+ for (const line of wrapNames(categoryNames)) console.log(chalk.white(line));
154
+ }
155
+ Print.newLine();
156
+ Print.info(`Total: ${names.length} component${names.length === 1 ? '' : 's'} in ${grouped.size} categor${grouped.size === 1 ? 'y' : 'ies'}`);
157
+ }
158
+
159
+ function printJson(components, grouped) {
160
+ const payload = {
161
+ total: Object.keys(components).length,
162
+ categories: [...grouped.entries()].map(([name, componentsInCategory]) => ({
163
+ name,
164
+ count: componentsInCategory.length,
165
+ components: componentsInCategory,
166
+ })),
167
+ };
168
+ console.log(JSON.stringify(payload, null, 2));
169
+ }
170
+
171
+ /**
172
+ * Lists local components and rewrites components.js.
173
+ *
174
+ * Default output is a compact category summary; `--all` lists every component.
175
+ * The long cli-table is gone on purpose: real apps have dozens/hundreds of
176
+ * components and a table becomes noise.
177
+ *
178
+ * @param {{ all?: boolean, category?: string, json?: boolean }} [options]
179
+ */
180
+ function listComponentsReal(options = {}) {
181
+ try {
182
+ const components = getComponents();
183
+ writeRegistry(components);
184
+
185
+ const filter = options.category
186
+ ? Object.entries(components).filter(([, data]) => data.category.toLowerCase() === String(options.category).toLowerCase())
187
+ : Object.entries(components);
188
+ const filtered = Object.fromEntries(filter);
189
+ const grouped = groupByCategory(filtered);
190
+
191
+ if (options.json) {
192
+ printJson(filtered, grouped);
193
+ return;
194
+ }
195
+
196
+ if (options.all) printAll(filtered, grouped);
197
+ else printCompact(filtered, grouped);
198
+ } catch (error) {
199
+ Print.error(`Failed to list components: ${error.message}`);
200
+ Print.info('Make sure your project structure is correct');
201
+ }
202
+ }
203
+
204
+ export { getComponents };
205
+ export default listComponentsReal;
@@ -14,7 +14,8 @@ import {
14
14
  MANIFEST_FILE,
15
15
  SITEMAP_FILE,
16
16
  loadFrameworkSeo,
17
- loadManifest
17
+ loadManifest,
18
+ loadSeoTranslator
18
19
  } from './support.js';
19
20
 
20
21
  export async function loadRoutes(projectRoot) {
@@ -42,9 +43,11 @@ export async function checkSeo(options = {}) {
42
43
  }
43
44
 
44
45
  const routes = options.routes || await loadRoutes(projectRoot);
46
+ const translator = options.translator ?? await loadSeoTranslator(projectRoot, framework);
45
47
  const { errors, warnings } = framework.validateSeoManifest(manifest, {
46
48
  routes,
47
- publicDir: path.join(projectRoot, 'src', 'public')
49
+ publicDir: path.join(projectRoot, 'src', 'public'),
50
+ translator
48
51
  });
49
52
 
50
53
  let sitemap = 'ok';
@@ -57,7 +60,7 @@ export async function checkSeo(options = {}) {
57
60
  errors.push(`${SITEMAP_FILE} is missing: run \`slice seo sitemap\``);
58
61
  } else {
59
62
  const origin = framework.normalizeOrigin(manifest.origin);
60
- const expected = origin ? framework.buildSitemap({ manifest, origin }) : null;
63
+ const expected = origin ? framework.buildSitemap({ manifest, origin, translator }) : null;
61
64
  if (expected !== null && fs.readFileSync(file, 'utf8') !== expected) {
62
65
  sitemap = 'drifted';
63
66
  errors.push(`${SITEMAP_FILE} is out of date: run \`slice seo sitemap\``);
@@ -85,7 +88,7 @@ export default async function checkCommand(options = {}, projectRoot) {
85
88
  `SEO OK: sitemap ${result.sitemap}, ${result.routes} route(s) cross-checked.`
86
89
  );
87
90
  } catch (error) {
88
- Print.error('slice seo check failed:', error.message);
91
+ Print.error(`slice seo check failed: ${error.message}`);
89
92
  process.exitCode = 1;
90
93
  }
91
94
  }