@shoplifter/cli 0.1.12 → 0.1.13

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/files.js CHANGED
@@ -50,7 +50,7 @@ export async function readProject(directory = process.cwd(), sourceImages = true
50
50
  }
51
51
  const project = validateProject(Object.fromEntries(entries));
52
52
  validateMigrations(JSON.parse((await readSourceBytes(resolve(directory, 'migrations.json'))).toString()));
53
- validateAstroConfig((await readSourceBytes(resolve(directory, 'astro.config.mjs'))).toString());
53
+ const previewEntry = validateAstroConfig((await readSourceBytes(resolve(directory, 'astro.config.mjs'))).toString());
54
54
  const root = await realpath(directory);
55
55
  for (const path of [...Object.values(project.manifest.components), ...(project.manifest.leads ? [project.manifest.leads.source, ...project.manifest.leads.forms.map(form => form.component)] : []), ...Object.values(project.assets).map(asset => asset.file)]) {
56
56
  const actual = await realpath(resolve(root, path));
@@ -58,6 +58,8 @@ export async function readProject(directory = process.cwd(), sourceImages = true
58
58
  if (local.startsWith('..' + sep) || local === '..' || !projectPath(local.split(sep).join('/')))
59
59
  throw new Error('Project files must stay inside the project');
60
60
  }
61
+ if (previewEntry)
62
+ await readSourceBytes(resolve(directory, previewEntry));
61
63
  if (sourceImages)
62
64
  await validateImages(directory, false, warn);
63
65
  return project;
@@ -27,7 +27,7 @@
27
27
  },
28
28
  {
29
29
  "path": "files.js",
30
- "sha256": "f65b46e16df3286bacdaeca4f5e598f4ab6b7c39a2d77dc01f9b9d9ff88a33f4"
30
+ "sha256": "8c0433d7dd6934b14551e65d1f4090acea7333ae131fe181d7f5547de414cbb0"
31
31
  },
32
32
  {
33
33
  "path": "index.d.ts",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  {
85
85
  "path": "upload-files.js",
86
- "sha256": "51c102f2d15498059e930de28797e459d9b39354741976028bca194815dd6616"
86
+ "sha256": "0b069a9a062a6bc795e8ed1dd162d01324b3798a82333c1c4284574e9827bf14"
87
87
  },
88
88
  {
89
89
  "path": "upload-runtime.d.ts",
@@ -4,7 +4,7 @@ import { resolve } from 'node:path';
4
4
  import { createHash } from 'node:crypto';
5
5
  import ignore from 'ignore';
6
6
  import { assertPresentationSource, isPresentationSourceDirectory, isPresentationSourcePath } from '@shoplifter/presentation-contract';
7
- import { validateImageMarkup } from '@shoplifter/presentation-contract';
7
+ import { validateAstroConfig, validateImageMarkup } from '@shoplifter/presentation-contract';
8
8
  import { readSourceBytes } from './files.js';
9
9
  export async function collectUploadFiles(directory, project) {
10
10
  const files = [];
@@ -70,6 +70,9 @@ export async function collectUploadFiles(directory, project) {
70
70
  throw new Error('Source bundle exceeds limits');
71
71
  const required = ['shoplifter.json', 'definition.json', 'editor.json', 'data.json', 'assets.json', 'design.json', 'migrations.json', 'package.json', 'astro.config.mjs',
72
72
  ...Object.values(project.manifest.components), ...Object.values(project.assets).map(asset => asset.file)];
73
+ const previewEntry = validateAstroConfig((await readSourceBytes(resolve(directory, 'astro.config.mjs'))).toString());
74
+ if (previewEntry)
75
+ required.push(previewEntry);
73
76
  for (const path of required)
74
77
  if (!files.some(file => file.path === path))
75
78
  throw new Error(`Required project file is missing or ignored: ${JSON.stringify(path)}`);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@shoplifter/cli",
3
- "version": "0.1.12",
4
- "shoplifterRuntimeVersion": "0.3.3",
5
- "shoplifterContractVersion": "0.3.2",
3
+ "version": "0.1.13",
4
+ "shoplifterRuntimeVersion": "0.3.4",
5
+ "shoplifterContractVersion": "0.3.3",
6
6
  "private": false,
7
7
  "license": "Apache-2.0",
8
8
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "ignore": "^7.0.14",
35
35
  "tar-stream": "3.2.2",
36
36
  "reflect-metadata": "^0.1.14",
37
- "@shoplifter/presentation-contract": "0.3.2"
37
+ "@shoplifter/presentation-contract": "0.3.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^24.19.2",