strimzi-ui icon indicating copy to clipboard operation
strimzi-ui copied to clipboard

fix: stop test assets bundled in production

Open nictownsend opened this issue 4 years ago • 3 comments

  • restructure ConfigFeatureFlag assets so they are no longer exporting test code as runtime dependencies

Contributes to: strimzi/strimzi-ui#152

Signed-off-by: Nic Townsend [email protected]

nictownsend avatar Dec 14 '20 15:12 nictownsend

@JQrdan - any better way you'd prefer to split the assets?

nictownsend avatar Dec 14 '20 15:12 nictownsend

PR Report

Bundle Sizes

Test Coverage

View test coverage
File Lines Statement Functions Branches
Total 100% 100% 100% 100%
client/Bootstrap/Navigation/useRouteConfig/useRouteConfig.hook.ts 100% 100% 100% 100%
client/Contexts/ConfigFeatureFlag/ConfigFeatureFlag.testassets.ts 100% 100% 100% 100%
client/Contexts/ConfigFeatureFlag/Context.tsx 100% 100% 100% 100%
client/Contexts/ConfigFeatureFlag/FeatureFlag.view.tsx 100% 100% 100% 100%
client/Contexts/Introspect/Introspection.ts 100% 100% 100% 100%
client/Contexts/Logging/Context.tsx 100% 100% 100% 100%
client/Hooks/useConfigFeatureFlag/useConfigFeatureFlag.ts 100% 100% 100% 100%
client/Hooks/useLogger/Hook.ts 100% 100% 100% 100%
client/Panels/Home/Home.tsx 100% 100% 100% 100%
client/Utils/sanitise/sanitise.ts 100% 100% 100% 100%
client/Utils/window/window.ts 100% 100% 100% 100%
File Lines Statement Functions Branches
Total 100% 100% 100% 100%
server/api/controller.ts 100% 100% 100% 100%
server/api/router.ts 100% 100% 100% 100%
server/client/controller.ts 100% 100% 100% 100%
server/client/router.ts 100% 100% 100% 100%
server/config/controller.ts 100% 100% 100% 100%
server/config/router.ts 100% 100% 100% 100%
server/core/app.ts 100% 100% 100% 100%
server/core/modules.ts 100% 100% 100% 100%
server/log/router.ts 100% 100% 100% 100%
server/mockapi/data.ts 100% 100% 100% 100%
server/mockapi/router.ts 100% 100% 100% 100%

Triggered by commit: 8d001155e391907c8e7cd57864989f68f7dbec8f

github-actions[bot] avatar Dec 14 '20 15:12 github-actions[bot]

Agree that these peieces should not be used/exported in production via the barrel.

Out of interest, would a:

export {publicItemOne, publicItemTwo} from './ConfigFeatureFlag.assets'

replacing

https://github.com/strimzi/strimzi-ui/blob/2ee0ba3ce3d76073cc9ba1178e54202fc4828255/client/Contexts/ConfigFeatureFlag/index.ts#L6

achieve the same effect (without the need for extra files)?

Unfortunately not - it seems like treeshaking isn't smart/configured to notice that the imports in ConfigFeatureFlag.assets are not used by the exported functions. Am happy to raise a following issue for backlog to investigate this though.

nictownsend avatar Dec 15 '20 12:12 nictownsend