@makeco/stripe-kit 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +71 -176
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,139 +1,45 @@
1
1
  # stripe-kit
2
2
 
3
- [![npm version](https://badge.fury.io/js/%40makeco%2Fstripe-kit.svg)](https://badge.fury.io/js/%40makeco%2Fstripe-kit)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![GitHub issues](https://img.shields.io/github/issues/makeco/stripe-kit)](https://github.com/makeco/stripe-kit/issues)
6
- [![GitHub stars](https://img.shields.io/github/stars/makeco/stripe-kit)](https://github.com/makeco/stripe-kit/stargazers)
7
-
8
- An unofficial CLI tool for creating, archiving, updating Stripe products and prices and syncing them to your database.
9
-
10
- ## Installation
11
-
12
- ```bash
13
- npm install @makeco/stripe-kit
14
- ```
15
-
16
- ## CLI Usage
17
-
18
- ### Core Commands
19
-
20
- ```bash
21
- # Create subscription plans in Stripe
22
- stripe-kit create -e dev -a postgres
23
-
24
- # Archive subscription plans in Stripe
25
- stripe-kit archive -e prod -a postgres
26
-
27
- # Sync Stripe plans to database
28
- stripe-kit db sync -e staging -a postgres
29
-
30
- # Update existing Stripe plans
31
- stripe-kit update -e prod -a postgres
32
-
33
- # Database operations
34
- stripe-kit db purge -e dev -a postgres
35
- ```
36
-
37
- ### Utility Commands
38
-
39
- ```bash
40
- # Show Stripe dashboard URLs
41
- stripe-kit urls # Interactive selection (shows both live & test URLs)
42
- stripe-kit urls -a # Show all URLs with labels
43
-
44
- # List Stripe products
45
- stripe-kit list products -e dev --all
46
-
47
- # List Stripe prices
48
- stripe-kit list prices -e dev --all
49
-
50
- # View current user preferences
51
- stripe-kit config
52
- ```
53
-
54
- ### Global Options
55
-
56
- - `-c, --config <path>` - Path to stripe.config.ts file (defaults to ./stripe.config.ts)
57
- - `-e, --env <environment>` - Target environment (test, dev, staging, prod)
58
- - `-a, --adapter <name>` - Database adapter name
3
+ > **⚠️ Experimental:** This tool is currently in experimental status and may undergo breaking changes.
59
4
 
60
- ## User Preferences
5
+ A CLI tool for creating, archiving, updating Stripe products and prices and syncing them to your database.
61
6
 
62
- The CLI remembers your last used environment and adapter selections for faster workflow:
63
-
64
- ```bash
65
- # First time - you'll be prompted to select
66
- stripe-kit create
67
-
68
- # Subsequent runs - your last selection is pre-selected
69
- stripe-kit archive # Uses your last environment/adapter as initial choice
70
-
71
- # View current preferences
72
- stripe-kit config
73
- ```
7
+ [![npm version](https://badge.fury.io/js/%40makeco%2Fstripe-kit.svg)](https://badge.fury.io/js/%40makeco%2Fstripe-kit)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
74
10
 
75
- Preferences are stored in `~/.config/@makeco/stripe-kit/config.json`
11
+ **Key Features:**
76
12
 
77
- ## Subcommands
13
+ - 🛒 **Product Management** - Create, update, and archive Stripe products and prices
14
+ - 🗄️ **Database Sync** - Sync Stripe data to your database with adapters
15
+ - 🌱 **Multi-Environment** - Built-in support for test, dev, staging, prod
16
+ - 📝 **TypeScript** - Full type safety with configuration files
17
+ - 🔧 **User Preferences** - Remembers your last used environment and adapter
78
18
 
79
- ### Database Operations
19
+ **Quick Start:**
80
20
 
81
21
  ```bash
82
- # Show available database operations
83
- stripe-kit db
84
-
85
- # Purge database plans
86
- stripe-kit db purge -e dev -a postgres
87
-
88
- # Sync Stripe plans to database
89
- stripe-kit db sync -e dev -a postgres
22
+ npm install @makeco/stripe-kit
23
+ yarn add @makeco/stripe-kit
24
+ bun add @makeco/stripe-kit
90
25
  ```
91
26
 
92
- ### List Operations
93
-
94
27
  ```bash
95
- # Show available list operations
96
- stripe-kit list
97
-
98
- # List products
99
- stripe-kit list products -e dev --all
100
-
101
- # List prices
102
- stripe-kit list prices -e dev --all
103
- ```
104
-
105
- ## API Usage
106
-
107
- ```typescript
108
- import { defineConfig } from 'stripe-kit';
109
-
110
- // Use the configuration helper
111
- export default defineConfig({
112
- plans: [
113
- {
114
- product: {
115
- id: 'basic-plan',
116
- name: 'Basic Plan',
117
- description: 'Our basic subscription plan'
118
- },
119
- prices: [
120
- {
121
- id: 'basic-monthly',
122
- nickname: 'Basic Monthly',
123
- unitAmount: 999,
124
- currency: 'usd',
125
- recurring: { interval: 'month' }
126
- }
127
- ]
128
- }
129
- ],
130
- adapters: {
131
- postgres: {
132
- // Your database adapter configuration
133
- connectionString: process.env.DATABASE_URL
134
- }
135
- }
136
- });
28
+ # Commands
29
+ create # Create subscription plans in Stripe
30
+ archive # Archive subscription plans in Stripe
31
+ update # Update existing Stripe plans
32
+ db sync # Sync Stripe plans to database
33
+ db purge # Purge database plans
34
+ list products # List Stripe products
35
+ list prices # List Stripe prices
36
+ urls # Show Stripe dashboard URLs
37
+ config # View current user preferences
38
+
39
+ # Global Options
40
+ -c, --config <path> # Path to stripe.config.ts file (default: ./stripe.config.ts)
41
+ -e, --env <environment> # Target environment (test, dev, staging, prod)
42
+ -a, --adapter <name> # Database adapter name
137
43
  ```
138
44
 
139
45
  ## Configuration
@@ -141,61 +47,50 @@ export default defineConfig({
141
47
  Create a `stripe.config.ts` file in your project root:
142
48
 
143
49
  ```typescript
144
- import { defineConfig } from 'stripe-kit';
50
+ import { defineConfig } from "stripe-kit";
145
51
 
146
52
  export default defineConfig({
147
- plans: [
148
- {
149
- product: {
150
- id: 'pro-plan',
151
- name: 'Pro Plan',
152
- description: 'Professional features for growing teams'
153
- },
154
- prices: [
155
- {
156
- id: 'pro-monthly',
157
- nickname: 'Pro Monthly',
158
- unitAmount: 2999,
159
- currency: 'usd',
160
- recurring: { interval: 'month' }
161
- },
162
- {
163
- id: 'pro-yearly',
164
- nickname: 'Pro Yearly',
165
- unitAmount: 29999,
166
- currency: 'usd',
167
- recurring: { interval: 'year' }
168
- }
169
- ]
170
- }
171
- ],
172
- adapters: {
173
- postgres: {
174
- // Your PostgreSQL adapter configuration
175
- connectionString: process.env.DATABASE_URL
176
- }
177
- },
178
- // Optional: Custom mappers for your database schema
179
- mappers: {
180
- // Define how to map Stripe objects to your database schema
181
- }
53
+ plans: [
54
+ {
55
+ // Stripe.Product (camelCase)
56
+ product: {
57
+ id: "pro-plan",
58
+ name: "Pro Plan",
59
+ description: "Professional features for growing teams",
60
+ },
61
+ // Stripe.Price[] (camelCase)
62
+ prices: [
63
+ {
64
+ id: "pro-monthly",
65
+ nickname: "Pro Monthly",
66
+ unitAmount: 2999,
67
+ currency: "usd",
68
+ recurring: { interval: "month" },
69
+ },
70
+ {
71
+ id: "pro-yearly",
72
+ nickname: "Pro Yearly",
73
+ unitAmount: 29999,
74
+ currency: "usd",
75
+ recurring: { interval: "year" },
76
+ },
77
+ ],
78
+ },
79
+ ],
80
+ adapters: {
81
+ // Custom property key. Can be postgres, sqlite, turso, myAdapter, etc.
82
+ postgres: {
83
+ syncProducts: async (products) => { /* Sync Stripe products to your database */ },
84
+ syncPrices: async (prices) => { /* Sync Stripe prices to your database */ },
85
+ clearProducts: async () => { /* Remove all products from your database */ },
86
+ clearPrices: async () => { /* Remove all prices from your database */ },
87
+ getProducts: async () => { /* Optional: Return all products from your database */ },
88
+ getPrices: async () => { /* Optional: Return all prices from your database */ }
89
+ },
90
+ },
182
91
  });
183
92
  ```
184
93
 
185
- ## Environment Variables
186
-
187
- Create environment files for different stages:
188
-
189
- ```bash
190
- # .env.development
191
- STRIPE_SECRET_KEY=sk_test_...
192
- DATABASE_URL=postgresql://...
193
-
194
- # .env.production
195
- STRIPE_SECRET_KEY=sk_live_...
196
- DATABASE_URL=postgresql://...
197
- ```
198
-
199
- ## Database Support
94
+ ## License
200
95
 
201
- Supports PostgreSQL, MySQL, and SQLite via custom database adapters. The CLI automatically detects and uses your configured adapters.
96
+ MIT © [makeco](https://github.com/makeco-labs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makeco/stripe-kit",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "author": "makeco",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,7 +50,7 @@
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": "npx ultracite@latest lint",
53
+ "lint": "bunx ultracite@latest lint",
54
54
  "format": "bunx ultracite@latest format",
55
55
  "test": "vitest",
56
56
  "ci": "bun lint && bun typecheck && bun format && bun run build",