From 78d267cc9f1edcdf09efc2f072c565902369b1a3 Mon Sep 17 00:00:00 2001 From: Josh Black Date: Thu, 19 Sep 2024 17:19:50 -0500 Subject: [PATCH] chore: update test-helpers entrypoint --- packages/react/package.json | 5 ++++- packages/react/rollup.config.mjs | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/react/package.json b/packages/react/package.json index 623bb36ec3d..957aa671185 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -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", diff --git a/packages/react/rollup.config.mjs b/packages/react/rollup.config.mjs index 6c4ad3cbe1f..6b40253473f 100644 --- a/packages/react/rollup.config.mjs +++ b/packages/react/rollup.config.mjs @@ -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', @@ -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', @@ -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,