[JS][Packaging] npm package is bloated with seemingly unnecessary code/deps
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, typescript
- Domain
- build-system, release
Research direction
Start by inspecting the published @apache-arrow/es5-cjs package contents and the Lerna package layout, including src and bin/arrow2csv.js. Measure which listed files and dependencies are required at runtime, then define package boundaries and verify that the published archives are smaller without breaking Node, browser, or TypeScript consumers.
Written by the indexing model from the issue text.
Description
Describe the enhancement requested
We're considering using Apache Arrow for a project, but it seems like the dependency is very large. For example, the @apache-arrow/es5-cjs package is 2.82MB compressed. It seems that the project was already split between target ES version and module loader for size efficiency, but without actually addressing the size problem.
From looking at the folder, I see the following components that could potentially be removed at a glance:
- All
.tsfiles, as these are only needed in development when using TypeScript. (this includes definition files and the entiresrcfolder) - All
.domand.mapfiles since these are only needed in the browser and not in Node. - The
bin/arrow2csv.jsfile as it seems to only be useful for testing. - All
@swcdependencies, as these are development dependencies. - All
@typesdependencies, as those should be installed separately only when using TypeScript. - The
command-line-argsandcommand-line-usagedependencies as they seem like development dependencies. - The
tslibdependency, which again is related to TypeScript and cannot be used by Node. - The
json-bignumdependency, as it doesn't seem to make sense if this project is actually an alternative to JSON to begin with. - For the
flatbuffersdependency, I'm not entirely sure, but it seems to support generating code from a schema, which may include all or some of the code needed to no longer needflatbuffers, although for this one, additional investigation would be needed. - I'm sure a lot of other files are used to do things like managing schemas and could potentially be removed as well from the production package.
Deleting all the above (except flatbuffers as it's unclear if it's needed) just to see the difference results in the uncompressed package size going from 6.4MB to 1.3MB, and it's probably incomplete and could be reduced much further.
I don't know much about the project internals, so my above assumptions might be wrong, but I'd definitely like to open a discussion about the size of this package and how to make it smaller as it seems the current approach to split packages is not quite achieving its goal and it might make more sense to split the project to something closer to a monorepo.
For example, something like this:
@apache-arrow/cli
@apache-arrow/types or @types/apache-arrow
@apache-arrow/node (doesn't need to be split by module types as only the entry point needs to change)
@apache-arrow/dom-es2015 (or es5, etc)
etc
Or even more granular (since for example we only need the ability to encode and not decode):
@apache-arrow/encoder
@apache-arrow/decoder
@apache-arrow/stream-writer
@apache-arrow/stream-reader
etc
Since the project already relies on Lerna, it shouldn't be too much work to change what gets released as what package I think, but I'd like to hear thoughts from maintainers before opening a PR with such a large restructuring of the project.
Component(s)
JavaScript, Packaging
- Dominant language
- TypeScript
- Stars
- 112
- Forks
- 23
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/arrow-js
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
Similar issues
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Mend: dependency security vulnerability untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 70/100