# Updating info on forked node

**URL:** <https://discourse.nodered.org/t/updating-info-on-forked-node/81487>\
**Category:** Developing Nodes\
**Created:** [22 September 2023 08:22 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487 "2023-09-22T08:22:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [22 September 2023 08:22 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/1 "2023-09-22T08:22:23Z")

</div>

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

```auto
  "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?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 September 2023 08:38 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/2 "2023-09-22T08:38:18Z")

</div>

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](https://nodered.org/docs/creating-nodes/packaging#naming)

Definitely update `repository.url` to point to your fork

Definitely increase the `version` number in line with [Semantic Versioning](https://semver.org/).

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.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [22 September 2023 08:43 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/3 "2023-09-22T08:43:43Z")

</div>

> [@Steve-Mcl](#):
>
> Change any "string" right of a colon `:` to the value you desire.

I know I'm not the brightest but come on! 🙂

> [@Steve-Mcl](#):
>
> Lastly, I would (but many don't) update the package and readme to tip a nod to the original author.

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?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 September 2023 08:48 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/4 "2023-09-22T08:48:51Z")

</div>

> [@cymplecy](#):
>
> > [@Steve-Mcl](#):
> >
> > Change any "string" right of a colon `:` to the value you desire.
> 
> I know I'm not the brightest but come on! 🙂

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

> [@cymplecy](#):
>
> > [@Steve-Mcl](#):
> >
> > Lastly, I would (but many don't) update the package and readme to tip a nod to the original author.
> 
> 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"?

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

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

```

> [@cymplecy](#):
>
> And what about version number - would it be OK to set mine to 1.0.0?

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](https://kevinkreuzer.medium.com/publishing-a-beta-or-alpha-version-to-npm-46035b630dd7)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [22 September 2023 12:04 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/5 "2023-09-22T12:04:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 September 2023 12:47 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/6 "2023-09-22T12:47:06Z")

</div>

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. ☹

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [22 September 2023 12:49 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/7 "2023-09-22T12:49:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [22 September 2023 12:58 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/8 "2023-09-22T12:58:42Z")

</div>

Short instructions for those following in future

Register a username on [www.npmjs.com](http://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

```auto
npm publish --access public

```

This is what worked for me

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 October 2023 12:58 UTC](https://discourse.nodered.org/t/updating-info-on-forked-node/81487/9 "2023-10-06T12:58:49Z")

</div>

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