easyorders 0.1.16 → 0.1.18

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/README.md CHANGED
@@ -8,7 +8,9 @@ Full theme documentation — Liquid variables, palette, sections, events:
8
8
 
9
9
  ## ⚠️ Important Notice
10
10
 
11
- The tunnel URL is tied to your current browser session. When you stop the dev server (tunnel) or close the theme editor, you **must close the browser entirely** to end the session. Otherwise the browser may continue trying to load the old tunnel URL, causing errors on subsequent runs.
11
+ The tunnel URL is linked to your current browser session. To end the session, stop the dev server, close the theme browser, or delete the `local_theme_src` cookie manually.
12
+
13
+ If the the site loads slowly after closing session, the browser may still be using a cached tunnel session. Deleting the `local_theme_src` cookie usually fixes the issue.
12
14
 
13
15
  ## Installation
14
16
 
@@ -21,7 +23,7 @@ npm install -g easyorders
21
23
  ### Create a new theme project
22
24
 
23
25
  ```bash
24
- easyorders create-theme my-theme
26
+ easyorders create my-theme
25
27
  ```
26
28
 
27
29
  This scaffolds a new directory `my-theme/` containing only the `theme/` folder and a minimal `package.json`. No server code is included — the server runs from the CLI package itself.
@@ -57,7 +59,7 @@ Create a `.env` file in your theme project root (or export the variables) to cus
57
59
 
58
60
  ## Theme Project Structure
59
61
 
60
- After running `create-theme`, your project will look like:
62
+ After running `create`, your project will look like:
61
63
 
62
64
  ```
63
65
  my-theme/
package/dist/bin/cli.js CHANGED
@@ -95,7 +95,7 @@ async function startDev() {
95
95
  const themeDir = path.join(cwd, "theme");
96
96
  if (!fs.existsSync(themeDir)) {
97
97
  console.error(`\n ${RED}${BOLD}✖ No "theme" folder found in the current directory.${RESET}`);
98
- console.error(` ${DIM}Run ${CYAN}npx easyorders create-theme <name>${DIM} first to create a project.${RESET}\n`);
98
+ console.error(` ${DIM}Run ${CYAN}npx easyorders create <name>${DIM} first to create a project.${RESET}\n`);
99
99
  process.exit(1);
100
100
  }
101
101
  // The server files are bundled inside the CLI package
@@ -139,8 +139,9 @@ function showMenu() {
139
139
  console.log(` ${CYAN}${BOLD}Easy Orders CLI${RESET}`);
140
140
  console.log("");
141
141
  console.log(` ${BOLD}Usage:${RESET}`);
142
- console.log(` ${CYAN}npx easyorders create-theme ${DIM}<name>${RESET} Create a new theme project`);
142
+ console.log(` ${CYAN}npx easyorders create ${DIM}<name>${RESET} Create a new theme project`);
143
143
  console.log(` ${CYAN}npx easyorders start${RESET} Start the dev server`);
144
+ console.log(` ${CYAN}npx easyorders -v${RESET} Show CLI version`);
144
145
  console.log("");
145
146
  }
146
147
  async function interactiveMenu() {
@@ -165,12 +166,19 @@ async function interactiveMenu() {
165
166
  process.exit(1);
166
167
  }
167
168
  }
168
- // ── Version check ───────────────────────────────────────────
169
- async function checkForUpdates() {
169
+ // ── Version ─────────────────────────────────────────────────
170
+ function getPackageInfo() {
170
171
  const pkgPath = path.resolve(__dirname, "..", "..", "package.json");
171
172
  const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
172
- const localVersion = pkg.version;
173
- const packageName = pkg.name;
173
+ return { name: pkg.name, version: pkg.version };
174
+ }
175
+ function showVersion() {
176
+ const { version } = getPackageInfo();
177
+ console.log(version);
178
+ }
179
+ // ── Version check ───────────────────────────────────────────
180
+ async function checkForUpdates() {
181
+ const { name: packageName, version: localVersion } = getPackageInfo();
174
182
  try {
175
183
  const res = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
176
184
  if (!res.ok)
@@ -193,13 +201,18 @@ async function checkForUpdates() {
193
201
  }
194
202
  // ── Entry point ─────────────────────────────────────────────
195
203
  (async () => {
196
- await checkForUpdates();
197
204
  const command = process.argv[2];
198
205
  switch (command) {
199
- case "create-theme":
206
+ case "-v":
207
+ case "--version":
208
+ showVersion();
209
+ break;
210
+ case "create":
211
+ await checkForUpdates();
200
212
  await createTheme();
201
213
  break;
202
214
  case "start":
215
+ await checkForUpdates();
203
216
  await startDev();
204
217
  break;
205
218
  case "--help":
@@ -207,6 +220,7 @@ async function checkForUpdates() {
207
220
  showMenu();
208
221
  break;
209
222
  default:
223
+ await checkForUpdates();
210
224
  await interactiveMenu();
211
225
  break;
212
226
  }
@@ -4,7 +4,7 @@ import express from "express";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
6
6
  import readline from "node:readline";
7
- import { exec } from "node:child_process";
7
+ import { execFile } from "node:child_process";
8
8
  import { generateCliToken, checkTokenStatus } from "./api.js";
9
9
  import { getToken, saveToken } from "./token-store.js";
10
10
  const CYAN = "\x1b[36m";
@@ -116,12 +116,17 @@ function promptStoreName() {
116
116
  });
117
117
  }
118
118
  function openBrowser(url) {
119
- const cmd = process.platform === "darwin"
120
- ? "open"
121
- : process.platform === "win32"
122
- ? "start"
123
- : "xdg-open";
124
- exec(`${cmd} "${url}"`);
119
+ if (process.platform === "darwin") {
120
+ execFile("open", [url]);
121
+ }
122
+ else if (process.platform === "win32") {
123
+ execFile("rundll32", ["url.dll,FileProtocolHandler", url], {
124
+ windowsHide: true,
125
+ });
126
+ }
127
+ else {
128
+ execFile("xdg-open", [url]);
129
+ }
125
130
  }
126
131
  function waitForApproval(tokenId) {
127
132
  return new Promise((resolve, reject) => {
@@ -3,28 +3,38 @@
3
3
  "logo": "",
4
4
  "pages": [
5
5
  {
6
- "id": "f0c83f71-05a6-42da-8911-ae7f45a88aac",
7
- "type": "page"
8
- },
9
- {
10
- "id": "97f8d618-dce3-4d1c-bcf3-75284532d2da",
11
- "type": "page"
6
+ "id": "ADD_PAGE_ID_HERE"
12
7
  }
13
8
  ],
14
9
  "social": [
15
10
  {
16
- "type": "facebook",
17
- "url": "https://facebook.com"
11
+ "url": "https://facebook.com",
12
+ "type": "facebook"
13
+ },
14
+ {
15
+ "url": "https://facebook.com",
16
+ "type": "instagram"
17
+ },
18
+ {
19
+ "url": "https://facebook.com",
20
+ "type": "twitter"
21
+ },
22
+ {
23
+ "url": "https://facebook.com",
24
+ "type": "linkedin"
25
+ },
26
+ {
27
+ "url": "https://facebook.com",
28
+ "type": "tiktok"
18
29
  },
19
30
  {
20
- "type": "instagram",
21
- "url": "https://facebook.com"
31
+ "url": "https://facebook.com",
32
+ "type": "youtube"
22
33
  }
23
34
  ],
24
35
  "categories": [
25
36
  {
26
- "id": "c2e15720-56f5-4f57-92aa-84d8dca24cb0",
27
- "type": "category"
37
+ "id": "ADD_CATEGORY_ID_HERE"
28
38
  }
29
39
  ],
30
40
  "payment_img": "https://easyorders.fra1.digitaloceanspaces.com/1773958283329740254payment_icons.svg",
@@ -34,23 +44,11 @@
34
44
  "logo": "",
35
45
  "links": [
36
46
  {
37
- "id": "c2e15720-56f5-4f57-92aa-84d8dca24cb0",
38
- "type": "category"
39
- },
40
- {
41
- "id": "a43e3bbe-afaf-4f96-b2a8-609574c618be",
47
+ "id": "ADD_CATEGORY_ID_HERE",
42
48
  "type": "category"
43
49
  },
44
50
  {
45
- "id": "5057e926-fd39-476a-a7c5-c91790121c95",
46
- "type": "category"
47
- },
48
- {
49
- "id": "f0c83f71-05a6-42da-8911-ae7f45a88aac",
50
- "type": "page"
51
- },
52
- {
53
- "id": "97f8d618-dce3-4d1c-bcf3-75284532d2da",
51
+ "id": "ADD_PAGE_ID_HERE",
54
52
  "type": "page"
55
53
  }
56
54
  ],
@@ -1,125 +1,125 @@
1
- {
2
- "icon": "https://files.easy-orders.net/1778107568557501919.png",
3
- "label": "Category mosaic",
4
- "section_schema": [
5
- {
6
- "name": "title",
7
- "type": "string",
8
- "default": "Shop by mood",
9
- "description": "Section heading"
10
- },
11
- {
12
- "name": "subtitle",
13
- "type": "string",
14
- "default": "Curated drops for work, weekend, and everything between.",
15
- "description": "Subheading under the title"
16
- },
17
- {
18
- "name": "heading_title_color",
19
- "type": "color",
20
- "default": "",
21
- "group": "controls_title",
22
- "description": "Heading title color (leave empty for default)"
23
- },
24
- {
25
- "name": "heading_title_size",
26
- "type": "number",
27
- "group": "controls_title",
28
- "default": 38,
29
- "description": "Heading title size (px)"
30
- },
31
- {
32
- "name": "heading_title_weight",
33
- "type": "select",
34
- "default": "500",
35
- "group": "controls_title",
36
- "description": "Heading title font weight",
37
- "options": [
38
- { "label": "Regular 400", "value": "400" },
39
- { "label": "Medium 500", "value": "500" },
40
- { "label": "SemiBold 600", "value": "600" },
41
- { "label": "Bold 700", "value": "700" }
42
- ]
43
- },
44
- {
45
- "name": "heading_subtitle_color",
46
- "type": "color",
47
- "default": "",
48
- "group": "controls_subtitle",
49
- "description": "Subtitle color (leave empty for default)"
50
- },
51
- {
52
- "name": "heading_subtitle_size",
53
- "type": "number",
54
- "group": "controls_subtitle",
55
- "default": 16,
56
- "description": "Subtitle size (px)"
57
- },
58
- {
59
- "name": "heading_subtitle_weight",
60
- "type": "select",
61
- "default": "400",
62
- "group": "controls_subtitle",
63
- "description": "Subtitle font weight",
64
- "options": [
65
- { "label": "Regular 400", "value": "400" },
66
- { "label": "Medium 500", "value": "500" },
67
- { "label": "SemiBold 600", "value": "600" },
68
- { "label": "Bold 700", "value": "700" }
69
- ]
70
- },
71
- {
72
- "name": "section_background",
73
- "type": "color",
74
- "default": "",
75
- "description": "Section background color (leave empty for default white)"
76
- },
77
- {
78
- "name": "columns",
79
- "type": "select",
80
- "default": "3",
81
- "description": "Columns on large screens",
82
- "options": [
83
- { "label": "Two columns", "value": "2" },
84
- { "label": "Three columns", "value": "3" },
85
- { "label": "Four columns", "value": "4" }
86
- ]
87
- },
88
- {
89
- "name": "gap_tight",
90
- "type": "boolean",
91
- "default": false,
92
- "description": "Use tighter spacing between tiles"
93
- },
94
- {
95
- "name": "tiles",
96
- "type": "object_array",
97
- "description": "Category or collection tiles",
98
- "fields": [
99
- {
100
- "name": "image",
101
- "type": "image",
102
- "default": "",
103
- "description": "صورة القسم"
104
- },
105
- {
106
- "name": "label",
107
- "type": "string",
108
- "default": "Dresses",
109
- "description": "اسم القسم على الصورة"
110
- },
111
- {
112
- "name": "tagline",
113
- "type": "string",
114
- "default": "Fluid lines",
115
- "description": "وصف قصير تحت الاسم"
116
- },
117
- {
118
- "name": "category_id",
119
- "type": "category_single_select",
120
- "description": "اختيار القسم (اللينك يتجاب أوتوماتيك)"
121
- }
122
- ]
123
- }
124
- ]
125
- }
1
+ {
2
+ "icon": "https://files.easy-orders.net/1778107568557501919.png",
3
+ "label": "Category mosaic",
4
+ "section_schema": [
5
+ {
6
+ "name": "title",
7
+ "type": "string",
8
+ "default": "Shop by mood",
9
+ "description": "Section heading"
10
+ },
11
+ {
12
+ "name": "subtitle",
13
+ "type": "string",
14
+ "default": "Curated drops for work, weekend, and everything between.",
15
+ "description": "Subheading under the title"
16
+ },
17
+ {
18
+ "name": "heading_title_color",
19
+ "type": "color",
20
+ "default": "",
21
+ "group": "controls_title",
22
+ "description": "Heading title color (leave empty for default)"
23
+ },
24
+ {
25
+ "name": "heading_title_size",
26
+ "type": "number",
27
+ "group": "controls_title",
28
+ "default": 38,
29
+ "description": "Heading title size (px)"
30
+ },
31
+ {
32
+ "name": "heading_title_weight",
33
+ "type": "select",
34
+ "default": "500",
35
+ "group": "controls_title",
36
+ "description": "Heading title font weight",
37
+ "options": [
38
+ { "label": "Regular 400", "value": "400" },
39
+ { "label": "Medium 500", "value": "500" },
40
+ { "label": "SemiBold 600", "value": "600" },
41
+ { "label": "Bold 700", "value": "700" }
42
+ ]
43
+ },
44
+ {
45
+ "name": "heading_subtitle_color",
46
+ "type": "color",
47
+ "default": "",
48
+ "group": "controls_subtitle",
49
+ "description": "Subtitle color (leave empty for default)"
50
+ },
51
+ {
52
+ "name": "heading_subtitle_size",
53
+ "type": "number",
54
+ "group": "controls_subtitle",
55
+ "default": 16,
56
+ "description": "Subtitle size (px)"
57
+ },
58
+ {
59
+ "name": "heading_subtitle_weight",
60
+ "type": "select",
61
+ "default": "400",
62
+ "group": "controls_subtitle",
63
+ "description": "Subtitle font weight",
64
+ "options": [
65
+ { "label": "Regular 400", "value": "400" },
66
+ { "label": "Medium 500", "value": "500" },
67
+ { "label": "SemiBold 600", "value": "600" },
68
+ { "label": "Bold 700", "value": "700" }
69
+ ]
70
+ },
71
+ {
72
+ "name": "section_background",
73
+ "type": "color",
74
+ "default": "",
75
+ "description": "Section background color (leave empty for default white)"
76
+ },
77
+ {
78
+ "name": "columns",
79
+ "type": "select",
80
+ "default": "3",
81
+ "description": "Columns on large screens",
82
+ "options": [
83
+ { "label": "Two columns", "value": "2" },
84
+ { "label": "Three columns", "value": "3" },
85
+ { "label": "Four columns", "value": "4" }
86
+ ]
87
+ },
88
+ {
89
+ "name": "gap_tight",
90
+ "type": "boolean",
91
+ "default": false,
92
+ "description": "Use tighter spacing between tiles"
93
+ },
94
+ {
95
+ "name": "tiles",
96
+ "type": "object_array",
97
+ "description": "Category or collection tiles",
98
+ "fields": [
99
+ {
100
+ "name": "image",
101
+ "type": "image",
102
+ "default": "",
103
+ "description": "صورة القسم"
104
+ },
105
+ {
106
+ "name": "label",
107
+ "type": "string",
108
+ "default": "Dresses",
109
+ "description": "اسم القسم على الصورة"
110
+ },
111
+ {
112
+ "name": "tagline",
113
+ "type": "string",
114
+ "default": "Fluid lines",
115
+ "description": "وصف قصير تحت الاسم"
116
+ },
117
+ {
118
+ "name": "category_id",
119
+ "type": "category_single_select",
120
+ "description": "اختيار القسم (اللينك يتجاب أوتوماتيك)"
121
+ }
122
+ ]
123
+ }
124
+ ]
125
+ }