• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.1 Latest
Buy Hosting

Maintaining package.json across updates

Scheduled Pinned Locked Moved NodeBB Development
5 Posts 3 Posters 506 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    girish
    wrote on last edited by
    #1

    I maintain the NodeBB package on Cloudron. It was suggested earlier that I should try to use upgrade --package option to update the package.json to the newer NodeBB version and preserving the plugin module names at the same time. This works as expected.

    However, I found that --package will not remove packages that are unused. For example, in 1.13.x NodeBB had a package called json-2-csv which was removed in 1.14.x. The --package will keep the old json-2-csv in package.json even though it's now gone.

    I have a few questions:

    • Is this behavior intentional or should we fix --package to remove extra deps? If not, how do I remove json-2-csv from package.json? Of course, I can npm uninstall the modules which are now gone in the newer NodeBB version manually but this means I have to manually diff package.json for every NodeBB upgrade (the situation I was trying to avoid in my first post). Having stale things in package.json is harmless but the issue is NodeBB does a dep check on startup (and json-2-csv is not installed).
    • A related issue: I found the flag dep-check to skip the dep check on start up. However, the loader does not pass command line args to app (so, you cannot use --no-dep-check). This means you have to use env var but that doesn't work because nconf parses dep-check=false as a string instead of bool (issue) and the code in start.js compares a string against a boolean now. Effectively, I don't know how to pass no-dep-check via loader.js.

    Thanks!

    PitaJP 1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to girish on last edited by
    #2

    @girish said in Maintaining package.json across updates:

    Is this behavior intentional or should we fix --package to remove extra deps?

    This should be fixed. Can you open an issue on GitHub? I think it should be possible to only merge forward packages starting with nodebb- (nodebb-theme-*, nodebb-plugin-, etc)

    If not, how do I remove json-2-csv from package.json? Of course, I can npm uninstall the modules which are now gone in the newer NodeBB version manually but this means I have to manually diff package.json for every NodeBB upgrade (the situation I was trying to avoid in my first post).

    If you wish to do this manually, I'd suggest you instead just copy install/package.json to package.json and then run npm install [packages...] for any plugins you need. Active plugins listed under ./nodebb plugins

    Having stale things in package.json is harmless but the issue is NodeBB does a dep check on startup (and json-2-csv is not installed).

    If it's in package.json, it should be installed. In what cases would there be a package specified as a dependency in package.json but that package not be installed? Uninstalling a package via npm should remove that package from the dependencies. This is the case in any recent version of npm.

    A related issue: I found the flag dep-check to skip the dep check on start up. ... Effectively, I don't know how to pass no-dep-check via loader.js.

    You should be able to set "dep-check": false in config.json

    julianJ 1 Reply Last reply
    2
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    replied to PitaJ on last edited by
    #3

    @PitaJ @girish thanks for pointing out the issues with package.json and upgrades. The solution to remove packages if not present in install/package.json (except those beginning with nodebb- should resolve the situation 👍

    If you could open up an issue so we can track this, that'd be helpful thanks!

    1 Reply Last reply
    0
  • G Offline
    G Offline
    girish
    wrote on last edited by
    #4

    @julian @PitaJ Thanks for the quick response. I will open a GitHub issue.

    1 Reply Last reply
    0
  • G Offline
    G Offline
    girish
    wrote on last edited by
    #5

    I created https://github.com/NodeBB/NodeBB/issues/8547

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development