Skip to content

Commit 8476cbc

Browse files
authored
Initial commit
0 parents  commit 8476cbc

12 files changed

+195
-0
lines changed

.editorconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# based on Sindre Sorhus `node-module-boilerplate`:
2+
# https://github.com/sindresorhus/node-module-boilerplate/blob/9b8dc81a35acfbd3b75f7f19c9679e4f83b36df3/.gitattributes
3+
* text=auto eol=lf

.github/workflows/main.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
test:
7+
name: Node.js ${{ matrix.node-version }}
8+
runs-on: ubuntu-latest
9+
strategy:
10+
# `fail-fast` is set to `false` because we won't know which Node versions are failing and which are passing
11+
fail-fast: false
12+
matrix:
13+
# https://nodejs.dev/en/about/releases/
14+
node-version:
15+
- 18
16+
- 20
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- run: yarn install
23+
- run: yarn test

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
coverage/
3+
4+
# as Sindre Sorhus
5+
yarn.lock
6+
7+
*.js
8+
*.d.ts

.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# for open-source libraries — don't use a lock file
2+
# - 😃 as Sindre Sorhus
3+
package-lock=false

index.ts

Whitespace-only changes.

license

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Antonio Stoilkov hello@astoilkov.com https://astoilkov.com
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

package.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "{{data.name}}",
3+
"version": "0.0.0",
4+
"description": "{{data.description}}",
5+
"license": "MIT",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/astoilkov/{{data.name}}"
9+
},
10+
"funding": "https://github.com/sponsors/astoilkov",
11+
"author": {
12+
"name": "Antonio Stoilkov",
13+
"email": "hello@astoilkov.com",
14+
"url": "https://astoilkov.com"
15+
},
16+
"keywords": [
17+
"{{data.keywords}}"
18+
],
19+
"type": "module",
20+
"exports": {
21+
"types": "./index.d.ts",
22+
"default": "./index.js"
23+
},
24+
"sideEffects": false,
25+
"engines": {
26+
"node": ">=16"
27+
},
28+
"scripts": {
29+
"build": "tsc",
30+
"test": "yarn build && vitest run --coverage",
31+
"release": "yarn build && np"
32+
},
33+
"files": [
34+
"index.js",
35+
"index.d.ts",
36+
"src/**/*.js",
37+
"src/**/*.d.ts"
38+
],
39+
"devDependencies": {
40+
"@vitest/coverage-v8": "^1.4.0",
41+
"jsdom": "^24.0.0",
42+
"np": "^10.0.1",
43+
"prettier": "^3.2.5",
44+
"typescript": "^5.4.2",
45+
"vitest": "^1.4.0"
46+
}
47+
}

readme.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# `{{data.name}}`
2+
3+
> {{data.description}}
4+
5+
[![Gzipped Size](https://img.shields.io/bundlephobia/minzip/{{data.name}})](https://bundlephobia.com/result?p={{data.name}})
6+
[![Build Status](https://img.shields.io/github/actions/workflow/status/astoilkov/{{data.name}}/main.yml?branch=main)](https://github.com/astoilkov/{{data.name}}/actions/workflows/main.yml)
7+
8+
## Install
9+
10+
```bash
11+
npm install {{data.name}}
12+
```
13+
14+
## Why
15+
16+
## Usage
17+
18+
## API
19+
20+
## Alternatives
21+
22+
## Related

test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { describe, expect, test } from "vitest";
2+
3+
describe("{{data.name}}", () => {
4+
test("", () => {
5+
expect(true).toBe(true);
6+
});
7+
});

tsconfig.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2022",
4+
"module": "ES2022",
5+
6+
"esModuleInterop": true,
7+
8+
// From what I understand while reading the docs "classic" was introduced first and "classic" is by
9+
// default(except when "module": "commonjs") because of backwards compatibility.
10+
//
11+
// From the docs: "node module resolution is the most-commonly used in the TypeScript community and is
12+
// recommended for most projects."
13+
"moduleResolution": "node",
14+
15+
// the npm package include ".js" files only so we need ".d.ts" files to be generated
16+
"declaration": true,
17+
18+
// - ℹ️ https://www.typescriptlang.org/tsconfig#isolatedModules
19+
// - 😃 Deno requires "isolatedModules" to be set to `true`
20+
// - 😃 the stricter version - I always prefer the stricter version
21+
// - 😃 probably the future
22+
"isolatedModules": true,
23+
24+
// strict options ensuring more stable code
25+
"strict": true,
26+
"noUnusedLocals": true,
27+
"noUnusedParameters": true,
28+
"allowUnreachableCode": false,
29+
"noUncheckedIndexedAccess": true,
30+
"noFallthroughCasesInSwitch": true,
31+
"exactOptionalPropertyTypes": true,
32+
"forceConsistentCasingInFileNames": true
33+
},
34+
"include": ["index.ts"]
35+
}

vitest.config.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
test: {
5+
// run tests on root and in /test folder with .ts and .tsx extensions
6+
include: ["./test.ts?(x)", "./test/**/**.ts?(x)"],
7+
8+
// restores original implementation (after each test is finished) when calling
9+
// `jest.spyOn()` inside of a test: https://vitest.dev/config/#restoremocks
10+
restoreMocks: true,
11+
12+
// adds jsdom (https://github.com/jsdom/jsdom) APIs to tests
13+
environment: "jsdom",
14+
},
15+
});

0 commit comments

Comments
 (0)