Setting the file. One moment.
Subchapter 8.2
references/advanced-ci.mdMarkdown2 KBView on GitHub
Automatically detect CI environments and toggle features based on local vs CI builds.
tsdown detects CI from the CI environment variable. CI mode is enabled when process.env.CI is set to a value other than 0 or false (case-insensitive).
Several options accept CI-aware string values:
| Value | Behavior |
|---|---|
true | Always enabled |
false | Always disabled |
'ci-only' | Enabled only in CI, disabled locally |
'local-only' | Enabled only locally, disabled in CI |
These options accept CI-aware values:
dts - TypeScript declaration file generationpublint - Package lint validationattw - “Are the types wrong” validationreport - Bundle size reportingexports - Auto-generate package.json exportsunused - Unused dependency checkdevtools - DevTools integrationfailOnWarn - Fail on warnings (defaults to false)export default defineConfig({
dts: 'local-only', // Skip DTS in CI for faster builds
publint: 'ci-only', // Only run publint in CI
failOnWarn: 'ci-only', // Fail on warnings in CI only (opt-in)
})When an option takes a configuration object, set enabled to a CI-aware value:
export default defineConfig({
publint: {
enabled: 'ci-only',
level: 'error',
},
attw: {
enabled: 'ci-only',
profile: 'node16',
},
})The config function receives a ci boolean in its context:
export default defineConfig((_, { ci }) => ({
minify: ci,
sourcemap: !ci,
}))export default defineConfig({
entry: 'src/index.ts',
format: ['esm', 'cjs'],
dts: true,
failOnWarn: 'ci-only',
publint: 'ci-only',
attw: 'ci-only',
})failOnWarn option details