pecunia-cli 0.0.5 → 0.0.6
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/index.mjs +15 -15
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -148,12 +148,12 @@ async function getConfig({ cwd, configPath, shouldThrowOnError = false }) {
|
|
|
148
148
|
jitiOptions: jitiOptions(cwd),
|
|
149
149
|
cwd
|
|
150
150
|
});
|
|
151
|
-
if (!("
|
|
152
|
-
if (shouldThrowOnError) throw new Error(`Couldn't read your
|
|
153
|
-
console.error(`[#
|
|
151
|
+
if (!("payment" in config) && !isDefaultExport(config)) {
|
|
152
|
+
if (shouldThrowOnError) throw new Error(`Couldn't read your payment config in ${resolvedPath}. Make sure to default export your payment instance or to export as a variable named payment.`);
|
|
153
|
+
console.error(`[#pecunia]: Couldn't read your payment config in ${resolvedPath}. Make sure to default export your payment instance or to export as a variable named payment.`);
|
|
154
154
|
process.exit(1);
|
|
155
155
|
}
|
|
156
|
-
configFile = "
|
|
156
|
+
configFile = "payment" in config ? config.payment?.options : config.options;
|
|
157
157
|
}
|
|
158
158
|
if (!configFile) for (const possiblePath of possiblePaths) try {
|
|
159
159
|
const { config } = await loadConfig({
|
|
@@ -162,35 +162,35 @@ async function getConfig({ cwd, configPath, shouldThrowOnError = false }) {
|
|
|
162
162
|
cwd
|
|
163
163
|
});
|
|
164
164
|
if (Object.keys(config).length > 0) {
|
|
165
|
-
configFile = config.
|
|
165
|
+
configFile = config.payment?.options || config.default?.options || null;
|
|
166
166
|
if (!configFile) {
|
|
167
|
-
if (shouldThrowOnError) throw new Error("Couldn't read your
|
|
168
|
-
console.error("[#
|
|
167
|
+
if (shouldThrowOnError) throw new Error("Couldn't read your payment config. Make sure to default export your payment instance or to export as a variable named payment.");
|
|
168
|
+
console.error("[#pecunia]: Couldn't read your payment config.");
|
|
169
169
|
console.log("");
|
|
170
|
-
console.log("[#
|
|
170
|
+
console.log("[#pecunia]: Make sure to default export your payment instance or to export as a variable named payment.");
|
|
171
171
|
process.exit(1);
|
|
172
172
|
}
|
|
173
173
|
break;
|
|
174
174
|
}
|
|
175
175
|
} catch (e) {
|
|
176
176
|
if (typeof e === "object" && e && "message" in e && typeof e.message === "string" && e.message.includes("This module cannot be imported from a Client Component module")) {
|
|
177
|
-
if (shouldThrowOnError) throw new Error(`Please remove import 'server-only' from your
|
|
178
|
-
console.error(`Please remove import 'server-only' from your
|
|
177
|
+
if (shouldThrowOnError) throw new Error(`Please remove import 'server-only' from your payment config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`);
|
|
178
|
+
console.error(`Please remove import 'server-only' from your payment config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`);
|
|
179
179
|
process.exit(1);
|
|
180
180
|
}
|
|
181
181
|
if (shouldThrowOnError) throw e;
|
|
182
|
-
console.error("[#
|
|
182
|
+
console.error("[#pecunia]: Couldn't read your payment config.", e);
|
|
183
183
|
process.exit(1);
|
|
184
184
|
}
|
|
185
185
|
return configFile;
|
|
186
186
|
} catch (e) {
|
|
187
187
|
if (typeof e === "object" && e && "message" in e && typeof e.message === "string" && e.message.includes("This module cannot be imported from a Client Component module")) {
|
|
188
|
-
if (shouldThrowOnError) throw new Error(`Please remove import 'server-only' from your
|
|
189
|
-
console.error(`Please remove import 'server-only' from your
|
|
188
|
+
if (shouldThrowOnError) throw new Error(`Please remove import 'server-only' from your payment config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`);
|
|
189
|
+
console.error(`Please remove import 'server-only' from your payment config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`);
|
|
190
190
|
process.exit(1);
|
|
191
191
|
}
|
|
192
192
|
if (shouldThrowOnError) throw e;
|
|
193
|
-
console.error("Couldn't read your
|
|
193
|
+
console.error("Couldn't read your payment config.", e);
|
|
194
194
|
process.exit(1);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -691,7 +691,7 @@ const migrate = new Command("migrate").option("-c, --cwd <cwd>", "the working di
|
|
|
691
691
|
process.on("SIGINT", () => process.exit(0));
|
|
692
692
|
process.on("SIGTERM", () => process.exit(0));
|
|
693
693
|
async function main() {
|
|
694
|
-
const program = new Command("
|
|
694
|
+
const program = new Command("Pecunia");
|
|
695
695
|
let packageInfo = {};
|
|
696
696
|
try {
|
|
697
697
|
packageInfo = await getPackageInfo();
|