Skip to content
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

Merged
merged 5 commits into from
Mar 29, 2022
Merged

Json to es #1575

merged 5 commits into from
Mar 29, 2022

Conversation

jacoblogan
Copy link
Contributor

@jacoblogan jacoblogan commented Mar 23, 2022

Description of changes

Add a new es module export of PrimitiveCatalog to the /internal/primitives-catalog subpath.

Checklist

  • PR description included
  • yarn test passes

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@changeset-bot
Copy link

changeset-bot bot commented Mar 23, 2022

🦋 Changeset detected

Latest commit: 42e2cae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/ui-react Patch

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

@jacoblogan jacoblogan temporarily deployed to ci March 23, 2022 21:23 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 23, 2022 21:23 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 23, 2022 21:23 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 23, 2022 21:23 Inactive
Copy link
Contributor

@reesscot reesscot left a 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.

@@ -12,6 +12,10 @@
"import": "./dist/esm/internal.js",
"require": "./dist/internal.js"
},
"./internal/primitive": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"./internal/primitive": {
"./internal/primitives-catalog": {

Copy link
Contributor

@zchenwei zchenwei Mar 28, 2022

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.

@@ -12,6 +12,10 @@
"import": "./dist/esm/internal.js",
"require": "./dist/internal.js"
},
"./internal/primitive": {
"import": "./dist/esm/primitive.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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;`;
Copy link
Contributor

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?

Suggested change
export default PrimitiveCatalog;`;
export { PrimitiveCatalog }`;

@jacoblogan jacoblogan temporarily deployed to ci March 23, 2022 22:23 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 23, 2022 22:23 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 23, 2022 22:23 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 23, 2022 22:23 Inactive
@jacoblogan jacoblogan marked this pull request as ready for review March 28, 2022 17:14
@jacoblogan jacoblogan temporarily deployed to ci March 28, 2022 17:25 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 28, 2022 17:25 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 28, 2022 17:25 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 28, 2022 17:25 Inactive
'dist/esm',
'primitives-catalog.js'
);
fs.writeFileSync(JSONoutputPath, jsonString);
Copy link
Contributor Author

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.

Copy link
Contributor

@joebuono joebuono left a 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
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

@jacoblogan jacoblogan temporarily deployed to ci March 28, 2022 22:44 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 28, 2022 22:44 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 28, 2022 22:44 Inactive
@jacoblogan jacoblogan temporarily deployed to ci March 28, 2022 22:44 Inactive
@jacoblogan jacoblogan merged commit 1570fe1 into main Mar 29, 2022
@jacoblogan jacoblogan deleted the json-to-es branch March 29, 2022 16:41
@github-actions github-actions bot mentioned this pull request Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants