-
Notifications
You must be signed in to change notification settings - Fork 4
chore: Add subpath entry points for all components #611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add subpath entry points for all components #611
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) ✅ code/snyk check is complete. No issues have been found. (View Details) |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
b45afb8
to
a43afe0
Compare
a43afe0
to
e2c4c38
Compare
@@ -27,9 +50,11 @@ export default defineConfig({ | |||
lib: { | |||
cssFileName: 'style', | |||
entry: { | |||
index: fileURLToPath(new URL('./src/index.ts', import.meta.url)), | |||
'utils/url-search-params': fileURLToPath(new URL('./src/utils/url-search-params/index.ts', import.meta.url)), | |||
index: 'src/index.ts', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: simplified this; I think the use of fileURLToPath
on previous versions of Vite, but it's been possible to use a plain string for a while now.
"types": "./dist/types/components/*/index.d.ts", | ||
"import": "./dist/js/components/*.js", | ||
"require": "./dist/js/components/*.cjs" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: new "core" entry point. This will allow v5 components to be imported without relying on the giant barrel file.
e.g. import { Button } from '@reapit/elements/core/button
"types": "./dist/types/deprecated/*/index.d.ts", | ||
"import": "./dist/js/deprecated/*.js", | ||
"require": "./dist/js/deprecated/*.cjs" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: new "deprecated" entry point. This will allow deprecated v4 components to be imported without relying on the giant barrel file.
e.g. import { Button } from '@reapit/elements/deprecated/button
export * from './table-row' | ||
export * from './table-row-selection' | ||
export * from './table-text' | ||
export * from './table-toolbar' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this barrel file for all the table components was previously missing. Added now to support the imports via @reapit/elements/core/table
Context
src/components/side-bar/index.ts
is a barrel file, but it's okay to use one here because it exports units of code designed to be used together, which means the chances of one things being used by a consumer and not the others is much smaller than a barrel file for the whole component library).@reapit/elements
;@reapit/elements/icons/*
;@reapit/elements/styles.css
;@reapit/elements/reset.css
; and,URLSearchParams
via@reapit/elements/utils/url-search-params
.src
directory to separate v5 components (now exclusively insrc/components
) from deprecated v4 components (now exclusively insrc/deprecated
).@reapit/elements/core
for v5 components and@reapit/elements/deprecated
for the deprecated v4 components.This PR
./core/*
and./deprecated/*
subpaths.utils/url-search-params
entry point is also updated to a generalised solution.src/components/table
.src/menu/index.tsx
tosrc/menu/index.ts
so that it matches the convention we expect for component barrel files.src/pattern
as it does not fit the convention required for directories withinsrc/deprecated
: it has noindex.ts
and it doesn't make sense to add one.note: these changes are entirely backwards compatible. Consumers can continue to import from the package's root entry point (
@reapit/elements
).