@lightspeed/crane 3.2.1 → 3.4.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 (27) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/UPGRADE.md +39 -0
  3. package/dist/cli.mjs +55 -48
  4. package/package.json +12 -13
  5. package/template/collections/example-collection/configuration.ts +6 -5
  6. package/template/eslint.config.js +1 -0
  7. package/template/footers/example-footer/component/MadeWith.vue +24 -8
  8. package/template/layouts/catalog/example-catalog/client.ts +6 -0
  9. package/template/layouts/catalog/example-catalog/settings/design.ts +229 -1
  10. package/template/layouts/catalog/example-catalog/settings/layout.ts +1 -0
  11. package/template/layouts/catalog/example-catalog/settings/translations.ts +285 -1
  12. package/template/layouts/category/example-category/Main.vue +2 -1
  13. package/template/layouts/category/example-category/client.ts +6 -0
  14. package/template/layouts/category/example-category/settings/design.ts +229 -1
  15. package/template/layouts/category/example-category/settings/layout.ts +1 -0
  16. package/template/layouts/category/example-category/settings/translations.ts +285 -0
  17. package/template/layouts/product/example-product/Main.vue +2 -1
  18. package/template/layouts/product/example-product/client.ts +6 -0
  19. package/template/layouts/product/example-product/settings/layout.ts +1 -0
  20. package/template/layouts/product/example-product/settings/translations.ts +1 -0
  21. package/template/package.json +1 -1
  22. package/template/preview/shared/api-routes.ts +27 -4
  23. package/template/preview/shared/mock.ts +9 -0
  24. package/template/preview/shared/preview.ts +3 -0
  25. package/template/preview/vite.config.js +4 -0
  26. package/template/reference/sections/tag-lines/TagLines.vue +6 -6
  27. package/template/eslint.config.cjs +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/crane",
3
- "version": "3.2.1",
3
+ "version": "3.4.0",
4
4
  "type": "module",
5
5
  "bin": "bin/crane.js",
6
6
  "main": "./dist/app.mjs",
@@ -58,41 +58,40 @@
58
58
  "mock-fs": "^5.5.0",
59
59
  "ts-jest": "^29.4.0",
60
60
  "ts-node": "^10.9.2",
61
- "typescript": "5.9.2",
61
+ "typescript": "5.9.3",
62
62
  "unbuild": "^3.5.0",
63
63
  "vite-plugin-dts": "^4.5.4",
64
64
  "vite-plugin-static-copy": "^3.1.0"
65
65
  },
66
66
  "dependencies": {
67
67
  "@jridgewell/sourcemap-codec": "^1.5.4",
68
- "@lightspeed/crane-api": "2.2.1",
68
+ "@lightspeed/crane-api": "2.3.0",
69
69
  "@lightspeed/eslint-config-crane": "1.1.3",
70
70
  "@types/micromatch": "^4.0.8",
71
71
  "@types/prompts": "^2.4.2",
72
72
  "@types/ws": "^8.5.3",
73
73
  "@vitejs/plugin-vue": "^6.0.1",
74
74
  "adm-zip": "^0.5.16",
75
- "ajv": "^8.17.1",
76
- "ajv-formats": "^3.0.1",
77
- "axios": "^1.11.0",
75
+ "axios": "^1.14.0",
78
76
  "axios-concurrency": "^1.0.4",
79
77
  "cac": "^6.7.14",
80
78
  "cli-progress": "^3.12.0",
81
79
  "eslint": "^9.33.0",
82
80
  "fs-extra": "^11.3.1",
83
- "glob": "^11.1.0",
84
- "jsonpath-plus": "^10.3.0",
81
+ "glob": "^13.0.6",
82
+ "jsonpath-plus": "^10.4.0",
85
83
  "kolorist": "^1.8.0",
84
+ "micromatch": "^4.0.8",
86
85
  "prompts": "^2.4.2",
87
86
  "semver": "^7.7.2",
88
87
  "terser": "^5.44.0",
89
88
  "tinycolor2": "^1.6.0",
90
- "typescript": "5.9.2",
89
+ "typescript": "5.9.3",
91
90
  "vite": "^7.1.4",
92
- "vite-plugin-checker": "^0.10.3",
91
+ "vite-plugin-checker": "^0.12.0",
93
92
  "vite-plugin-compression": "^0.5.1",
94
93
  "vite-plugin-externals": "^0.6.2",
95
- "vite-tsconfig-paths": "^5.1.4",
94
+ "vite-tsconfig-paths": "^6.1.1",
96
95
  "vue": "^3.5.21",
97
96
  "vue-tsc": "^3.0.6",
98
97
  "ws": "^8.19.0"
@@ -102,10 +101,10 @@
102
101
  },
103
102
  "overrides": {
104
103
  "axios-concurrency": {
105
- "axios": "1.11.0"
104
+ "axios": "1.14.0"
106
105
  },
107
106
  "magic-string": "0.30.10",
108
- "glob": "^11.1.0",
107
+ "glob": "^13.0.6",
109
108
  "stylus": "^0.64.0"
110
109
  }
111
110
  }
@@ -1,4 +1,6 @@
1
- export default {
1
+ import { collection, section } from '@lightspeed/crane-api';
2
+
3
+ export default collection.configuration({
2
4
  metadata: {
3
5
  name: 'Example Collection',
4
6
  description: 'Example Collection with custom sections, headers, and footers',
@@ -11,11 +13,10 @@ export default {
11
13
  },
12
14
  },
13
15
  sections: [
14
- {
15
- type: 'custom',
16
+ section.custom({
16
17
  id: 'example-section',
17
18
  showcase_id: '1',
18
19
  category: 'COLLECTIONS',
19
- },
20
+ }),
20
21
  ],
21
- };
22
+ });
@@ -0,0 +1 @@
1
+ export { default } from '@lightspeed/eslint-config-crane';
@@ -1,11 +1,26 @@
1
1
  <template>
2
- <div>
3
- <a :href="madeWith?.url" target="{{ madeWith?.target }}">
4
- <span>{{ madeWith?.poweredBy }} &nbsp;</span>
5
- <span>
6
- <img :src="madeWith?.icon" alt="cart" />
7
- </span>
8
- <span>{{ madeWith?.company }}</span>
2
+ <div v-if="madeWith">
3
+ <a :href="madeWith.url" :target="madeWith.target">
4
+ <template v-if="isV2">
5
+ <span>{{ madeWith.poweredBy }}</span>
6
+ <span
7
+ v-if="madeWith.iconSvg"
8
+ v-html="madeWith.iconSvg"
9
+ />
10
+ <img
11
+ v-else-if="madeWith.icon"
12
+ :src="madeWith.icon"
13
+ :alt="madeWith.poweredBy"
14
+ />
15
+ <span v-if="madeWith.company">{{ madeWith.company }}</span>
16
+ </template>
17
+ <template v-else>
18
+ <span>{{ madeWith.poweredBy }} &nbsp;</span>
19
+ <span>
20
+ <img :src="madeWith.icon" alt="cart" />
21
+ </span>
22
+ <span>{{ madeWith.company }}</span>
23
+ </template>
9
24
  </a>
10
25
  </div>
11
26
  </template>
@@ -16,7 +31,8 @@ import { Design } from '../type.ts';
16
31
 
17
32
  const baseProps = useVueBaseProps<unknown, Design>();
18
33
  const siteContent: SiteContent = baseProps.site?.value satisfies SiteContent;
19
- const madeWith = siteContent.madeWith;
34
+ const isV2 = !!siteContent.madeWithV2;
35
+ const madeWith = siteContent.madeWithV2 ?? siteContent.madeWith;
20
36
  </script>
21
37
 
22
38
  <style scoped>
@@ -0,0 +1,6 @@
1
+ import { createLayoutApp } from '@lightspeed/crane-api';
2
+
3
+ import Main from './Main.vue';
4
+ import { Content, Design } from './type.ts';
5
+
6
+ export default createLayoutApp<Content, Design>(Main);
@@ -1 +1,229 @@
1
- export default {} as const;
1
+ import { design } from '@lightspeed/crane-api';
2
+
3
+ export default {
4
+ storefront_default_settings: design.accordion({
5
+ items: {
6
+ catalog_page_settings: {
7
+ label: '$label.accordion.catalog_page_settings',
8
+ editors: {
9
+ categoryViewMode: design.selectbox({
10
+ label: '$label.category_view.label',
11
+ description: '$label.category_view.description',
12
+ options: [
13
+ { value: 'EXPANDED', label: '$label.category_view.expanded' },
14
+ { value: 'COLLAPSED', label: '$label.category_view.collapsed' },
15
+ ],
16
+ defaults: { value: 'COLLAPSED' },
17
+ }),
18
+ productFiltersVisibleOnCatalogPages: design.selectbox({
19
+ label: '$label.product_filter_placement.label',
20
+ options: [
21
+ { value: 'true', label: '$label.product_filter_placement.all_pages' },
22
+ { value: 'false', label: '$label.product_filter_placement.category_pages' },
23
+ ],
24
+ defaults: { value: 'false' },
25
+ }),
26
+ productFiltersOrientationPosition: design.selectbox({
27
+ label: '$label.filter_panel_orientation.label',
28
+ options: [
29
+ { value: 'VERTICAL', label: '$label.filter_panel_orientation.vertical' },
30
+ { value: 'HORIZONTAL', label: '$label.filter_panel_orientation.horizontal' },
31
+ ],
32
+ defaults: { value: 'VERTICAL' },
33
+ }),
34
+ filterPriority: design.info({
35
+ label: '$label.filter_priority.label',
36
+ description: '$label.filter_priority.description',
37
+ button: {
38
+ label: '$label.filter_priority.button',
39
+ link: '#product-filters:mode=sort',
40
+ },
41
+ }),
42
+ catalogPageDivider1: design.divider({
43
+ label: '$label.divider',
44
+ }),
45
+ productFiltersPositionOnCatalogPages: design.selectbox({
46
+ label: '$label.side_to_show_filters.label',
47
+ options: [
48
+ { value: 'RIGHT', label: '$label.side_to_show_filters.right' },
49
+ { value: 'LEFT', label: '$label.side_to_show_filters.left' },
50
+ ],
51
+ defaults: { value: 'RIGHT' },
52
+ }),
53
+ productFiltersOpenedByDefaultOnCategoryPage: design.toggle({
54
+ label: '$label.expand_filter_panel.label',
55
+ defaults: { enabled: false },
56
+ }),
57
+ showSortViewAsOptions: design.toggle({
58
+ label: '$label.show_sort_by_options.label',
59
+ defaults: { enabled: true },
60
+ }),
61
+ showFooterMenu: design.toggle({
62
+ label: '$label.show_bottom_navigation_menu.label',
63
+ defaults: { enabled: true },
64
+ }),
65
+ showSigninLink: design.toggle({
66
+ label: '$label.show_signin_link.label',
67
+ defaults: { enabled: true },
68
+ }),
69
+ },
70
+ },
71
+ product_card_settings: {
72
+ label: '$label.accordion.product_card_settings',
73
+ editors: {
74
+ productCardSpacingType: design.selectbox({
75
+ label: '$label.card_grid_spacing.label',
76
+ description: '$label.card_grid_spacing.description',
77
+ options: [
78
+ { value: 'NONE', label: '$label.card_grid_spacing.none' },
79
+ { value: 'NARROW', label: '$label.card_grid_spacing.narrow' },
80
+ { value: 'MEDIUM', label: '$label.card_grid_spacing.medium' },
81
+ { value: 'WIDE', label: '$label.card_grid_spacing.wide' },
82
+ ],
83
+ defaults: { value: 'WIDE' },
84
+ }),
85
+ productCardLayout: design.selectbox({
86
+ label: '$label.content_alignment.label',
87
+ options: [
88
+ { value: 'CENTER', label: '$label.content_alignment.center' },
89
+ { value: 'LEFT', label: '$label.content_alignment.left' },
90
+ { value: 'JUSTIFY', label: '$label.content_alignment.justify' },
91
+ { value: 'RIGHT', label: '$label.content_alignment.right' },
92
+ ],
93
+ defaults: { value: 'CENTER' },
94
+ }),
95
+ imageAspectRatio: design.selectbox({
96
+ label: '$label.image_proportions.label',
97
+ options: [
98
+ { value: 'SQUARE', label: '$label.image_proportions.square_1_1' },
99
+ { value: 'PORTRAIT_0667', label: '$label.image_proportions.portrait_2_3' },
100
+ { value: 'PORTRAIT_075', label: '$label.image_proportions.portrait_3_4' },
101
+ { value: 'LANDSCAPE_1333', label: '$label.image_proportions.landscape_4_3' },
102
+ { value: 'LANDSCAPE_15', label: '$label.image_proportions.landscape_2_3' },
103
+ ],
104
+ defaults: { value: 'PORTRAIT_0667' },
105
+ }),
106
+ imageSize: design.selectbox({
107
+ label: '$label.card_size.label',
108
+ options: [
109
+ { value: 'SMALL', label: '$label.card_size.small' },
110
+ { value: 'MEDIUM', label: '$label.card_size.medium' },
111
+ { value: 'LARGE', label: '$label.card_size.large' },
112
+ ],
113
+ defaults: { value: 'LARGE' },
114
+ }),
115
+ productTitleBehavior: design.selectbox({
116
+ label: '$label.product_name.label',
117
+ options: [
118
+ { value: 'SHOW', label: '$label.show' },
119
+ { value: 'HIDE', label: '$label.do_not_show' },
120
+ { value: 'SHOW_ON_HOVER', label: '$label.show_on_mouse_hover' },
121
+ ],
122
+ defaults: { value: 'SHOW' },
123
+ }),
124
+ productSubtitleBehavior: design.selectbox({
125
+ label: '$label.product_subtitle.label',
126
+ options: [
127
+ { value: 'SHOW', label: '$label.show' },
128
+ { value: 'HIDE', label: '$label.do_not_show' },
129
+ { value: 'SHOW_ON_HOVER', label: '$label.show_on_mouse_hover' },
130
+ ],
131
+ defaults: { value: 'SHOW' },
132
+ }),
133
+ productPriceBehavior: design.selectbox({
134
+ label: '$label.price.label',
135
+ options: [
136
+ { value: 'SHOW', label: '$label.show' },
137
+ { value: 'HIDE', label: '$label.do_not_show' },
138
+ { value: 'SHOW_ON_HOVER', label: '$label.show_on_mouse_hover' },
139
+ ],
140
+ defaults: { value: 'SHOW' },
141
+ }),
142
+ productListSwatchesProductOptionBehavior: design.selectbox({
143
+ label: '$label.color_swatches.label',
144
+ description: '$label.color_swatches.description',
145
+ options: [
146
+ { value: 'SHOW', label: '$label.show' },
147
+ { value: 'HIDE', label: '$label.do_not_show' },
148
+ ],
149
+ defaults: { value: 'HIDE' },
150
+ }),
151
+ productSkuBehavior: design.selectbox({
152
+ label: '$label.sku.label',
153
+ options: [
154
+ { value: 'SHOW', label: '$label.show' },
155
+ { value: 'HIDE', label: '$label.do_not_show' },
156
+ { value: 'SHOW_ON_HOVER', label: '$label.show_on_mouse_hover' },
157
+ ],
158
+ defaults: { value: 'HIDE' },
159
+ }),
160
+ productBuyButtonBehavior: design.selectbox({
161
+ label: '$label.buy_now_button.label',
162
+ options: [
163
+ { value: 'SHOW', label: '$label.show' },
164
+ { value: 'HIDE', label: '$label.do_not_show' },
165
+ { value: 'SHOW_ON_HOVER', label: '$label.show_on_mouse_hover' },
166
+ ],
167
+ defaults: { value: 'HIDE' },
168
+ }),
169
+ productRatingSectionBehavior: design.selectbox({
170
+ label: '$label.product_rating.label',
171
+ options: [
172
+ { value: 'SHOW', label: '$label.show' },
173
+ { value: 'HIDE', label: '$label.do_not_show' },
174
+ { value: 'SHOW_ON_HOVER', label: '$label.show_on_mouse_hover' },
175
+ ],
176
+ defaults: { value: 'SHOW' },
177
+ }),
178
+ productRatingViewBehavior: design.selectbox({
179
+ label: '$label.rating_view.label',
180
+ options: [
181
+ { value: '5_STARS_VIEW', label: '$label.rating_view.five_stars' },
182
+ { value: '1_STAR_VIEW', label: '$label.rating_view.one_star' },
183
+ ],
184
+ defaults: { value: '5_STARS_VIEW' },
185
+ }),
186
+ showProductRatingAvg: design.toggle({
187
+ label: '$label.show_average_product_rating.label',
188
+ defaults: { enabled: true },
189
+ }),
190
+ showProductTotalNumberOfReview: design.toggle({
191
+ label: '$label.show_total_number_of_reviews.label',
192
+ defaults: { enabled: true },
193
+ }),
194
+ productCardDivider1: design.divider({
195
+ label: '$label.divider',
196
+ }),
197
+ showProductFrame: design.toggle({
198
+ label: '$label.show_product_card_frame.label',
199
+ defaults: { enabled: false },
200
+ }),
201
+ showProductImages: design.toggle({
202
+ label: '$label.show_main_product_image.label',
203
+ defaults: { enabled: true },
204
+ }),
205
+ showAdditionalImageOnHover: design.toggle({
206
+ label: '$label.show_additional_image_on_hover.label',
207
+ defaults: { enabled: false },
208
+ }),
209
+ },
210
+ },
211
+ categories_settings: {
212
+ label: '$label.accordion.categories_settings',
213
+ editors: {
214
+ categoryTitleBehavior: design.selectbox({
215
+ label: '$label.name_position.label',
216
+ options: [
217
+ { value: 'SHOW_ON_IMAGE', label: '$label.name_position.on_the_image' },
218
+ { value: 'SHOW_BELOW_IMAGE', label: '$label.name_position.below_the_image' },
219
+ { value: 'SHOW_ON_HOVER', label: '$label.name_position.on_mouse_hover' },
220
+ { value: 'HIDE', label: '$label.name_position.hide_category_names' },
221
+ { value: 'SHOW_TEXT_ONLY', label: '$label.name_position.hide_category_images' },
222
+ ],
223
+ defaults: { value: 'SHOW_ON_IMAGE' },
224
+ }),
225
+ },
226
+ },
227
+ },
228
+ }),
229
+ };
@@ -0,0 +1 @@
1
+ export default [] as const;