10
45
Fork
You've already forked doipjs
28

Optimize size of npm tarball #77

Open
vladimyr wants to merge 1 commit from vladimyr/doipjs:npm-pack into dev
pull from: vladimyr/doipjs:npm-pack
merge into: keyoxide:dev
keyoxide:main
keyoxide:dev
keyoxide:fix-irc-fetcher
keyoxide:new-claim-eveonline-143
keyoxide:prepare-new-release
keyoxide:fix-jsdoc-types
keyoxide:yarn-to-npm
keyoxide:support-openpgp-aspe-claims
keyoxide:support-html-alias
keyoxide:improve-activitypub-support
keyoxide:v1-restructure
keyoxide:into-es-module
keyoxide:support-aspe
keyoxide:fix-js-lsp-issues
keyoxide:improve-linting
keyoxide:add-markers
keyoxide:support-opencollective-claim
keyoxide:support-entity-decoding
keyoxide:use-rome-tools
keyoxide:support-cloudflare-buster
keyoxide:support-fediverse-posts
keyoxide:matrix-room-verification

Leveraging package.json files field to optimize the tarball size that npm produces.
See: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files

In order to test it run:

$ npm pack --dry-run

Before

npm notice === Tarball Details === 
npm notice name: doipjs 
npm notice version: 1.2.8 
npm notice filename: doipjs-1.2.8.tgz 
npm notice package size: 2.2 MB 
npm notice unpacked size: 6.7 MB 
npm notice shasum: fb2cc25248601eb60dd697404b4b31adaca95543
npm notice integrity: sha512-E++7WedEo0CXS[...]8b/ShTpPM//IQ==
npm notice total files: 93 
npm notice 
doipjs-1.2.8.tgz

After

npm notice === Tarball Details === 
npm notice name: doipjs 
npm notice version: 1.2.8 
npm notice filename: doipjs-1.2.8.tgz 
npm notice package size: 2.2 MB 
npm notice unpacked size: 6.6 MB 
npm notice shasum: 37212d80268c374409ad80deba8a00407ffc6552
npm notice integrity: sha512-Q1BM+vAFDqwK6[...]JUDQhDjhmEixg==
npm notice total files: 64 
npm notice 
doipjs-1.2.8.tgz

It is not much in terms of actual tarball size, but the number of files packaged went down significantly.

Leveraging `package.json` `files` field to optimize the tarball size that `npm` produces. See: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files In order to test it run: ```sh $ npm pack --dry-run ``` ## Before ``` npm notice === Tarball Details === npm notice name: doipjs npm notice version: 1.2.8 npm notice filename: doipjs-1.2.8.tgz npm notice package size: 2.2 MB npm notice unpacked size: 6.7 MB npm notice shasum: fb2cc25248601eb60dd697404b4b31adaca95543 npm notice integrity: sha512-E++7WedEo0CXS[...]8b/ShTpPM//IQ== npm notice total files: 93 npm notice doipjs-1.2.8.tgz ``` ## After ``` npm notice === Tarball Details === npm notice name: doipjs npm notice version: 1.2.8 npm notice filename: doipjs-1.2.8.tgz npm notice package size: 2.2 MB npm notice unpacked size: 6.6 MB npm notice shasum: 37212d80268c374409ad80deba8a00407ffc6552 npm notice integrity: sha512-Q1BM+vAFDqwK6[...]JUDQhDjhmEixg== npm notice total files: 64 npm notice doipjs-1.2.8.tgz ``` It is not much in terms of actual tarball size, but the number of files packaged went down significantly.
package.json Outdated
@ -6,1 +6,4 @@
"main": "./src/index.js",
"files": [
"src",
"dist"
Owner
Copy link

I think for legal reasons, the LICENSE must be attached to the tarball.

I _think_ for legal reasons, the LICENSE must be attached to the tarball.
Author
Member
Copy link

It is included by default:

Certain files are always included, regardless of settings:

  • package.json
  • README
  • LICENSE / LICENCE
  • The file in the "main" field
  • The file(s) in the "bin" field

README & LICENSE can have any case and extension.

It is included by default: > Certain files are always included, regardless of settings: > > - package.json > - README > - LICENSE / LICENCE > - The file in the "main" field > - The file(s) in the "bin" field > > README & LICENSE can have any case and extension.
Ryuno-Ki marked this conversation as resolved
vladimyr force-pushed npm-pack from b2aa41f19a
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
to f779d23ffc
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
2024年02月02日 13:56:19 +01:00
Compare
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u npm-pack:vladimyr-npm-pack
git switch vladimyr-npm-pack
Sign in to join this conversation.
No reviewers
Labels
Clear labels
bug
Something is not working

Archived

enhancement
New feature

Archived

Contribution welcome
Get started contributing here
Good first issue
Good if you are new to the project or to open source contributions
Impact
External
Affects the people using the project
Impact
Internal
Affects on the people working on the project
Priority
Critical
Work on right now
Priority
High
Work on at earliest convenience
Priority
Low
Work on in spare time
Priority
Medium
Work on regularly
Review
Duplicate
Already exists
Review
Off Topic
Does not fall within the scope of the repo/project
Status
Backlog
Is not being worked on yet
Status
Blocked
Is waiting on something or someone
Status
Completed
Is done
Status
In Progress
Is being worked on
Status
Investigating
Is waiting on research or questions
Status
Needs Decision
Is waiting on a decision by the devs/contributors
Status
Needs Info
Is waiting on additional information before it can be solved
Status
Needs Triage
Is new issue that needs reviewing
Status
Testing
Is being checked and verified
Status
Waiting For Review
Is waiting on reviewers to approve
Status
Won't Fix
Won't be fixed
Type
Bug
Related to something not working as intended
Type
CI
Related to continuous integration
Type
Documentation
Related to documentation
Type
Enhancement
Related to a new feature or an improved one
Type
New Claim
Related to a new identity claim/proof
Type
Security
Related to security
Type
Tests
Related to code tests
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
keyoxide/doipjs!77
Reference in a new issue
keyoxide/doipjs
No description provided.
Delete branch "vladimyr/doipjs:npm-pack"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?