Updating info on forked node

I've made a fork of node-red-contrib-counter (to fix a long outstanding bug - author hasn't responded in a few years)

But I'm wondering how to update the package.json

  "name": "node-red-contrib-counter",
  "version": "0.1.6",
  "description": "A Node-RED node to create a counter with messages.",
  "homepage": "http://github.com/dkern/node-red-counter",
  "bugs": "http://github.com/dkern/node-red-counter/issues",
  "license": "Apache-2.0",
  "author": {
    "name": "Daniel 'Eisbehr' Kern",
    "email": "jquery@eisbehr.de",
    "url": "http://eisbehr.de"
  },
  "repository": {
    "type": "git",
    "url": "git@github.com:dkern/node-red-counter.git"
  },
  "keywords": [
    "node-red",
    "counter",
    "count"
  ],
  "node-red": {
    "nodes": {
      "counter": "counter.js"
    }
  }
}

Any advice please?

Change any "string" right of a colon : to the value you desire.

If you intend on publishing a new fork to NPM, I suggest you keep the name but prefix it with a scope e.g. "name": "@cymplecy/node-red-contrib-counter" - see here for more info: Packaging : Node-RED

Definitely update repository.url to point to your fork

Definitely increase the version number in line with Semantic Versioning.

Look to include engines, min node-red version, and others to avoid a poor scorecard

Lastly, I would (but many don't) update the package and readme to tip a nod to the original author.

2 Likes

I know I'm not the brightest but come on! :slight_smile:

So how do I add a nod in the package? Can I just make up my own key value such as "forked from original code @xxxx"?

And what about version number - would it be OK to set mine to 1.0.0?

Yeah, I thought I was funny - but it is good info for future readers - honest gov :angel:

Yes, but contributors is a good place for this e.g.

  "contributors" : [
  {
    "name" : "Barney Rubble",
    "email" : "b@rubble.com",
    "url" : "http://barnyrubble.tumblr.com/",
    "note": "Original Author of this package"
  }, 

Absolutely - a jump to v1 has to happen at some point. As long as you feel it is production ready, then yes, go for it.

If you want to publish betas first, the use a tag and version like 1.0.0-beta.1 and do npm publish --tag beta. see here for a better explanation: Publishing a beta or alpha version to NPM | by Kevin Kreuzer | Medium

3 Likes

But getting back to me not being the brightest ....

I couldn't find out how to actually publish the node to npm very easily without a lot of googling/trial and error

Is it documented on the Node-RED site?

It used to be more obvious but it is a little more tricky now, especially if you've turned on 2FA (and if you haven't, you really should).

But no, I don't think it is in the Node-RED docs. And yes, I had to spend time working it out and then more time configuring npm to stop asking me who I was each time. And then more time when I turned on 2FA. And yet more time when they differentiated between public and private publishing. And yet more when namespaces were introduced. :frowning:

As long as it wasn't me being thick - I'm quite happy then that I managed to do it :slight_smile:

Short instructions for those following in future

Register a username on www.npmjs.com

On command line/terminal - go into the folder your node package is in

Do

npm login

and follow the instructions

then do

npm publish --access public

This is what worked for me

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.