Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/cli/program.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { calculate_coverage, type Coverage, type CoverageResult } from '../lib/index.js'
// import from absolute package name instead of relative import (like ../lib/index.ts)
// to prevent lib/index.js being bundled into cli.js, which would mean that indexjs
// ends up in our /dist twice which is wasteful
import { calculate_coverage, type Coverage, type CoverageResult } from '@projectwallace/css-code-coverage'

export type Report = {
context: {
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
],
"declaration": true,
"rootDirs": ["src/lib", "src/cli"],
"outDir": "dist"
"outDir": "dist",
"paths": {
// So we can import like an external in the CLI
"@projectwallace/css-code-coverage": ["./src/lib/index.ts"]
}
},
"include": [
"src/lib/index.ts",
Expand Down
3 changes: 3 additions & 0 deletions tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export default defineConfig([
platform: 'node',
format: 'esm',
dts: false,
// The CLI references the Core via 'external' reference to prevent it
// from ending up as duplicate code in cli.js
external: ['@projectwallace/css-code-coverage'],
plugins: [
codecovVitePlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
Expand Down