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

Fix internal build script #706

Merged
merged 7 commits into from
Sep 1, 2022
Merged

Fix internal build script #706

merged 7 commits into from
Sep 1, 2022

Conversation

kevinxh
Copy link
Collaborator

@kevinxh kevinxh commented Aug 31, 2022

Description

There is an issue when you run npm run build in commerce-sdk-react, the build in /dist has a weird folder structure where there is double /dist.

This happens because the package.json has a main field for dist/index.js to specify the main entry point (this file doesn't exist in other public libraries because this is the first library in the mono repo that has an index file default export.) The PR fixes this by not copy the files that is already in dist.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • update prepare dist script

How to Test-Drive This PR

  • cd packages/commerce-sdk-react && npm run build
    you should have a /dist folder that look like this:

Screen Shot 2022-08-30 at 5 41 31 PM

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@kevinxh kevinxh requested a review from a team as a code owner August 31, 2022 00:33
@@ -59,8 +59,7 @@ const main = async () => {

try {
// Get a list of files from the `npm pack --dry-run` command.
const packageFiles = await packlist()

const packageFiles = (await packlist()).filter((path) => !path.startsWith('dist'))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This single line change is the key of this PR. (the rest is just maintenance.)

@@ -2,20 +2,16 @@
"name": "pwa-kit-react-sdk",
"version": "2.3.0-dev",
"description": "A library that supports the isomorphic React rendering pipeline for Commerce Cloud Managed Runtime apps",
"main": "dist/index.js",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Remove it because we don't have this file in the dist folder.

@kevinxh kevinxh requested a review from alexvuong August 31, 2022 00:38
Copy link
Collaborator

@alexvuong alexvuong left a comment

Choose a reason for hiding this comment

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

LGTM

@kevinxh kevinxh merged commit 37ce0a3 into develop Sep 1, 2022
@kevinxh kevinxh deleted the fix-build-script branch September 1, 2022 20:52
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.

2 participants