create-dig-app 0.3.0 → 0.3.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.
package/lib/nft-cli.js
CHANGED
|
@@ -100,7 +100,10 @@ function resolveItems(root, imageFiles) {
|
|
|
100
100
|
* @returns {{count:number, manifestPath:string, metadataDir:string}}
|
|
101
101
|
*/
|
|
102
102
|
export function generateMetadata(root, opts = {}) {
|
|
103
|
-
|
|
103
|
+
// An empty / whitespace-only storeId falls back to the placeholder — never emit an empty-store-id
|
|
104
|
+
// URI (`urn:dig:chia:/…`). The CLI (dig-nft.mjs) rejects an explicitly-empty `--store-id` louder;
|
|
105
|
+
// here we coerce defensively so a programmatic caller can't produce a broken URN. (#1065)
|
|
106
|
+
const storeId = opts.storeId && String(opts.storeId).trim() ? opts.storeId : PLACEHOLDER_STORE_ID;
|
|
104
107
|
const collection = loadCollection(root);
|
|
105
108
|
const imageFiles = listImages(root);
|
|
106
109
|
const items = resolveItems(root, imageFiles);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-dig-app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Scaffold a wallet-wired, deployable DIG Network app — free, no mint. The JS front door for building dapps, frontends, and NFT collections on Chia.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "DIG Network",
|
|
@@ -358,7 +358,8 @@ function readGeneratedLicense(root, collection, storeId = PLACEHOLDER_STORE_ID)
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
function generateMetadata(root, opts = {}) {
|
|
361
|
-
|
|
361
|
+
// Empty/whitespace storeId falls back to the placeholder — never an empty-store-id URI. (#1065)
|
|
362
|
+
const storeId = opts.storeId && String(opts.storeId).trim() ? opts.storeId : PLACEHOLDER_STORE_ID;
|
|
362
363
|
const collection = loadCollection(root);
|
|
363
364
|
const imageFiles = listImages(root);
|
|
364
365
|
const items = resolveItems(root, imageFiles);
|
|
@@ -471,12 +472,24 @@ function flagValue(args, name) {
|
|
|
471
472
|
return undefined;
|
|
472
473
|
}
|
|
473
474
|
|
|
475
|
+
/** True if `name` appears in the argv slice as a flag (with or without a value). */
|
|
476
|
+
function flagPresent(args, name) {
|
|
477
|
+
return args.some((a) => a === name || a.startsWith(`${name}=`));
|
|
478
|
+
}
|
|
479
|
+
|
|
474
480
|
function main() {
|
|
475
481
|
const cmd = process.argv[2];
|
|
476
482
|
const args = process.argv.slice(3);
|
|
477
483
|
try {
|
|
478
484
|
if (cmd === "metadata") {
|
|
479
485
|
const storeId = flagValue(args, "--store-id");
|
|
486
|
+
if (flagPresent(args, "--store-id") && !(storeId && storeId.trim())) {
|
|
487
|
+
console.error(
|
|
488
|
+
"Error: --store-id was given but empty. Omit it for the pre-publish placeholder pass, " +
|
|
489
|
+
"or pass the real store id from `digstore deploy` (e.g. --store-id <id>).",
|
|
490
|
+
);
|
|
491
|
+
process.exit(2);
|
|
492
|
+
}
|
|
480
493
|
const r = generateMetadata(ROOT, storeId ? { storeId } : {});
|
|
481
494
|
console.log(`Generated ${r.count} CHIP-0007 metadata file(s) → metadata/ and the items.json manifest.`);
|
|
482
495
|
if (storeId) {
|