Skip to content

Commit fb2ba56

Browse files
authored
chore: share build scripts between packages (#1169)
* chore: update Turborepo to 1.7.4 * chore: reorganize build scripts to be able to share them between packages
1 parent c5ac1ef commit fb2ba56

File tree

7 files changed

+160
-8
lines changed

7 files changed

+160
-8
lines changed

packages/build-scripts/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `build-scripts`
2+
3+
This is the base build script shared across all packages in this monorepo.
File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "build-scripts",
3+
"version": "0.0.0",
4+
"private": true,
5+
"files": [
6+
"env-shim.ts",
7+
"tsup.config.ts"
8+
],
9+
"devDependencies": {
10+
"@types/node": "^18.11.10",
11+
"tsconfig": "workspace:*",
12+
"tsup": "6.5.0"
13+
}
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"compilerOptions": {
4+
"types": ["node"]
5+
},
6+
"display": "Build Scripts",
7+
"extends": "tsconfig/base.json"
8+
}

packages/library/tsup.config.ts renamed to packages/build-scripts/tsup.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'path';
12
import { defineConfig, Format, Options } from 'tsup';
23

34
type Platform =
@@ -15,15 +16,16 @@ function getBaseConfig(platform: Platform, format: Format[], options: Options):
1516
__REACTNATIVE__: `${platform === 'native'}`,
1617
},
1718
entry: [`./src/index.ts`],
18-
esbuildOptions(options, { format }) {
19+
esbuildOptions(options, fuck) {
20+
const { format } = fuck;
1921
options.minify = format === 'iife' && !isDebugBuild;
2022
if (format === 'iife') {
2123
options.define = {
2224
...options.define,
2325
__DEV__: `${isDebugBuild}`,
2426
};
2527
}
26-
options.inject = ['./src/env-shim.ts'];
28+
options.inject = [path.resolve(__dirname, 'env-shim.ts')];
2729
},
2830
format,
2931
globalName: 'solanaWeb3',

packages/library/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"web3"
3737
],
3838
"scripts": {
39-
"compile:js": "tsup",
39+
"compile:js": "tsup --config build-scripts/tsup.config.ts",
4040
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
4141
"dev": "jest -c ./internal/jest/jest-dev.config.ts --watch",
4242
"test:lint": "jest -c ./internal/jest/jest-lint.config.ts --silent",
@@ -69,6 +69,7 @@
6969
"@typescript-eslint/eslint-plugin": "^5.43.0",
7070
"@typescript-eslint/parser": "^5.43.0",
7171
"agadoo": "^2.0.0",
72+
"build-scripts": "workspace:*",
7273
"eslint": "^8.27.0",
7374
"eslint-plugin-jest": "^27.1.5",
7475
"eslint-plugin-react-hooks": "^4.6.0",

pnpm-lock.yaml

Lines changed: 129 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)