dodopayments-cli 2.0.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/.github/ISSUE_TEMPLATE/bug_report.yml +125 -0
- package/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +88 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +69 -0
- package/.github/workflows/publish.yml +63 -0
- package/CODE_OF_CONDUCT.md +133 -0
- package/CONTRIBUTING.md +200 -0
- package/LICENSE +21 -0
- package/README.md +185 -0
- package/SECURITY.md +98 -0
- package/build-binaries.ts +22 -0
- package/dist/index.js +28 -0
- package/dodo-webhooks/functions/generate-dispute-data.ts +123 -0
- package/dodo-webhooks/functions/generate-licence-data.ts +39 -0
- package/dodo-webhooks/functions/generate-payment-data.ts +101 -0
- package/dodo-webhooks/functions/generate-refund-data.ts +44 -0
- package/dodo-webhooks/functions/generate-subscription-data.ts +153 -0
- package/dodo-webhooks/functions/supported-events.ts +24 -0
- package/dodo-webhooks/index.ts +207 -0
- package/dodo-webhooks/types/baseArgs.ts +9 -0
- package/index.ts +438 -0
- package/package.json +41 -0
- package/tsconfig.json +29 -0
- package/utils/currency-to-symbol-map.ts +8 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a bug or unexpected behavior
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: ["bug", "triage"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for taking the time to report a bug! Please fill out the form below to help us understand and fix the issue.
|
|
10
|
+
|
|
11
|
+
- type: checkboxes
|
|
12
|
+
id: existing-issue
|
|
13
|
+
attributes:
|
|
14
|
+
label: Is there an existing issue for this?
|
|
15
|
+
description: Please search to see if an issue already exists for the bug you encountered.
|
|
16
|
+
options:
|
|
17
|
+
- label: I have searched the existing issues
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
- type: dropdown
|
|
21
|
+
id: command
|
|
22
|
+
attributes:
|
|
23
|
+
label: CLI Command
|
|
24
|
+
description: Which command is affected?
|
|
25
|
+
options:
|
|
26
|
+
- dodo login
|
|
27
|
+
- dodo products
|
|
28
|
+
- dodo payments
|
|
29
|
+
- dodo customers
|
|
30
|
+
- dodo discounts
|
|
31
|
+
- dodo licences
|
|
32
|
+
- dodo wh (webhooks)
|
|
33
|
+
- Other
|
|
34
|
+
validations:
|
|
35
|
+
required: true
|
|
36
|
+
|
|
37
|
+
- type: textarea
|
|
38
|
+
id: description
|
|
39
|
+
attributes:
|
|
40
|
+
label: Bug Description
|
|
41
|
+
description: A clear and concise description of what the bug is.
|
|
42
|
+
placeholder: Describe the bug...
|
|
43
|
+
validations:
|
|
44
|
+
required: true
|
|
45
|
+
|
|
46
|
+
- type: textarea
|
|
47
|
+
id: steps
|
|
48
|
+
attributes:
|
|
49
|
+
label: Steps to Reproduce
|
|
50
|
+
description: Steps to reproduce the behavior
|
|
51
|
+
placeholder: |
|
|
52
|
+
1. Run 'dodo ...'
|
|
53
|
+
2. Select '...'
|
|
54
|
+
3. See error
|
|
55
|
+
validations:
|
|
56
|
+
required: true
|
|
57
|
+
|
|
58
|
+
- type: textarea
|
|
59
|
+
id: expected
|
|
60
|
+
attributes:
|
|
61
|
+
label: Expected Behavior
|
|
62
|
+
description: A clear and concise description of what you expected to happen.
|
|
63
|
+
validations:
|
|
64
|
+
required: true
|
|
65
|
+
|
|
66
|
+
- type: textarea
|
|
67
|
+
id: actual
|
|
68
|
+
attributes:
|
|
69
|
+
label: Actual Behavior
|
|
70
|
+
description: What actually happened?
|
|
71
|
+
validations:
|
|
72
|
+
required: true
|
|
73
|
+
|
|
74
|
+
- type: textarea
|
|
75
|
+
id: logs
|
|
76
|
+
attributes:
|
|
77
|
+
label: Error Logs
|
|
78
|
+
description: Please copy and paste any relevant error messages or logs. This will be automatically formatted into code.
|
|
79
|
+
render: shell
|
|
80
|
+
|
|
81
|
+
- type: input
|
|
82
|
+
id: version
|
|
83
|
+
attributes:
|
|
84
|
+
label: CLI Version
|
|
85
|
+
description: What version of the CLI are you running? (Check package.json or npm list -g dodopayments-cli)
|
|
86
|
+
placeholder: e.g., 0.1.0
|
|
87
|
+
validations:
|
|
88
|
+
required: true
|
|
89
|
+
|
|
90
|
+
- type: input
|
|
91
|
+
id: runtime
|
|
92
|
+
attributes:
|
|
93
|
+
label: Runtime & Version
|
|
94
|
+
description: Are you using Bun or Node? What version? (Run `bun --version` or `node --version`)
|
|
95
|
+
placeholder: e.g., Bun 1.1.0 or Node 20.10.0
|
|
96
|
+
validations:
|
|
97
|
+
required: true
|
|
98
|
+
|
|
99
|
+
- type: dropdown
|
|
100
|
+
id: os
|
|
101
|
+
attributes:
|
|
102
|
+
label: Operating System
|
|
103
|
+
options:
|
|
104
|
+
- macOS
|
|
105
|
+
- Windows
|
|
106
|
+
- Linux
|
|
107
|
+
- Other
|
|
108
|
+
validations:
|
|
109
|
+
required: true
|
|
110
|
+
|
|
111
|
+
- type: dropdown
|
|
112
|
+
id: mode
|
|
113
|
+
attributes:
|
|
114
|
+
label: Environment Mode
|
|
115
|
+
description: Were you using test mode or live mode?
|
|
116
|
+
options:
|
|
117
|
+
- Test Mode
|
|
118
|
+
- Live Mode
|
|
119
|
+
- Not applicable
|
|
120
|
+
|
|
121
|
+
- type: textarea
|
|
122
|
+
id: additional
|
|
123
|
+
attributes:
|
|
124
|
+
label: Additional Context
|
|
125
|
+
description: Add any other context about the problem here.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Discord Community
|
|
4
|
+
url: https://discord.gg/bYqAp4ayYh
|
|
5
|
+
about: Join our Discord for questions, help, and community discussions
|
|
6
|
+
- name: Dodo Payments Documentation
|
|
7
|
+
url: https://docs.dodopayments.com
|
|
8
|
+
about: Check out our documentation for guides and API reference
|
|
9
|
+
- name: Security Vulnerability
|
|
10
|
+
url: https://github.com/dodopayments/dodopayments-cli/security/advisories/new
|
|
11
|
+
about: Report a security vulnerability privately
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest a new feature or enhancement
|
|
3
|
+
title: "[Feature]: "
|
|
4
|
+
labels: ["enhancement"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for suggesting a feature! Please fill out the form below to help us understand your request.
|
|
10
|
+
|
|
11
|
+
- type: checkboxes
|
|
12
|
+
id: existing-issue
|
|
13
|
+
attributes:
|
|
14
|
+
label: Is there an existing issue for this?
|
|
15
|
+
description: Please search to see if a feature request already exists.
|
|
16
|
+
options:
|
|
17
|
+
- label: I have searched the existing issues
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
- type: dropdown
|
|
21
|
+
id: feature-type
|
|
22
|
+
attributes:
|
|
23
|
+
label: Feature Type
|
|
24
|
+
description: What type of feature is this?
|
|
25
|
+
options:
|
|
26
|
+
- New CLI command
|
|
27
|
+
- Enhancement to existing command
|
|
28
|
+
- New webhook event support
|
|
29
|
+
- Output/formatting improvement
|
|
30
|
+
- Documentation
|
|
31
|
+
- Performance improvement
|
|
32
|
+
- Other
|
|
33
|
+
validations:
|
|
34
|
+
required: true
|
|
35
|
+
|
|
36
|
+
- type: textarea
|
|
37
|
+
id: problem
|
|
38
|
+
attributes:
|
|
39
|
+
label: Problem Statement
|
|
40
|
+
description: Is your feature request related to a problem? Please describe.
|
|
41
|
+
placeholder: A clear description of what the problem is. Ex. I'm always frustrated when...
|
|
42
|
+
validations:
|
|
43
|
+
required: true
|
|
44
|
+
|
|
45
|
+
- type: textarea
|
|
46
|
+
id: solution
|
|
47
|
+
attributes:
|
|
48
|
+
label: Proposed Solution
|
|
49
|
+
description: Describe the solution you'd like
|
|
50
|
+
placeholder: A clear description of what you want to happen.
|
|
51
|
+
validations:
|
|
52
|
+
required: true
|
|
53
|
+
|
|
54
|
+
- type: textarea
|
|
55
|
+
id: alternatives
|
|
56
|
+
attributes:
|
|
57
|
+
label: Alternatives Considered
|
|
58
|
+
description: Describe any alternative solutions or features you've considered.
|
|
59
|
+
|
|
60
|
+
- type: dropdown
|
|
61
|
+
id: command
|
|
62
|
+
attributes:
|
|
63
|
+
label: Related Command (if applicable)
|
|
64
|
+
description: Is this feature related to a specific command?
|
|
65
|
+
options:
|
|
66
|
+
- Not command-specific
|
|
67
|
+
- dodo login
|
|
68
|
+
- dodo products
|
|
69
|
+
- dodo payments
|
|
70
|
+
- dodo customers
|
|
71
|
+
- dodo discounts
|
|
72
|
+
- dodo licences
|
|
73
|
+
- dodo wh (webhooks)
|
|
74
|
+
- New command
|
|
75
|
+
|
|
76
|
+
- type: textarea
|
|
77
|
+
id: additional
|
|
78
|
+
attributes:
|
|
79
|
+
label: Additional Context
|
|
80
|
+
description: Add any other context, screenshots, or examples about the feature request here.
|
|
81
|
+
|
|
82
|
+
- type: checkboxes
|
|
83
|
+
id: contribution
|
|
84
|
+
attributes:
|
|
85
|
+
label: Contribution
|
|
86
|
+
description: Would you be willing to contribute this feature?
|
|
87
|
+
options:
|
|
88
|
+
- label: I would be willing to submit a PR for this feature
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
<!-- Provide a brief description of the changes in this PR -->
|
|
4
|
+
|
|
5
|
+
## Related Issue
|
|
6
|
+
|
|
7
|
+
<!-- Link to the issue this PR addresses (if applicable) -->
|
|
8
|
+
<!-- Use "Fixes #123" or "Closes #123" to automatically close the issue when merged -->
|
|
9
|
+
|
|
10
|
+
Fixes #
|
|
11
|
+
|
|
12
|
+
## Type of Change
|
|
13
|
+
|
|
14
|
+
<!-- Mark the appropriate option with an "x" -->
|
|
15
|
+
|
|
16
|
+
- [ ] Bug fix (non-breaking change that fixes an issue)
|
|
17
|
+
- [ ] New feature (non-breaking change that adds functionality)
|
|
18
|
+
- [ ] New CLI command
|
|
19
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
20
|
+
- [ ] Documentation update
|
|
21
|
+
- [ ] Refactoring (no functional changes)
|
|
22
|
+
|
|
23
|
+
## Changes Made
|
|
24
|
+
|
|
25
|
+
<!-- Describe the changes in detail -->
|
|
26
|
+
|
|
27
|
+
-
|
|
28
|
+
-
|
|
29
|
+
-
|
|
30
|
+
|
|
31
|
+
## Testing
|
|
32
|
+
|
|
33
|
+
<!-- Describe how you tested your changes -->
|
|
34
|
+
|
|
35
|
+
### Test Environment
|
|
36
|
+
|
|
37
|
+
- Runtime (Bun/Node) version:
|
|
38
|
+
- OS:
|
|
39
|
+
|
|
40
|
+
### Test Cases
|
|
41
|
+
|
|
42
|
+
<!-- List the test cases you've verified -->
|
|
43
|
+
|
|
44
|
+
- [ ] Tested in test mode
|
|
45
|
+
- [ ] Tested in live mode (if applicable)
|
|
46
|
+
- [ ] Tested on macOS
|
|
47
|
+
- [ ] Tested on Windows
|
|
48
|
+
- [ ] Tested on Linux
|
|
49
|
+
- [ ] Other: <!-- specify -->
|
|
50
|
+
|
|
51
|
+
## Checklist
|
|
52
|
+
|
|
53
|
+
<!-- Mark completed items with an "x" -->
|
|
54
|
+
|
|
55
|
+
- [ ] My code follows the project's coding guidelines
|
|
56
|
+
- [ ] I have performed a self-review of my code
|
|
57
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
58
|
+
- [ ] I have made corresponding changes to the documentation (README.md)
|
|
59
|
+
- [ ] My changes generate no new warnings
|
|
60
|
+
- [ ] I have tested my changes locally with `bun run index.ts`
|
|
61
|
+
- [ ] The build passes with `bun run build`
|
|
62
|
+
|
|
63
|
+
## Screenshots (if applicable)
|
|
64
|
+
|
|
65
|
+
<!-- Add screenshots or terminal output to help explain your changes -->
|
|
66
|
+
|
|
67
|
+
## Additional Notes
|
|
68
|
+
|
|
69
|
+
<!-- Add any additional context or notes for reviewers -->
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Publish to npm on tag
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup Node.js
|
|
19
|
+
uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: 20
|
|
22
|
+
registry-url: 'https://registry.npmjs.org'
|
|
23
|
+
|
|
24
|
+
- name: Setup Bun
|
|
25
|
+
uses: oven-sh/setup-bun@v2
|
|
26
|
+
with:
|
|
27
|
+
bun-version: 'latest'
|
|
28
|
+
|
|
29
|
+
- name: Update package.json version from release tag
|
|
30
|
+
env:
|
|
31
|
+
TAG_NAME: ${{ github.ref_name }}
|
|
32
|
+
run: |
|
|
33
|
+
echo "TAG_NAME=${TAG_NAME}"
|
|
34
|
+
TAG_STRIPPED="${TAG_NAME#v}"
|
|
35
|
+
echo "Updating package.json version to: ${TAG_STRIPPED}"
|
|
36
|
+
|
|
37
|
+
# Update package.json version using node
|
|
38
|
+
node -e "
|
|
39
|
+
const fs = require('fs');
|
|
40
|
+
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
|
41
|
+
pkg.version = '${TAG_STRIPPED}';
|
|
42
|
+
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n');
|
|
43
|
+
console.log('Updated package.json version to:', pkg.version);
|
|
44
|
+
"
|
|
45
|
+
|
|
46
|
+
# Verify the update
|
|
47
|
+
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
48
|
+
echo "package.json version after update: ${PKG_VERSION}"
|
|
49
|
+
if [ "${TAG_STRIPPED}" != "${PKG_VERSION}" ]; then
|
|
50
|
+
echo "::error::Failed to update package.json version"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
- name: Install dependencies
|
|
55
|
+
run: bun install
|
|
56
|
+
|
|
57
|
+
- name: Build
|
|
58
|
+
run: bun run build
|
|
59
|
+
|
|
60
|
+
- name: Publish to npm
|
|
61
|
+
env:
|
|
62
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
63
|
+
run: npm publish --provenance --access public
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official email address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
**[support@dodopayments.com](mailto:support@dodopayments.com)**.
|
|
64
|
+
|
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
66
|
+
|
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
68
|
+
reporter of any incident.
|
|
69
|
+
|
|
70
|
+
## Enforcement Guidelines
|
|
71
|
+
|
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
74
|
+
|
|
75
|
+
### 1. Correction
|
|
76
|
+
|
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
78
|
+
unprofessional or unwelcome in the community.
|
|
79
|
+
|
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
|
83
|
+
|
|
84
|
+
### 2. Warning
|
|
85
|
+
|
|
86
|
+
**Community Impact**: A violation through a single incident or series of
|
|
87
|
+
actions.
|
|
88
|
+
|
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
93
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
94
|
+
ban.
|
|
95
|
+
|
|
96
|
+
### 3. Temporary Ban
|
|
97
|
+
|
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
|
99
|
+
sustained inappropriate behavior.
|
|
100
|
+
|
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
102
|
+
communication with the community for a specified period of time. No public or
|
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
105
|
+
Violating these terms may lead to a permanent ban.
|
|
106
|
+
|
|
107
|
+
### 4. Permanent Ban
|
|
108
|
+
|
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
112
|
+
|
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
114
|
+
community.
|
|
115
|
+
|
|
116
|
+
## Attribution
|
|
117
|
+
|
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
119
|
+
version 2.1, available at
|
|
120
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
121
|
+
|
|
122
|
+
Community Impact Guidelines were inspired by
|
|
123
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
124
|
+
|
|
125
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
126
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
127
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
128
|
+
|
|
129
|
+
[homepage]: https://www.contributor-covenant.org
|
|
130
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
131
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
132
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
133
|
+
[translations]: https://www.contributor-covenant.org/translations
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Contributing to Dodo Payments CLI
|
|
2
|
+
|
|
3
|
+
First off, thank you for considering contributing to the Dodo Payments CLI! It's people like you that make this tool great for everyone.
|
|
4
|
+
|
|
5
|
+
We welcome contributions of all kinds - bug reports, feature requests, documentation improvements, and code contributions.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Code of Conduct](#code-of-conduct)
|
|
10
|
+
- [Getting Started](#getting-started)
|
|
11
|
+
- [Development Setup](#development-setup)
|
|
12
|
+
- [Project Structure](#project-structure)
|
|
13
|
+
- [How to Contribute](#how-to-contribute)
|
|
14
|
+
- [Coding Guidelines](#coding-guidelines)
|
|
15
|
+
- [Pull Request Process](#pull-request-process)
|
|
16
|
+
- [Adding New Commands](#adding-new-commands)
|
|
17
|
+
- [Community](#community)
|
|
18
|
+
|
|
19
|
+
## Code of Conduct
|
|
20
|
+
|
|
21
|
+
This project and everyone participating in it is governed by our [Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [support@dodopayments.com](mailto:support@dodopayments.com).
|
|
22
|
+
|
|
23
|
+
## Getting Started
|
|
24
|
+
|
|
25
|
+
### Prerequisites
|
|
26
|
+
|
|
27
|
+
- [Bun](https://bun.sh/) >= 1.0 (recommended) or Node.js >= 18
|
|
28
|
+
- A Dodo Payments account (for testing)
|
|
29
|
+
|
|
30
|
+
### Development Setup
|
|
31
|
+
|
|
32
|
+
1. **Fork the repository** on GitHub
|
|
33
|
+
|
|
34
|
+
2. **Clone your fork** locally:
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/YOUR_USERNAME/dodopayments-cli.git
|
|
37
|
+
cd dodopayments-cli
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
3. **Install dependencies**:
|
|
41
|
+
```bash
|
|
42
|
+
bun install
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
4. **Create a branch** for your changes:
|
|
46
|
+
```bash
|
|
47
|
+
git checkout -b feature/your-feature-name
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
5. **Run the CLI locally**:
|
|
51
|
+
```bash
|
|
52
|
+
bun run index.ts <command>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
6. **Build the project**:
|
|
56
|
+
```bash
|
|
57
|
+
bun run build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Project Structure
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
dodopayments-cli/
|
|
64
|
+
├── index.ts # Main CLI entrypoint
|
|
65
|
+
├── utils/ # Utility functions
|
|
66
|
+
├── dodo-webhooks/ # Webhook testing functionality
|
|
67
|
+
├── .github/
|
|
68
|
+
│ ├── ISSUE_TEMPLATE/ # Issue templates
|
|
69
|
+
│ ├── PULL_REQUEST_TEMPLATE.md
|
|
70
|
+
│ └── workflows/ # CI/CD workflows
|
|
71
|
+
├── CONTRIBUTING.md # This file
|
|
72
|
+
├── CODE_OF_CONDUCT.md
|
|
73
|
+
├── LICENSE
|
|
74
|
+
└── README.md
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## How to Contribute
|
|
78
|
+
|
|
79
|
+
### Reporting Bugs
|
|
80
|
+
|
|
81
|
+
Before creating a bug report, please check existing issues to avoid duplicates. When creating a bug report, include:
|
|
82
|
+
|
|
83
|
+
- A clear, descriptive title
|
|
84
|
+
- Steps to reproduce the issue
|
|
85
|
+
- Expected behavior vs actual behavior
|
|
86
|
+
- Your environment (OS, Bun/Node version, CLI version)
|
|
87
|
+
- Any relevant error messages or logs
|
|
88
|
+
|
|
89
|
+
### Suggesting Features
|
|
90
|
+
|
|
91
|
+
Feature requests are welcome! Please include:
|
|
92
|
+
|
|
93
|
+
- A clear description of the feature
|
|
94
|
+
- The problem it solves or use case it addresses
|
|
95
|
+
- Any alternative solutions you've considered
|
|
96
|
+
|
|
97
|
+
### Contributing Code
|
|
98
|
+
|
|
99
|
+
1. Check the [issues](https://github.com/dodopayments/dodopayments-cli/issues) for open tasks
|
|
100
|
+
2. Comment on an issue to let others know you're working on it
|
|
101
|
+
3. Follow the [coding guidelines](#coding-guidelines)
|
|
102
|
+
4. Submit a [pull request](#pull-request-process)
|
|
103
|
+
|
|
104
|
+
## Coding Guidelines
|
|
105
|
+
|
|
106
|
+
### General Principles
|
|
107
|
+
|
|
108
|
+
- **Use TypeScript**: All code should be written in TypeScript
|
|
109
|
+
- **Use Bun APIs**: Prefer Bun's built-in APIs when available
|
|
110
|
+
- **Keep it simple**: Write clear, readable code
|
|
111
|
+
- **Add comments**: Document complex logic and non-obvious decisions
|
|
112
|
+
|
|
113
|
+
### Code Style
|
|
114
|
+
|
|
115
|
+
- Use 2 spaces for indentation
|
|
116
|
+
- Use single quotes for strings
|
|
117
|
+
- Add semicolons at end of statements
|
|
118
|
+
- Use `const` by default, `let` when reassignment is needed
|
|
119
|
+
|
|
120
|
+
### CLI Design Principles
|
|
121
|
+
|
|
122
|
+
- **Interactive by default**: Use prompts for required inputs when not provided as arguments
|
|
123
|
+
- **Helpful error messages**: Provide clear, actionable error messages
|
|
124
|
+
- **Consistent output**: Use consistent formatting across all commands
|
|
125
|
+
|
|
126
|
+
## Pull Request Process
|
|
127
|
+
|
|
128
|
+
1. **Update documentation** if you're adding or changing functionality
|
|
129
|
+
|
|
130
|
+
2. **Follow the PR template** - Fill out all sections completely
|
|
131
|
+
|
|
132
|
+
3. **Link related issues** - Reference any issues your PR addresses
|
|
133
|
+
|
|
134
|
+
4. **Keep PRs focused** - One feature or fix per PR
|
|
135
|
+
|
|
136
|
+
5. **Write clear commit messages** - Describe what and why
|
|
137
|
+
|
|
138
|
+
6. **Ensure the build passes** - Run `bun run build` before submitting
|
|
139
|
+
|
|
140
|
+
7. **Request review** - Tag maintainers for review
|
|
141
|
+
|
|
142
|
+
## Adding New Commands
|
|
143
|
+
|
|
144
|
+
To add a new command to the CLI:
|
|
145
|
+
|
|
146
|
+
1. **Add the command handler** in `index.ts`:
|
|
147
|
+
```typescript
|
|
148
|
+
case 'your-command':
|
|
149
|
+
await handleYourCommand();
|
|
150
|
+
break;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
2. **Implement the handler function**:
|
|
154
|
+
- Use `inquirer` for interactive prompts
|
|
155
|
+
- Use the `dodopayments` SDK for API calls
|
|
156
|
+
- Handle errors gracefully with helpful messages
|
|
157
|
+
|
|
158
|
+
3. **Update the README** with documentation for the new command
|
|
159
|
+
|
|
160
|
+
4. **Test thoroughly** in both test and live modes
|
|
161
|
+
|
|
162
|
+
### Example Command Structure
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
async function handleYourCommand() {
|
|
166
|
+
// 1. Parse any arguments
|
|
167
|
+
const args = process.argv.slice(3);
|
|
168
|
+
|
|
169
|
+
// 2. Prompt for missing inputs
|
|
170
|
+
const answers = await inquirer.prompt([
|
|
171
|
+
{
|
|
172
|
+
type: 'input',
|
|
173
|
+
name: 'someInput',
|
|
174
|
+
message: 'Enter value:',
|
|
175
|
+
}
|
|
176
|
+
]);
|
|
177
|
+
|
|
178
|
+
// 3. Make API call
|
|
179
|
+
const result = await dodo.someResource.someMethod({
|
|
180
|
+
// ...
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// 4. Display results
|
|
184
|
+
console.log(result);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Community
|
|
189
|
+
|
|
190
|
+
- **Discord**: [Join our community](https://discord.gg/bYqAp4ayYh) for help and discussion
|
|
191
|
+
- **GitHub Issues**: For bug reports and feature requests
|
|
192
|
+
- **Twitter**: Follow [@dodopayments](https://twitter.com/dodopayments) for updates
|
|
193
|
+
|
|
194
|
+
## Recognition
|
|
195
|
+
|
|
196
|
+
We appreciate all contributors! Your contributions help make the Dodo Payments CLI better for everyone.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
Thank you for contributing to Dodo Payments CLI!
|