[TIMOB-24591] Use package-lock.json instead of checking in node_modules
| GitHub Issue | n/a |
|---|---|
| Type | Story |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-07-20T22:56:11.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 6.2.0 |
| Components | Android, CLI, iOS, Tooling |
| Labels | n/a |
| Reporter | Christopher Williams |
| Assignee | Christopher Williams |
| Created | 2017-04-18T15:55:45.000+0000 |
| Updated | 2017-08-29T22:54:40.000+0000 |
Description
We've long checked in our node_modules folder when we update our npm dependencies. I believe we've done so to avoid npm dependency resolution issues?
If so, we could move to using yarn and lock file to ensure the full tree of dependency versions matches on everyone's systems and builds - and avoid bloating the hell out of our repo size and history.
One potential hangup is that we have a special 'titanium-sdk' module which actually only lives in the SDK repo, and has never been moved out to it's own package/repo. I've opened a PR to address that here: https://github.com/appcelerator/titanium_mobile/pull/8974
I'm fine with using Yarn, but now everybody MUST use Yarn. Just so everybody understands, Yarn should be installed via the recommended methods and NPM isn't one of them. Every developer will need to routinely run
yarn upgradeafter pulling the latest from git. We should document this in the readme and an email to all active committers would be appropriate. Also, I've seen theyarn.lockfile be updated after doingyarn upgrade. The updatedyarn.lockwill be updated with any newly resolved versions, so we should probably instruct to useyarn upgrade \-\-frozen\-lockfile.[~cb1kenobi] Is there a particular reason we'd need to regularly run
yarn upgradeafter checkouts? Doesn't that make yarn attempt to upgrade all packages to the latest version within the semversion specs (and as a result also updateyarn.lock)? Wouldn't we instead want devs to runyarn installto grab the matching dependencies from the lock file when it's been updated? I would assume we'd prefer to runyarn upgradeas a way to update our existing dependencies to the latest as a step near fork/release time just so we're not falling behind (and that we'd have to test/validate the upgrades). In other words, upgrade would be an intentional step in a PR that was tested/reviewed and would be meant to update the lock file.I've only been running
yarn upgradeas habit from runningnpm upgrade. Ifyarn installdoes the trick, then that's cool. Everyone will need to runyarn installafter pulling the latest from whichever branch just in case theyarn.lockfile changed. This will require an internet connection. These 2 reasons are whynode_modulesis in thetitanium_mobilerepo. I guarantee you someone will not remember to runyarn installand complain things aren't working all because of an out of date dependency.Just to confirm, you are correct, we should run
yarn install, notyarn upgrade.So, npm 5 just came out. Basically eliminates the need to use yarn and yarn.lock. Ugh, re-purposing this ticket to move to npm5 and package-lock.json file.
PR was merged. Closing ticket as changes are seen in the latest SDK's