@shirtiny/ts-lib-template
Version:
ts-lib-template desc
93 lines (66 loc) • 1.58 kB
Markdown
> [Ts-lib-template](https://github.com/Shirtiny/ts-lib-template) A starter template for typescript library.
```shell
yarn
yarn build
make version
make publish
yarn start
```
This is a template for typescript library base on esbuild. This template includes followings:
- TypeScript
- Esbuild
- Makefile
- Dev server
- Env
- Prettier
- Eslint
- Jest
- Sass/scss & Autoprefixer
- Github action
Create your repository by clicking 'Use this template' top of the page. Then, check the package.json file.
```js
// .sh.js
const { MY_ENV, PORT, NODE_ENV, npm_package_name } = process.env;
// the customized ENV, just pick what you need
const env = {
MY_ENV,
PORT,
NODE_ENV,
npm_package_name,
};
module.exports = {
// your lib global name
globalName: "tsLibTemplate",
// the output prefix name, default is 'main', please check your package.json after this option changed.
outputFileName: "main",
// devServer option
devServer: {
host: HOST || "localhost",
port: PORT || 2021,
proxy: {
"^/api": {
target: "http://192.168.0.123:1234",
pathRewrite: { "^/api": "" },
},
},
},
// jsx options direct set to esbuild
jsxFactory: "React.createElement",
jsxFragment: "React.Fragment",
// if env is false, default is all process env
env,
};
```
[](https://github.com/raulanatol/template-ts-package)
The MIT License (MIT)