Skip to content

Commit

Permalink
build: bundle @fireproof/ipfs using tsup instead of manual scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
thedanchez committed Jan 7, 2024
1 parent 9cbbf77 commit 0817c94
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"build:clean:react": "pnpm --filter use-fireproof build:clean",
"build:core": "pnpm --filter @fireproof/core build",
"build:react": "pnpm --filter use-fireproof build",
"build:tsup:ipfs": "pnpm --filter @fireproof/ipfs build:tsup",
"clean": "rm -rf node_modules && pnpm -r clean",
"clean:all": "pnpm build:clean && pnpm clean",
"clean:blockstore": "pnpm --filter @fireproof/encrypted-blockstore clean",
Expand Down
4 changes: 3 additions & 1 deletion packages/connect-ipfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"scripts": {
"prepublishOnly": "npm run build",
"build:clean": "rm -rf dist",
"build:tsup": "tsup",
"build:tsc": "npm run build:clean && tsc && mkdir dist/tsc && mv dist/*.js dist/tsc/ && node ./scripts/types.js",
"build:script": "node ./scripts/build.js",
"build": "npm run build:tsc && npm run build:script && cp dist/browser/index.iife.js ../fireproof/test/www/ipfs.iife.js",
Expand All @@ -45,14 +46,15 @@
"esbuild-plugin-tsc": "^0.4.0",
"partykit": "0.0.24",
"ts-loader": "^9.4.4",
"tsup": "^8.0.1",
"typescript": "^5.2.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@alanshaw/pail": "^0.3.3",
"@fireproof/core": "workspace:^",
"@fireproof/connect": "workspace:^",
"@fireproof/core": "workspace:^",
"@fireproof/encrypted-blockstore": "workspace:^",
"@ucanto/core": "^8.2.0",
"@ucanto/interface": "^8.1.0",
Expand Down
31 changes: 31 additions & 0 deletions packages/connect-ipfs/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { defineConfig } from 'tsup';

/*
By default tsup bundles all import-ed modules but, dependencies and peerDependencies in your package.json are always excluded.
You can also use --external <module|pkgJson> flag to mark other packages or other special package.json's dependencies and peerDependencies as external.
If you are using tsup to build for Node.js applications/APIs, usually bundling dependencies is not needed,
and it can even break things, for instance, while outputting to ESM.
*/
export default defineConfig({
name: "@fireproof/ipfs",
// Entry file for your library
entryPoints: ['src/index.ts'],

// Output directory for the bundled files
outDir: 'dist',

// Format options for ESM and UMD bundles
format: ['esm', 'cjs', 'iife'],

// Enable TypeScript type generation
dts: true,
clean: true,
sourcemap: true,
minify: true,

/** Always bundle modules matching given patterns */
noExternal: [],
/** Don't bundle these modules */
external: [],
});
Loading

0 comments on commit 0817c94

Please sign in to comment.