Skip to content

Commit d1bf603

Browse files
author
Beniamin Dudek
committed
Initial version of the template
1 parent 743f769 commit d1bf603

12 files changed

+2260
-23
lines changed

.eslintrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended"
5+
],
6+
"rules": {
7+
"indent": ["error", 2],
8+
"quotes": ["error", "single"],
9+
"semi": ["error", "always"],
10+
"no-empty": "off",
11+
"no-cond-assign": ["error", "always"]
12+
}
13+
}

.github/workflows/build-check.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Test and Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
checks: write
10+
contents: write
11+
12+
jobs:
13+
run-tests:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: '18.x'
25+
26+
- name: Install pnpm
27+
run: npm install -g pnpm
28+
29+
- name: Cache dependencies
30+
uses: actions/cache@v2
31+
with:
32+
path: ~/.pnpm-store
33+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pnpm-
36+
37+
- name: Install dependencies
38+
run: pnpm install
39+
40+
- name: Run tests
41+
run: pnpm test
42+
43+
- name: Build project
44+
run: pnpm build

.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

LICENSE

-21
This file was deleted.

README.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
1-
# clean-node-package-typescript
2-
A simple and clean template for creating Node packages using TypeScript, Vite, ESLint, Vitest
1+
# Clean Node Package with TypeScript Template
2+
3+
This template provides a concise and efficient foundation for crafting a Node.js package. It seamlessly integrates:
4+
- **TypeScript** for robust type safety
5+
- **Vite 4** for optimal bundling
6+
- **Vitest** for comprehensive testing
7+
- **ESLint** for consistent code quality
8+
9+
Furthermore, a built-in GitHub Actions workflow ensures quality control for every pull request targeting the `main` branch. While this workflow doesn't publish or store any artifacts, it serves as a robust foundation for pull request validation.
10+
11+
## Usage
12+
13+
Though this project has been initialized using [pnpm](https://pnpm.io/), you're welcome to utilize your preferred package manager.
14+
15+
| Pnpm command | Npm command | Description |
16+
| ------------------------------------- | ------------------------- |
17+
| `pnpm install` | `npm install` | Install dependencies |
18+
| `pnpm test` | `npm test` | Execute tests |
19+
| `pnpm test:watch` | `npm test:watch` | Run tests in watch mode |
20+
| `pnpm build` | `npm build` | Build the package |
21+
22+
By default, the package is configured to build to the `dist` folder. If you wish to modify this, adjustments can be made in the `vite.config.ts` file. Additionally, type definitions are included in the build, ensuring compatibility with other TypeScript projects.

package.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "clean-node-package-typescript",
3+
"private": false,
4+
"version": "1.0.0",
5+
"description": "A simple template for creating a Node.js package with TypeScript, Vite, Vitest and ESLint",
6+
"homepage": "https://github.com/Xkonti/clean-node-package-typescript#readme",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/Xkonti/clean-node-package-typescript.git"
10+
},
11+
"keywords": [
12+
"typescript",
13+
"vite",
14+
"vitest",
15+
"eslint",
16+
"template"
17+
],
18+
"author": "Beniamin (Xkonti) Dudek <[email protected]>",
19+
"bugs": {
20+
"url": "https://github.com/Xkonti/clean-node-package-typescript/issues"
21+
},
22+
"type": "module",
23+
"main": "./dist/clean-node-package-typescript.umd.cjs",
24+
"module": "./dist/clean-node-package-typescript.js",
25+
"types": "./dist/index.d.ts",
26+
"exports": {
27+
".": {
28+
"import": "./dist/clean-node-package-typescript.js",
29+
"require": "./dist/clean-node-package-typescript.umd.cjs"
30+
}
31+
},
32+
"files": [
33+
"dist"
34+
],
35+
"scripts": {
36+
"build": "tsc && vite build",
37+
"test": "vitest run",
38+
"test:watch": "vitest watch",
39+
"coverage": "vitest run --coverage"
40+
},
41+
"devDependencies": {
42+
"@types/node": "^20.4.5",
43+
"@typescript-eslint/eslint-plugin": "^6.2.1",
44+
"@typescript-eslint/parser": "^6.2.1",
45+
"eslint": "^8.46.0",
46+
"typescript": "^5.1.6",
47+
"vite": "^4.4.7",
48+
"vite-plugin-dts": "^3.4.0",
49+
"vite-plugin-eslint": "^1.8.1",
50+
"vitest": "^0.33.0"
51+
}
52+
}

0 commit comments

Comments
 (0)