@cimplify/cli 0.6.11 → 0.6.14
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/{add-5G7UZ6DA.mjs → add-6SPMUMSJ.mjs} +1 -1
- package/dist/{assets-EBEMMENZ.mjs → assets-74SK63TR.mjs} +73 -24
- package/dist/{chunk-SNDMYYOK.mjs → chunk-CNIFXKZV.mjs} +1 -1
- package/dist/{chunk-KOJZB3S4.mjs → chunk-RGF2RSSR.mjs} +4 -1
- package/dist/chunk-RIOQDUQO.mjs +5707 -0
- package/dist/dispatcher.mjs +12 -10
- package/dist/{doctor-3UOTPOJ6.mjs → doctor-726TVOXT.mjs} +2 -2
- package/dist/{explain-DXJ3R52F.mjs → explain-6BWR5MCK.mjs} +29 -1
- package/dist/inspect-CGYX4DDF.mjs +411 -0
- package/dist/{introspect-77SUZ5X5.mjs → introspect-4LD27NVX.mjs} +2 -2
- package/dist/{list-QX7RM3P3.mjs → list-2YRVKBXY.mjs} +1 -1
- package/dist/{update-UHKPFT6F.mjs → update-J65Z6Q7E.mjs} +1 -1
- package/package.json +4 -1
- package/templates/storefront-auto/app/api/revalidate/route.ts +5 -0
- package/templates/storefront-auto/bun.lock +745 -6
- package/templates/storefront-auto/package.json +2 -2
- package/templates/storefront-auto/tsconfig.json +24 -6
- package/templates/storefront-bakery/app/api/revalidate/route.ts +5 -0
- package/templates/storefront-bakery/bun.lock +1167 -0
- package/templates/storefront-bakery/package.json +2 -2
- package/templates/storefront-bakery/tsconfig.json +24 -6
- package/templates/storefront-fashion/app/api/revalidate/route.ts +5 -0
- package/templates/storefront-fashion/bun.lock +747 -8
- package/templates/storefront-fashion/package.json +2 -2
- package/templates/storefront-fashion/tsconfig.json +24 -6
- package/templates/storefront-grocery/app/api/revalidate/route.ts +5 -0
- package/templates/storefront-grocery/bun.lock +745 -6
- package/templates/storefront-grocery/package.json +2 -2
- package/templates/storefront-grocery/tsconfig.json +24 -6
- package/templates/storefront-pharmacy/app/api/revalidate/route.ts +5 -0
- package/templates/storefront-pharmacy/bun.lock +745 -6
- package/templates/storefront-pharmacy/package.json +2 -2
- package/templates/storefront-pharmacy/tsconfig.json +24 -6
- package/templates/storefront-restaurant/app/api/revalidate/route.ts +5 -0
- package/templates/storefront-restaurant/bun.lock +745 -6
- package/templates/storefront-restaurant/package.json +2 -2
- package/templates/storefront-restaurant/tsconfig.json +24 -6
- package/templates/storefront-retail/app/api/revalidate/route.ts +5 -0
- package/templates/storefront-retail/bun.lock +745 -6
- package/templates/storefront-retail/package.json +2 -2
- package/templates/storefront-retail/tsconfig.json +24 -6
- package/templates/storefront-services/app/api/revalidate/route.ts +5 -0
- package/templates/storefront-services/bun.lock +745 -6
- package/templates/storefront-services/package.json +2 -2
- package/templates/storefront-services/tsconfig.json +24 -6
- package/dist/chunk-OLZMA2TM.mjs +0 -5707
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { REGISTRY_INDEX, REGISTRY } from './chunk-
|
|
2
|
+
import { REGISTRY_INDEX, REGISTRY } from './chunk-RIOQDUQO.mjs';
|
|
3
3
|
import { promptYesNo } from './chunk-ITAFAORS.mjs';
|
|
4
4
|
import { parseArgs, flagString, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
5
5
|
import { CliError, CLI_ERROR_CODE, info, bold, dim, success, result, yellow } from './chunk-E2T2SBP5.mjs';
|
|
@@ -32,6 +32,13 @@ function endpointInit(businessId) {
|
|
|
32
32
|
function endpointConfirm(businessId) {
|
|
33
33
|
return `/v1/businesses/${encodeURIComponent(businessId)}/assets/confirm`;
|
|
34
34
|
}
|
|
35
|
+
function endpointList(businessId) {
|
|
36
|
+
return `/v1/businesses/${encodeURIComponent(businessId)}/assets`;
|
|
37
|
+
}
|
|
38
|
+
function endpointAsset(businessId, uploadId) {
|
|
39
|
+
return `/v1/businesses/${encodeURIComponent(businessId)}/assets/${encodeURIComponent(uploadId)}`;
|
|
40
|
+
}
|
|
41
|
+
var SERVER_LIST_PAGE_LIMIT = 100;
|
|
35
42
|
function manifestPath(cwd = process.cwd()) {
|
|
36
43
|
return path.join(cwd, MANIFEST_FILE);
|
|
37
44
|
}
|
|
@@ -172,37 +179,79 @@ async function runUpload(args) {
|
|
|
172
179
|
});
|
|
173
180
|
}
|
|
174
181
|
async function runLs(args) {
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
182
|
+
const folder = flagString(args, "prefix") ?? flagString(args, "folder");
|
|
183
|
+
const mimePrefix = flagString(args, "type");
|
|
184
|
+
const auth = await readAuth();
|
|
185
|
+
const client = ApiClient.fromAuth(auth);
|
|
186
|
+
const assets = [];
|
|
187
|
+
let page = 1;
|
|
188
|
+
let total = 0;
|
|
189
|
+
for (; ; ) {
|
|
190
|
+
const response = await client.get(endpointList(auth.businessId), {
|
|
191
|
+
query: {
|
|
192
|
+
page,
|
|
193
|
+
limit: SERVER_LIST_PAGE_LIMIT,
|
|
194
|
+
...folder ? { folder } : {},
|
|
195
|
+
...mimePrefix ? { mime_prefix: mimePrefix } : {}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
assets.push(...response.assets);
|
|
199
|
+
total = response.pagination.total;
|
|
200
|
+
if (response.assets.length < SERVER_LIST_PAGE_LIMIT) break;
|
|
201
|
+
page += 1;
|
|
202
|
+
}
|
|
203
|
+
if (assets.length === 0) {
|
|
204
|
+
info(dim("No storefront assets uploaded yet."));
|
|
180
205
|
} else {
|
|
181
|
-
info(bold(`
|
|
182
|
-
for (const
|
|
183
|
-
|
|
206
|
+
info(bold(`Storefront assets (${total} total):`));
|
|
207
|
+
for (const a of assets) {
|
|
208
|
+
const key = a.folder_path ? `${a.folder_path}/${a.filename}` : a.filename;
|
|
209
|
+
info(
|
|
210
|
+
` ${green("\u25CF")} ${key.padEnd(36)} ${dim(a.content_type.padEnd(24))} ${dim(
|
|
211
|
+
formatBytes(a.size_bytes).padStart(10)
|
|
212
|
+
)} ${dim(a.id)} ${dim(`\u2192 ${a.url}`)}`
|
|
213
|
+
);
|
|
184
214
|
}
|
|
185
215
|
}
|
|
186
|
-
result({
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
216
|
+
result({ count: assets.length, total, assets });
|
|
217
|
+
}
|
|
218
|
+
function formatBytes(n) {
|
|
219
|
+
if (n < 1024) return `${n} B`;
|
|
220
|
+
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
221
|
+
return `${(n / (1024 * 1024)).toFixed(2)} MB`;
|
|
190
222
|
}
|
|
191
223
|
async function runRm(args) {
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
194
|
-
throw new CliError(
|
|
224
|
+
const target = args.positional[1];
|
|
225
|
+
if (!target) {
|
|
226
|
+
throw new CliError(
|
|
227
|
+
CLI_ERROR_CODE.INVALID_INPUT,
|
|
228
|
+
"Usage: cimplify assets rm <upload_id-or-key>"
|
|
229
|
+
);
|
|
195
230
|
}
|
|
231
|
+
const auth = await readAuth();
|
|
232
|
+
const client = ApiClient.fromAuth(auth);
|
|
196
233
|
const manifest = await readManifest();
|
|
197
|
-
|
|
198
|
-
|
|
234
|
+
let uploadId;
|
|
235
|
+
let resolvedKey = null;
|
|
236
|
+
if (target.startsWith("upl_")) {
|
|
237
|
+
uploadId = target;
|
|
238
|
+
resolvedKey = Object.entries(manifest).find(([, e]) => e.upload_id === target)?.[0] ?? null;
|
|
239
|
+
} else if (target in manifest) {
|
|
240
|
+
uploadId = manifest[target].upload_id;
|
|
241
|
+
resolvedKey = target;
|
|
242
|
+
} else {
|
|
243
|
+
throw new CliError(
|
|
244
|
+
CLI_ERROR_CODE.NOT_FOUND,
|
|
245
|
+
`Not found locally: ${target}. Pass an upload_id from \`cimplify assets ls\` instead.`
|
|
246
|
+
);
|
|
199
247
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
248
|
+
await client.delete(endpointAsset(auth.businessId, uploadId));
|
|
249
|
+
if (resolvedKey) {
|
|
250
|
+
delete manifest[resolvedKey];
|
|
251
|
+
await writeManifest(manifest);
|
|
252
|
+
}
|
|
253
|
+
success(`Removed ${resolvedKey ?? uploadId}`);
|
|
254
|
+
result({ removed_upload_id: uploadId, removed_key: resolvedKey });
|
|
206
255
|
}
|
|
207
256
|
|
|
208
|
-
export { run as default, endpointConfirm, endpointInit, mimeOf, readManifest, sha256Hex, walkFiles, writeManifest };
|
|
257
|
+
export { run as default, endpointAsset, endpointConfirm, endpointInit, endpointList, mimeOf, readManifest, sha256Hex, walkFiles, writeManifest };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { gitDetectRoot, gitCurrentBranch, gitCurrentSha, gitStatusPorcelain } from './chunk-K5464A3L.mjs';
|
|
3
3
|
import { parseEnvFile } from './chunk-DBZ3UOQ2.mjs';
|
|
4
|
-
import { package_default } from './chunk-
|
|
4
|
+
import { package_default } from './chunk-RGF2RSSR.mjs';
|
|
5
5
|
import { parseArgs } from './chunk-C4M3DXKC.mjs';
|
|
6
6
|
import { readAuthOrNull, readProjectLinkOrNull, readProjectState } from './chunk-UBAI443T.mjs';
|
|
7
7
|
import { bold, dim, yellow, green, info, result, red } from './chunk-E2T2SBP5.mjs';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// package.json
|
|
3
3
|
var package_default = {
|
|
4
4
|
name: "@cimplify/cli",
|
|
5
|
-
version: "0.6.
|
|
5
|
+
version: "0.6.14",
|
|
6
6
|
description: "Cimplify CLI \u2014 deploy, manage env vars, link projects, and scaffold storefronts",
|
|
7
7
|
keywords: [
|
|
8
8
|
"cimplify",
|
|
@@ -45,6 +45,9 @@ var package_default = {
|
|
|
45
45
|
tsup: "^8.5.1",
|
|
46
46
|
typescript: "5.9.3",
|
|
47
47
|
vitest: "^4.1.5"
|
|
48
|
+
},
|
|
49
|
+
dependencies: {
|
|
50
|
+
"@cimplify/sdk": "^0.49.0"
|
|
48
51
|
}
|
|
49
52
|
};
|
|
50
53
|
|