diff --git a/packages/build-scripts/README.md b/packages/build-scripts/README.md new file mode 100644 index 000000000000..f6321548c697 --- /dev/null +++ b/packages/build-scripts/README.md @@ -0,0 +1,3 @@ +# `build-scripts` + +This is the base build script shared across all packages in this monorepo. diff --git a/packages/library/src/env-shim.ts b/packages/build-scripts/env-shim.ts similarity index 100% rename from packages/library/src/env-shim.ts rename to packages/build-scripts/env-shim.ts diff --git a/packages/build-scripts/package.json b/packages/build-scripts/package.json new file mode 100644 index 000000000000..7b5c3de5985f --- /dev/null +++ b/packages/build-scripts/package.json @@ -0,0 +1,14 @@ +{ + "name": "build-scripts", + "version": "0.0.0", + "private": true, + "files": [ + "env-shim.ts", + "tsup.config.ts" + ], + "devDependencies": { + "@types/node": "^18.11.10", + "tsconfig": "workspace:*", + "tsup": "6.5.0" + } +} diff --git a/packages/build-scripts/tsconfig.json b/packages/build-scripts/tsconfig.json new file mode 100644 index 000000000000..26aa6ee423e1 --- /dev/null +++ b/packages/build-scripts/tsconfig.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "types": ["node"] + }, + "display": "Build Scripts", + "extends": "tsconfig/base.json" +} diff --git a/packages/library/tsup.config.ts b/packages/build-scripts/tsup.config.ts similarity index 90% rename from packages/library/tsup.config.ts rename to packages/build-scripts/tsup.config.ts index 083955f26f79..877b18a4f03f 100644 --- a/packages/library/tsup.config.ts +++ b/packages/build-scripts/tsup.config.ts @@ -1,3 +1,4 @@ +import path from 'path'; import { defineConfig, Format, Options } from 'tsup'; type Platform = @@ -15,7 +16,8 @@ function getBaseConfig(platform: Platform, format: Format[], options: Options): __REACTNATIVE__: `${platform === 'native'}`, }, entry: [`./src/index.ts`], - esbuildOptions(options, { format }) { + esbuildOptions(options, fuck) { + const { format } = fuck; options.minify = format === 'iife' && !isDebugBuild; if (format === 'iife') { options.define = { @@ -23,7 +25,7 @@ function getBaseConfig(platform: Platform, format: Format[], options: Options): __DEV__: `${isDebugBuild}`, }; } - options.inject = ['./src/env-shim.ts']; + options.inject = [path.resolve(__dirname, 'env-shim.ts')]; }, format, globalName: 'solanaWeb3', diff --git a/packages/library/package.json b/packages/library/package.json index 0bee3b4c00c3..5079ef1d2e10 100644 --- a/packages/library/package.json +++ b/packages/library/package.json @@ -36,7 +36,7 @@ "web3" ], "scripts": { - "compile:js": "tsup", + "compile:js": "tsup --config build-scripts/tsup.config.ts", "compile:typedefs": "tsc -p ./tsconfig.declarations.json", "dev": "jest -c ./internal/jest/jest-dev.config.ts --watch", "test:lint": "jest -c ./internal/jest/jest-lint.config.ts --silent", @@ -69,6 +69,7 @@ "@typescript-eslint/eslint-plugin": "^5.43.0", "@typescript-eslint/parser": "^5.43.0", "agadoo": "^2.0.0", + "build-scripts": "workspace:*", "eslint": "^8.27.0", "eslint-plugin-jest": "^27.1.5", "eslint-plugin-react-hooks": "^4.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8046adbf6843..bf0dfe64d9af 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,7 +16,17 @@ importers: '@solana/prettier-config-solana': 0.0.1_prettier@2.8.3 commitlint: 17.4.2 eslint-config-turbo: 0.0.7_eslint@8.33.0 - turbo: 1.7.3 + turbo: 1.7.4 + + packages/build-scripts: + specifiers: + '@types/node': ^18.11.10 + tsconfig: workspace:* + tsup: 6.5.0 + devDependencies: + '@types/node': 18.11.17 + tsconfig: link:../tsconfig + tsup: 6.5.0 packages/library: specifiers: @@ -27,6 +37,7 @@ importers: '@typescript-eslint/eslint-plugin': ^5.43.0 '@typescript-eslint/parser': ^5.43.0 agadoo: ^2.0.0 + build-scripts: workspace:* eslint: ^8.27.0 eslint-plugin-jest: ^27.1.5 eslint-plugin-react-hooks: ^4.6.0 @@ -50,6 +61,7 @@ importers: '@typescript-eslint/eslint-plugin': 5.50.0_rsaczafy73x3xqauzesvzbsgzy '@typescript-eslint/parser': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u agadoo: 2.0.0 + build-scripts: link:../build-scripts eslint: 8.33.0 eslint-plugin-jest: 27.2.1_b3dzcxbxjgpw4jvln3rxkjf4tu eslint-plugin-react-hooks: 4.6.0_eslint@8.33.0 @@ -3448,12 +3460,12 @@ packages: acorn: 7.4.1 dev: true - /acorn-jsx/5.3.2_acorn@8.8.0: + /acorn-jsx/5.3.2_acorn@8.8.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.8.0 + acorn: 8.8.2 dev: true /acorn-walk/7.2.0: @@ -5517,8 +5529,8 @@ packages: resolution: {integrity: sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.8.0 - acorn-jsx: 5.3.2_acorn@8.8.0 + acorn: 8.8.2 + acorn-jsx: 5.3.2_acorn@8.8.2 eslint-visitor-keys: 3.3.0 dev: true @@ -8909,6 +8921,22 @@ packages: - supports-color dev: true + /postcss-load-config/3.1.4: + resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} + engines: {node: '>= 10'} + peerDependencies: + postcss: '>=8.0.9' + ts-node: '>=9.0.0' + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + dependencies: + lilconfig: 2.0.6 + yaml: 1.10.2 + dev: true + /postcss-load-config/3.1.4_aesdjsunmf4wiehhujt67my7tu: resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} engines: {node: '>= 10'} @@ -10292,6 +10320,41 @@ packages: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} dev: true + /tsup/6.5.0: + resolution: {integrity: sha512-36u82r7rYqRHFkD15R20Cd4ercPkbYmuvRkz3Q1LCm5BsiFNUgpo36zbjVhCOgvjyxNBWNKHsaD5Rl8SykfzNA==} + engines: {node: '>=14'} + hasBin: true + peerDependencies: + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: ^4.1.0 + peerDependenciesMeta: + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + bundle-require: 3.1.2_esbuild@0.15.18 + cac: 6.7.14 + chokidar: 3.5.3 + debug: 4.3.4 + esbuild: 0.15.18 + execa: 5.1.1 + globby: 11.1.0 + joycon: 3.1.1 + postcss-load-config: 3.1.4 + resolve-from: 5.0.0 + rollup: 3.14.0 + source-map: 0.8.0-beta.0 + sucrase: 3.29.0 + tree-kill: 1.2.2 + transitivePeerDependencies: + - supports-color + - ts-node + dev: true + /tsup/6.5.0_i34tea5lx62cqnoctglecdfgia: resolution: {integrity: sha512-36u82r7rYqRHFkD15R20Cd4ercPkbYmuvRkz3Q1LCm5BsiFNUgpo36zbjVhCOgvjyxNBWNKHsaD5Rl8SykfzNA==} engines: {node: '>=14'} @@ -10348,6 +10411,14 @@ packages: dev: true optional: true + /turbo-darwin-64/1.7.4: + resolution: {integrity: sha512-ZyYrQlUl8K/mYN1e6R7bEhPPYjMakz0DYMaexkyD7TAijQtWmTSd4a+I7VknOYNEssnUZ/v41GU3gPV1JAzxxQ==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /turbo-darwin-arm64/1.7.3: resolution: {integrity: sha512-puS9+pqpiy4MrIvWRBTg3qfO2+JPXR7reQcXQ7qUreuyAJnSw9H9/TIHjeK6FFxUfQbmruylPtH6dNpfcML9CA==} cpu: [arm64] @@ -10356,6 +10427,14 @@ packages: dev: true optional: true + /turbo-darwin-arm64/1.7.4: + resolution: {integrity: sha512-CKIXg9uqp1a+Yeq/c4U0alPOqvwLUq5SBZf1PGYhGqJsfG0fRBtJfkUjHuBsuJIOGXg8rCmcGSWGIsIF6fqYuw==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /turbo-linux-64/1.7.3: resolution: {integrity: sha512-BnbpgcK8Wag6fhnff7tMaecswmFHN/T56VIDnjcwcJnK9H3jdwpjwZlmcDtkoslzjPj3VuqHyqLDMvSb3ejXSg==} cpu: [x64] @@ -10364,6 +10443,14 @@ packages: dev: true optional: true + /turbo-linux-64/1.7.4: + resolution: {integrity: sha512-RIUl4RUFFyzD2T024vL7509Ygwcw+SEa8NOwPfaN6TtJHK7RZV/SBP3fLNVOptG9WRLnOWX3OvsLMbiOqDLLyA==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /turbo-linux-arm64/1.7.3: resolution: {integrity: sha512-+epY+0dfjmAJNZHfj7rID2hENRaeM3D0Ijqkhh/M53o46fQMwPNqI5ff9erh+f9r8sWuTpVnRlZeu7TE1P/Okw==} cpu: [arm64] @@ -10372,6 +10459,14 @@ packages: dev: true optional: true + /turbo-linux-arm64/1.7.4: + resolution: {integrity: sha512-Bg65F0AjYYYxqE6RPf2H5TIGuA/EyWMeGOATHVSZOWAbYcnG3Ly03GZii8AHnUi7ntWBdjwvXf/QbOS1ayNB6A==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /turbo-windows-64/1.7.3: resolution: {integrity: sha512-/2Z8WB4fASlq/diO6nhmHYuDCRPm3dkdUE6yhwQarXPOm936m4zj3xGQA2eSWMpvfst4xjVxxU7P7HOIOyWChA==} cpu: [x64] @@ -10380,6 +10475,14 @@ packages: dev: true optional: true + /turbo-windows-64/1.7.4: + resolution: {integrity: sha512-rTaV50XZ2BRxRHOHqt1UsWfeDmYLbn8UKE6g2D2ED+uW+kmnTvR9s01nmlGWd2sAuWcRYQyQ2V+O09VfKPKcQw==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /turbo-windows-arm64/1.7.3: resolution: {integrity: sha512-UD9Uhop42xj1l1ba5LRdwqRq1Of+RgqQuv+QMd1xOAZ2FXn/91uhkfLv+H4Pkiw7XdUohOxpj/FcOvjCiiUxGw==} cpu: [arm64] @@ -10388,6 +10491,14 @@ packages: dev: true optional: true + /turbo-windows-arm64/1.7.4: + resolution: {integrity: sha512-h8sxdKPvHTnWUPtwnYszFMmSO0P/iUUwmYY9n7iYThA71zSao28UeZ0H0Gw75cY3MPjvkjn2C4EBAUGPjuZJLw==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /turbo/1.7.3: resolution: {integrity: sha512-mrqo72vPQO6ykmARThaNP/KXPDuBDSqDXfkUxD8hX1ET3YSFbOWJixlHU32tPtiFIhScIKbEGShEVWBrLeM0wg==} hasBin: true @@ -10401,6 +10512,19 @@ packages: turbo-windows-arm64: 1.7.3 dev: true + /turbo/1.7.4: + resolution: {integrity: sha512-8RLedDoUL0kkVKWEZ/RMM70BvKLyDFen06QuKKhYC2XNOfNKqFDqzIdcY/vGick869bNIWalChoy4O07k0HLsA==} + hasBin: true + requiresBuild: true + optionalDependencies: + turbo-darwin-64: 1.7.4 + turbo-darwin-arm64: 1.7.4 + turbo-linux-64: 1.7.4 + turbo-linux-arm64: 1.7.4 + turbo-windows-64: 1.7.4 + turbo-windows-arm64: 1.7.4 + dev: true + /tweetnacl/1.0.3: resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==} dev: true