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

Update package.json to exclude source code from NPM package #253

Merged

Conversation

s-vamshi
Copy link
Contributor

@s-vamshi s-vamshi commented Oct 9, 2024

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

Resolves #200

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems

src folder shouldn't be added in package and compiled types should be inside dist/types

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email [email protected] to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

Added .npmignore file to ignore src and added decelerationDir key in tsconfig.json to put complied types in dist/types/src

Copy link
Contributor

@pavinduLakshan pavinduLakshan left a comment

Choose a reason for hiding this comment

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

Let's also exclude tsbundleinfo as well from being packed into the SDK bundle.

lib/.npmignore Outdated Show resolved Hide resolved
lib/tsconfig.json Outdated Show resolved Hide resolved
lib/.npmignore Outdated Show resolved Hide resolved
@s-vamshi
Copy link
Contributor Author

s-vamshi commented Oct 9, 2024

Hey @NipuniBhagya @pavinduLakshan done with the changes

lib/.npmignore Outdated Show resolved Hide resolved
@s-vamshi
Copy link
Contributor Author

s-vamshi commented Oct 9, 2024

@NipuniBhagya can you please review this now made the changes

@brionmario
Copy link
Member

brionmario commented Oct 9, 2024

Hi @s-vamshi,

While .npmignore seems like a viable option to overcome the issue, i think we can resolve this with a simple files entry in the package.json.

Have you considered that option?

IMO, since we don't go into granular level to which files in include, rather we can just simply include dist, package.json, README, better to go for the files option.

Additionally, we could also copy the LICENSE file at the root to the lib folder, and include that as well in the distribution.

WDYT?

@s-vamshi
Copy link
Contributor Author

s-vamshi commented Oct 9, 2024

Hey @brionmario, I agree with you, as lib folder didn't have .gitignore I thought of going with .npmignore.

I will add files section in package.json and push them!

@brionmario
Copy link
Member

Hey @brionmario, I agree with you, as lib folder didn't have .gitignore I thought of going with .npmignore.

I will add files section in package.json and push them!

Cool 🙌

Lets duplicate the LICENSE inside lib and include that as well :)

@s-vamshi
Copy link
Contributor Author

s-vamshi commented Oct 9, 2024

Sure 🚀

@s-vamshi s-vamshi force-pushed the fix/ignore-source-code-in-npm-package branch from 06738a4 to e731614 Compare October 9, 2024 14:32
@s-vamshi
Copy link
Contributor Author

s-vamshi commented Oct 9, 2024

hey @brionmario, done with changes

lib/package.json Outdated Show resolved Hide resolved
@s-vamshi s-vamshi force-pushed the fix/ignore-source-code-in-npm-package branch from e731614 to 77bd188 Compare October 10, 2024 06:19
@s-vamshi s-vamshi changed the title Update .npmignore to exclude source code from NPM package Update package.json to exclude source code from NPM package Oct 10, 2024
@s-vamshi
Copy link
Contributor Author

Hey @brionmario @NipuniBhagya @pavinduLakshan I have made the changes as suggested can you please review this PR?

@s-vamshi s-vamshi requested a review from NipuniBhagya October 14, 2024 05:02
@s-vamshi
Copy link
Contributor Author

Hey @brionmario @NipuniBhagya @pavinduLakshan can you please review this PR?

Copy link
Contributor

@pavinduLakshan pavinduLakshan left a comment

Choose a reason for hiding this comment

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

LGTM

@brionmario
Copy link
Member

brionmario commented Oct 14, 2024

LGTM too. Merged!

@brionmario brionmario merged commit 37341eb into asgardeo:main Oct 14, 2024
1 check passed
@brionmario
Copy link
Member

🚢 Shipped with v5.2.0

@brionmario
Copy link
Member

Thanks @s-vamshi for the contribution 🎉

Looks like the fix is working as expected. If time permits, please try the released version in a React app and do a regression test round!

Screenshot 2024-10-14 at 19 15 26

@pavinduLakshan
Copy link
Contributor

Thanks @s-vamshi for the contribution. This just reduced the package size by 10% (744KB -> 659KB). Great work!

@s-vamshi
Copy link
Contributor Author

Thanks @s-vamshi for the contribution 🎉

Looks like the fix is working as expected. If time permits, please try the released version in a React app and do a regression test round!

Screenshot 2024-10-14 at 19 15 26

Sure I will do regression testing

@NipuniBhagya
Copy link
Contributor

Hi @s-vamshi,

🎉 Thank you for your contribution! 🎉

We appreciate your effort and the time you've taken to submit this PR. As part of the Hacktoberfest process, please make sure to fill out the form [1] shared to ensure we can properly track your contribution.

[1] - https://docs.google.com/forms/d/1RT5fdrj7DvJCtzHOpvAIbN-4d08RswCOK_GZswZKR8w/viewform?edit_requested=true

Once again, thank you for your support, and we're excited to have you involved in our project! 🙌

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.

Source code should not be packed into the NPM package
4 participants