Open kylef opened 5 years ago
Posting as a question, not sure how feasible it is. Perhaps we can hook into GYP to delete some of the build state for release builds.
In theory, something like the following should contain everything for the runtime:
We do need to consider that some of the LICENSE files for vendored dependencies are not there and how to ensure they are always present.
Looking at the GYP documentation, doesn't appear to be any hooks or way we can execute code, and even if we could it would be tricky to make it platforn independent. I think an NPM hook for postinstall
may be the best option, we can produce a Node file which contains instructions to delete the artefacts for Release builds (we can omit these for debug).
I thought we need *.a
files because protagonist.node is dynamically linked. Did you get it working after deleting those things after installing protagonist as a module?
Yes, it works. .a
is a static library, it is used to build protagonist.node
. protagonist.node
does not dynamically link to anything other than libc++ and system libraries once built:
$ otool -L build/Release/protagonist.node
build/Release/protagonist.node:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
Any progress on this? We'd love to take advantage of this slimmed down release.
@gap777 There hasn't been, I am not entirely sure if it is possible from Protagonist alone. I haven't had chance to fully look into it, it might be up for discussion upstream in Node JS (node-gyp specifically: https://github.com/nodejs/node-gyp) since this can apply to all the C++ add-ons for Node.
If you want a slimmed down build, you can take a look at drafter.js, it's a pure JavaScript version of Protagonist (https://github.com/apiaryio/drafter.js/).
When you
npm install protagonist
into a project, it takes up around 100MB, over 90MB of that is built artefacts which are not needed by Protagonist at runtime, all that is really needed frombuild
at runtime isbuild/release/protagonist.node
.