@nartallax/ts-build-utils
v1.2.7
Published
A collection of utility scripts for automating build process of TypeScript projects.
Readme
@nartallax/ts-build-utils
A collection of utility scripts that help with build process of TypeScript projects.
Powered by ESBuild, @chialab/esbuild-html-plugin, dts-bundle-generator and more.
Install
npm install --save-dev @nartallax/ts-build-utilsUse
// Main entrypoint of this package is buildUtils function:
import {buildUtils} from "@nartallax/ts-build-utils"
// This function accepts parameters describing your project
// and creates a bunch of other functions
// (not everything listed here, be sure to check typedefs):
const {
clear,
build,
runTests,
copyToTarget,
npm,
serve
} = buildUtils({
buildOptions: {
entryPoints: ["./src/index.html"]
}
})
// buildUtils() assumes a lot of stuff,
// like that project has tsconfig.json,
// and that tsconfig.json has rootDir set;
// this may not always be true, but that's checked,
// so if something is not there - the script will tell you.
// also override options are there for almost everything;
// you can pass various options to most util functions.
// after acquiring the utils, you may use them to describe your build process:
await clear()
switch(process.argv[2]){
case "dev": {
await serve()
} break
case "test": {
await runTests({nameFilter: process.argv[3]})
} break
case "publish": {
await build()
await copyToTarget("README.md", "LICENSE", "package.json")
await npm.publish({dryRun: true})
}
}Development
# clone the repo
git clone ssh://[email protected]:nartallax/ts-build-utils
# get into repo's dir
cd ts-build-utils
# set up signing
# also, make sure that `git config --get user.email` is equal to your email in forgejo
git config gpg.format ssh
git config user.signingKey "~/.ssh/id_rsa"
# this one is optional. forgejo will show commits as signed without this step
# but git can panic about missing keys sometimes
echo "$(git config --get user.email) namespaces=\"git\" $(cat ~/.ssh/id_rsa.pub)" >> allowed_signers
git add . && git commit -m "Add new key to allowed_signers" && git push
# enable signing by default
git config commit.gpgsign true