Skip to content

Commit

Permalink
chore: update test-helpers entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack committed Sep 19, 2024
1 parent a4d9e5f commit 78d267c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
"typings": "lib/index.d.ts",
"sideEffects": [
"lib-esm/**/*.css",
"lib/**/*.css"
"lib/**/*.css",
"src/**/test-helpers.tsx",
"lib-esm/**/test-helpers.js",
"lib/**/test-helpers.js"
],
"scripts": {
"build": "./script/build",
Expand Down
18 changes: 14 additions & 4 deletions packages/react/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ const input = new Set([
// "./next"
'src/next/index.ts',

// "./test-helpers"
'src/utils/test-helpers.tsx',

// Make sure all members are exported
'src/constants.ts',

Expand Down Expand Up @@ -66,6 +63,15 @@ const input = new Set([
),
])

function getEntrypointsFromInput(input) {
return Object.fromEntries(
Array.from(input).map(value => {
const relativePath = path.relative('src', value)
return [path.join(path.dirname(relativePath), path.basename(relativePath, path.extname(relativePath))), value]
}),
)
}

const extensions = ['.js', '.jsx', '.ts', '.tsx']
const ESM_ONLY = new Set([
'@github/combobox-nav',
Expand All @@ -91,7 +97,11 @@ const postcssModulesOptions = {
}

const baseConfig = {
input: Array.from(input),
input: {
...getEntrypointsFromInput(input),
// "./test-helpers"
'test-helpers': 'src/utils/test-helpers.tsx',
},
plugins: [
babel({
extensions,
Expand Down

0 comments on commit 78d267c

Please sign in to comment.