node library project template

Usage no npm install needed!

<script type="module">
  import ahmadnassriTemplateJsLib from 'https://cdn.skypack.dev/@ahmadnassri/template-js-lib';


JavaScript Library Template

Universal JavaScript library project template

license release super linter test semantic


CI Automation

Using GitHub Actions

Local Automation

Using Docker Compose


GitHub Templates

Automated through @ahmadnassri/action-template-repository-sync

  1. create a repository from the template
  2. clone locally
  3. add secrets in GitHub Actions for NPM_TOKEN & GH_TOKEN
  4. update colophon.yml, docs/README.md with info about the project

GH_TOKEN is required for action auto-merge, readme, release workflows

Local Automation

use Docker Compose to run tasks locally:

  • docker-compose run readme to regenerate README.md
  • docker-compose run test to run tests across all LTS versions of Node.js
  • docker-compose run lint to execute super-linter locally

Your main README.md file is in docs/README.md, the file at root is generated using pandoc using the provided template.

You should run docker-compose run readme after any change to docs/README.md and before commit / push


npm install template-js-lib


import * as Lib from '@ahmadnassri/template-js-lib'

Lib() // returns "hello world"


const Lib = require('@ahmadnassri/template-js-lib')

Lib() // returns "hello world"


<script src="https://unpkg.com/@ahmadnassri/template-js-lib@latest/dist/index.umd.js">// UMD bundle</script>
<script type="module" src="https://unpkg.com/@ahmadnassri/template-js-lib@latest/dist/index.module.mjs">// ESM bundle</script>
<script type="module" src="https://unpkg.com/@ahmadnassri/template-js-lib@latest/dist/index.modern.mjs">// ESM for modern browsers</script>

Author: Ahmad Nassri • Twitter: @AhmadNassri