@stripe/extensibility-dev-tools 0.23.5
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 +19 -0
- package/dist/bin/build-custom-object-definitions.cjs +2111 -0
- package/dist/bin/build-custom-object-definitions.d.ts +11 -0
- package/dist/bin/build-custom-object-definitions.d.ts.map +1 -0
- package/dist/bin/build-custom-object-definitions.js +2088 -0
- package/dist/bin/create-upload-image.cjs +2136 -0
- package/dist/bin/create-upload-image.d.ts +17 -0
- package/dist/bin/create-upload-image.d.ts.map +1 -0
- package/dist/bin/create-upload-image.js +2113 -0
- package/dist/bin/dev-tools-rpc.cjs +3874 -0
- package/dist/bin/dev-tools-rpc.d.ts +3 -0
- package/dist/bin/dev-tools-rpc.d.ts.map +1 -0
- package/dist/bin/dev-tools-rpc.js +3864 -0
- package/dist/bin/gen-schemas.cjs +20739 -0
- package/dist/bin/gen-schemas.d.ts +8 -0
- package/dist/bin/gen-schemas.d.ts.map +1 -0
- package/dist/bin/gen-schemas.js +20715 -0
- package/dist/bin/gen-workspace.cjs +3847 -0
- package/dist/bin/gen-workspace.d.ts +8 -0
- package/dist/bin/gen-workspace.d.ts.map +1 -0
- package/dist/bin/gen-workspace.js +3841 -0
- package/dist/bin/manifest.cjs +686 -0
- package/dist/bin/manifest.d.ts +10 -0
- package/dist/bin/manifest.d.ts.map +1 -0
- package/dist/bin/manifest.js +663 -0
- package/dist/bin/rpc/dispatch.d.ts +10 -0
- package/dist/bin/rpc/dispatch.d.ts.map +1 -0
- package/dist/bin/rpc/handlers.d.ts +4 -0
- package/dist/bin/rpc/handlers.d.ts.map +1 -0
- package/dist/bin/rpc/types.d.ts +29 -0
- package/dist/bin/rpc/types.d.ts.map +1 -0
- package/dist/bin/template-info.cjs +1511 -0
- package/dist/bin/template-info.d.ts +9 -0
- package/dist/bin/template-info.d.ts.map +1 -0
- package/dist/bin/template-info.js +1488 -0
- package/dist/custom-objects/build-definitions.d.ts +98 -0
- package/dist/custom-objects/build-definitions.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/custom_objects/pub/api/app_api/object_definitions_app_service.pb.d.ts +191 -0
- package/dist/custom-objects/generated/proto/custom_objects/pub/api/app_api/object_definitions_app_service.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/custom_objects/pub/api/common/schema.pb.d.ts +131 -0
- package/dist/custom-objects/generated/proto/custom_objects/pub/api/common/schema.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/google/protobuf/descriptor.pb.d.ts +1482 -0
- package/dist/custom-objects/generated/proto/google/protobuf/descriptor.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/google/protobuf/timestamp.pb.d.ts +167 -0
- package/dist/custom-objects/generated/proto/google/protobuf/timestamp.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/proto/annotations.pb.d.ts +64 -0
- package/dist/custom-objects/generated/proto/proto/annotations.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/proto/extensions.pb.d.ts +657 -0
- package/dist/custom-objects/generated/proto/proto/extensions.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/metadata/pub/api/api_metadata.pb.d.ts +105 -0
- package/dist/custom-objects/generated/proto/vendor/metadata/pub/api/api_metadata.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/net/idempotency/idempotency_model.pb.d.ts +79 -0
- package/dist/custom-objects/generated/proto/vendor/net/idempotency/idempotency_model.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/api_group_enum.pb.d.ts +129 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/api_group_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/api_visibility.pb.d.ts +76 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/api_visibility.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/customize_dispatch_middleware_enum.pb.d.ts +78 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/customize_dispatch_middleware_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/docs_namespace_group_enum.pb.d.ts +146 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/docs_namespace_group_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/documented_enum.pb.d.ts +76 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/documented_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/event_scope_enum.pb.d.ts +92 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/event_scope_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/extension_interface.pb.d.ts +124 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/extension_interface.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/feature_enum.pb.d.ts +1070 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/feature_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/field_validation_rules.pb.d.ts +279 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/field_validation_rules.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/flavor_enum.pb.d.ts +78 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/flavor_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/http_error_status.pb.d.ts +102 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/http_error_status.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/method_kind_enum.pb.d.ts +86 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/method_kind_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/method_priority.pb.d.ts +80 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/method_priority.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/permission_check_enum.pb.d.ts +74 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/permission_check_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/redaction_enum.pb.d.ts +76 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/redaction_enum.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/region_routers.pb.d.ts +103 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/region_routers.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/rollout_configs.pb.d.ts +153 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/rollout_configs.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/v2ext.pb.d.ts +1111 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/v2ext.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/vext/annotations.pb.d.ts +602 -0
- package/dist/custom-objects/generated/proto/vendor/vext/annotations.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/vext/extensions.pb.d.ts +144 -0
- package/dist/custom-objects/generated/proto/vendor/vext/extensions.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/vext/privacy_unified_annotations.pb.d.ts +851 -0
- package/dist/custom-objects/generated/proto/vendor/vext/privacy_unified_annotations.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/vext/xml_annotations.pb.d.ts +125 -0
- package/dist/custom-objects/generated/proto/vendor/vext/xml_annotations.pb.d.ts.map +1 -0
- package/dist/custom-objects/to-proto-json.d.ts +17 -0
- package/dist/custom-objects/to-proto-json.d.ts.map +1 -0
- package/dist/dependencies/index.cjs +601 -0
- package/dist/dependencies/index.d.ts +320 -0
- package/dist/dependencies/index.d.ts.map +1 -0
- package/dist/dependencies/index.js +560 -0
- package/dist/extensibility-dev-tools-alpha.d.ts +199 -0
- package/dist/extensibility-dev-tools-beta.d.ts +199 -0
- package/dist/extensibility-dev-tools-dependencies-alpha.d.ts +51 -0
- package/dist/extensibility-dev-tools-dependencies-beta.d.ts +51 -0
- package/dist/extensibility-dev-tools-dependencies-internal.d.ts +372 -0
- package/dist/extensibility-dev-tools-dependencies-public.d.ts +51 -0
- package/dist/extensibility-dev-tools-internal.d.ts +1722 -0
- package/dist/extensibility-dev-tools-jsonschema-tools-alpha.d.ts +57 -0
- package/dist/extensibility-dev-tools-jsonschema-tools-beta.d.ts +57 -0
- package/dist/extensibility-dev-tools-jsonschema-tools-internal.d.ts +123 -0
- package/dist/extensibility-dev-tools-jsonschema-tools-public.d.ts +57 -0
- package/dist/extensibility-dev-tools-manifest-alpha.d.ts +31 -0
- package/dist/extensibility-dev-tools-manifest-beta.d.ts +31 -0
- package/dist/extensibility-dev-tools-manifest-internal.d.ts +461 -0
- package/dist/extensibility-dev-tools-manifest-public.d.ts +31 -0
- package/dist/extensibility-dev-tools-public.d.ts +199 -0
- package/dist/extensibility-dev-tools-schemas-alpha.d.ts +9 -0
- package/dist/extensibility-dev-tools-schemas-beta.d.ts +9 -0
- package/dist/extensibility-dev-tools-schemas-internal.d.ts +41 -0
- package/dist/extensibility-dev-tools-schemas-public.d.ts +9 -0
- package/dist/extensibility-dev-tools-templates-alpha.d.ts +67 -0
- package/dist/extensibility-dev-tools-templates-beta.d.ts +67 -0
- package/dist/extensibility-dev-tools-templates-internal.d.ts +554 -0
- package/dist/extensibility-dev-tools-templates-public.d.ts +67 -0
- package/dist/extensibility-dev-tools-workspace-alpha.d.ts +51 -0
- package/dist/extensibility-dev-tools-workspace-beta.d.ts +51 -0
- package/dist/extensibility-dev-tools-workspace-internal.d.ts +410 -0
- package/dist/extensibility-dev-tools-workspace-public.d.ts +51 -0
- package/dist/index.cjs +3810 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3758 -0
- package/dist/jsonschema-tools.cjs +20451 -0
- package/dist/jsonschema-tools.d.ts +98 -0
- package/dist/jsonschema-tools.d.ts.map +1 -0
- package/dist/jsonschema-tools.js +20404 -0
- package/dist/manifest/index.cjs +610 -0
- package/dist/manifest/index.d.ts +8 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +571 -0
- package/dist/manifest/manifest-v1.d.ts +102 -0
- package/dist/manifest/manifest-v1.d.ts.map +1 -0
- package/dist/manifest/manifest-v2.d.ts +253 -0
- package/dist/manifest/manifest-v2.d.ts.map +1 -0
- package/dist/manifest/stripe-app-manifest.d.ts +114 -0
- package/dist/manifest/stripe-app-manifest.d.ts.map +1 -0
- package/dist/schemas/index.cjs +20692 -0
- package/dist/schemas/index.d.ts +37 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +20656 -0
- package/dist/templates/diff-viewer/diff-generator.d.ts +22 -0
- package/dist/templates/diff-viewer/diff-generator.d.ts.map +1 -0
- package/dist/templates/diff-viewer/diff-prompt.d.ts +13 -0
- package/dist/templates/diff-viewer/diff-prompt.d.ts.map +1 -0
- package/dist/templates/diff-viewer/index.d.ts +7 -0
- package/dist/templates/diff-viewer/index.d.ts.map +1 -0
- package/dist/templates/diff-viewer/terminal-renderer.d.ts +29 -0
- package/dist/templates/diff-viewer/terminal-renderer.d.ts.map +1 -0
- package/dist/templates/diff-viewer/types.d.ts +58 -0
- package/dist/templates/diff-viewer/types.d.ts.map +1 -0
- package/dist/templates/extensions/base.d.ts +23 -0
- package/dist/templates/extensions/base.d.ts.map +1 -0
- package/dist/templates/extensions/billing.bill.discount_calculation.d.ts +6 -0
- package/dist/templates/extensions/billing.bill.discount_calculation.d.ts.map +1 -0
- package/dist/templates/extensions/billing.customer_balance_application.d.ts +6 -0
- package/dist/templates/extensions/billing.customer_balance_application.d.ts.map +1 -0
- package/dist/templates/extensions/billing.invoice_collection_setting.d.ts +6 -0
- package/dist/templates/extensions/billing.invoice_collection_setting.d.ts.map +1 -0
- package/dist/templates/extensions/billing.prorations.d.ts +6 -0
- package/dist/templates/extensions/billing.prorations.d.ts.map +1 -0
- package/dist/templates/extensions/billing.recurring_billing_item_handling.d.ts +6 -0
- package/dist/templates/extensions/billing.recurring_billing_item_handling.d.ts.map +1 -0
- package/dist/templates/extensions/core.workflows.custom_action.d.ts +6 -0
- package/dist/templates/extensions/core.workflows.custom_action.d.ts.map +1 -0
- package/dist/templates/extensions/extend.objects.custom_objects.d.ts +6 -0
- package/dist/templates/extensions/extend.objects.custom_objects.d.ts.map +1 -0
- package/dist/templates/extensions/extend.workflows.custom_action.d.ts +6 -0
- package/dist/templates/extensions/extend.workflows.custom_action.d.ts.map +1 -0
- package/dist/templates/extensions/index.d.ts +13 -0
- package/dist/templates/extensions/index.d.ts.map +1 -0
- package/dist/templates/extensions/registry.d.ts +10 -0
- package/dist/templates/extensions/registry.d.ts.map +1 -0
- package/dist/templates/extensions/types.d.ts +104 -0
- package/dist/templates/extensions/types.d.ts.map +1 -0
- package/dist/templates/file-writer.d.ts +140 -0
- package/dist/templates/file-writer.d.ts.map +1 -0
- package/dist/templates/fs/_impl.d.ts +29 -0
- package/dist/templates/fs/_impl.d.ts.map +1 -0
- package/dist/templates/fs/filesystem.d.ts +8 -0
- package/dist/templates/fs/filesystem.d.ts.map +1 -0
- package/dist/templates/fs/in-memory.d.ts +9 -0
- package/dist/templates/fs/in-memory.d.ts.map +1 -0
- package/dist/templates/fs/index.d.ts +25 -0
- package/dist/templates/fs/index.d.ts.map +1 -0
- package/dist/templates/fs-utils.d.ts +17 -0
- package/dist/templates/fs-utils.d.ts.map +1 -0
- package/dist/templates/index.cjs +2248 -0
- package/dist/templates/index.d.ts +32 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +2203 -0
- package/dist/templates/root/index.d.ts +60 -0
- package/dist/templates/root/index.d.ts.map +1 -0
- package/dist/templates/simple-templates.d.ts +8 -0
- package/dist/templates/simple-templates.d.ts.map +1 -0
- package/dist/templates/template-manager.d.ts +8 -0
- package/dist/templates/template-manager.d.ts.map +1 -0
- package/dist/templates/types.d.ts +9 -0
- package/dist/templates/types.d.ts.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/workspace/index.cjs +3756 -0
- package/dist/workspace/index.d.ts +336 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +3731 -0
- package/package.json +137 -0
- package/templates/extensions/billing.bill.discount_calculation/index.test.ts +15 -0
- package/templates/extensions/billing.bill.discount_calculation/index.ts +20 -0
- package/templates/extensions/billing.customer_balance_application/index.test.ts +15 -0
- package/templates/extensions/billing.customer_balance_application/index.ts +18 -0
- package/templates/extensions/billing.invoice_collection_setting/index.test.ts +15 -0
- package/templates/extensions/billing.invoice_collection_setting/index.ts +16 -0
- package/templates/extensions/billing.prorations/index.test.ts +15 -0
- package/templates/extensions/billing.prorations/index.ts +18 -0
- package/templates/extensions/billing.recurring_billing_item_handling/index.test.ts +15 -0
- package/templates/extensions/billing.recurring_billing_item_handling/index.ts +42 -0
- package/templates/extensions/common/.prettierignore +3 -0
- package/templates/extensions/common/eslint.config.mts.mustache +95 -0
- package/templates/extensions/common/package.json.mustache +26 -0
- package/templates/extensions/common/tsconfig.build.json.mustache +15 -0
- package/templates/extensions/common/tsconfig.json.mustache +16 -0
- package/templates/extensions/core.workflows.custom_action/custom_input.schema.json +6 -0
- package/templates/extensions/core.workflows.custom_action/index.test.ts +15 -0
- package/templates/extensions/core.workflows.custom_action/index.ts +31 -0
- package/templates/extensions/extend.workflows.custom_action/custom_input.schema.json +6 -0
- package/templates/extensions/extend.workflows.custom_action/index.test.ts +15 -0
- package/templates/extensions/extend.workflows.custom_action/index.ts +31 -0
- package/templates/root/.husky/pre-commit +1 -0
- package/templates/root/.prettierignore +5 -0
- package/templates/root/.prettierrc +7 -0
- package/templates/root/_gitignore +28 -0
- package/templates/root/custom-objects/package.json +20 -0
- package/templates/root/custom-objects/tsconfig.json +9 -0
- package/templates/root/eslint.config.mts +95 -0
- package/templates/root/package.json.mustache +32 -0
- package/templates/root/pnpm-workspace.yaml +7 -0
- package/templates/root/stripe-app.yaml.mustache +6 -0
- package/templates/root/tools/test.mts +38 -0
- package/templates/root/tsconfig.base.json +23 -0
- package/templates/root/tsconfig.json +15 -0
- package/templates/root/ui/package.json +17 -0
- package/templates/root/vitest.config.mts +47 -0
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
// src/dependencies/index.ts
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import os from "os";
|
|
5
|
+
import { execSync } from "child_process";
|
|
6
|
+
import PackageJson from "@npmcli/package-json";
|
|
7
|
+
import * as semver from "semver";
|
|
8
|
+
import { load as parseToml } from "js-toml";
|
|
9
|
+
import { _createCliContext } from "@stripe/extensibility-tool-utils";
|
|
10
|
+
function _npmDep(name, version) {
|
|
11
|
+
return { type: "npm", name, version };
|
|
12
|
+
}
|
|
13
|
+
function _devNpmDep(name, version) {
|
|
14
|
+
return { type: "dev-npm", name, version };
|
|
15
|
+
}
|
|
16
|
+
function _stripeCliPluginDep(name, minVersion) {
|
|
17
|
+
return minVersion ? { type: "stripe-cli-plugin", name, minVersion } : { type: "stripe-cli-plugin", name };
|
|
18
|
+
}
|
|
19
|
+
function _detectPackageManager(cwd) {
|
|
20
|
+
if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) {
|
|
21
|
+
return "pnpm";
|
|
22
|
+
}
|
|
23
|
+
if (fs.existsSync(path.join(cwd, "yarn.lock"))) {
|
|
24
|
+
return "yarn";
|
|
25
|
+
}
|
|
26
|
+
if (fs.existsSync(path.join(cwd, "package-lock.json"))) {
|
|
27
|
+
return "npm";
|
|
28
|
+
}
|
|
29
|
+
let currentDir = cwd;
|
|
30
|
+
const root = path.parse(currentDir).root;
|
|
31
|
+
while (currentDir !== root) {
|
|
32
|
+
const parentDir = path.dirname(currentDir);
|
|
33
|
+
if (parentDir === currentDir) break;
|
|
34
|
+
if (fs.existsSync(path.join(parentDir, "pnpm-lock.yaml"))) {
|
|
35
|
+
if (fs.existsSync(path.join(parentDir, "pnpm-workspace.yaml"))) {
|
|
36
|
+
return "pnpm";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (fs.existsSync(path.join(parentDir, "yarn.lock"))) {
|
|
40
|
+
return "yarn";
|
|
41
|
+
}
|
|
42
|
+
if (fs.existsSync(path.join(parentDir, "package-lock.json"))) {
|
|
43
|
+
return "npm";
|
|
44
|
+
}
|
|
45
|
+
currentDir = parentDir;
|
|
46
|
+
}
|
|
47
|
+
return "npm";
|
|
48
|
+
}
|
|
49
|
+
var _NpmDependencyHandler = class {
|
|
50
|
+
cwd;
|
|
51
|
+
quiet;
|
|
52
|
+
devDependencies;
|
|
53
|
+
context;
|
|
54
|
+
constructor(options) {
|
|
55
|
+
this.cwd = options.cwd;
|
|
56
|
+
this.quiet = options.quiet;
|
|
57
|
+
this.devDependencies = options.devDependencies ?? false;
|
|
58
|
+
this.context = options.context ?? _createCliContext();
|
|
59
|
+
}
|
|
60
|
+
get dependencyKey() {
|
|
61
|
+
return this.devDependencies ? "devDependencies" : "dependencies";
|
|
62
|
+
}
|
|
63
|
+
get dependencyLabel() {
|
|
64
|
+
return this.devDependencies ? "devDependencies" : "dependencies";
|
|
65
|
+
}
|
|
66
|
+
/** Check whether the npm dependency is already present in package.json. */
|
|
67
|
+
async check(dep) {
|
|
68
|
+
const packageJsonPath = path.join(this.cwd, "package.json");
|
|
69
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
70
|
+
return {
|
|
71
|
+
satisfied: false,
|
|
72
|
+
message: `package.json not found at ${this.cwd}`
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const pkgJson = await PackageJson.load(this.cwd);
|
|
76
|
+
const rawDeps = pkgJson.content[this.dependencyKey];
|
|
77
|
+
const deps = rawDeps ?? {};
|
|
78
|
+
const currentVersion = deps[dep.name];
|
|
79
|
+
if (currentVersion === void 0) {
|
|
80
|
+
return {
|
|
81
|
+
satisfied: false,
|
|
82
|
+
message: `${dep.name} not found in ${this.dependencyLabel}`
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (currentVersion === dep.version) {
|
|
86
|
+
return {
|
|
87
|
+
satisfied: true,
|
|
88
|
+
currentVersion,
|
|
89
|
+
message: `${dep.name}@${dep.version} already in ${this.dependencyLabel}`
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (this.versionsCompatible(currentVersion, dep.version)) {
|
|
93
|
+
return {
|
|
94
|
+
satisfied: true,
|
|
95
|
+
currentVersion,
|
|
96
|
+
message: `${dep.name}@${currentVersion} satisfies ${dep.version}`
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
satisfied: false,
|
|
101
|
+
currentVersion,
|
|
102
|
+
message: `${dep.name}@${currentVersion} does not satisfy ${dep.version}`
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Check whether the requested version conflicts with the currently installed version. */
|
|
106
|
+
async checkConflict(dep) {
|
|
107
|
+
const packageJsonPath = path.join(this.cwd, "package.json");
|
|
108
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
109
|
+
return { hasConflict: false };
|
|
110
|
+
}
|
|
111
|
+
const pkgJson = await PackageJson.load(this.cwd);
|
|
112
|
+
const rawDeps = pkgJson.content[this.dependencyKey];
|
|
113
|
+
const deps = rawDeps ?? {};
|
|
114
|
+
const existingVersion = deps[dep.name];
|
|
115
|
+
if (existingVersion === void 0) {
|
|
116
|
+
return { hasConflict: false };
|
|
117
|
+
}
|
|
118
|
+
if (existingVersion === dep.version) {
|
|
119
|
+
return { hasConflict: false };
|
|
120
|
+
}
|
|
121
|
+
const existingMajor = this.extractMajorVersion(existingVersion);
|
|
122
|
+
const requestedMajor = this.extractMajorVersion(dep.version);
|
|
123
|
+
if (existingMajor !== null && requestedMajor !== null && existingMajor !== requestedMajor) {
|
|
124
|
+
return {
|
|
125
|
+
hasConflict: true,
|
|
126
|
+
existingVersion,
|
|
127
|
+
requestedVersion: dep.version,
|
|
128
|
+
message: `Major version mismatch: existing ${existingVersion} vs requested ${dep.version}`
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (!this.versionsCompatible(existingVersion, dep.version)) {
|
|
132
|
+
return {
|
|
133
|
+
hasConflict: true,
|
|
134
|
+
existingVersion,
|
|
135
|
+
requestedVersion: dep.version,
|
|
136
|
+
message: `Incompatible version ranges: existing ${existingVersion} vs requested ${dep.version}`
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return { hasConflict: false };
|
|
140
|
+
}
|
|
141
|
+
/** Add or update the npm dependency in package.json. */
|
|
142
|
+
async add(dep) {
|
|
143
|
+
const packageJsonPath = path.join(this.cwd, "package.json");
|
|
144
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
145
|
+
throw new Error(`package.json not found at ${this.cwd}`);
|
|
146
|
+
}
|
|
147
|
+
const pkgJson = await PackageJson.load(this.cwd);
|
|
148
|
+
const rawDeps = pkgJson.content[this.dependencyKey];
|
|
149
|
+
const deps = rawDeps ?? {};
|
|
150
|
+
const existingVersion = deps[dep.name];
|
|
151
|
+
const isUpdate = existingVersion !== void 0;
|
|
152
|
+
const update = {
|
|
153
|
+
[this.dependencyKey]: {
|
|
154
|
+
...deps,
|
|
155
|
+
[dep.name]: dep.version
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
pkgJson.update(update);
|
|
159
|
+
await pkgJson.save();
|
|
160
|
+
const action = isUpdate ? "update" : "add";
|
|
161
|
+
const message = isUpdate ? `Updated ${dep.name} from ${existingVersion} to ${dep.version} in ${this.dependencyLabel}` : `Added ${dep.name}@${dep.version} to ${this.dependencyLabel}`;
|
|
162
|
+
if (!this.quiet) {
|
|
163
|
+
this.context.ux.log(`\u2713 ${message}`);
|
|
164
|
+
}
|
|
165
|
+
return { action, message };
|
|
166
|
+
}
|
|
167
|
+
/** Run the package manager install command in the working directory. */
|
|
168
|
+
install(_deps) {
|
|
169
|
+
const packageManager = _detectPackageManager(this.cwd);
|
|
170
|
+
if (!this.quiet) {
|
|
171
|
+
this.context.ux.log(`Running ${packageManager} install...`);
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
execSync(`${packageManager} install`, {
|
|
175
|
+
cwd: this.cwd,
|
|
176
|
+
stdio: this.quiet ? "pipe" : "inherit"
|
|
177
|
+
});
|
|
178
|
+
} catch (error) {
|
|
179
|
+
const baseMessage = `Failed to run ${packageManager} install`;
|
|
180
|
+
if (error instanceof Error) {
|
|
181
|
+
return Promise.reject(new Error(`${baseMessage}: ${error.message}`));
|
|
182
|
+
}
|
|
183
|
+
return Promise.reject(new Error(`${baseMessage}: ${String(error)}`));
|
|
184
|
+
}
|
|
185
|
+
return Promise.resolve();
|
|
186
|
+
}
|
|
187
|
+
versionsCompatible(existing, requested) {
|
|
188
|
+
if (existing.startsWith("file:") || requested.startsWith("file:") || existing.startsWith("workspace:") || requested.startsWith("workspace:")) {
|
|
189
|
+
return existing === requested;
|
|
190
|
+
}
|
|
191
|
+
if (!semver.validRange(existing) || !semver.validRange(requested)) {
|
|
192
|
+
return existing === requested;
|
|
193
|
+
}
|
|
194
|
+
return semver.intersects(existing, requested);
|
|
195
|
+
}
|
|
196
|
+
extractMajorVersion(version) {
|
|
197
|
+
if (version.startsWith("file:") || version.startsWith("workspace:")) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const coerced = semver.coerce(version);
|
|
201
|
+
if (coerced) {
|
|
202
|
+
return coerced.major;
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var _StripeCliPluginHandler = class {
|
|
208
|
+
stripeConfigDir;
|
|
209
|
+
quiet;
|
|
210
|
+
context;
|
|
211
|
+
constructor(options) {
|
|
212
|
+
this.stripeConfigDir = options.stripeConfigDir;
|
|
213
|
+
this.quiet = options.quiet;
|
|
214
|
+
this.context = options.context ?? _createCliContext();
|
|
215
|
+
}
|
|
216
|
+
/** Check whether the Stripe CLI plugin is installed and meets the minimum version. */
|
|
217
|
+
check(dep) {
|
|
218
|
+
const pluginsTomlPath = path.join(this.stripeConfigDir, "plugins.toml");
|
|
219
|
+
if (!fs.existsSync(pluginsTomlPath)) {
|
|
220
|
+
return Promise.resolve({
|
|
221
|
+
satisfied: false,
|
|
222
|
+
message: `Stripe CLI plugin '${dep.name}' is not installed (plugins.toml not found)`
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
const pluginsContent = fs.readFileSync(pluginsTomlPath, "utf-8");
|
|
226
|
+
const installedPlugin = this.findPluginInToml(pluginsContent, dep.name);
|
|
227
|
+
if (!installedPlugin) {
|
|
228
|
+
return Promise.resolve({
|
|
229
|
+
satisfied: false,
|
|
230
|
+
message: `Stripe CLI plugin '${dep.name}' is not installed`
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
if (dep.minVersion && installedPlugin.version) {
|
|
234
|
+
if (!this.isVersionSatisfied(installedPlugin.version, dep.minVersion)) {
|
|
235
|
+
return Promise.resolve({
|
|
236
|
+
satisfied: false,
|
|
237
|
+
currentVersion: installedPlugin.version,
|
|
238
|
+
message: `Stripe CLI plugin '${dep.name}' version ${installedPlugin.version} is below minimum ${dep.minVersion}`
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const result = {
|
|
243
|
+
satisfied: true,
|
|
244
|
+
message: `Stripe CLI plugin '${dep.name}' is installed${installedPlugin.version ? ` (version ${installedPlugin.version})` : ""}`
|
|
245
|
+
};
|
|
246
|
+
if (installedPlugin.version) {
|
|
247
|
+
result.currentVersion = installedPlugin.version;
|
|
248
|
+
}
|
|
249
|
+
return Promise.resolve(result);
|
|
250
|
+
}
|
|
251
|
+
/** Check whether the installed plugin version conflicts with the requested minimum. */
|
|
252
|
+
async checkConflict(dep) {
|
|
253
|
+
const checkResult = await this.check(dep);
|
|
254
|
+
if (checkResult.satisfied) {
|
|
255
|
+
return { hasConflict: false };
|
|
256
|
+
}
|
|
257
|
+
if (checkResult.currentVersion && dep.minVersion) {
|
|
258
|
+
return {
|
|
259
|
+
hasConflict: true,
|
|
260
|
+
existingVersion: checkResult.currentVersion,
|
|
261
|
+
requestedVersion: dep.minVersion,
|
|
262
|
+
message: `Installed version ${checkResult.currentVersion} is below minimum ${dep.minVersion}`
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return { hasConflict: false };
|
|
266
|
+
}
|
|
267
|
+
/** Stage a Stripe CLI plugin for installation; the actual install happens in `install`. */
|
|
268
|
+
async add(dep) {
|
|
269
|
+
const checkResult = await this.check(dep);
|
|
270
|
+
const isUpdate = checkResult.currentVersion !== void 0;
|
|
271
|
+
const action = isUpdate ? "update" : "add";
|
|
272
|
+
const message = isUpdate ? `Will update Stripe CLI plugin '${dep.name}'` : `Will install Stripe CLI plugin '${dep.name}'`;
|
|
273
|
+
return { action, message };
|
|
274
|
+
}
|
|
275
|
+
/** Install Stripe CLI plugins using `stripe plugin install`. */
|
|
276
|
+
async install(deps) {
|
|
277
|
+
for (const dep of deps) {
|
|
278
|
+
const checkResult = await this.check(dep);
|
|
279
|
+
const isUpdate = checkResult.currentVersion !== void 0;
|
|
280
|
+
try {
|
|
281
|
+
execSync(`stripe plugin install ${dep.name}`, {
|
|
282
|
+
stdio: this.quiet ? "pipe" : "inherit"
|
|
283
|
+
});
|
|
284
|
+
const message = isUpdate ? `Updated Stripe CLI plugin '${dep.name}'` : `Installed Stripe CLI plugin '${dep.name}'`;
|
|
285
|
+
if (!this.quiet) {
|
|
286
|
+
this.context.ux.log(`\u2713 ${message}`);
|
|
287
|
+
}
|
|
288
|
+
} catch (error) {
|
|
289
|
+
const baseMessage = `Failed to install Stripe CLI plugin '${dep.name}'`;
|
|
290
|
+
if (error instanceof Error) {
|
|
291
|
+
throw new Error(`${baseMessage}: ${error.message}`);
|
|
292
|
+
}
|
|
293
|
+
throw new Error(`${baseMessage}: ${String(error)}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
findPluginInToml(content, pluginName) {
|
|
298
|
+
try {
|
|
299
|
+
const parsed = parseToml(content);
|
|
300
|
+
const plugins = parsed.Plugin;
|
|
301
|
+
if (!plugins || !Array.isArray(plugins)) {
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
const plugin = plugins.find((p) => p.Shortname === pluginName);
|
|
305
|
+
if (!plugin) {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
if (plugin.Release && Array.isArray(plugin.Release) && plugin.Release.length > 0) {
|
|
309
|
+
const currentArch = os.arch();
|
|
310
|
+
const currentOS = os.platform();
|
|
311
|
+
const normalizedArch = currentArch === "x64" ? "amd64" : currentArch;
|
|
312
|
+
const normalizedOS = currentOS === "win32" ? "windows" : currentOS;
|
|
313
|
+
const platformReleases = plugin.Release.filter(
|
|
314
|
+
(r) => r.Arch === normalizedArch && r.OS === normalizedOS
|
|
315
|
+
);
|
|
316
|
+
if (platformReleases.length === 0) {
|
|
317
|
+
return null;
|
|
318
|
+
}
|
|
319
|
+
const localBuildRelease = platformReleases.find(
|
|
320
|
+
(r) => r.Version === "local.build.dev"
|
|
321
|
+
);
|
|
322
|
+
if (localBuildRelease) {
|
|
323
|
+
return { version: "local.build.dev" };
|
|
324
|
+
}
|
|
325
|
+
const versions = platformReleases.map((r) => r.Version).filter((v) => v !== void 0);
|
|
326
|
+
if (versions.length === 0) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
const sortedVersions = versions.map((v) => ({ original: v, parsed: semver.coerce(v) })).filter(
|
|
330
|
+
(v) => v.parsed !== null
|
|
331
|
+
).sort((a, b) => semver.rcompare(a.parsed, b.parsed));
|
|
332
|
+
if (sortedVersions.length === 0) {
|
|
333
|
+
return { version: versions[0] };
|
|
334
|
+
}
|
|
335
|
+
return { version: sortedVersions[0]?.original };
|
|
336
|
+
}
|
|
337
|
+
return { version: plugin.Version };
|
|
338
|
+
} catch {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Check if installed version satisfies the required minimum version.
|
|
344
|
+
*
|
|
345
|
+
* Permissive policy: Non-semver versions (e.g., "local.build.dev", "dev", "canary-abc123")
|
|
346
|
+
* always satisfy version requirements. This avoids forcing upgrades during local development
|
|
347
|
+
* when developers are using locally built plugins.
|
|
348
|
+
*
|
|
349
|
+
* For valid semver versions, uses the semver library for proper semantic version comparison.
|
|
350
|
+
*
|
|
351
|
+
* @param installed - The installed version string
|
|
352
|
+
* @param required - The required minimum version string
|
|
353
|
+
* @returns true if installed version satisfies requirement
|
|
354
|
+
*/
|
|
355
|
+
isVersionSatisfied(installed, required) {
|
|
356
|
+
const installedSemver = semver.coerce(installed);
|
|
357
|
+
const requiredSemver = semver.coerce(required);
|
|
358
|
+
if (!installedSemver) {
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
if (!requiredSemver) {
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
return semver.gte(installedSemver, requiredSemver);
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
function dependencyKey(dep) {
|
|
368
|
+
return `${dep.type}:${dep.name}`;
|
|
369
|
+
}
|
|
370
|
+
var _DependencyManager = class {
|
|
371
|
+
cwd;
|
|
372
|
+
stripeConfigDir;
|
|
373
|
+
quiet;
|
|
374
|
+
context;
|
|
375
|
+
npmHandler;
|
|
376
|
+
devNpmHandler;
|
|
377
|
+
stripeCliPluginHandler;
|
|
378
|
+
/** Internal state: pending changes indexed by dependency key */
|
|
379
|
+
pendingChanges = /* @__PURE__ */ new Map();
|
|
380
|
+
/** Whether commit() has been called */
|
|
381
|
+
committed = false;
|
|
382
|
+
constructor(options = {}) {
|
|
383
|
+
this.cwd = options.cwd ?? process.cwd();
|
|
384
|
+
this.stripeConfigDir = options.stripeConfigDir ?? path.join(os.homedir(), ".config", "stripe");
|
|
385
|
+
this.quiet = options.quiet ?? false;
|
|
386
|
+
this.context = options.context ?? _createCliContext();
|
|
387
|
+
this.npmHandler = new _NpmDependencyHandler({
|
|
388
|
+
cwd: this.cwd,
|
|
389
|
+
quiet: this.quiet,
|
|
390
|
+
devDependencies: false,
|
|
391
|
+
context: this.context
|
|
392
|
+
});
|
|
393
|
+
this.devNpmHandler = new _NpmDependencyHandler({
|
|
394
|
+
cwd: this.cwd,
|
|
395
|
+
quiet: this.quiet,
|
|
396
|
+
devDependencies: true,
|
|
397
|
+
context: this.context
|
|
398
|
+
});
|
|
399
|
+
this.stripeCliPluginHandler = new _StripeCliPluginHandler({
|
|
400
|
+
stripeConfigDir: this.stripeConfigDir,
|
|
401
|
+
quiet: this.quiet,
|
|
402
|
+
context: this.context
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Analyze dependencies and accumulate changes.
|
|
407
|
+
* Can be called multiple times before commit().
|
|
408
|
+
* Returns the changes for this specific call.
|
|
409
|
+
*/
|
|
410
|
+
async ensureDependencies(input) {
|
|
411
|
+
if (this.committed) {
|
|
412
|
+
throw new Error("DependencyManager has already been committed");
|
|
413
|
+
}
|
|
414
|
+
const { required, optional = [] } = input;
|
|
415
|
+
const changes = [];
|
|
416
|
+
for (const dep of [...required, ...optional]) {
|
|
417
|
+
const change = await this.analyzeDependency(dep);
|
|
418
|
+
changes.push(change);
|
|
419
|
+
this.pendingChanges.set(dependencyKey(dep), change);
|
|
420
|
+
}
|
|
421
|
+
return changes;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Resolve a conflict by marking it for force install.
|
|
425
|
+
* Throws if the dependency is not in conflict state.
|
|
426
|
+
*/
|
|
427
|
+
resolveConflict(dep) {
|
|
428
|
+
if (this.committed) {
|
|
429
|
+
throw new Error("DependencyManager has already been committed");
|
|
430
|
+
}
|
|
431
|
+
const key = dependencyKey(dep);
|
|
432
|
+
const change = this.pendingChanges.get(key);
|
|
433
|
+
if (!change) {
|
|
434
|
+
throw new Error(`Dependency '${dep.name}' not found in pending changes`);
|
|
435
|
+
}
|
|
436
|
+
if (change.action !== "conflict") {
|
|
437
|
+
throw new Error(
|
|
438
|
+
`Dependency '${dep.name}' is not in conflict (action: ${change.action})`
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
change.conflictResolved = true;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Get all pending changes (accumulated across all ensureDependencies calls).
|
|
445
|
+
*/
|
|
446
|
+
getPendingChanges() {
|
|
447
|
+
return Array.from(this.pendingChanges.values());
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Commit all accumulated changes.
|
|
451
|
+
* - For npm deps: updates package.json, optionally runs package manager install
|
|
452
|
+
* - For Stripe CLI deps: always installs (no separate add step)
|
|
453
|
+
*
|
|
454
|
+
* @param options - Commit options. `options.runInstall`: if true, run package manager install for npm deps (default: true)
|
|
455
|
+
* @returns Summary of changes made
|
|
456
|
+
* @throws If called more than once
|
|
457
|
+
*/
|
|
458
|
+
async commit(options = {}) {
|
|
459
|
+
if (this.committed) {
|
|
460
|
+
throw new Error("DependencyManager has already been committed");
|
|
461
|
+
}
|
|
462
|
+
this.committed = true;
|
|
463
|
+
const { runInstall = true } = options;
|
|
464
|
+
let added = 0;
|
|
465
|
+
let updated = 0;
|
|
466
|
+
const npmDeps = [];
|
|
467
|
+
const stripeCliDeps = [];
|
|
468
|
+
for (const change of this.pendingChanges.values()) {
|
|
469
|
+
if (change.action === "already-satisfied") {
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
if (change.action === "conflict" && !change.conflictResolved) {
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
const dep = change.dependency;
|
|
476
|
+
if (dep.type === "npm" || dep.type === "dev-npm") {
|
|
477
|
+
npmDeps.push(dep);
|
|
478
|
+
} else {
|
|
479
|
+
stripeCliDeps.push(dep);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
for (const dep of npmDeps) {
|
|
483
|
+
const handler = dep.type === "npm" ? this.npmHandler : this.devNpmHandler;
|
|
484
|
+
const result = await handler.add(dep);
|
|
485
|
+
if (result.action === "add") {
|
|
486
|
+
added++;
|
|
487
|
+
} else {
|
|
488
|
+
updated++;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (runInstall && npmDeps.length > 0) {
|
|
492
|
+
await this.npmHandler.install(npmDeps);
|
|
493
|
+
}
|
|
494
|
+
if (stripeCliDeps.length > 0) {
|
|
495
|
+
await this.stripeCliPluginHandler.install(stripeCliDeps);
|
|
496
|
+
for (const dep of stripeCliDeps) {
|
|
497
|
+
const change = this.pendingChanges.get(dependencyKey(dep));
|
|
498
|
+
if (change?.action === "add" || change?.action === "conflict" && !change.previousVersion) {
|
|
499
|
+
added++;
|
|
500
|
+
} else {
|
|
501
|
+
updated++;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return { added, updated };
|
|
506
|
+
}
|
|
507
|
+
async analyzeDependency(dep) {
|
|
508
|
+
const handler = this.getHandler(dep);
|
|
509
|
+
const checkResult = await handler.check(dep);
|
|
510
|
+
if (checkResult.satisfied) {
|
|
511
|
+
return {
|
|
512
|
+
dependency: dep,
|
|
513
|
+
action: "already-satisfied",
|
|
514
|
+
message: checkResult.message
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
const conflictResult = await handler.checkConflict(dep);
|
|
518
|
+
if (conflictResult.hasConflict) {
|
|
519
|
+
const result2 = {
|
|
520
|
+
dependency: dep,
|
|
521
|
+
action: "conflict",
|
|
522
|
+
message: conflictResult.message ?? "Dependency conflict detected",
|
|
523
|
+
conflict: conflictResult
|
|
524
|
+
};
|
|
525
|
+
if (conflictResult.existingVersion) {
|
|
526
|
+
result2.previousVersion = conflictResult.existingVersion;
|
|
527
|
+
}
|
|
528
|
+
return result2;
|
|
529
|
+
}
|
|
530
|
+
const isUpdate = checkResult.currentVersion !== void 0;
|
|
531
|
+
const result = {
|
|
532
|
+
dependency: dep,
|
|
533
|
+
action: isUpdate ? "update" : "add",
|
|
534
|
+
message: isUpdate ? `Will update ${dep.name} from ${String(checkResult.currentVersion)}` : `Will add ${dep.name}`
|
|
535
|
+
};
|
|
536
|
+
if (checkResult.currentVersion) {
|
|
537
|
+
result.previousVersion = checkResult.currentVersion;
|
|
538
|
+
}
|
|
539
|
+
return result;
|
|
540
|
+
}
|
|
541
|
+
getHandler(dep) {
|
|
542
|
+
switch (dep.type) {
|
|
543
|
+
case "npm":
|
|
544
|
+
return this.npmHandler;
|
|
545
|
+
case "dev-npm":
|
|
546
|
+
return this.devNpmHandler;
|
|
547
|
+
case "stripe-cli-plugin":
|
|
548
|
+
return this.stripeCliPluginHandler;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
export {
|
|
553
|
+
_DependencyManager,
|
|
554
|
+
_NpmDependencyHandler,
|
|
555
|
+
_StripeCliPluginHandler,
|
|
556
|
+
_detectPackageManager,
|
|
557
|
+
_devNpmDep,
|
|
558
|
+
_npmDep,
|
|
559
|
+
_stripeCliPluginDep
|
|
560
|
+
};
|