Skip to content

Commit

Permalink
build: base tsup config (#3576)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Feb 5, 2025
1 parent 88af932 commit 3189247
Show file tree
Hide file tree
Showing 29 changed files with 78 additions and 305 deletions.
13 changes: 2 additions & 11 deletions packages/abi-ts/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/exports/internal.ts", "src/bin/abi-ts.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/block-logs-stream/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/exports/index.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { globSync } from "glob";
import { readFileSync } from "node:fs";
import path from "node:path";
import { MudPackages } from "./src/common";
import { baseConfig } from "../../tsup.config.base";

const mudWorkspace = path.normalize(`${__dirname}/../..`);

Expand All @@ -18,19 +19,9 @@ const mudPackages: MudPackages = Object.fromEntries(
);

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/index.ts", "src/mud.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
env: {
MUD_PACKAGES: JSON.stringify(mudPackages),
},
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/common/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: {
index: "src/index.ts",
actions: "src/actions/index.ts",
Expand All @@ -13,15 +15,4 @@ export default defineConfig((opts) => ({
kms: "src/exports/kms.ts",
internal: "src/exports/internal.ts",
},
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/config/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: {
index: "src/exports/index.ts",
internal: "src/exports/internal.ts",
"deprecated/node": "src/deprecated/node/index.ts",
},
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/create-mud/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/bin/cli.ts"],
target: "esnext",
format: ["esm"],
minify: true,
sourcemap: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/dev-tools/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from "tsup";
import packageJson from "./package.json";
import { baseConfig } from "../../tsup.config.base";

// tsup doesn't bundle deps by default (https://tsup.egoist.dev/#excluding-packages),
// but we want to do that for dev-tools because it's used as a standalone package.
Expand All @@ -13,21 +14,11 @@ const peerDeps = Object.keys(packageJson.peerDependencies);
const bundledDeps = Object.keys(packageJson.dependencies).filter((dep) => !peerDeps.includes(dep));

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/index.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
injectStyle: true,
// bundle all non-peer deps
noExternal: bundledDeps,
// don't code split otherwise dep imports in bundle seem to break
splitting: false,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
11 changes: 2 additions & 9 deletions packages/entrykit/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";
// import packageJson from "./package.json";

export default defineConfig((opts) => ({
...baseConfig(opts),
outDir: "dist/tsup",
entry: ["src/exports/index.ts", "src/exports/internal.ts", "src/bin/deploy.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// Because we're injecting CSS via shadow DOM, we'll disable style injection and load CSS as a base64 string.
// TODO: figure out how to do this conditionally for only specific imports?
injectStyle: false,
loader: { ".css": "text" },
dts: true,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/explorer/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
tsconfig: "tsconfig.tsup.json",
entry: ["src/bin/explorer.ts", "src/exports/observer.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: false,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/faucet/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/index.ts", "src/bin/faucet-server.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/gas-report/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["ts/exports/internal.ts", "ts/bin/gas-report.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/protocol-parser/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: {
index: "src/exports/index.ts",
internal: "src/exports/internal.ts",
},
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/react/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/index.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/recs/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/index.ts", "src/deprecated/index.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
15 changes: 2 additions & 13 deletions packages/schema-type/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: {
index: "src/typescript/exports/index.ts",
internal: "src/typescript/exports/internal.ts",
deprecated: "src/typescript/exports/deprecated.ts",
},
outDir: "dist",
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
injectStyle: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/solhint-config-mud/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/index.ts"],
target: "esnext",
format: ["cjs"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/solhint-plugin-mud/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/index.ts"],
target: "esnext",
format: ["cjs"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
13 changes: 2 additions & 11 deletions packages/stash/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { defineConfig } from "tsup";
import { baseConfig } from "../../tsup.config.base";

export default defineConfig((opts) => ({
...baseConfig(opts),
entry: ["src/exports/index.ts", "src/exports/internal.ts", "src/exports/react.ts"],
target: "esnext",
format: ["esm"],
sourcemap: true,
minify: true,
// don't generate DTS during watch mode because it's slow
// we're likely using TS source in this mode anyway
dts: !opts.watch,
// don't clean during watch mode to avoid removing
// previously-built DTS files, which other build tasks
// depend on
clean: !opts.watch,
}));
Loading

0 comments on commit 3189247

Please sign in to comment.