Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build scripts to generate source maps #2202

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/snippets/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Setup

1. From the stripe-node root folder, run `yarn build` to build the modules.
1. From the stripe-node root folder, run `yarn build` or `yarn build-dev` to build the modules. `yarn build-dev` produces source maps for each of the SDK .ts files. This is optional but very useful when troubleshooting SDK behavior.
2. Then, from this snippets folder, run `yarn` to install node dependencies for the example snippets. This will reference the local Stripe SDK modules created in step 1.

If on step 2 you see an error `Error: unsure how to copy this: /Users/jar/stripe/sdks/node/.git/fsmonitor--daemon.ipc`:
run `rm /path/to/node/sdk/.git/fsmonitor--daemon.ipc && yarn`
This file is used by a file monitor built into git. Removing it temporarily does not seem to affect its operation, and this one liner will let `yarn` succeed.

Note that if you modify the stripe-node code, you must delete your snippets `node_modules` folder and rerun these steps.
Note that if you modify the stripe-node code, rerun step 1 and then run `yarn upgrade stripe` from this folder to pull in the new built package.

## Running an example

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "ISC",
"dependencies": {
"express": "^4.21.0",
"stripe": "file:../../",
"stripe": "file:../..",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
}
Expand Down
8 changes: 4 additions & 4 deletions examples/snippets/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==

"@types/node@>=8.1.0":
version "22.6.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.6.1.tgz#e531a45f4d78f14a8468cb9cdc29dc9602afc7ac"
integrity sha512-V48tCfcKb/e6cVUigLAaJDAILdMP0fUW6BidkPK4GpGjXcfbnoHasCZDwz3N3yVt5we2RHm4XTQCpv0KJz9zqw==
version "22.7.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.4.tgz#e35d6f48dca3255ce44256ddc05dee1c23353fcc"
integrity sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==
dependencies:
undici-types "~6.19.2"

Expand Down Expand Up @@ -524,7 +524,7 @@ statuses@2.0.1:
integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==

"stripe@file:../..":
version "16.12.0"
version "17.0.0"
dependencies:
"@types/node" ">=8.1.0"
qs "^6.11.0"
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@
"license": "MIT",
"scripts": {
"build": "yarn build-esm && yarn build-cjs",
"build-dev": "yarn build-esm-dev && yarn build-cjs-dev",
"build-esm": "mkdir -p esm && tsc -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > esm/package.json",
"build-esm-dev": "mkdir -p esm && tsc -p tsconfig.esm.json --sourceMap true && echo '{\"type\":\"module\"}' > esm/package.json",
"build-cjs": "mkdir -p cjs && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > cjs/package.json",
"build-cjs-dev": "mkdir -p cjs && tsc -p tsconfig.cjs.json --sourceMap true && echo '{\"type\":\"commonjs\"}' > cjs/package.json",
"clean": "rm -rf ./.nyc_output ./node_modules/.cache ./coverage ./esm ./cjs",
"prepack": "yarn install && yarn build",
"mocha": "nyc mocha",
Expand Down
Loading