Skip to content

Commit 7e34665

Browse files
authored
move internal dependency to devDependencies (#102)
1 parent 9d912f6 commit 7e34665

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

.changeset/forty-dolphins-whisper.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@caravan/wallets": patch
3+
"@caravan/psbt": patch
4+
---
5+
6+
move internal deps to devDependencies

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ anything else that relies on it should be tested to make sure they're not broken
149149
If you want to break this coupling, a published package version can be referenced instead of
150150
using `*` (this is not recommended however).
151151

152+
#### Note about internal packages
153+
154+
Sometimes it makes sense to move code you want to share between packages into an internal package.
155+
In fact this is [recommended by Turborepo](https://turbo.build/repo/docs/crafting-your-repository/creating-an-internal-package#best-practices-for-internal-packages).
156+
157+
> When you're creating Internal Packages, it's recommended to create packages that have a single "purpose".
158+
159+
Internal packages should be added to the `devDependencies` list of the packages/apps that depend on them.
160+
This is because the bundlers (tsup by default in caravan) won't include `dependencies` into the bundle
161+
and then when the package is attempted to be installed by external downstream projects it will try
162+
and find the internal dependency in a remote registry (which will fail). By including it in the
163+
devDependency:
164+
165+
* the dependency graph will be correct
166+
* the bundler will build it in with the final package
167+
* other projects won't try and install the internal dependency
168+
169+
@caravan/multisig is an example of such a package that is depended on by other packages
170+
like @caravan/psbt and @caravan/wallets.
171+
152172
### Adding a new package
153173
NOTE: Turborepo provides [code generator capability](https://turbo.build/repo/docs/core-concepts/monorepos/code-generation)
154174
for bootstrapping a new project. You can run `turbo gen` or `npm run gen`

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/caravan-psbt/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
],
4141
"dependencies": {
4242
"@caravan/bitcoin": "*",
43-
"@caravan/multisig": "*",
4443
"bignumber.js": "^8.1.1",
4544
"bip174": "^2.1.1",
4645
"bitcoinjs-lib-v6": "npm:bitcoinjs-lib@^6.1.5",
@@ -52,6 +51,7 @@
5251
"author": "unchained capital",
5352
"license": "ISC",
5453
"devDependencies": {
54+
"@caravan/multisig": "*",
5555
"@caravan/eslint-config": "*",
5656
"@caravan/typescript-config": "*",
5757
"@inrupt/jest-jsdom-polyfills": "^3.2.1",

packages/caravan-wallets/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"@babel/preset-env": "^7.7.1",
4343
"@babel/preset-typescript": "^7.18.6",
4444
"@caravan/eslint-config": "*",
45+
"@caravan/multisig": "*",
4546
"@caravan/typescript-config": "*",
4647
"@inrupt/jest-jsdom-polyfills": "^3.2.1",
4748
"@types/jest": "^29.5.12",
@@ -81,7 +82,6 @@
8182
"@babel/polyfill": "^7.7.0",
8283
"@babel/runtime": "^7.23.9",
8384
"@caravan/bitcoin": "*",
84-
"@caravan/multisig": "*",
8585
"@caravan/psbt": "*",
8686
"@ledgerhq/hw-app-btc": "^5.34.1",
8787
"@ledgerhq/hw-transport-u2f": "^5.34.0",

turbo.json

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
]
2727
},
2828
"dev": {
29-
"dependsOn": [
30-
"^dev"
31-
],
3229
"cache": false,
3330
"persistent": true
3431
},

0 commit comments

Comments
 (0)