Code Monkey home page Code Monkey logo

test-node-library's Introduction

Template ESM Typescript library

A template used for projects which produce both CommonJS and ESM packages from a common Typescript ESM codebase.

Includes testing, coverage, coveralls.io, linting, TSDoc and auto creation of a package on creating a github release.

If you are creating a new project from this template, instructions are here.

Typescript Node.js CI Node.js CI Coverage Status

Install

This is a github hosted package so you need to add an entry to your .npmrc file so the package manager knows where to download the package from:

@x-ware-ltd:registry=https://npm.pkg.github.com

Then:

> npm install @gilbertbw/test-node-library

If the package is private you need to authenticate to github by getting a Personal Access Token from github with read:packages permissions. Either login for the session, which will request your github username, and password (use your Personal Access Token):

> npm login --scope=@x-ware-ltd --registry=https://npm.pkg.github.com

Or, create a personal .npmrc file in your home directory:

//npm.pkg.github.com/:_authToken=aaa_abcDeFghIjklMNopqRSTuvWXYz

If you are running CI/CD on your package you will need to provide credentials for the server. Save a Personal Access Token in your Github secrets and in your github actions:

- name: Authenticate private github packages
  run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.PACKAGE_READ_TOKEN }}" > ~/.npmrc

Features

  • Works with CommonJS and ESM
  • Provides Typescript types

Usage

ESM:

import {add} from '@gilbertbw/test-node-library';

console.log(add(3, 5)); // 8

CommonJS:

var lib = require('@gilbertbw/test-node-library');

console.log(lib.add(3, -1)); // 2

API Reference

Documentation for add and subtract methods can be found in TSDoc for each

Contributing

Make sure your code passes testing, and create a Pull Request

> npm test

test-node-library's People

Contributors

gilbertbw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.