You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
@jfirebaugh, I'm frequently running into issues with npm not updating those two repositories. What are the reasons we use npm to manage these rather than just using submodules?
In my experience, updating dependencies are more of a hassle with submodules than with node packages. All the make commands have dependencies that should cause npm update to be run whenever package.json is more recent than node_modules. I don't know of a similar way to get that behavior with submodules.
What situation are you seeing where node_modules doesn't get updated?
What situation are you seeing where node_modules doesn't get updated?
For instance depending on npm will make the Yocto and Buildroot packages extra complicated, because you will have npm as buildtime dependencies for embedded systems. I second using git submodules.
A submodule might work for shaders, if we can find a way to auto-update it like we do now via npm update. I don't think a submodule is workable for the test-suite, because it has sub-dependencies that need to be initialized by npm.
I've found that when the submodule rev changed on a certain parent module commit, it automatically gets checked out to that version when you change the HEAD. Apart from that, we can use this combination:
I've found that when the submodule rev changed on a certain parent module commit, it automatically gets checked out to that version when you change the HEAD.
Are you testing that in GitUp? It's a feature of that app, but not the git checkout command.
mapbox-gl-test-suite -- not feasible not to use npm due to subdependencies.
mapbox-gl-shaders -- I'm fine with using a submodule if someone does the work to ensure that make commands automatically update it if it's out of date. I'm not planning to work on this myself.
I tried using ExternalProject_Add, but found odd behavior: It always runs the configure/build/install steps, regardless of whether any code was updated. This is unfortunate because it means that we'd run npm install et al every time a build runs, even though we only rarely update it.
I tried using ExternalProject_Add, but found odd behavior: It always runs the configure/build/install steps, regardless of whether any code was updated.
It is possible to workaround this by adding empty steps. A header only library would look like:
Yeah, I did that as well, but ideally, we'd want to run npm install as the INSTALL_COMMAND, but not every time you run cmake, only when the actual source changes.
We've encountered a couple issues with npm that encourage switching to a submodule:
npm incorrectly dedupes git dependencies pinned to different hashes. @boundsj encountered this on the dds-wip branch yesterday: mapbox-gl-style-spec is pinned to different commits in mapbox-gl-native package.json versus mapbox-gl-js package.json, and npm installed the mapbox-gl-js version at the top level. This will cease to be an issue once we have a full mapbox-gl-js monorepo, but it's an issue right now.
npm (correctly) omits files specified via .npmignore even for git dependencies. This is an issue because mapbox-gl-js needs to exclude the test directory from the published package, but mapbox-gl-native wants that directory because it's where the test-suite integration tests are going to live (Merge 'mapbox-gl-test-suite' repo without preserving git history mapbox-gl-js#3834).
Additionally, with a mapbox-gl-js monorepo, it seems likely that a submodule will perform better for day-to-day development than an npm dependency:
Updates are efficient get fetch operations, rather than complete fresh clones.
You can work on dependent changes directly in the submodule, and push them to the mapbox-gl-js origin, rather than doing an npm link dance.
As noted above, we'll need to cope with subdependencies of the submodule, which will no longer be installed automatically by npm. We can do this by having the build scripts run npm install inside the submodule. Conveniently, this will allow mapbox-gl-js to use dev dependencies for the test-suite harness, which wouldn't be installed if mapbox-gl-js were itself an npm dependency of mapbox-gl-native.
We can do this by having the build scripts run npm install inside the submodule.
A drawback to this solution is that we're unable to cache mapbox-gl-js/node_modules using Travis's caching mechanism. I tried adding that directory to the caching list, but then initializing the submodule fails because the mapbox-gl-js directory is non-empty.
Not having it cached seems to increase the build times substantially.
As @tmpsantos suggests in #7513 (comment), can we create a symlink of mapbox-gl-js/node_modules to the root node_modules folder after we do the initial checkout and before running npm install?
Reacted by Lucas Wojciechowski and Thiago Marcos P. Santos
Activity
jfirebaugh commentedon Jun 6, 2016
In my experience, updating dependencies are more of a hassle with submodules than with node packages. All the make commands have dependencies that should cause
npm updateto be run wheneverpackage.jsonis more recent thannode_modules. I don't know of a similar way to get that behavior with submodules.What situation are you seeing where node_modules doesn't get updated?
tmpsantos commentedon Jun 6, 2016
For instance depending on
npmwill make the Yocto and Buildroot packages extra complicated, because you will havenpmas buildtime dependencies for embedded systems. I second usinggitsubmodules.kkaefer commentedon Jun 6, 2016
I'm using linked npm packages, and
npm updatedoesn't work with that. Is there another way of updating the code of a package except for linking it?jfirebaugh commentedon Jun 6, 2016
A submodule might work for shaders, if we can find a way to auto-update it like we do now via
npm update. I don't think a submodule is workable for the test-suite, because it has sub-dependencies that need to be initialized by npm.tmpsantos commentedon Jun 6, 2016
From embedded packaging perspective that would be fine. We don't build the tests when making the packages.
kkaefer commentedon Jun 7, 2016
I've found that when the submodule rev changed on a certain parent module commit, it automatically gets checked out to that version when you change the HEAD. Apart from that, we can use this combination:
.gitmodules:and calling
git submodule update --init -- deps/shadersto force the submodule to the correct pinned commit.jfirebaugh commentedon Jun 7, 2016
Are you testing that in GitUp? It's a feature of that app, but not the
git checkoutcommand.kkaefer commentedon Jun 7, 2016
I used the CLI, but I had GitUp open with that repo, so maybe it did that in the background.
tmpsantos commentedon Jun 29, 2016
Any decision on this? Can we move forward on not depending on
npmfor building on Linux?jfirebaugh commentedon Jun 29, 2016
mapbox-gl-test-suite-- not feasible not to use npm due to subdependencies.mapbox-gl-shaders-- I'm fine with using a submodule if someone does the work to ensure that make commands automatically update it if it's out of date. I'm not planning to work on this myself.tmpsantos commentedon Jul 25, 2016
Depends on #5359. We can simple use
externalproject_add(GIT_SUBMODULES).https://cmake.org/cmake/help/v3.0/module/ExternalProject.html
kkaefer commentedon Sep 19, 2016
I've found that using npm with git creates a lot of duplicate clones in
~/.npm; they took up several gigabytes on my machine.kkaefer commentedon Sep 19, 2016
I tried using
ExternalProject_Add, but found odd behavior: It always runs the configure/build/install steps, regardless of whether any code was updated. This is unfortunate because it means that we'd runnpm installet al every time a build runs, even though we only rarely update it.mikemorris commentedon Sep 19, 2016
This is by design in npm v2, and theoretically fixed in npm v3, but the implementation is still buggy 😞 npm/npm#10727
tmpsantos commentedon Sep 21, 2016
It is possible to workaround this by adding empty steps. A header only library would look like:
kkaefer commentedon Sep 21, 2016
Yeah, I did that as well, but ideally, we'd want to run
npm installas theINSTALL_COMMAND, but not every time you run cmake, only when the actual source changes.jfirebaugh commentedon Dec 21, 2016
We've encountered a couple issues with npm that encourage switching to a submodule:
dds-wipbranch yesterday: mapbox-gl-style-spec is pinned to different commits in mapbox-gl-native package.json versus mapbox-gl-js package.json, and npm installed the mapbox-gl-js version at the top level. This will cease to be an issue once we have a full mapbox-gl-js monorepo, but it's an issue right now.testdirectory from the published package, but mapbox-gl-native wants that directory because it's where the test-suite integration tests are going to live (Merge 'mapbox-gl-test-suite' repo without preserving git history mapbox-gl-js#3834).Additionally, with a mapbox-gl-js monorepo, it seems likely that a submodule will perform better for day-to-day development than an npm dependency:
get fetchoperations, rather than complete fresh clones.npm linkdance.As noted above, we'll need to cope with subdependencies of the submodule, which will no longer be installed automatically by npm. We can do this by having the build scripts run
npm installinside the submodule. Conveniently, this will allow mapbox-gl-js to use dev dependencies for the test-suite harness, which wouldn't be installed if mapbox-gl-js were itself an npm dependency of mapbox-gl-native.jfirebaugh commentedon Dec 22, 2016
A drawback to this solution is that we're unable to cache
mapbox-gl-js/node_modulesusing Travis's caching mechanism. I tried adding that directory to the caching list, but then initializing the submodule fails because themapbox-gl-jsdirectory is non-empty.Not having it cached seems to increase the build times substantially.
kkaefer commentedon Dec 22, 2016
As @tmpsantos suggests in #7513 (comment), can we create a symlink of
mapbox-gl-js/node_modulesto the rootnode_modulesfolder after we do the initial checkout and before runningnpm install?jfirebaugh commentedon Dec 22, 2016
Clever! I'll try it.
jfirebaugh commentedon Jan 10, 2017
Done in #7531.