@nullpay/cli 1.0.3 → 1.0.4

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.
@@ -119,6 +119,13 @@ function formatCurrencyLabel(currency) {
119
119
  return 'CREDITS + USDCX + USAD';
120
120
  return currency;
121
121
  }
122
+ function resolveOutputPath(input) {
123
+ const trimmed = input.trim();
124
+ if (!trimmed) {
125
+ return path.resolve(process.cwd(), 'nullpay.json');
126
+ }
127
+ return path.resolve(process.cwd(), trimmed);
128
+ }
122
129
  async function validateMerchant(secretKey, merchantAddress) {
123
130
  const res = await fetch(`${BACKEND_URL}/sdk/onboard/validate`, {
124
131
  method: 'POST',
@@ -478,13 +485,23 @@ async function onboard() {
478
485
  line(` ${C.rose('X')} ${C.white('No invoices confirmed. Exiting.')}`);
479
486
  process.exit(1);
480
487
  }
481
- const projectRoot = process.cwd();
482
- const outputPath = path.join(projectRoot, 'nullpay.json');
488
+ blank();
489
+ const defaultOutputPath = path.resolve(process.cwd(), 'nullpay.json');
490
+ const { outputPathInput } = await inquirer_1.default.prompt([{
491
+ type: 'input',
492
+ name: 'outputPathInput',
493
+ message: C.slate('Write nullpay.json to'),
494
+ prefix: C.brand(' >'),
495
+ default: defaultOutputPath,
496
+ validate: (v) => v.trim().length ? true : C.rose('Path cannot be empty'),
497
+ }]);
498
+ const outputPath = resolveOutputPath(outputPathInput);
483
499
  const output = {
484
500
  merchant: resolvedAddress,
485
501
  generated_at: new Date().toISOString(),
486
502
  invoices: generatedInvoices,
487
503
  };
504
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true });
488
505
  fs.writeFileSync(outputPath, JSON.stringify(output, null, 2));
489
506
  blank();
490
507
  blank();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nullpay/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "NullPay CLI — Developer onboarding and invoice management tools",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {