Remove path-array#990
Conversation
|
Does this actually work though? I was looking at this a while back because the dependency depth here bothers me too but I wasn't sure that the same functionality could be replicated quite as easily. Perhaps it's really this easy but since we don't have test cases around this I'm not overly confident! We can certainly give it a try in v4 pre-releases which I'm planning on spinning up soon but tests would be nice. Any chance you'd like to write us some tests for this? |
|
Sure – I mean, I believe it was only added by @TooTallNate originally because he thought it was a good fit for the I just reverted those lines to how they were when #509 was merged. Kinda seems like overkill to add a module for just a single string join, no? |
| var pypath = new PathArray(process.env, 'PYTHONPATH') | ||
| pypath.unshift(path.join(__dirname, '..', 'gyp', 'pylib')) | ||
| var pypath = process.env.PYTHONPATH ? [process.env.PYTHONPATH] : [] | ||
| pypath.unshift(path.resolve(__dirname, '..', 'gyp', 'pylib')) |
There was a problem hiding this comment.
Ah, just noticed this should stay as path.join – will add that.
|
I'll add some tests tomorrow if I can figure out how 👍 |
| var pypath = new PathArray(process.env, 'PYTHONPATH') | ||
| var pypath = process.env.PYTHONPATH ? [process.env.PYTHONPATH] : [] | ||
| pypath.unshift(path.join(__dirname, '..', 'gyp', 'pylib')) | ||
| process.env.PYTHONPATH = pypath.join(process.platform === 'win32' ? ';' : ':') |
There was a problem hiding this comment.
It's arguably a bit nicer to wrap it in a if ('PYTHONPATH' in process.env) { ... }.
Can you replace the process.platform === 'win32' ? ';' : ':' with win ? ';' : ':'?
There was a problem hiding this comment.
When you say wrap in an if, what did you have in mind?
I can certainly do:
var pypath = 'PYTHONPATH' in process.env ? [process.env.PYTHONPATH] : []Or would you prefer something like:
var pypath = [path.join(__dirname, '..', 'gyp', 'pylib')]
if ('PYTHONPATH' in process.env) {
pypath.push(process.env.PYTHONPATH)
}
process.env.PYTHONPATH = pypath.join(win ? ';' : ':')(I kinda prefer that over an unshift anyway tbh)
There was a problem hiding this comment.
I mean the second one. I wrote 'PYTHONPATH' in process.env but perhaps checking for truthiness / non-emptiness (i.e., just process.env.PYTHONPATH) is better.
There was a problem hiding this comment.
var pypath = [path.join(__dirname, '..', 'gyp', 'pylib')]
if (process.env.PYTHONPATH) pypath.push(process.env.PYTHONPATH)
process.env.PYTHONPATH = pypath.join(win ? ';' : ':')Preferences on indentation, braces?
There was a problem hiding this comment.
node-gyp uses two spaces and (predominantly, I think) braces.
|
It's only so big because of |
|
@rvagg added some tests 👍 |
This saves 3.6MB of cruft. See: nodejs/node-gyp#990
|
@rvagg let me know if those tests look ok, or if there's anything you need further to get this through |
|
Hi all – any movement on this? FWIW, I've been building a tool to track down size regressions (and other issues with sub-deps) – you can see an example of it coming to life here: http://pkgsize.com.s3.amazonaws.com/node-gyp.html (hovering over should show you what events caused certain size changes) Obviously, |
|
This probably also needs a CI run with v0.10 and v0.12. |
|
@bnoordhuis would love to get this in – how do I get a CI run with v0.10 and v0.12? |
|
https://ci.nodejs.org/view/All/job/nodegyp-test-commit/13/ - v0.10.46 @nodejs/build Can someone take a look at why the win2012r2 bot complains about this: |
|
The ubuntu buildbot seems pretty happy though so I think this is good to go. @mhart Can you squash it into what you think are logical/reasonable commits? |
|
@bnoordhuis Sure thing – I'll keep the original "revert" commits separate and squash the rest |
3d603ce to
bb835d6
Compare
|
@bnoordhuis done – let me know if you want me to squash further |
Using push instead of the original unshift makes the logic a little cleaner to read here.
bb835d6 to
f658da7
Compare
|
The job was trying to download Started two jobs with similar parameters:
Seems good! |
|
Anything more need to be done on this? If so lemme know 👍 |
|
Hey all, just checking in on this PR. Let me know if there are any more concerns? |
This reverts commit ff88e5f. Of the 5.5MB footprint of node-gyp, path-array makes up 3.6MB. Removing this reduces the weight of npm (and thus node) appreciably. PR-URL: #990 Reviewed-By: Ben Noordhuis <[email protected]>
This reverts commit 81eadc5. PR-URL: #990 Reviewed-By: Ben Noordhuis <[email protected]>
Using push instead of the original unshift makes the logic a little cleaner to read here. PR-URL: #990 Reviewed-By: Ben Noordhuis <[email protected]>
|
I think we were (and are) just waiting for the next node-gyp release. I've landed it in 9c8d275...ddac348, thanks! |
|
Great, thanks @bnoordhuis 👍 Once it makes it to Node.js it'll be the first drop in size we've seen in years – here's hoping! |
|
This is pretty awesome. Thanks for the effort! |
|
Thanks for pushing this out – [email protected] has just included it and has reaped the benefits of an 18% reduction in size 👍 |
This saves 3.6MB of cruft. See: nodejs/node-gyp#990
This reverts commits 81eadc5 and ff88e5f.
Of the 5.5MB footprint of node-gyp, path-array makes up 3.6MB.
Removing this reduces the weight of npm (and ultimately node) appreciably (by 20%)