@makeco/stripe-kit 0.1.4 → 0.2.0
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/LICENSE.md +1 -1
- package/README.md +47 -35
- package/dist/cli-prompts.d.ts +19 -0
- package/dist/cli-prompts.d.ts.map +1 -0
- package/dist/cli-prompts.js +154 -0
- package/dist/cli-prompts.js.map +1 -0
- package/dist/cli.js +13 -14
- package/dist/cli.js.map +1 -1
- package/dist/commands/archive.d.ts +3 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +119 -0
- package/dist/commands/archive.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +33 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +113 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/db.d.ts +3 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +143 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/index.d.ts +7 -7
- package/dist/commands/index.js +7 -7
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +147 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/update.d.ts +3 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +141 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/urls.d.ts +3 -0
- package/dist/commands/urls.d.ts.map +1 -0
- package/dist/commands/urls.js +79 -0
- package/dist/commands/urls.js.map +1 -0
- package/dist/definitions/action.constants.js +16 -16
- package/dist/definitions/config.schemas.d.ts +19 -256
- package/dist/definitions/config.schemas.d.ts.map +1 -1
- package/dist/definitions/config.schemas.js +11 -17
- package/dist/definitions/config.schemas.js.map +1 -1
- package/dist/definitions/context.types.d.ts +3 -4
- package/dist/definitions/context.types.d.ts.map +1 -1
- package/dist/definitions/database-adapter.schemas.d.ts +2 -2
- package/dist/definitions/database-adapter.schemas.js +1 -1
- package/dist/definitions/env.constants.js +4 -4
- package/dist/definitions/index.d.ts +6 -8
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/index.js +6 -8
- package/dist/definitions/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/utils/create-context.d.ts +1 -1
- package/dist/utils/create-context.d.ts.map +1 -1
- package/dist/utils/create-context.js +2 -5
- package/dist/utils/create-context.js.map +1 -1
- package/dist/utils/create-logger.d.ts +1 -1
- package/dist/utils/create-logger.js +13 -13
- package/dist/utils/define-config.d.ts +1 -1
- package/dist/utils/define-config.js +1 -1
- package/dist/utils/find-env-directories.js +14 -14
- package/dist/utils/index.d.ts +10 -11
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +10 -11
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/load-config.d.ts +1 -1
- package/dist/utils/load-config.d.ts.map +1 -1
- package/dist/utils/load-config.js +68 -48
- package/dist/utils/load-config.js.map +1 -1
- package/dist/utils/load-env.d.ts +1 -1
- package/dist/utils/load-env.js +18 -18
- package/dist/utils/stripe-client.d.ts +1 -1
- package/dist/utils/stripe-client.js +3 -3
- package/dist/utils/stripe-repository.d.ts +2 -2
- package/dist/utils/stripe-repository.js +2 -2
- package/dist/utils/user-preferences.d.ts +1 -1
- package/dist/utils/user-preferences.js +7 -7
- package/package.json +9 -4
- package/dist/cli-prompts/action.d.ts +0 -5
- package/dist/cli-prompts/action.d.ts.map +0 -1
- package/dist/cli-prompts/action.js +0 -36
- package/dist/cli-prompts/action.js.map +0 -1
- package/dist/cli-prompts/adapter.d.ts +0 -9
- package/dist/cli-prompts/adapter.d.ts.map +0 -1
- package/dist/cli-prompts/adapter.js +0 -53
- package/dist/cli-prompts/adapter.js.map +0 -1
- package/dist/cli-prompts/confirmation.d.ts +0 -6
- package/dist/cli-prompts/confirmation.d.ts.map +0 -1
- package/dist/cli-prompts/confirmation.js +0 -27
- package/dist/cli-prompts/confirmation.js.map +0 -1
- package/dist/cli-prompts/environment.d.ts +0 -5
- package/dist/cli-prompts/environment.d.ts.map +0 -1
- package/dist/cli-prompts/environment.js +0 -43
- package/dist/cli-prompts/environment.js.map +0 -1
- package/dist/cli-prompts/index.d.ts +0 -5
- package/dist/cli-prompts/index.d.ts.map +0 -1
- package/dist/cli-prompts/index.js +0 -5
- package/dist/cli-prompts/index.js.map +0 -1
- package/dist/commands/archive/archive.action.d.ts +0 -5
- package/dist/commands/archive/archive.action.d.ts.map +0 -1
- package/dist/commands/archive/archive.action.js +0 -73
- package/dist/commands/archive/archive.action.js.map +0 -1
- package/dist/commands/archive/archive.command.d.ts +0 -3
- package/dist/commands/archive/archive.command.d.ts.map +0 -1
- package/dist/commands/archive/archive.command.js +0 -24
- package/dist/commands/archive/archive.command.js.map +0 -1
- package/dist/commands/archive/archive.preflight.d.ts +0 -13
- package/dist/commands/archive/archive.preflight.d.ts.map +0 -1
- package/dist/commands/archive/archive.preflight.js +0 -27
- package/dist/commands/archive/archive.preflight.js.map +0 -1
- package/dist/commands/archive/index.d.ts +0 -2
- package/dist/commands/archive/index.d.ts.map +0 -1
- package/dist/commands/archive/index.js +0 -2
- package/dist/commands/archive/index.js.map +0 -1
- package/dist/commands/config/config.command.d.ts +0 -3
- package/dist/commands/config/config.command.d.ts.map +0 -1
- package/dist/commands/config/config.command.js +0 -33
- package/dist/commands/config/config.command.js.map +0 -1
- package/dist/commands/config/index.d.ts +0 -2
- package/dist/commands/config/index.d.ts.map +0 -1
- package/dist/commands/config/index.js +0 -2
- package/dist/commands/config/index.js.map +0 -1
- package/dist/commands/create/create.action.d.ts +0 -5
- package/dist/commands/create/create.action.d.ts.map +0 -1
- package/dist/commands/create/create.action.js +0 -53
- package/dist/commands/create/create.action.js.map +0 -1
- package/dist/commands/create/create.command.d.ts +0 -3
- package/dist/commands/create/create.command.d.ts.map +0 -1
- package/dist/commands/create/create.command.js +0 -22
- package/dist/commands/create/create.command.js.map +0 -1
- package/dist/commands/create/create.preflight.d.ts +0 -13
- package/dist/commands/create/create.preflight.d.ts.map +0 -1
- package/dist/commands/create/create.preflight.js +0 -24
- package/dist/commands/create/create.preflight.js.map +0 -1
- package/dist/commands/create/index.d.ts +0 -2
- package/dist/commands/create/index.d.ts.map +0 -1
- package/dist/commands/create/index.js +0 -2
- package/dist/commands/create/index.js.map +0 -1
- package/dist/commands/db/db.command.d.ts +0 -3
- package/dist/commands/db/db.command.d.ts.map +0 -1
- package/dist/commands/db/db.command.js +0 -13
- package/dist/commands/db/db.command.js.map +0 -1
- package/dist/commands/db/index.d.ts +0 -4
- package/dist/commands/db/index.d.ts.map +0 -1
- package/dist/commands/db/index.js +0 -4
- package/dist/commands/db/index.js.map +0 -1
- package/dist/commands/db/purge/index.d.ts +0 -2
- package/dist/commands/db/purge/index.d.ts.map +0 -1
- package/dist/commands/db/purge/index.js +0 -2
- package/dist/commands/db/purge/index.js.map +0 -1
- package/dist/commands/db/purge/purge.action.d.ts +0 -3
- package/dist/commands/db/purge/purge.action.d.ts.map +0 -1
- package/dist/commands/db/purge/purge.action.js +0 -17
- package/dist/commands/db/purge/purge.action.js.map +0 -1
- package/dist/commands/db/purge/purge.command.d.ts +0 -3
- package/dist/commands/db/purge/purge.command.d.ts.map +0 -1
- package/dist/commands/db/purge/purge.command.js +0 -23
- package/dist/commands/db/purge/purge.command.js.map +0 -1
- package/dist/commands/db/purge/purge.preflight.d.ts +0 -12
- package/dist/commands/db/purge/purge.preflight.d.ts.map +0 -1
- package/dist/commands/db/purge/purge.preflight.js +0 -27
- package/dist/commands/db/purge/purge.preflight.js.map +0 -1
- package/dist/commands/db/sync/index.d.ts +0 -2
- package/dist/commands/db/sync/index.d.ts.map +0 -1
- package/dist/commands/db/sync/index.js +0 -2
- package/dist/commands/db/sync/index.js.map +0 -1
- package/dist/commands/db/sync/sync.action.d.ts +0 -3
- package/dist/commands/db/sync/sync.action.d.ts.map +0 -1
- package/dist/commands/db/sync/sync.action.js +0 -24
- package/dist/commands/db/sync/sync.action.js.map +0 -1
- package/dist/commands/db/sync/sync.command.d.ts +0 -3
- package/dist/commands/db/sync/sync.command.d.ts.map +0 -1
- package/dist/commands/db/sync/sync.command.js +0 -23
- package/dist/commands/db/sync/sync.command.js.map +0 -1
- package/dist/commands/db/sync/sync.preflight.d.ts +0 -12
- package/dist/commands/db/sync/sync.preflight.d.ts.map +0 -1
- package/dist/commands/db/sync/sync.preflight.js +0 -33
- package/dist/commands/db/sync/sync.preflight.js.map +0 -1
- package/dist/commands/list/index.d.ts +0 -4
- package/dist/commands/list/index.d.ts.map +0 -1
- package/dist/commands/list/index.js +0 -4
- package/dist/commands/list/index.js.map +0 -1
- package/dist/commands/list/list.command.d.ts +0 -3
- package/dist/commands/list/list.command.d.ts.map +0 -1
- package/dist/commands/list/list.command.js +0 -13
- package/dist/commands/list/list.command.js.map +0 -1
- package/dist/commands/list/prices/index.d.ts +0 -2
- package/dist/commands/list/prices/index.d.ts.map +0 -1
- package/dist/commands/list/prices/index.js +0 -2
- package/dist/commands/list/prices/index.js.map +0 -1
- package/dist/commands/list/prices/prices.action.d.ts +0 -5
- package/dist/commands/list/prices/prices.action.d.ts.map +0 -1
- package/dist/commands/list/prices/prices.action.js +0 -40
- package/dist/commands/list/prices/prices.action.js.map +0 -1
- package/dist/commands/list/prices/prices.command.d.ts +0 -3
- package/dist/commands/list/prices/prices.command.d.ts.map +0 -1
- package/dist/commands/list/prices/prices.command.js +0 -22
- package/dist/commands/list/prices/prices.command.js.map +0 -1
- package/dist/commands/list/prices/prices.preflight.d.ts +0 -13
- package/dist/commands/list/prices/prices.preflight.d.ts.map +0 -1
- package/dist/commands/list/prices/prices.preflight.js +0 -19
- package/dist/commands/list/prices/prices.preflight.js.map +0 -1
- package/dist/commands/list/products/index.d.ts +0 -2
- package/dist/commands/list/products/index.d.ts.map +0 -1
- package/dist/commands/list/products/index.js +0 -2
- package/dist/commands/list/products/index.js.map +0 -1
- package/dist/commands/list/products/products.action.d.ts +0 -5
- package/dist/commands/list/products/products.action.d.ts.map +0 -1
- package/dist/commands/list/products/products.action.js +0 -32
- package/dist/commands/list/products/products.action.js.map +0 -1
- package/dist/commands/list/products/products.command.d.ts +0 -3
- package/dist/commands/list/products/products.command.d.ts.map +0 -1
- package/dist/commands/list/products/products.command.js +0 -22
- package/dist/commands/list/products/products.command.js.map +0 -1
- package/dist/commands/list/products/products.preflight.d.ts +0 -13
- package/dist/commands/list/products/products.preflight.d.ts.map +0 -1
- package/dist/commands/list/products/products.preflight.js +0 -19
- package/dist/commands/list/products/products.preflight.js.map +0 -1
- package/dist/commands/update/index.d.ts +0 -2
- package/dist/commands/update/index.d.ts.map +0 -1
- package/dist/commands/update/index.js +0 -2
- package/dist/commands/update/index.js.map +0 -1
- package/dist/commands/update/update.action.d.ts +0 -3
- package/dist/commands/update/update.action.d.ts.map +0 -1
- package/dist/commands/update/update.action.js +0 -84
- package/dist/commands/update/update.action.js.map +0 -1
- package/dist/commands/update/update.command.d.ts +0 -3
- package/dist/commands/update/update.command.d.ts.map +0 -1
- package/dist/commands/update/update.command.js +0 -22
- package/dist/commands/update/update.command.js.map +0 -1
- package/dist/commands/update/update.preflight.d.ts +0 -12
- package/dist/commands/update/update.preflight.d.ts.map +0 -1
- package/dist/commands/update/update.preflight.js +0 -36
- package/dist/commands/update/update.preflight.js.map +0 -1
- package/dist/commands/urls/index.d.ts +0 -2
- package/dist/commands/urls/index.d.ts.map +0 -1
- package/dist/commands/urls/index.js +0 -2
- package/dist/commands/urls/index.js.map +0 -1
- package/dist/commands/urls/urls.action.d.ts +0 -4
- package/dist/commands/urls/urls.action.d.ts.map +0 -1
- package/dist/commands/urls/urls.action.js +0 -65
- package/dist/commands/urls/urls.action.js.map +0 -1
- package/dist/commands/urls/urls.command.d.ts +0 -6
- package/dist/commands/urls/urls.command.d.ts.map +0 -1
- package/dist/commands/urls/urls.command.js +0 -19
- package/dist/commands/urls/urls.command.js.map +0 -1
- package/dist/definitions/stripe-price.schemas.d.ts +0 -132
- package/dist/definitions/stripe-price.schemas.d.ts.map +0 -1
- package/dist/definitions/stripe-price.schemas.js +0 -50
- package/dist/definitions/stripe-price.schemas.js.map +0 -1
- package/dist/definitions/stripe-product.schemas.d.ts +0 -87
- package/dist/definitions/stripe-product.schemas.d.ts.map +0 -1
- package/dist/definitions/stripe-product.schemas.js +0 -42
- package/dist/definitions/stripe-product.schemas.js.map +0 -1
- package/dist/utils/create-mappers.d.ts +0 -3
- package/dist/utils/create-mappers.d.ts.map +0 -1
- package/dist/utils/create-mappers.js +0 -98
- package/dist/utils/create-mappers.js.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { execSync } from
|
|
2
|
-
import fs from
|
|
3
|
-
import path from
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
4
|
const WORKSPACE_INDICATORS = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
"pnpm-workspace.yaml",
|
|
6
|
+
"lerna.json",
|
|
7
|
+
"nx.json",
|
|
8
|
+
"turbo.json",
|
|
9
|
+
"rush.json",
|
|
10
10
|
];
|
|
11
11
|
function hasWorkspaceIndicators(dir) {
|
|
12
12
|
return WORKSPACE_INDICATORS.some((indicator) => fs.existsSync(path.join(dir, indicator)));
|
|
13
13
|
}
|
|
14
14
|
function hasMonorepoStructure(dir) {
|
|
15
|
-
const packageJsonPath = path.join(dir,
|
|
15
|
+
const packageJsonPath = path.join(dir, "package.json");
|
|
16
16
|
if (!fs.existsSync(packageJsonPath)) {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
|
-
const commonDirs = [
|
|
19
|
+
const commonDirs = ["packages", "apps"];
|
|
20
20
|
for (const dirName of commonDirs) {
|
|
21
21
|
const dirPath = path.join(dir, dirName);
|
|
22
22
|
if (fs.existsSync(dirPath) &&
|
|
@@ -31,7 +31,7 @@ function hasPackageJsonInSubdirs(dir) {
|
|
|
31
31
|
const subdirs = fs.readdirSync(dir);
|
|
32
32
|
return subdirs.some((subdir) => {
|
|
33
33
|
const subdirPath = path.join(dir, subdir);
|
|
34
|
-
const subPackageJson = path.join(subdirPath,
|
|
34
|
+
const subPackageJson = path.join(subdirPath, "package.json");
|
|
35
35
|
return fs.existsSync(subPackageJson);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
@@ -55,9 +55,9 @@ function detectWorkspaceRoot(startDir) {
|
|
|
55
55
|
}
|
|
56
56
|
function getGitRoot() {
|
|
57
57
|
try {
|
|
58
|
-
const gitRoot = execSync(
|
|
59
|
-
encoding:
|
|
60
|
-
stdio:
|
|
58
|
+
const gitRoot = execSync("git rev-parse --show-toplevel", {
|
|
59
|
+
encoding: "utf8",
|
|
60
|
+
stdio: "pipe",
|
|
61
61
|
}).trim();
|
|
62
62
|
return gitRoot;
|
|
63
63
|
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from './user-preferences.js';
|
|
1
|
+
export * from "../definitions/index.js";
|
|
2
|
+
export * from "./create-context.js";
|
|
3
|
+
export * from "./create-logger.js";
|
|
4
|
+
export * from "./define-config.js";
|
|
5
|
+
export * from "./find-env-directories.js";
|
|
6
|
+
export * from "./load-config.js";
|
|
7
|
+
export * from "./load-env.js";
|
|
8
|
+
export * from "./stripe-client.js";
|
|
9
|
+
export * from "./stripe-repository.js";
|
|
10
|
+
export * from "./user-preferences.js";
|
|
12
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from './user-preferences.js';
|
|
1
|
+
export * from "../definitions/index.js";
|
|
2
|
+
export * from "./create-context.js";
|
|
3
|
+
export * from "./create-logger.js";
|
|
4
|
+
export * from "./define-config.js";
|
|
5
|
+
export * from "./find-env-directories.js";
|
|
6
|
+
export * from "./load-config.js";
|
|
7
|
+
export * from "./load-env.js";
|
|
8
|
+
export * from "./stripe-client.js";
|
|
9
|
+
export * from "./stripe-repository.js";
|
|
10
|
+
export * from "./user-preferences.js";
|
|
12
11
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AA4H5C,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAgBpD;AAKD,wBAAsB,UAAU,CAAC,KAAK,EAAE;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ClB"}
|
|
@@ -1,68 +1,88 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import { createRequire } from
|
|
3
|
-
import path from
|
|
4
|
-
import { z } from
|
|
5
|
-
import { configSchema } from
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { configSchema } from "../definitions/index.js";
|
|
6
|
+
async function loadTypeScriptConfig(tsPath) {
|
|
7
|
+
const esbuild = await import("esbuild");
|
|
8
|
+
const { pathToFileURL } = await import("node:url");
|
|
9
|
+
const tempPath = tsPath.replace(".ts", ".temp.mjs");
|
|
9
10
|
try {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
await esbuild.build({
|
|
12
|
+
entryPoints: [tsPath],
|
|
13
|
+
outfile: tempPath,
|
|
14
|
+
format: "esm",
|
|
15
|
+
platform: "node",
|
|
16
|
+
bundle: true,
|
|
17
|
+
target: "node18",
|
|
18
|
+
external: [
|
|
19
|
+
"@makeco/stripe-kit",
|
|
20
|
+
"node:*",
|
|
21
|
+
"fs",
|
|
22
|
+
"path",
|
|
23
|
+
"crypto",
|
|
24
|
+
"util",
|
|
25
|
+
"stream",
|
|
26
|
+
"events",
|
|
27
|
+
"buffer",
|
|
28
|
+
"process",
|
|
29
|
+
],
|
|
30
|
+
treeShaking: true,
|
|
31
|
+
minify: false,
|
|
13
32
|
});
|
|
33
|
+
const fileUrl = pathToFileURL(tempPath).href;
|
|
34
|
+
const imported = await import(fileUrl);
|
|
35
|
+
return imported.default ?? imported;
|
|
14
36
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
};
|
|
37
|
+
finally {
|
|
38
|
+
await fs.promises.unlink(tempPath).catch(() => {
|
|
39
|
+
});
|
|
20
40
|
}
|
|
21
|
-
|
|
22
|
-
};
|
|
41
|
+
}
|
|
23
42
|
async function loadConfigFile(absolutePath) {
|
|
24
|
-
const { unregister } = await safeRegister();
|
|
25
|
-
let config;
|
|
26
43
|
const ext = path.extname(absolutePath);
|
|
27
|
-
|
|
44
|
+
let config;
|
|
45
|
+
if (ext === ".ts") {
|
|
46
|
+
config = await loadTypeScriptConfig(absolutePath);
|
|
47
|
+
}
|
|
48
|
+
else if (ext === ".cjs") {
|
|
28
49
|
const require = createRequire(import.meta.url);
|
|
29
50
|
const required = require(absolutePath);
|
|
30
51
|
config = required.default ?? required;
|
|
31
52
|
}
|
|
32
53
|
else {
|
|
33
|
-
const { pathToFileURL } = await import(
|
|
54
|
+
const { pathToFileURL } = await import("node:url");
|
|
34
55
|
const fileUrl = pathToFileURL(absolutePath).href;
|
|
35
56
|
const imported = await import(fileUrl);
|
|
36
57
|
config = imported.default ?? imported;
|
|
37
58
|
}
|
|
38
|
-
unregister();
|
|
39
59
|
return config;
|
|
40
60
|
}
|
|
41
61
|
function handleConfigLoadError(error) {
|
|
42
62
|
if (error instanceof z.ZodError) {
|
|
43
|
-
const errorMessages = error.issues.map((err) => `${err.path.join(
|
|
44
|
-
throw new Error(`Invalid stripe config file:\n${errorMessages.join(
|
|
63
|
+
const errorMessages = error.issues.map((err) => `${err.path.join(".")}: ${err.message}`);
|
|
64
|
+
throw new Error(`Invalid stripe config file:\n${errorMessages.join("\n")}`);
|
|
45
65
|
}
|
|
46
66
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
47
|
-
if (errorMessage.includes(
|
|
48
|
-
errorMessage.includes(
|
|
49
|
-
throw new Error(
|
|
67
|
+
if (errorMessage.includes("ERR_PACKAGE_PATH_NOT_EXPORTED") ||
|
|
68
|
+
errorMessage.includes("Cannot resolve module")) {
|
|
69
|
+
throw new Error("Failed to load stripe config file: " +
|
|
50
70
|
errorMessage +
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
"\n\n" +
|
|
72
|
+
"This error often occurs when:\n" +
|
|
73
|
+
"- Your config file imports ESM-only packages\n" +
|
|
74
|
+
"- Workspace packages have complex export maps\n" +
|
|
75
|
+
"- There are module resolution conflicts\n\n" +
|
|
76
|
+
"Try checking your package.json exports and dependencies.");
|
|
57
77
|
}
|
|
58
78
|
throw new Error(`Failed to load stripe config file: ${error}`);
|
|
59
79
|
}
|
|
60
80
|
export function discoverStripeConfig() {
|
|
61
81
|
const configPatterns = [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
"stripe.config.ts",
|
|
83
|
+
"stripe.config.js",
|
|
84
|
+
"stripe.config.mjs",
|
|
85
|
+
"stripe.config.cjs",
|
|
66
86
|
];
|
|
67
87
|
const cwd = process.cwd();
|
|
68
88
|
for (const pattern of configPatterns) {
|
|
@@ -82,17 +102,17 @@ export async function loadConfig(input) {
|
|
|
82
102
|
else {
|
|
83
103
|
const discoveredConfig = discoverStripeConfig();
|
|
84
104
|
if (!discoveredConfig) {
|
|
85
|
-
console.error(
|
|
86
|
-
console.error(
|
|
87
|
-
console.error(
|
|
88
|
-
console.error(
|
|
89
|
-
console.error(
|
|
105
|
+
console.error("❌ Error: No stripe.config.ts file found.");
|
|
106
|
+
console.error("Expected files: stripe.config.ts, stripe.config.js, stripe.config.mjs, or stripe.config.cjs");
|
|
107
|
+
console.error("Or specify a config file with --config flag");
|
|
108
|
+
console.error("");
|
|
109
|
+
console.error("Example stripe.config.ts:");
|
|
90
110
|
console.error(`import { defineConfig } from 'stripe-kit';`);
|
|
91
|
-
console.error(
|
|
92
|
-
console.error(
|
|
93
|
-
console.error(
|
|
94
|
-
console.error(
|
|
95
|
-
console.error(
|
|
111
|
+
console.error("export default defineConfig({");
|
|
112
|
+
console.error(" plans: [...],");
|
|
113
|
+
console.error(" adapters: {...},");
|
|
114
|
+
console.error(" envFiles: {...}");
|
|
115
|
+
console.error("});");
|
|
96
116
|
process.exit(1);
|
|
97
117
|
}
|
|
98
118
|
resolvedConfigPath = discoveredConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"load-config.js","source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
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
3
|
-
import chalk from
|
|
4
|
-
import dotenv from
|
|
5
|
-
import { findEnvDirectories } from
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import dotenv from "dotenv";
|
|
5
|
+
import { findEnvDirectories } from "./find-env-directories.js";
|
|
6
6
|
function getEnvFilePatterns(env) {
|
|
7
7
|
const patterns = {
|
|
8
8
|
dev: [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
".env.dev.local",
|
|
10
|
+
".env.development.local",
|
|
11
|
+
".env.dev",
|
|
12
|
+
".env.development",
|
|
13
13
|
],
|
|
14
|
-
test: [
|
|
15
|
-
staging: [
|
|
14
|
+
test: [".env.test.local", ".env.test"],
|
|
15
|
+
staging: [".env.staging.local", ".env.staging"],
|
|
16
16
|
prod: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
".env.prod.local",
|
|
18
|
+
".env.production.local",
|
|
19
|
+
".env.prod",
|
|
20
|
+
".env.production",
|
|
21
21
|
],
|
|
22
22
|
};
|
|
23
23
|
return patterns[env] || [`.env.${env}.local`, `.env.${env}`];
|
|
@@ -28,7 +28,7 @@ export function loadEnvironment(env) {
|
|
|
28
28
|
const loadedFiles = [];
|
|
29
29
|
const searchedDirs = [];
|
|
30
30
|
for (const directory of searchDirectories) {
|
|
31
|
-
searchedDirs.push(path.relative(process.cwd(), directory) ||
|
|
31
|
+
searchedDirs.push(path.relative(process.cwd(), directory) || ".");
|
|
32
32
|
for (const pattern of envPatterns) {
|
|
33
33
|
const envPath = path.join(directory, pattern);
|
|
34
34
|
if (fs.existsSync(envPath)) {
|
|
@@ -44,8 +44,8 @@ export function loadEnvironment(env) {
|
|
|
44
44
|
}
|
|
45
45
|
if (loadedFiles.length === 0) {
|
|
46
46
|
console.warn(chalk.yellow(`⚠️ No environment files found for environment: ${env}`));
|
|
47
|
-
console.log(chalk.gray(`Searched in: ${searchedDirs.join(
|
|
48
|
-
console.log(chalk.gray(`Expected files: ${envPatterns.join(
|
|
47
|
+
console.log(chalk.gray(`Searched in: ${searchedDirs.join(", ")}`));
|
|
48
|
+
console.log(chalk.gray(`Expected files: ${envPatterns.join(", ")}`));
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
console.log(chalk.green(`✅ Loaded ${loadedFiles.length} environment file(s) for: ${env}`));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Stripe from
|
|
1
|
+
import Stripe from "stripe";
|
|
2
2
|
export function createStripeClient(env) {
|
|
3
3
|
if (!env.STRIPE_SECRET_KEY) {
|
|
4
|
-
throw new Error(
|
|
4
|
+
throw new Error("STRIPE_SECRET_KEY is required");
|
|
5
5
|
}
|
|
6
6
|
return new Stripe(env.STRIPE_SECRET_KEY, {
|
|
7
|
-
apiVersion:
|
|
7
|
+
apiVersion: "2025-08-27.basil",
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=stripe-client.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type Stripe from
|
|
2
|
-
import type { Context } from
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
import type { Context } from "../definitions/index.js";
|
|
3
3
|
export declare function findStripeProduct(ctx: Context, input: {
|
|
4
4
|
internalProductId: string;
|
|
5
5
|
}): Promise<Stripe.Product | null>;
|
|
@@ -20,7 +20,7 @@ export async function findStripePrice(ctx, input) {
|
|
|
20
20
|
}
|
|
21
21
|
export async function listStripeProducts(ctx, options = {}) {
|
|
22
22
|
const { showAll = false } = options;
|
|
23
|
-
ctx.logger.info(`Fetching ${showAll ?
|
|
23
|
+
ctx.logger.info(`Fetching ${showAll ? "all" : "managed"} products from Stripe...`);
|
|
24
24
|
let hasMore = true;
|
|
25
25
|
let startingAfter;
|
|
26
26
|
let allStripeProducts = [];
|
|
@@ -46,7 +46,7 @@ export async function listStripeProducts(ctx, options = {}) {
|
|
|
46
46
|
}
|
|
47
47
|
export async function listStripePrices(ctx, options = {}) {
|
|
48
48
|
const { showAll = false } = options;
|
|
49
|
-
ctx.logger.info(`Fetching ${showAll ?
|
|
49
|
+
ctx.logger.info(`Fetching ${showAll ? "all" : "managed"} prices from Stripe...`);
|
|
50
50
|
let hasMore = true;
|
|
51
51
|
let startingAfter;
|
|
52
52
|
let allStripePrices = [];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from
|
|
2
|
-
import { homedir } from
|
|
3
|
-
import { join } from
|
|
4
|
-
const CONFIG_DIR = join(homedir(),
|
|
5
|
-
const CONFIG_FILE = join(CONFIG_DIR,
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
const CONFIG_DIR = join(homedir(), ".config", "@makeco", "stripe-kit");
|
|
5
|
+
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
6
6
|
export function loadUserPreferences() {
|
|
7
7
|
try {
|
|
8
8
|
if (!existsSync(CONFIG_FILE)) {
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
11
|
-
const content = readFileSync(CONFIG_FILE,
|
|
11
|
+
const content = readFileSync(CONFIG_FILE, "utf-8");
|
|
12
12
|
return JSON.parse(content);
|
|
13
13
|
}
|
|
14
14
|
catch {
|
|
15
|
-
console.warn(
|
|
15
|
+
console.warn("Warning: Could not load user preferences, using defaults");
|
|
16
16
|
return {};
|
|
17
17
|
}
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makeco/stripe-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "makeco",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -50,19 +50,23 @@
|
|
|
50
50
|
"build": "bun clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths && chmod +x dist/cli.js",
|
|
51
51
|
"dev": "tsc -p tsconfig.build.json --watch",
|
|
52
52
|
"dev:typecheck": "bun typecheck --watch --preserveWatchOutput",
|
|
53
|
-
"lint": "bunx ultracite@latest
|
|
54
|
-
"
|
|
53
|
+
"lint": "bunx ultracite@latest check",
|
|
54
|
+
"fix": "bunx ultracite@latest fix",
|
|
55
55
|
"test": "vitest",
|
|
56
|
-
"ci": "bun
|
|
56
|
+
"ci": "bun typecheck && bun run build",
|
|
57
|
+
"release": "semantic-release",
|
|
57
58
|
"git": "bun ci && git add . && git commit -m",
|
|
58
59
|
"postgit": "git push --all"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
62
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
63
|
+
"@semantic-release/git": "^10.0.1",
|
|
61
64
|
"@types/better-sqlite3": "^7.6.13",
|
|
62
65
|
"@types/node": "^20.0.0",
|
|
63
66
|
"@types/prompts": "^2.4.9",
|
|
64
67
|
"better-sqlite3": "^12.2.0",
|
|
65
68
|
"eslint": "^9.29.0",
|
|
69
|
+
"semantic-release": "^25.0.2",
|
|
66
70
|
"tsc-alias": "^1.8.16",
|
|
67
71
|
"typescript": "^5.8.3",
|
|
68
72
|
"ultracite": "^5.1.2",
|
|
@@ -73,6 +77,7 @@
|
|
|
73
77
|
"chalk": "^5.2.0",
|
|
74
78
|
"commander": "^12.1.0",
|
|
75
79
|
"dotenv": "^16.0.3",
|
|
80
|
+
"esbuild": "^0.24.0",
|
|
76
81
|
"esbuild-register": "^3.6.0",
|
|
77
82
|
"prompts": "^2.4.2",
|
|
78
83
|
"stripe": "^18.4.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/cli-prompts/action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMhD,wBAAsB,eAAe,CAAC,KAAK,EAAE;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,SAAS,CAAC,CAyCrB"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import prompts from 'prompts';
|
|
3
|
-
import { ACTION_DESCRIPTIONS, VALID_ACTIONS } from '../definitions/index.js';
|
|
4
|
-
export async function determineAction(input) {
|
|
5
|
-
const { actionInput } = input;
|
|
6
|
-
if (actionInput && VALID_ACTIONS.includes(actionInput)) {
|
|
7
|
-
const action = actionInput;
|
|
8
|
-
console.log(chalk.green(`Action specified via argument: ${chalk.bold(action)}`));
|
|
9
|
-
return action;
|
|
10
|
-
}
|
|
11
|
-
if (actionInput) {
|
|
12
|
-
console.log(chalk.yellow(`Invalid action specified: "${actionInput}". Prompting...`));
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const response = await prompts({
|
|
16
|
-
type: 'select',
|
|
17
|
-
name: 'value',
|
|
18
|
-
message: chalk.blue('Select the action to perform:'),
|
|
19
|
-
choices: VALID_ACTIONS.map((action) => ({
|
|
20
|
-
title: ACTION_DESCRIPTIONS[action],
|
|
21
|
-
value: action,
|
|
22
|
-
})),
|
|
23
|
-
initial: 0,
|
|
24
|
-
});
|
|
25
|
-
if (!response.value) {
|
|
26
|
-
process.exit(0);
|
|
27
|
-
}
|
|
28
|
-
console.log(chalk.green(`Action selected via prompt: ${chalk.bold(response.value)}`));
|
|
29
|
-
return response.value;
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
console.error(chalk.red('Error during action prompt:'), error);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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+B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CACzE,CAAC;QACF,OAAO,QAAQ,CAAC,KAAK,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { DatabaseAdapter } from '../definitions/index.js';
|
|
2
|
-
export declare function determineAdapter(input: {
|
|
3
|
-
adapterInput: string | undefined;
|
|
4
|
-
availableAdapters: Record<string, DatabaseAdapter>;
|
|
5
|
-
}): Promise<{
|
|
6
|
-
name: string;
|
|
7
|
-
adapter: DatabaseAdapter;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/cli-prompts/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAUrD,wBAAsB,gBAAgB,CAAC,KAAK,EAAE;IAC5C,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACpD,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,CAAC,CA4EtD"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import prompts from 'prompts';
|
|
3
|
-
import { getLastUsedAdapter, saveUserPreference } from '../utils/index.js';
|
|
4
|
-
export async function determineAdapter(input) {
|
|
5
|
-
const { adapterInput, availableAdapters } = input;
|
|
6
|
-
const adapterNames = Object.keys(availableAdapters);
|
|
7
|
-
if (adapterNames.length === 0) {
|
|
8
|
-
console.error(chalk.red('No adapters found in configuration'));
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
if (adapterNames.length === 1) {
|
|
12
|
-
const adapterName = adapterNames[0];
|
|
13
|
-
console.log(chalk.green(`Auto-selected adapter: ${chalk.bold(adapterName)}`));
|
|
14
|
-
return { name: adapterName, adapter: availableAdapters[adapterName] };
|
|
15
|
-
}
|
|
16
|
-
if (adapterInput) {
|
|
17
|
-
if (availableAdapters[adapterInput]) {
|
|
18
|
-
console.log(chalk.green(`Adapter specified via flag: ${chalk.bold(adapterInput)}`));
|
|
19
|
-
saveUserPreference('defaultAdapter', adapterInput);
|
|
20
|
-
return { name: adapterInput, adapter: availableAdapters[adapterInput] };
|
|
21
|
-
}
|
|
22
|
-
console.log(chalk.yellow(`Invalid adapter specified: "${adapterInput}". Available: ${adapterNames.join(', ')}`));
|
|
23
|
-
}
|
|
24
|
-
const lastUsedAdapter = getLastUsedAdapter();
|
|
25
|
-
const initialIndex = lastUsedAdapter && adapterNames.includes(lastUsedAdapter)
|
|
26
|
-
? adapterNames.indexOf(lastUsedAdapter)
|
|
27
|
-
: 0;
|
|
28
|
-
try {
|
|
29
|
-
const response = await prompts({
|
|
30
|
-
type: 'select',
|
|
31
|
-
name: 'value',
|
|
32
|
-
message: chalk.blue(lastUsedAdapter && adapterNames.includes(lastUsedAdapter)
|
|
33
|
-
? `Select the database adapter (last used: ${chalk.bold(lastUsedAdapter)}):`
|
|
34
|
-
: 'Select the database adapter:'),
|
|
35
|
-
choices: adapterNames.map((name) => ({
|
|
36
|
-
title: name.charAt(0).toUpperCase() + name.slice(1),
|
|
37
|
-
value: name,
|
|
38
|
-
})),
|
|
39
|
-
initial: initialIndex,
|
|
40
|
-
});
|
|
41
|
-
if (!response.value) {
|
|
42
|
-
process.exit(0);
|
|
43
|
-
}
|
|
44
|
-
console.log(chalk.green(`Adapter selected via prompt: ${chalk.bold(response.value)}`));
|
|
45
|
-
saveUserPreference('defaultAdapter', response.value);
|
|
46
|
-
return { name: response.value, adapter: availableAdapters[response.value] };
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.error(chalk.red('Error during adapter prompt:'), error);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/cli-prompts/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AASjE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAGtC;IACC,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IAClD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAGpD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAE9B,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CAAC,0BAA0B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CACjE,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;IACxE,CA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