mw-username-generator

1.1.1 • Public • Published

Username Generator

NPM

Introduction

A project to learn how to publish a package on npm. Should be accessible on CLI, Node and on client-size via npm installation or CDN.

Username are created from a random adjective and noun

Output examples

DoubtfulPomegranate
ConcernedKiosk
SuccessfulShout
TastyWit

Installation

npm install mw-username-generator

Usage - Node

const userNameGenerator = require('mw-username-generator');
console.log(userNameGenerator()); //Display a random username

Usage - Browser

You can install and use directly from your working directory or through the following CDN :

UNPKG

<script src='https://unpkg.com/mw-username-generator'></script>

JSDelivr

<script src='https://cdn.jsdelivr.net/npm/mw-username-generator/dist/namegenerator.bundle.min.js'></script>

Access through CDN or local link will create a usernameGenerator function accesible in your script.

Usage - CLI

On your favorite CLI :

npx rand-username

or if package installed globaly

rand-username

Build

To have a working solution on Node and in browser I've used webpack to transpile and bundle my JS files and convert my CJS module to UMD, the following webpack config was used :

const path = require("path");

module.exports = {
  entry: "./namegenerator.js",
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "namegenerator.bundle.js",
    library: {
      type: "umd", 
      name: "usernameGenerator", //  export name after bundling
    },
    globalObject: "this",
  },
};

Readme

Keywords

Package Sidebar

Install

npm i mw-username-generator

Weekly Downloads

2

Version

1.1.1

License

ISC

Unpacked Size

67.3 kB

Total Files

4

Last publish

Collaborators

  • maitre-pangolin