Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3rd party modules updater for updatenotification #3142

Closed
bugsounet opened this issue Jul 2, 2023 · 9 comments
Closed

3rd party modules updater for updatenotification #3142

bugsounet opened this issue Jul 2, 2023 · 9 comments

Comments

@bugsounet
Copy link
Contributor

Hi,

I'm thinking about this new default module: self updating of 3rd party module
I use it with my modules/plugins since 3 years now!
So why not create a default secure module for this ?

Actually how i do this:

  • I have created an embed script with npm run update command on each module. It's allows to fetch last version of this module and install it
    sample there
  • I have created a module to check if an update is available (+/- like updatenotification default module)
  • If an update is available, it checks some rules (only my modules)
  • It install the update (run the update command)
  • after install: if no error: restart MagicMirror (with or without pm2)
  • if any errors: display a warn (with alert)

How I plan to do this with a new default module !?

  • it's a developer choice to create an embed command or not
  • If developer make choice to add a self updater: add update feature in package.json like this:
{
  "name": "MMM-Test",
  "description": "Test module",
  "main": "MMM-Test.js",
  "update": "update", <--- update feature with command to launch
  "scripts": {
    "preinstall": "installer/preinstall.sh",
    "postinstall": "installer/postinstall.sh",
    "update": "installer/update.sh" <--- update command to launch (with npm run xxx)
  },
  "author": "bugsounet",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/bugsounet/MMM-Test"
  }
}
  • if this feature don't exist, don't apply self updating
  • actually with my update module: my rules says run npm run update if it's an @bugsounet module Tag. So I can check package.json with update feature
  • Naturally... I will check also if no package.json

what do you this about this ?

@khassel
Copy link
Collaborator

khassel commented Jul 2, 2023

my thoughts so far:

@sdetweil
Copy link
Collaborator

sdetweil commented Jul 2, 2023

I think the title needs to be changed,

Module sample, with autoupdate

none of the default modules would use this as they are updated by base..

I think this should be started from npm then its clear where it gets triggered, and where it goes from there

@bugsounet
Copy link
Contributor Author

I had implemented this at the beginning but it causes too many problems.

Afterwards, a simple git pull && npm install to implement in the git helper is not enough
Why ?
let's take the example of request... missing (sam is used to it now!)
it is depreciated, ok... but some old modules still use it
You understand that the user will add it to package.json (via npm install request)
it will add it in package.json
and disaster ... you can't update because the file has been modified

this can also be the case if the user modifies one of the source files

that's why I prefer in the package.json as I explained

For me, an update should not become a headache.
It must be tested in all directions, in order to verify the proper functioning.
This is why it must be validated by the developer

Example in my case: git pull && npm install will never work
Why ? because the source files are minify with my installer (for speed up!)

@sdetweil
Copy link
Collaborator

sdetweil commented Jul 2, 2023

@bugsounet for this

it will add it in package.json
and disaster ... you can't update because the file has been modified

the module hasn't been updated in years, unlikely this will need to be addressed..
but your point is taken.. files will be changed.. unexpectedly

@bugsounet
Copy link
Contributor Author

and what does @rejas think of all this?
what is your point of view?

@sdetweil
Copy link
Collaborator

sdetweil commented Jul 3, 2023

well, if we have a sample for the NPM process, then we need a sample module itself.. or two.. one with and without node_helper

@bugsounet
Copy link
Contributor Author

Tomorrow, I will recode MMM-Test for testing self updates

@khassel
Copy link
Collaborator

khassel commented Sep 9, 2023

I think this is under development here: #3150

@bugsounet bugsounet changed the title Idea of new default module 3rd party modules updater for updatenotification Sep 18, 2023
@khassel
Copy link
Collaborator

khassel commented Jun 24, 2024

Looks like this is done so I will close this (if not please add a comment and I will reopen).

@khassel khassel closed this as completed Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants