@lightspeed/crane 1.3.1 → 1.3.3
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/CHANGELOG.md +22 -0
- package/dist/app.d.mts +9 -9
- package/dist/app.d.ts +9 -9
- package/dist/cli.mjs +7 -7
- package/package.json +3 -3
- package/template/_gitignore +1 -0
- package/template/preview/sections/preview.html +2 -0
- package/template/preview/vite.config.js +49 -7
- package/template/reference/templates/reference-template-apparel/configuration.ts +22 -0
- package/template/reference/templates/reference-template-apparel/pages/catalog.ts +10 -0
- package/template/reference/templates/reference-template-apparel/pages/category.ts +10 -0
- package/template/reference/templates/reference-template-apparel/pages/home.ts +24 -0
- package/template/reference/templates/reference-template-apparel/pages/product.ts +10 -0
- package/template/reference/templates/reference-template-bike/configuration.ts +22 -0
- package/template/reference/templates/reference-template-bike/pages/catalog.ts +10 -0
- package/template/reference/templates/reference-template-bike/pages/category.ts +10 -0
- package/template/reference/templates/reference-template-bike/pages/home.ts +24 -0
- package/template/reference/templates/reference-template-bike/pages/product.ts +10 -0
- package/template/reference/templates/reference-template-apparel.ts +0 -44
- package/template/reference/templates/reference-template-bike.ts +0 -44
- package/template/templates/assets/template_cover_image.png +0 -0
- package/template/templates/template.ts +0 -198
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightspeed/crane",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "bin/crane.js",
|
|
6
6
|
"main": "./dist/app.mjs",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
65
|
-
"@lightspeed/eslint-config-crane": "1.1.
|
|
65
|
+
"@lightspeed/eslint-config-crane": "1.1.2",
|
|
66
66
|
"@types/prompts": "^2.4.2",
|
|
67
67
|
"@vitejs/plugin-vue": "^4.1.0",
|
|
68
68
|
"adm-zip": "^0.5.16",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"axios-concurrency": "^1.0.4",
|
|
73
73
|
"cac": "^6.7.14",
|
|
74
74
|
"cli-progress": "^3.12.0",
|
|
75
|
-
"eslint": "9.
|
|
75
|
+
"eslint": "^9.33.0",
|
|
76
76
|
"fs-extra": "^11.1.1",
|
|
77
77
|
"glob": "^9.3.5",
|
|
78
78
|
"jsonpath-plus": "^10.3.0",
|
package/template/_gitignore
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {defineConfig} from 'vite';
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
2
4
|
|
|
3
5
|
export default defineConfig({
|
|
4
6
|
root: '.',
|
|
5
7
|
server: {
|
|
6
|
-
fs: {
|
|
8
|
+
fs: {strict: false},
|
|
7
9
|
},
|
|
8
10
|
plugins: [
|
|
9
11
|
{
|
|
@@ -19,13 +21,53 @@ export default defineConfig({
|
|
|
19
21
|
{
|
|
20
22
|
name: 'no-vite-cache',
|
|
21
23
|
configureServer(server) {
|
|
22
|
-
//
|
|
24
|
+
// use process.cwd() for analytics path
|
|
25
|
+
const analyticsDir = path.resolve(process.cwd(), 'preview', 'shared')
|
|
26
|
+
const analyticsFile = path.resolve(analyticsDir, 'analytics.json')
|
|
27
|
+
|
|
28
|
+
// ensure analytics folder & file exist
|
|
29
|
+
fs.mkdirSync(analyticsDir, {recursive: true})
|
|
30
|
+
if (!fs.existsSync(analyticsFile)) {
|
|
31
|
+
fs.writeFileSync(analyticsFile, JSON.stringify({}, null, 2), 'utf-8')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// helper to bump and persist counter for a given section
|
|
35
|
+
function bumpSectionCount(section) {
|
|
36
|
+
const raw = fs.readFileSync(analyticsFile, 'utf-8')
|
|
37
|
+
const data = JSON.parse(raw)
|
|
38
|
+
const next = (data[section] || 0) + 1
|
|
39
|
+
data[section] = next
|
|
40
|
+
fs.writeFileSync(analyticsFile, JSON.stringify(data, null, 2), 'utf-8')
|
|
41
|
+
return next
|
|
42
|
+
}
|
|
43
|
+
|
|
23
44
|
server.middlewares.use((req, res, next) => {
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
const url = req.url || ''
|
|
46
|
+
|
|
47
|
+
// cache-bust for any /sections/ URL
|
|
48
|
+
if (url.includes('/sections/')) {
|
|
49
|
+
server.moduleGraph.invalidateAll()
|
|
50
|
+
return next()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (url.startsWith('/chosen-section')) {
|
|
54
|
+
// extract "sectionName" from "/chosen-section/<sectionName>"
|
|
55
|
+
|
|
56
|
+
const sectionName = req.url.replace(/\/$/, '').split('/').filter(Boolean).pop()
|
|
57
|
+
const newCount = bumpSectionCount(sectionName)
|
|
58
|
+
|
|
59
|
+
res.statusCode = 200
|
|
60
|
+
res.setHeader('Content-Type', 'application/json')
|
|
61
|
+
return res.end(JSON.stringify({
|
|
62
|
+
section: sectionName,
|
|
63
|
+
count: newCount
|
|
64
|
+
}))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// all other requests
|
|
68
|
+
next()
|
|
26
69
|
}
|
|
27
|
-
|
|
28
|
-
});
|
|
70
|
+
);
|
|
29
71
|
},
|
|
30
72
|
},
|
|
31
73
|
],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
metadata: {
|
|
3
|
+
name: 'Reference Template — Apparel',
|
|
4
|
+
description: 'This is a reference template geared towards apparel merchants to aid development and act as a starting point for your custom template.',
|
|
5
|
+
preview_url: 'https://reference-template-apparel.company.site/',
|
|
6
|
+
cover_image: {
|
|
7
|
+
set: {
|
|
8
|
+
ORIGINAL: {
|
|
9
|
+
url: 'reference_template_apparel_cover_image.jpg',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
type: 'default',
|
|
16
|
+
id: 'header',
|
|
17
|
+
},
|
|
18
|
+
footer: {
|
|
19
|
+
type: 'default',
|
|
20
|
+
id: 'footer',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
sections: [
|
|
3
|
+
{
|
|
4
|
+
type: 'custom',
|
|
5
|
+
id: 'intro-slider',
|
|
6
|
+
showcase_id: '1',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
type: 'custom',
|
|
10
|
+
id: 'tag-lines',
|
|
11
|
+
showcase_id: '1',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'custom',
|
|
15
|
+
id: 'about-us',
|
|
16
|
+
showcase_id: '1',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'custom',
|
|
20
|
+
id: 'example-section',
|
|
21
|
+
showcase_id: '1',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
metadata: {
|
|
3
|
+
name: 'Reference Template — Bike',
|
|
4
|
+
description: 'This is a reference template geared towards bike shops to aid development and act as a starting point for your custom template.',
|
|
5
|
+
preview_url: 'https://reference-template-bike.company.site/',
|
|
6
|
+
cover_image: {
|
|
7
|
+
set: {
|
|
8
|
+
ORIGINAL: {
|
|
9
|
+
url: 'reference_template_bike_cover_image.jpg',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
type: 'default',
|
|
16
|
+
id: 'header',
|
|
17
|
+
},
|
|
18
|
+
footer: {
|
|
19
|
+
type: 'default',
|
|
20
|
+
id: 'footer',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
sections: [
|
|
3
|
+
{
|
|
4
|
+
type: 'custom',
|
|
5
|
+
id: 'intro-slider',
|
|
6
|
+
showcase_id: '2',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
type: 'custom',
|
|
10
|
+
id: 'example-section',
|
|
11
|
+
showcase_id: '3',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'custom',
|
|
15
|
+
id: 'tag-lines',
|
|
16
|
+
showcase_id: '2',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'custom',
|
|
20
|
+
id: 'about-us',
|
|
21
|
+
showcase_id: '2',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
metadata: {
|
|
3
|
-
name: 'Reference Template — Apparel',
|
|
4
|
-
description: 'This is a reference template geared towards apparel merchants to aid development and act as a starting point for your custom template.',
|
|
5
|
-
preview_url: 'https://reference-template-apparel.company.site/',
|
|
6
|
-
cover_image: {
|
|
7
|
-
set: {
|
|
8
|
-
ORIGINAL: {
|
|
9
|
-
url: 'reference_template_apparel_cover_image.jpg',
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
sections: [
|
|
15
|
-
{
|
|
16
|
-
type: 'default',
|
|
17
|
-
id: 'header',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: 'custom',
|
|
21
|
-
id: 'intro-slider',
|
|
22
|
-
showcase_id: '1',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'custom',
|
|
26
|
-
id: 'tag-lines',
|
|
27
|
-
showcase_id: '1',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'custom',
|
|
31
|
-
id: 'about-us',
|
|
32
|
-
showcase_id: '1',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: 'custom',
|
|
36
|
-
id: 'example-section',
|
|
37
|
-
showcase_id: '1',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'default',
|
|
41
|
-
id: 'footer',
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
metadata: {
|
|
3
|
-
name: 'Reference Template — Bike',
|
|
4
|
-
description: 'This is a reference template geared towards bike shops to aid development and act as a starting point for your custom template.',
|
|
5
|
-
preview_url: 'https://reference-template-bike.company.site/',
|
|
6
|
-
cover_image: {
|
|
7
|
-
set: {
|
|
8
|
-
ORIGINAL: {
|
|
9
|
-
url: 'reference_template_bike_cover_image.jpg',
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
sections: [
|
|
15
|
-
{
|
|
16
|
-
type: 'default',
|
|
17
|
-
id: 'header',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: 'custom',
|
|
21
|
-
id: 'intro-slider',
|
|
22
|
-
showcase_id: '2',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'custom',
|
|
26
|
-
id: 'example-section',
|
|
27
|
-
showcase_id: '3',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'custom',
|
|
31
|
-
id: 'tag-lines',
|
|
32
|
-
showcase_id: '2',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: 'custom',
|
|
36
|
-
id: 'about-us',
|
|
37
|
-
showcase_id: '2',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'default',
|
|
41
|
-
id: 'footer',
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
};
|
|
Binary file
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
metadata: {
|
|
3
|
-
name: 'Example Template :: Standard Preset',
|
|
4
|
-
description: 'Standard Preset for the Example template',
|
|
5
|
-
preview_url: 'https://template_preview.company.site',
|
|
6
|
-
cover_image: {
|
|
7
|
-
set: {
|
|
8
|
-
ORIGINAL: {
|
|
9
|
-
url: 'template_cover_image.png',
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
sections: [
|
|
15
|
-
{
|
|
16
|
-
type: 'default',
|
|
17
|
-
id: 'header',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: 'default',
|
|
21
|
-
id: 'slider',
|
|
22
|
-
showcase_id: '001',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'custom',
|
|
26
|
-
id: 'example-section',
|
|
27
|
-
showcase_id: '1',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'custom',
|
|
31
|
-
id: 'example-section',
|
|
32
|
-
showcase_overrides: {
|
|
33
|
-
content: {
|
|
34
|
-
section_title: {
|
|
35
|
-
type: 'INPUTBOX',
|
|
36
|
-
text: '$label.template_standard_showcase_1.section_title.text',
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
images: {
|
|
40
|
-
type: 'DECK',
|
|
41
|
-
cards: [
|
|
42
|
-
{
|
|
43
|
-
settings: {
|
|
44
|
-
image_text: {
|
|
45
|
-
type: 'TEXTAREA',
|
|
46
|
-
text: '$label.showcase_2.image_text_1.text',
|
|
47
|
-
},
|
|
48
|
-
image_content: {
|
|
49
|
-
type: 'IMAGE',
|
|
50
|
-
imageData: {
|
|
51
|
-
set: {
|
|
52
|
-
MOBILE_WEBP_LOW_RES: {
|
|
53
|
-
url: 'new_tshirts_collection_mobile_low.jpeg',
|
|
54
|
-
},
|
|
55
|
-
MOBILE_WEBP_HI_RES: {
|
|
56
|
-
url: 'new_tshirts_collection_mobile_high.jpeg',
|
|
57
|
-
},
|
|
58
|
-
WEBP_LOW_RES: {
|
|
59
|
-
url: 'new_tshirts_collection_pc_low.jpeg',
|
|
60
|
-
},
|
|
61
|
-
WEBP_HI_2X_RES: {
|
|
62
|
-
url: 'new_tshirts_collection_pc_high.jpeg',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
borderInfo: {},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
image_link: {
|
|
69
|
-
type: 'INPUTBOX',
|
|
70
|
-
text: '$label.showcase_2.image_link_1.text',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
settings: {
|
|
76
|
-
image_text: {
|
|
77
|
-
type: 'TEXTAREA',
|
|
78
|
-
text: '$label.showcase_2.image_text_2.text',
|
|
79
|
-
},
|
|
80
|
-
image_content: {
|
|
81
|
-
type: 'IMAGE',
|
|
82
|
-
imageData: {
|
|
83
|
-
set: {
|
|
84
|
-
MOBILE_WEBP_LOW_RES: {
|
|
85
|
-
url: 'autumn_looks_mobile_low.jpeg',
|
|
86
|
-
},
|
|
87
|
-
MOBILE_WEBP_HI_RES: {
|
|
88
|
-
url: 'autumn_looks_mobile_high.jpeg',
|
|
89
|
-
},
|
|
90
|
-
WEBP_LOW_RES: {
|
|
91
|
-
url: 'autumn_looks_pc_low.jpeg',
|
|
92
|
-
},
|
|
93
|
-
WEBP_HI_2X_RES: {
|
|
94
|
-
url: 'autumn_looks_pc_high.jpeg',
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
borderInfo: {},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
settings: {
|
|
105
|
-
image_text: {
|
|
106
|
-
type: 'TEXTAREA',
|
|
107
|
-
text: '$label.showcase_2.image_text_3.text',
|
|
108
|
-
},
|
|
109
|
-
image_content: {
|
|
110
|
-
type: 'IMAGE',
|
|
111
|
-
imageData: {
|
|
112
|
-
set: {
|
|
113
|
-
MOBILE_WEBP_LOW_RES: {
|
|
114
|
-
url: 'bianka_wardrobe_mobile_low.jpeg',
|
|
115
|
-
},
|
|
116
|
-
MOBILE_WEBP_HI_RES: {
|
|
117
|
-
url: 'bianka_wardrobe_mobile_high.jpeg',
|
|
118
|
-
},
|
|
119
|
-
WEBP_LOW_RES: {
|
|
120
|
-
url: 'bianka_wardrobe_pc_low.jpeg',
|
|
121
|
-
},
|
|
122
|
-
WEBP_HI_2X_RES: {
|
|
123
|
-
url: 'bianka_wardrobe_pc_high.jpeg',
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
borderInfo: {},
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
settings: {
|
|
134
|
-
image_text: {
|
|
135
|
-
type: 'TEXTAREA',
|
|
136
|
-
text: '$label.showcase_2.image_text_4.text',
|
|
137
|
-
},
|
|
138
|
-
image_content: {
|
|
139
|
-
type: 'IMAGE',
|
|
140
|
-
imageData: {
|
|
141
|
-
set: {
|
|
142
|
-
MOBILE_WEBP_LOW_RES: {
|
|
143
|
-
url: 'story_of_jane_mobile_low.jpeg',
|
|
144
|
-
},
|
|
145
|
-
MOBILE_WEBP_HI_RES: {
|
|
146
|
-
url: 'story_of_jane_mobile_high.jpeg',
|
|
147
|
-
},
|
|
148
|
-
WEBP_LOW_RES: {
|
|
149
|
-
url: 'story_of_jane_pc_low.jpeg',
|
|
150
|
-
},
|
|
151
|
-
WEBP_HI_2X_RES: {
|
|
152
|
-
url: 'story_of_jane_pc_high.jpeg',
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
borderInfo: {},
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
design: {
|
|
164
|
-
section_title: {
|
|
165
|
-
type: 'TEXT',
|
|
166
|
-
font: 'global.fontFamily.body',
|
|
167
|
-
size: 42,
|
|
168
|
-
bold: true,
|
|
169
|
-
italic: true,
|
|
170
|
-
color: '#222',
|
|
171
|
-
},
|
|
172
|
-
image_text: {
|
|
173
|
-
type: 'TEXT',
|
|
174
|
-
size: 22,
|
|
175
|
-
bold: false,
|
|
176
|
-
italic: true,
|
|
177
|
-
},
|
|
178
|
-
background: {
|
|
179
|
-
type: 'BACKGROUND',
|
|
180
|
-
style: 'COLOR',
|
|
181
|
-
color: 'global.color.background',
|
|
182
|
-
},
|
|
183
|
-
image_content: {
|
|
184
|
-
type: 'IMAGE',
|
|
185
|
-
overlay: 'GRADIENT',
|
|
186
|
-
color: ['#FFFFFF', '#CCCCCC'],
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
layoutId: 'Caption_Under_Image',
|
|
190
|
-
blockName: '$label.showcase_2.blockName',
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
type: 'default',
|
|
195
|
-
id: 'footer',
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
};
|