Skip to content

Commit 4986aa2

Browse files
feat: added setup script (#82)
* feat: added setup script * Also remove setup script * cspell ignore * Fix a bit of linting
1 parent 8df8c35 commit 4986aa2

11 files changed

+1761
-3512
lines changed

.all-contributorsrc

-46
This file was deleted.

.all-contributorsrc.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"commit": false,
3+
"commitConvention": "angular",
4+
"contributors": [
5+
{
6+
"avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4",
7+
"contributions": [
8+
"bug",
9+
"code",
10+
"content",
11+
"example",
12+
"ideas",
13+
"infra",
14+
"maintenance",
15+
"platform",
16+
"projectManagement",
17+
"review",
18+
"security",
19+
"tool",
20+
"test"
21+
],
22+
"login": "JoshuaKGoldberg",
23+
"name": "Josh Goldberg",
24+
"profile": "http://www.joshuakgoldberg.com"
25+
},
26+
{
27+
"login": "sinchang",
28+
"name": "Jeff Wen",
29+
"avatar_url": "https://avatars.githubusercontent.com/u/3297859?v=4",
30+
"profile": "https://sinchang.me",
31+
"contributions": ["tool"]
32+
}
33+
],
34+
"contributorsPerLine": 7,
35+
"files": ["README.md"],
36+
"imageSize": 100,
37+
"projectName": "template-typescript-node-package",
38+
"projectOwner": "JoshuaKGoldberg",
39+
"repoHost": "https://github.com",
40+
"repoType": "github",
41+
"skipCi": true
42+
}

.eslintrc.cjs

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
module.exports = {
2+
env: {
3+
es2022: true,
4+
node: true,
5+
},
26
extends: [
37
"eslint:recommended",
48
"plugin:eslint-comments/recommended",
@@ -52,9 +56,13 @@ module.exports = {
5256
],
5357
root: true,
5458
rules: {
59+
// These off-by-default rules work well for this repo and we like them on.
5560
"deprecation/deprecation": "error",
5661
"no-only-tests/no-only-tests": "error",
5762
"simple-import-sort/exports": "error",
5863
"simple-import-sort/imports": "error",
64+
65+
// These on-by-default rules don't work well for this repo and we like them off.
66+
"no-inner-declarations": "off",
5967
},
6068
};

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.vscode/
33
*.test.*
44
coverage/
5+
pnpm-lock.yaml

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
dist/
1+
dist/
2+
pnpm-lock.yaml

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,36 @@
2424
<img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />
2525
</p>
2626

27+
## Explainer
28+
29+
This template is available for anybody who wants to set up a basic Node application using TypeScript.
30+
It sets up the following tooling for you:
31+
32+
- [**ESLint**](https://eslint.org): Static analysis for JavaScript code, configured with [typescript-eslint](https://typescript-eslint.io) for TypeScript code and other general-use plugins.
33+
- [**Markdownlint**](https://github.com/DavidAnson/markdownlint): Static analysis for Markdown code.
34+
- [**pnpm**](https://pnpm.io): Desk-efficient package manager alternative.
35+
- [**Prettier**](https://prettier.io): Opinionated formatting for code, run on file save and as a Git commit hook via [husky](https://typicode.github.io/husky) and [lint-staged](https://github.com/okonet/lint-staged).
36+
- [**ts-prune**](https://github.com/nadeesha/ts-prune): Unused exports detection for TypeScript code.
37+
- [**TypeScript**](https://typescriptlang.org): A typed superset of JavaScript, configured with strict compiler options.
38+
- [**Vitest**](https://vitest.dev): Fast unit tests, configured with coverage tracking.
39+
40+
## Setup
41+
42+
First make sure you have the following installed:
43+
44+
- [GitHub CLI](https://cli.github.com) _(you'll need to be logged in)_
45+
- [Node.js](https://nodejs.org)
46+
- [pnpm](https://pnpm.io)
47+
48+
To use this template:
49+
50+
1. Click the [_Use this template_](https://github.com/JoshuaKGoldberg/template-typescript-node-package/generate) button to create a new repository with the same Git history
51+
2. Open that repository, such as by [cloning it locally](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) or [developing in a codespace](https://docs.github.com/en/codespaces/developing-in-codespaces/developing-in-a-codespace)
52+
3. `pnpm install`
53+
4. `pnpm run setup`
54+
55+
> The setup script removes the `## Explainer` and `## Setup` from this README.md.
56+
2757
## Usage
2858

2959
```shell

cspell.json

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
{
22
"dictionaries": ["typescript"],
3-
"ignorePaths": [".github", "dist", "node_modules", "pnpm-lock.yaml"],
4-
"words": ["Codecov", "commitlint", "lcov"]
3+
"ignorePaths": [
4+
".github",
5+
"dist",
6+
"node_modules",
7+
"pnpm-lock.yaml",
8+
"script/*.json"
9+
],
10+
"words": [
11+
"Codecov",
12+
"codespace",
13+
"commitlint",
14+
"contributorsrc",
15+
"lcov",
16+
"wontfix"
17+
]
518
}

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@typescript-eslint/eslint-plugin": "^5.38.1",
1212
"@typescript-eslint/parser": "^5.38.1",
1313
"@vitest/coverage-c8": "^0.25.4",
14+
"chalk": "^5.1.2",
1415
"cspell": "^6.12.0",
1516
"eslint": "^8.24.0",
1617
"eslint-config-prettier": "^8.5.0",
@@ -58,6 +59,7 @@
5859
"lint:prune": "ts-prune",
5960
"lint:spelling": "cspell \"**\" \".github/**/*\"",
6061
"prepare": "husky install",
62+
"setup": "npx --yes zx --quiet script/setup.js",
6163
"test": "vitest"
6264
},
6365
"type": "module",

0 commit comments

Comments
 (0)