@platform/ts
v4.7.7
Published
TypesScript build, prepare and publish toolchain.
Downloads
133
Readme
ts
TypesScript build, prepare and publish toolchain.
Provides:
- Command line for building, linting, preparing for publish and ultimately publishing.
- Produces CommonJS and modern ESM transpiled builds.
- Publishes to NPM from the distribution older, removing unnecesary pathing into the module from consumers (eg. '@my-modules/lib/...` is avoided).
Commands
Adds the ts
command to your module's bin
. You can optionally use the following scripts in you package.json
:
{
"scripts: {
"test": "ts test",
"tdd": "ts test --watch",
"lint": "ts lint",
"build": "ts build",
"prepare": "ts prepare",
}
}
To build without ESM module compilation:
{
"scripts: {
"build": "ts build --no-esm",
}
}
ESModules
When setting the main
of package.json make sure to not include the .js
file extensions allowing environments that as using ESModule's to infer the .msj
version.
{
"name": "my-module",
"main": "index",
"types": "index.d.ts"
}
References:
- ECMAScript Modules (ESM)
- Using JavaScript modules on the web - Google/Primer
- ECMAScript modules in Node.js: the new plan - December 2018
- ES6 Modules Today With TypeScript - recipe used.