Skip to content

Commit c30eebb

Browse files
committed
cleanup
1 parent 668e206 commit c30eebb

File tree

6 files changed

+55
-43
lines changed

6 files changed

+55
-43
lines changed

.github/workflows/lint-and-test.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
node-version: ${{ matrix.nodejs }}
1919

2020
- run: yarn install
21-
- run: yarn lint
21+
- run: yarn add -D esbuild
2222
- run: yarn test
23-
- run: yarn build
23+
- run: yarn lint
24+
- run: yarn build-all

.gitlab-ci.yml

+13-12
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ lint-and-test:
1212
stage: test
1313
script:
1414
- yarn install
15-
- yarn build
15+
- yarn add -D esbuild
1616
- yarn test
1717
- yarn lint
18+
- yarn build-all
1819

1920
# Deploy docs to Gitlab pages
20-
# pages:
21-
# stage: deploy
22-
# only:
23-
# - master
24-
# script:
25-
# - yarn install
26-
# - yarn docs
27-
# - mv docs public
28-
# artifacts:
29-
# paths:
30-
# - public
21+
pages:
22+
stage: deploy
23+
only:
24+
- master
25+
script:
26+
- yarn install
27+
- yarn docs
28+
- mv docs public
29+
artifacts:
30+
paths:
31+
- public

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
coverage
1010
*.log
11+
.gitlab-ci.yml
1112

1213
package-lock.json
1314
/*.tgz

README.md

+35-27
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,33 @@
1-
# TypeScript Project Boilerplate
1+
# TypeScript Boilerplate for 2021
22

3-
TypeScript project with modern tooling (March 2021) to get started quickly and right-footed. Ideal for quick projects as well as npm packages.
3+
[![Build and test status](https://github.com/metachris/typescript-boilerplate/workflows/Lint%20and%20test/badge.svg)](https://github.com/metachris/micropython-ctl/actions?query=workflow%3A%22Build+and+test%22)
44

5-
Batteries included:
5+
Get started quickly and right-footed
66

7-
* TypeScript 4, optionally [esbuild](https://esbuild.github.io/)
7+
TypeScript project boilerplate with modern tooling, targetting for Node.js and browser.
8+
9+
* [TypeScript](https://www.typescriptlang.org/) 4
10+
* Optionally [esbuild](https://esbuild.github.io/) - to bundle for browsers and Node.js
811
* Linting with [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) ([tslint](https://palantir.github.io/tslint/) is deprecated)
9-
* Tests with [Jest](https://jestjs.io/docs/getting-started) (and [ts-jest](https://www.npmjs.com/package/ts-jest))
10-
* CI for testing and linting ([GitHub Actions](https://docs.github.com/en/actions) / [Gitlab CI](https://docs.gitlab.com/ee/ci/))
11-
* Automatic API documentation with [typedoc](https://typedoc.org/guides/doccomments/)
12-
* Building a browser-compatible module with [esbuild](https://esbuild.github.io/) or [webpack](https://webpack.js.org/)
12+
* Testing with [Jest](https://jestjs.io/docs/getting-started) (and [ts-jest](https://www.npmjs.com/package/ts-jest))
13+
* Publishing to npm
14+
* Continuous integration ([GitHub Actions](https://docs.github.com/en/actions) / [GitLab CI](https://docs.gitlab.com/ee/ci/))
15+
* Automatic API documentation with [TypeDoc](https://typedoc.org/guides/doccomments/)
1316

14-
See also the [introduction blog post](https://www.metachris.com/2021/03/bootstrapping-a-typescript-node.js-project/).
17+
See also the introduction blog post: [Starting a TypeScript Project in 2021](https://www.metachris.com/2021/03/bootstrapping-a-typescript-node.js-project/).
1518

1619

1720
## Getting Started
1821

1922
* Clone the repository (you can also click "Use this template")
2023
* Edit `package.json` and `tsconfig.json` to your liking
2124
* Now you can run `yarn run`, `yarn lint`, `yarn test`, `yarn build` and `yarn ts-node <filename>`.
25+
* Take a look at all the scripts in [`package.json`](https://github.com/metachris/typescript-boilerplate/blob/master/package.json)
2226
* For publishing to npm, use `yarn publish` (or `npm publish`)
2327

24-
### Want documentation, published to GitHub or GitLab pages?
25-
26-
You can auto-generate API documentation from the TyoeScript source files using [typedoc](https://typedoc.org/guides/doccomments/). The generated documentation can be published to GitHub / GitLab pages through the CI:
28+
## esbuild
2729

28-
* Install [typedoc](https://typedoc.org/guides/doccomments/): `yarn add -D typedoc`
29-
* Add `docs` script to `package.json`: `"docs": "typedoc --entryPoints src/main.ts"`
30-
* You can now generate the documentation with `yarn docs`. The resulting HTML is saved in `docs/`.
31-
* Publish to pages through CI:
32-
* [GitHub pages](https://pages.github.com/): uncomment content of `.github/workflows/deploy-gh-pages.yml` and enable pages in GitHub repo settings
33-
* [GitLab pages](https://docs.gitlab.com/ee/user/project/pages/): uncomment deploy task in `.gitlab-ci.yml`
34-
35-
### esbuild
36-
37-
You can use [esbuild](https://esbuild.github.io/) instead of the default TypeScript compiler (`tsc`) to build and bundle the output for node and browsers.
30+
You can use [esbuild](https://esbuild.github.io/) to bundle for browsers (and Node.js if you want).
3831
`esbuild` is an extremely fast bundler that supports a [large part of the TypeScript syntax](https://esbuild.github.io/content-types/#typescript).
3932

4033
```bash
@@ -45,23 +38,38 @@ yarn add -D esbuild
4538
./node_modules/.bin/esbuild src/cli.ts --bundle --platform=node --outfile=dist/esbuild/cli.js
4639

4740
# Build for browsers
48-
./node_modules/.bin/esbuild src/browser.ts --bundle --outfile=dist/browser.js
41+
./node_modules/.bin/esbuild src/browser.ts --bundle --outfile=dist/esbuild/browser.js
4942
```
5043

44+
You can build everything with `yarn build`. Read more about the esbuild setup [here](TODO).
45+
46+
## Documentation, published to GitHub or GitLab pages
47+
48+
You can auto-generate API documentation from the TyoeScript source files using [typedoc](https://typedoc.org/guides/doccomments/). The generated documentation can be published to GitHub / GitLab pages through the CI:
49+
50+
* Install [typedoc](https://typedoc.org/guides/doccomments/): `yarn add -D typedoc`
51+
* Add `docs` script to `package.json`: `"docs": "typedoc --entryPoints src/main.ts"`
52+
* You can now generate the documentation with `yarn docs`. The resulting HTML is saved in `docs/`.
53+
* Publish to pages through CI:
54+
* [GitHub pages](https://pages.github.com/): uncomment content of `.github/workflows/deploy-gh-pages.yml` and enable pages in GitHub repo settings
55+
* [GitLab pages](https://docs.gitlab.com/ee/user/project/pages/): uncomment deploy task in `.gitlab-ci.yml`
56+
57+
For example the documentation for this project: https://metachris.github.io/typescript-boilerplate/
58+
5159
## References
5260

53-
* [Blog post: Starting a TypeScript Project in 2021](https://www.metachris.com/2021/03/bootstrapping-a-typescript-node.js-project/)
61+
* **[Blog post: Starting a TypeScript Project in 2021](https://www.metachris.com/2021/03/bootstrapping-a-typescript-node.js-project/)**
5462
* [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
55-
* [esbuild docs](https://esbuild.github.io/)
5663
* [tsconfig docs](https://www.typescriptlang.org/tsconfig)
64+
* [esbuild docs](https://esbuild.github.io/)
5765
* [typescript-eslint docs](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md)
5866
* [Jest docs](https://jestjs.io/docs/getting-started)
5967
* [GitHub Actions](https://docs.github.com/en/actions), [GitLab CI](https://docs.gitlab.com/ee/ci/)
6068

6169

6270
## Feedback
6371

64-
Please post your feedback and/or ideas:
72+
Reach out with feedback and ideas:
6573

6674
* [twitter.com/metachris](https://twitter.com/metachris)
67-
* [Create a new issue](https://github.com/metachris/typescript-nodejs-boilerplate/issues)
75+
* [Create a new issue](https://github.com/metachris/typescript-boilerplate/issues)

browser-test.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html>
22
<head>
33
<script src="./dist/esbuild/browser.js"></script>
4+
<!-- <script src="https://cdn.jsdelivr.net/npm/typescript-boilerplate-2021"></script> -->
45
</head>
56
<body>
67
Open the devtools 👇

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.3.0",
44
"description": "Boilerplate for a TypeScript library",
55
"author": "Chris Hager <chris@linuxuser.at>",
6-
"repository": "https://github.com/metachris/typescript-nodejs-boilerplate",
6+
"repository": "https://github.com/metachris/typescript-boilerplate",
77
"license": "MIT",
88
"main": "./dist/tsc/main.js",
99
"types": "./dist/tsc/main.d.ts",
@@ -12,7 +12,7 @@
1212
"my-cli-tool": "./dist/esbuild/cli.js"
1313
},
1414
"scripts": {
15-
"start": "ts-node src/main.ts",
15+
"cli": "ts-node src/cli.ts",
1616
"lint": "eslint src/ --ext .js,.jsx,.ts,.tsx",
1717
"test": "jest",
1818
"clean": "rm -rf dist build package",

0 commit comments

Comments
 (0)