@cimplify/sdk 0.44.0 → 0.44.1

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.
@@ -81,6 +81,12 @@ Logs flags:
81
81
  --deployment <id> Override which deployment to read (default: latest)
82
82
  --follow Poll until the deployment terminates
83
83
  `;
84
+ async function siblingModuleUrl(...segments) {
85
+ const { fileURLToPath, pathToFileURL } = await import('url');
86
+ const { dirname, join } = await import('path');
87
+ const here = dirname(fileURLToPath(import.meta.url));
88
+ return pathToFileURL(join(here, ...segments)).href;
89
+ }
84
90
  async function main() {
85
91
  const [, , maybeSub, ...rest] = process.argv;
86
92
  const TOP_LEVEL_FLAGS = /* @__PURE__ */ new Set(["--help", "-h", "help", "--version", "-v", "version"]);
@@ -93,10 +99,7 @@ async function main() {
93
99
  switch (sub) {
94
100
  case "mock": {
95
101
  process.argv = [process.argv[0], process.argv[1], ...args];
96
- const { fileURLToPath } = await import('url');
97
- const { dirname, join } = await import('path');
98
- const here = dirname(fileURLToPath(import.meta.url));
99
- await import(join(here, "mock", "cli.mjs"));
102
+ await import(await siblingModuleUrl("mock", "cli.mjs"));
100
103
  return;
101
104
  }
102
105
  case "init":
@@ -105,10 +108,7 @@ async function main() {
105
108
  case "add":
106
109
  case "list": {
107
110
  process.argv = [process.argv[0], process.argv[1], sub, ...args];
108
- const { fileURLToPath } = await import('url');
109
- const { dirname, join } = await import('path');
110
- const here = dirname(fileURLToPath(import.meta.url));
111
- await import(join(here, "cli.js"));
111
+ await import(await siblingModuleUrl("cli.js"));
112
112
  return;
113
113
  }
114
114
  case "login":
@@ -232,11 +232,8 @@ async function runInit(args) {
232
232
  console.log("Then open http://localhost:3000");
233
233
  }
234
234
  async function runCloudCommand(sub, args) {
235
- const { fileURLToPath } = await import('url');
236
- const { dirname, join } = await import('path');
237
- const here = dirname(fileURLToPath(import.meta.url));
238
- const modulePath = join(here, "cli", "commands", `${sub}.mjs`);
239
- const mod = await import(modulePath);
235
+ const moduleUrl = await siblingModuleUrl("cli", "commands", `${sub}.mjs`);
236
+ const mod = await import(moduleUrl);
240
237
  const run = mod.default;
241
238
  if (typeof run !== "function") {
242
239
  console.error(`cimplify ${sub}: command module did not export a default function`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.44.0",
3
+ "version": "0.44.1",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",
@@ -3,9 +3,9 @@
3
3
  "private": true,
4
4
  "version": "0.0.0",
5
5
  "scripts": {
6
- "dev": "concurrently -k -n mock,next -c blue,magenta \"bunx @cimplify/sdk --quiet\" \"next dev\"",
6
+ "dev": "concurrently -k -n mock,next -c blue,magenta \"bunx @cimplify/sdk --seed default --quiet\" \"next dev\"",
7
7
  "dev:storefront": "next dev",
8
- "dev:mock": "bunx @cimplify/sdk",
8
+ "dev:mock": "bunx @cimplify/sdk --seed default",
9
9
  "build": "next build",
10
10
  "start": "next start",
11
11
  "lint": "next lint"