Closed Andrew-Colman closed 3 years ago
Never mind. Will use npm outdated
to check is it needs update.
npm and github repository are not in sync (lol)
only the: bin/index.min.js
- built by builder.js script (merges all files from ./lib and optimize)
its published, all the rest files are ignored
the bin/
folder is ignored
What I'm thinking: when running sync-fork
check for npm if has a version greater than the current that executed the command,
and if found a new: run an alert: you are running an outdated version of sync-fork, please run npm i -g sync-fork
to update it
current version: 0.01
latest version: 0.0.2
Yes i figured lol, i will use the command npm outdated -json
which gives me a list of outdated packages in JSON formant (self explanatory), then will check if "sync-fork" is a key, and if it is then display the alert to update. I have seen this method used before in a few packages so it seems robust.
Found this: https://registry.npmjs.org/sync-fork/latest seems to run faster and gives the property easily
{
"version": "0.5.4"
}
It looks like a modified package.json, i will have to perform an HTTP request to get it.
But npm show sync-fork version
gives the same thing 0.5.4
but i will have to import parse the package.json to get the current version.
npm outdated -json
gives
{
"commander": {
"current": "6.2.1",
"wanted": "6.2.1",
"latest": "7.0.0",
"location": "node_modules/commander"
},
"eslint-config-prettier": {
"current": "6.15.0",
"wanted": "6.15.0",
"latest": "7.2.0",
"location": "node_modules/eslint-config-prettier"
}
}
So everything we need is in one JSON object. and it keeps with the structure of your code, running commands with exec and parsing stdout. In fact doing it this way might let us alert the user about outdated dependancies within sync-fork itself.
If sync-fork is outdated it will appear in this object. This is just an example snippet
Also, I have have got it working with npm outdated
. Just need to draw a pretty alert box.
Also, I have have got it working with npm outdated
if we get in trouble with it or if it run slowly
I added the https method here: https://github.com/Andrew-Colman/sync-fork/commit/f7ea4033cc5bc30bc26ab702df3ce0d2b2cc3eef
Sure, i will benchmark both methods and use the best one.
Will be working on this. Will it be sufficient to check if a new Tag exists on the repo and then ask to update?