shopq 0.3.8 → 0.3.9
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/shopq.js +7 -30
- package/package.json +2 -2
package/dist/shopq.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
|
|
3
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
4
3
|
|
|
5
4
|
// src/graphql.ts
|
|
6
5
|
var API_VERSION = "2026-01";
|
|
@@ -29,33 +28,11 @@ class ConfigError extends Error {
|
|
|
29
28
|
missing;
|
|
30
29
|
constructor(missing) {
|
|
31
30
|
super(`Missing required environment variables: ${missing.join(", ")}
|
|
32
|
-
` + `Set them in
|
|
31
|
+
` + `Set them in a .env file or as environment variables.`);
|
|
33
32
|
this.missing = missing;
|
|
34
33
|
this.name = "ConfigError";
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
function loadConfigEnv() {
|
|
38
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || `${process.env.HOME || __require("os").homedir()}/.config`;
|
|
39
|
-
const configPath = `${xdgConfig}/shopq/.env`;
|
|
40
|
-
try {
|
|
41
|
-
const content = __require("fs").readFileSync(configPath, "utf-8");
|
|
42
|
-
for (const line of content.split(`
|
|
43
|
-
`)) {
|
|
44
|
-
const trimmed = line.trim();
|
|
45
|
-
if (!trimmed || trimmed.startsWith("#"))
|
|
46
|
-
continue;
|
|
47
|
-
const eqIdx = trimmed.indexOf("=");
|
|
48
|
-
if (eqIdx === -1)
|
|
49
|
-
continue;
|
|
50
|
-
const key = trimmed.slice(0, eqIdx).trim();
|
|
51
|
-
const value = trimmed.slice(eqIdx + 1).trim().replace(/^["']|["']$/g, "");
|
|
52
|
-
if (!process.env[key]) {
|
|
53
|
-
process.env[key] = value;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
} catch {}
|
|
57
|
-
}
|
|
58
|
-
loadConfigEnv();
|
|
59
36
|
function resolveConfig(storeFlag) {
|
|
60
37
|
const missing = [];
|
|
61
38
|
const store = storeFlag || process.env.SHOPIFY_STORE;
|
|
@@ -179,7 +156,7 @@ function createClient(config) {
|
|
|
179
156
|
}
|
|
180
157
|
|
|
181
158
|
// src/helpers.ts
|
|
182
|
-
import { existsSync, readFileSync } from "
|
|
159
|
+
import { existsSync, readFileSync } from "fs";
|
|
183
160
|
|
|
184
161
|
// src/output.ts
|
|
185
162
|
function formatOutput(data, columns, options) {
|
|
@@ -212,7 +189,7 @@ function formatOutput(data, columns, options) {
|
|
|
212
189
|
}).join(" ");
|
|
213
190
|
process.stdout.write(`${headerLine}
|
|
214
191
|
`);
|
|
215
|
-
const separator = widths.map((w) => "
|
|
192
|
+
const separator = widths.map((w) => "\u2500".repeat(w)).join(" ");
|
|
216
193
|
process.stdout.write(`${separator}
|
|
217
194
|
`);
|
|
218
195
|
for (const row of data) {
|
|
@@ -354,7 +331,7 @@ register("config", "Configuration management", "show", {
|
|
|
354
331
|
});
|
|
355
332
|
|
|
356
333
|
// src/commands/gql.ts
|
|
357
|
-
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "
|
|
334
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
358
335
|
async function handleGql(parsed) {
|
|
359
336
|
let query;
|
|
360
337
|
if (parsed.flags.file) {
|
|
@@ -2051,7 +2028,7 @@ register("theme", "Theme management", "list", {
|
|
|
2051
2028
|
});
|
|
2052
2029
|
|
|
2053
2030
|
// src/cli.ts
|
|
2054
|
-
import { readFileSync as readFileSync3 } from "
|
|
2031
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
2055
2032
|
|
|
2056
2033
|
// src/help.ts
|
|
2057
2034
|
function topLevelHelp() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shopq",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"description": "A zero-dependency Shopify Admin CLI built on Bun",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"skills"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "bun build bin/shopq.ts --target=
|
|
15
|
+
"build": "bun build bin/shopq.ts --target=bun --outfile dist/shopq.js && chmod +x dist/shopq.js",
|
|
16
16
|
"prepublishOnly": "bun run build",
|
|
17
17
|
"test": "bun test",
|
|
18
18
|
"check": "bunx --bun biome check --write .",
|