1.0.5 • Published 5 years ago
@ahmadnassri/template-js-lib v1.0.5
JavaScript Library Template
Universal JavaScript library project template
Features
CI Automation
Using GitHub Actions
- automatic releases with conventional-commits & semantic-release
- publish to both npm Public Registry & GitHub Package Manager
- full history changelog in GitHub Releases
- automatic pull-requests for dependency updates using dependabot
- automatic merging of "patch" updates to dependencies using dependabot-auto-merge
- lint everything with super-linter
- lint commit message format against Conventional Commits
- test on all LTS versions of Node.js + Headless browsers (Chromium, Safari, Firefox)
- run
npm auditbefore releasing / testing to keep a higher security standard - generate universal JavaScript outputs using Microbundle
- unit testing & code coverage with Tap
- browser testing with Playwright
Local Automation
Using Docker Compose
- lint everything with super-linter
- test on all LTS versions of Node.js
- generate README using pandoc with a template
Usage
GitHub Templates
Automated through
@ahmadnassri/action-template-repository-sync
- create a repository from the template
- clone locally
- add secrets in GitHub Actions for
NPM_TOKEN&GH_TOKEN - update
colophon.yml,docs/README.mdwith info about the project
Note:
GH_TOKENis required for actionauto-merge,readme,releaseworkflows
Local Automation
use Docker Compose to run tasks locally:
docker-compose run readmeto regenerateREADME.mddocker-compose run testto run tests across all LTS versions of Node.jsdocker-compose run lintto execute super-linter locally
Note:
Your mainREADME.mdfile is indocs/README.md, the file at root is generated using pandoc using the provided template.You should run
docker-compose run readmeafter any change todocs/README.mdand before commit / push
Install
npm install template-js-libImport
import * as Lib from '@ahmadnassri/template-js-lib'
Lib() // returns "hello world"Require
const Lib = require('@ahmadnassri/template-js-lib')
Lib() // returns "hello world"Browser
<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