Another boilerplate for ts projects, especifically to ts npm packages
A boiler plate that allow to generate TS hybrid packages with mjs
and cjs
Simply run npm run build
and hybrid package will be generate
NOTE: Files under ./mjs will be reemplace lines with ".class" to ".class.js" to be compatible with browsers
For mjs
with mjs-formatter.sh
all is OK because exists top level await.
Check index.ts to find out that import is with .js
instead of file without extension
For cjs
the process is to remove with cjs-formatter
all top level awaits from index.js
and use an eval to perform a require
As mjs
find out that require is with .js
npm i ts-hybrid-boilerplate
import { HelloWorld } from 'ts-hybrid-boilerplate';
const { HelloWorld } = require('ts-hybrid-boilerplate');
At this moment package support github
and gitlab
CI/CD
Configure env vars to handle it.
NPM_TOKEN
: Allow to deploy tonpmjs.com
configure.npmrc
to push package to another package repositoryGH_TOKEN
: Allow to modify repository to add tags with releases (GITHUB
)GITLAB_TOKEN
: Allo to modify repository to add tags with releases (GITLAB
)
Below it uses semantic-release so the semantic-release guide is: https://github.com/semantic-release/semantic-release