.Net application development specialists
asp.net, c#, vb.net, html, javascript, jquery, html, xhtml, css, oop, design patterns, sql server, mvc and much more
contact: admin@paxium.co.uk

Paxium is the company owned by myself, Dave Amour and used for providing IT contract development services including


  • Application development - Desktop, Web, Services - with Classic ASP, Asp.net WebForms, Asp.net MVC, Asp.net Core
  • Html, Css, JavaScript, jQuery, React, C#, SQL Server, Ado.net, Entity Framework, NHibernate, TDD, WebApi, GIT, IIS
  • Database schema design, implementation & ETL activities
  • Website design and hosting including email hosting
  • Training - typically one to one sessions
  • Reverse Engineering and documentation of undocumented systems
  • Code Reviews
  • Performance Tuning
  • Located in Cannock, Staffordshire
Rugeley Chess Club Buying Butler Cuckooland Katmaid Pet Sitting Services Roland Garros 60 60 Golf cement Technical Conformity Goofy MaggieBears Vacc Track Find Your Smart Phone eBate Taylors Poultry Services Lafarge Rebates System Codemasters Grid Game eBate DOFF

Create And Publish An npm Package

I have been learning React recently. I already have some Angular experience and 26 years of HTML, CSS & JavaScript. Whilst doing this I learned that you can publish and consume an npm package in less than half an hour. The following are my notes and instructions if you want to have a go yourself.

1) Sign up & login to npm at www.npmjs.com

npm login

2) Create the project

mkdir paxium-tools
cd paxium-tools

3) Initialize the package

npm init -y

4) Add code: index.js

function capitalize(str) {
    if (!str) return "";
    return str.charAt(0).toUpperCase() + str.slice(1);
}

function reverse(str) {
    return str.split("").reverse().join("");
}

function truncate(str, length) {
    if (str.length <= length) return str;
    return str.slice(0, length) + "...";
}

module.exports = { capitalize, reverse, truncate };

5) Add README.md

Include features, install instructions, and usage examples. npm renders this on the package page.

6) Configure package.json

{
    "name": "paxium-tools",
    "version": "1.0.1",
    "description": "A lightweight utility library with simple string functions for everyday use.",
    "main": "index.js",
    "files": ["index.js", "README.md"],
    "keywords": ["string", "utility", "capitalize", "reverse", "truncate"],
    "author": "Dave Amour",
    "license": "MIT"
}
Tip: Before publishing, preview contents with npm pack --dry-run.

7) Publish

npm publish

After publishing you can view this at https://www.npmjs.com/package/paxium-tools

For updates, just increase the version number in packages.json
(which was created when we did npm init -y) and do npm publish again

8) Test in a React app

npm install paxium-tools
import { capitalize, reverse, truncate } from "paxium-tools";

console.log(capitalize("react"));     // React
console.log(reverse("hello"));        // olleh
console.log(truncate("abcdefghij",5)); // abcde...

9) View via unpkg

https://unpkg.com/paxium-tools@1.0.1/index.js
https://unpkg.com/paxium-tools@1.0.1/README.md
https://unpkg.com/paxium-tools@1.0.1/package.json

Lessons Learned

  • Keep index.js, package.json, and README.md in the project root.
  • Always bump version before republishing.
  • Use npm pack --dry-run to check contents.
  • A good README makes your package approachable and professional.