create-shopnex 0.0.0-edge.c8ad7df → 0.0.0-edge.cde2cf6
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/main.mjs +34 -19
- package/package.json +2 -1
package/dist/main.mjs
CHANGED
|
@@ -40,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
40
40
|
var define_PKG_default;
|
|
41
41
|
var init_define_PKG = __esm({
|
|
42
42
|
"<define:__PKG__>"() {
|
|
43
|
-
define_PKG_default = { version: "0.0.0-edge.
|
|
43
|
+
define_PKG_default = { version: "0.0.0-edge.cde2cf6", engines: { node: ">=22.22.0" } };
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
|
|
@@ -678,7 +678,7 @@ function me() {
|
|
|
678
678
|
init_define_PKG();
|
|
679
679
|
import { parseArgs } from "node:util";
|
|
680
680
|
|
|
681
|
-
// src/errors.ts
|
|
681
|
+
// ../cli-core/src/errors.ts
|
|
682
682
|
init_define_PKG();
|
|
683
683
|
var UsageError = class extends Error {
|
|
684
684
|
};
|
|
@@ -805,7 +805,9 @@ function planFromBundle(input) {
|
|
|
805
805
|
// Tables of its own: a schema in the shop's PostgreSQL, or its own embedded database
|
|
806
806
|
...extra.database && {
|
|
807
807
|
APP_DATABASE_URL: databaseUrl.startsWith("pglite:") ? `pglite:${join(shopDir, "apps", extra.dir, ".pglite")}` : databaseUrl
|
|
808
|
-
}
|
|
808
|
+
},
|
|
809
|
+
// Files of its own (Reviews: its SQLite database), kept with the shop
|
|
810
|
+
...extra.dataDir && { DATA_DIR: join(shopDir, "apps", extra.dir, "data") }
|
|
809
811
|
},
|
|
810
812
|
readyUrl: `http://127.0.0.1:${extra.port}/shopnex/app.js`
|
|
811
813
|
}))
|
|
@@ -879,7 +881,16 @@ var extras = [
|
|
|
879
881
|
keyEnv: "CJ_DROPSHIPPING_APP_KEY",
|
|
880
882
|
database: true
|
|
881
883
|
},
|
|
882
|
-
{ name: "shippo", label: "Shippo", dir: "shippo", port: 4900, urlEnv: "SHIPPO_APP_URL", keyEnv: "SHIPPO_APP_KEY" }
|
|
884
|
+
{ name: "shippo", label: "Shippo", dir: "shippo", port: 4900, urlEnv: "SHIPPO_APP_URL", keyEnv: "SHIPPO_APP_KEY" },
|
|
885
|
+
{
|
|
886
|
+
name: "reviews",
|
|
887
|
+
label: "Reviews",
|
|
888
|
+
dir: "reviews",
|
|
889
|
+
port: 5100,
|
|
890
|
+
urlEnv: "REVIEWS_APP_URL",
|
|
891
|
+
keyEnv: "REVIEWS_APP_KEY",
|
|
892
|
+
dataDir: true
|
|
893
|
+
}
|
|
883
894
|
];
|
|
884
895
|
function pickExtras(values, list = extras) {
|
|
885
896
|
const names = (values ?? []).flatMap((value) => value.split(",")).map((name) => name.trim().toLowerCase());
|
|
@@ -893,7 +904,7 @@ function pickExtras(values, list = extras) {
|
|
|
893
904
|
return picked;
|
|
894
905
|
}
|
|
895
906
|
|
|
896
|
-
// src/bundle.ts
|
|
907
|
+
// ../cli-core/src/bundle.ts
|
|
897
908
|
init_define_PKG();
|
|
898
909
|
import { createHash } from "node:crypto";
|
|
899
910
|
import {
|
|
@@ -911,7 +922,7 @@ import { spawnSync } from "node:child_process";
|
|
|
911
922
|
import { Readable, Transform } from "node:stream";
|
|
912
923
|
import { pipeline } from "node:stream/promises";
|
|
913
924
|
|
|
914
|
-
// src/paths.ts
|
|
925
|
+
// ../cli-core/src/paths.ts
|
|
915
926
|
init_define_PKG();
|
|
916
927
|
import { homedir } from "node:os";
|
|
917
928
|
import { join as join3, resolve } from "node:path";
|
|
@@ -923,14 +934,14 @@ function resolveShopDir(name, cwd = process.cwd()) {
|
|
|
923
934
|
}
|
|
924
935
|
var appCacheDir = () => process.env.SHOPNEX_APP_DIR ?? join3(homedir(), ".shopnex", "app");
|
|
925
936
|
|
|
926
|
-
// src/bundle.ts
|
|
937
|
+
// ../cli-core/src/bundle.ts
|
|
927
938
|
var isEdge = (version) => /-edge\./.test(version);
|
|
928
939
|
var bundleName = (version) => `shopnex-v${version}-node.tgz`;
|
|
929
940
|
var bundleUrl = (version) => process.env.SHOPNEX_BUNDLE_URL ?? (isEdge(version) ? "https://github.com/shopnex-ai/shopnex/releases/download/edge/shopnex-edge-node.tgz" : `https://github.com/shopnex-ai/shopnex/releases/download/v${version}/${bundleName(version)}`);
|
|
930
941
|
var bundleDir = (key) => join4(appCacheDir(), key);
|
|
931
942
|
var isInstalled = (key) => existsSync2(join4(bundleDir(key), "manifest.json"));
|
|
932
943
|
var installedEdges = () => existsSync2(appCacheDir()) ? readdirSync(appCacheDir()).filter((name) => /^edge-[0-9a-f]{12}$/.test(name)) : [];
|
|
933
|
-
async function get(url, what, version) {
|
|
944
|
+
async function get(url, what, version, cli) {
|
|
934
945
|
let response;
|
|
935
946
|
try {
|
|
936
947
|
response = await fetch(url);
|
|
@@ -942,7 +953,7 @@ Check your connection and try again.`);
|
|
|
942
953
|
if (response.status === 404) {
|
|
943
954
|
throw new UnavailableError(
|
|
944
955
|
`ShopNex ${version} has no packaged build to download (404 for ${url}).
|
|
945
|
-
Use a released version of
|
|
956
|
+
Use a released version of ${cli}.`
|
|
946
957
|
);
|
|
947
958
|
}
|
|
948
959
|
if (!response.ok) {
|
|
@@ -969,7 +980,7 @@ async function download(response, file, onProgress) {
|
|
|
969
980
|
);
|
|
970
981
|
return hash.digest("hex");
|
|
971
982
|
}
|
|
972
|
-
async function resolveBundle({ version }) {
|
|
983
|
+
async function resolveBundle({ version, cli = "create-shopnex" }) {
|
|
973
984
|
const edge = isEdge(version);
|
|
974
985
|
if (!edge && isInstalled(version)) return bundleDir(version);
|
|
975
986
|
mkdirSync2(appCacheDir(), { recursive: true });
|
|
@@ -982,7 +993,7 @@ async function resolveBundle({ version }) {
|
|
|
982
993
|
let work;
|
|
983
994
|
try {
|
|
984
995
|
const url = bundleUrl(version);
|
|
985
|
-
const expected = parseChecksum(await (await get(`${url}.sha256`, "the checksum", version)).text());
|
|
996
|
+
const expected = parseChecksum(await (await get(`${url}.sha256`, "the checksum", version, cli)).text());
|
|
986
997
|
if (!/^[0-9a-f]{64}$/.test(expected)) throw new UnavailableError(`${url}.sha256 does not hold a SHA-256 checksum.`);
|
|
987
998
|
const key = edge ? `edge-${expected.slice(0, 12)}` : version;
|
|
988
999
|
const dir = bundleDir(key);
|
|
@@ -995,7 +1006,7 @@ async function resolveBundle({ version }) {
|
|
|
995
1006
|
work = mkdtempSync(join4(appCacheDir(), `${key}.tmp-`));
|
|
996
1007
|
const file = join4(work, "bundle.tgz");
|
|
997
1008
|
const actual = await download(
|
|
998
|
-
await get(url, "ShopNex", version),
|
|
1009
|
+
await get(url, "ShopNex", version, cli),
|
|
999
1010
|
file,
|
|
1000
1011
|
(bytes) => say(`Downloading ${label}: ${(bytes / 1e6).toFixed(1)} MB`)
|
|
1001
1012
|
);
|
|
@@ -1032,7 +1043,7 @@ async function resolveBundle({ version }) {
|
|
|
1032
1043
|
}
|
|
1033
1044
|
}
|
|
1034
1045
|
|
|
1035
|
-
// src/node-version.ts
|
|
1046
|
+
// ../cli-core/src/node-version.ts
|
|
1036
1047
|
init_define_PKG();
|
|
1037
1048
|
var atLeast = (version, minimum) => version.replace(/^v/, "").localeCompare(minimum, void 0, { numeric: true }) >= 0;
|
|
1038
1049
|
function assertNode(version, enginesRange) {
|
|
@@ -1044,7 +1055,7 @@ function assertNode(version, enginesRange) {
|
|
|
1044
1055
|
}
|
|
1045
1056
|
}
|
|
1046
1057
|
|
|
1047
|
-
// src/env.ts
|
|
1058
|
+
// ../cli-core/src/env.ts
|
|
1048
1059
|
init_define_PKG();
|
|
1049
1060
|
import { randomBytes } from "node:crypto";
|
|
1050
1061
|
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, appendFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -1101,6 +1112,7 @@ var GITIGNORE = `# ShopNex: secrets and local data stay out of git
|
|
|
1101
1112
|
.pglite/
|
|
1102
1113
|
apps/*/.pglite/
|
|
1103
1114
|
apps/*/app-key
|
|
1115
|
+
apps/*/data/
|
|
1104
1116
|
`;
|
|
1105
1117
|
var composeUrl = (version) => `https://raw.githubusercontent.com/shopnex-ai/shopnex/${isEdge(version) ? "main" : `v${version}`}/deploy/docker-compose.yml`;
|
|
1106
1118
|
async function writeScaffold(shopDir, version, fetcher = fetch) {
|
|
@@ -1119,7 +1131,7 @@ async function writeScaffold(shopDir, version, fetcher = fetch) {
|
|
|
1119
1131
|
}
|
|
1120
1132
|
}
|
|
1121
1133
|
|
|
1122
|
-
// src/theme.ts
|
|
1134
|
+
// ../cli-core/src/theme.ts
|
|
1123
1135
|
init_define_PKG();
|
|
1124
1136
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
1125
1137
|
var BRAND = [67, 192, 122];
|
|
@@ -1128,12 +1140,9 @@ var truecolor = import_picocolors2.default.isColorSupported && /^(truecolor|24bi
|
|
|
1128
1140
|
var brand = (text) => truecolor ? `\x1B[38;2;${BRAND.join(";")}m${text}\x1B[39m` : import_picocolors2.default.green(text);
|
|
1129
1141
|
var brandBadge = (text) => truecolor ? `\x1B[48;2;${BRAND.join(";")}m\x1B[38;2;${ON_BRAND.join(";")}m${text}\x1B[39m\x1B[49m` : import_picocolors2.default.bgGreen(import_picocolors2.default.black(text));
|
|
1130
1142
|
|
|
1131
|
-
// src/
|
|
1143
|
+
// ../cli-core/src/ports.ts
|
|
1132
1144
|
init_define_PKG();
|
|
1133
|
-
import { spawn } from "node:child_process";
|
|
1134
1145
|
import { connect } from "node:net";
|
|
1135
|
-
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
1136
|
-
var sleep = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
1137
1146
|
function portInUse(port) {
|
|
1138
1147
|
const tryHost = (host) => new Promise((resolve3) => {
|
|
1139
1148
|
const socket = connect({ port, host });
|
|
@@ -1151,6 +1160,12 @@ async function assertPortsFree(ports) {
|
|
|
1151
1160
|
}
|
|
1152
1161
|
}
|
|
1153
1162
|
}
|
|
1163
|
+
|
|
1164
|
+
// src/run.ts
|
|
1165
|
+
init_define_PKG();
|
|
1166
|
+
import { spawn } from "node:child_process";
|
|
1167
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
1168
|
+
var sleep = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
1154
1169
|
async function isUp(url) {
|
|
1155
1170
|
try {
|
|
1156
1171
|
return (await fetch(url, { redirect: "manual" })).status < 500;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-shopnex",
|
|
3
|
-
"version": "0.0.0-edge.
|
|
3
|
+
"version": "0.0.0-edge.cde2cf6",
|
|
4
4
|
"description": "Try ShopNex with one command: npx create-shopnex starts the admin and the storefront on an embedded database, nothing else to install",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://shopnex.ai",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@clack/prompts": "^0.7.0",
|
|
41
|
+
"@shopnex/cli-core": "workspace:*",
|
|
41
42
|
"@types/node": "catalog:",
|
|
42
43
|
"esbuild": "0.28.2",
|
|
43
44
|
"picocolors": "^1.1.1",
|