-
Notifications
You must be signed in to change notification settings - Fork 308
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
Json to es #1575
Json to es #1575
Conversation
🦋 Changeset detectedLatest commit: 42e2cae The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
This approach LGTM. Just a few non-blocking naming nits.
packages/react/package.json
Outdated
@@ -12,6 +12,10 @@ | |||
"import": "./dist/esm/internal.js", | |||
"require": "./dist/internal.js" | |||
}, | |||
"./internal/primitive": { |
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.
"./internal/primitive": { | |
"./internal/primitives-catalog": { |
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.
Should we be consistent with primitive
though I agree this name is better? The json version used by studio is named primitive
. I think a new name will cause confusion but they are the same in different forms.
packages/react/package.json
Outdated
@@ -12,6 +12,10 @@ | |||
"import": "./dist/esm/internal.js", | |||
"require": "./dist/internal.js" | |||
}, | |||
"./internal/primitive": { | |||
"import": "./dist/esm/primitive.js", |
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.
"import": "./dist/esm/primitive.js", | |
"import": "./dist/esm/primitives-catalog.js", |
* import { PrimitiveCatalog } from '@aws-amplify/ui-react/internal/primitive' | ||
*/ | ||
const exportString = `export const PrimitiveCatalog = ${jsonString}; | ||
export default PrimitiveCatalog;`; |
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.
Should we use a named export to stay consistent with the rest of the repo?
export default PrimitiveCatalog;`; | |
export { PrimitiveCatalog }`; |
'dist/esm', | ||
'primitives-catalog.js' | ||
); | ||
fs.writeFileSync(JSONoutputPath, jsonString); |
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.
Continuing to create the JSON version so that this isn't a breaking change for studio, will remove this export once studio has had a chance to migrate over to the new export.
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.
LGTM
@@ -12,6 +12,10 @@ | |||
"import": "./dist/esm/internal.js", | |||
"require": "./dist/internal.js" | |||
}, | |||
"./internal/primitives-catalog": { | |||
"import": "./dist/esm/primitives-catalog.js", | |||
"default": null |
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.
Do we have a plan to add CJS export in the future? It is a dual(ESM/CJS) package. This seems deviating from the goal
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.
I don't know of any plans to add a CJS export as this is an internal package only being used by studio we would do one if they ever needed it, but I'm not sure if there are any plans otherwise. That being said I could add a CJS export for consistency if that is what we agree should happen.
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.
Ok, that makes sense. CJS is not a must
Description of changes
Add a new es module export of PrimitiveCatalog to the
/internal/primitives-catalog
subpath.Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.