-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e906744
Showing
12 changed files
with
201 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# based on Sindre Sorhus `node-module-boilerplate`: | ||
# https://github.com/sindresorhus/node-module-boilerplate/blob/9b8dc81a35acfbd3b75f7f19c9679e4f83b36df3/.gitattributes | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: CI | ||
on: | ||
- push | ||
- pull_request | ||
jobs: | ||
test: | ||
name: Node.js ${{ matrix.node-version }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
# `fail-fast` is set to `false` because we won't know which Node versions are failing and which are passing | ||
fail-fast: false | ||
matrix: | ||
# https://nodejs.dev/en/about/releases/ | ||
node-version: | ||
- 18 | ||
- 20 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: yarn install | ||
- run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules/ | ||
coverage/ | ||
|
||
# as Sindre Sorhus | ||
yarn.lock | ||
|
||
*.js | ||
*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# for open-source libraries — don't use a lock file | ||
# - 😃 as Sindre Sorhus | ||
package-lock=false |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Antonio Stoilkov [email protected] https://astoilkov.com | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "{{data.name}}", | ||
"version": "0.0.0", | ||
"description": "{{data.description}}", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/astoilkov/{{data.name}}" | ||
}, | ||
"funding": "https://github.com/sponsors/astoilkov", | ||
"author": { | ||
"name": "Antonio Stoilkov", | ||
"email": "[email protected]", | ||
"url": "https://astoilkov.com" | ||
}, | ||
"keywords": [ | ||
"{{data.keywords}}" | ||
], | ||
"type": "module", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "yarn build && vitest run --coverage", | ||
"release": "yarn build && np" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts", | ||
"src/**/*.js", | ||
"src/**/*.d.ts" | ||
], | ||
"devDependencies": { | ||
"@vitest/coverage-v8": "^2.0.3", | ||
"jsdom": "^24.1.0", | ||
"np": "^10.0.6", | ||
"prettier": "^3.3.3", | ||
"typescript": "^5.5.3", | ||
"vitest": "^2.0.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# `{{data.name}}` | ||
|
||
> {{data.description}} | ||
[](https://bundlephobia.com/result?p={{data.name}}) | ||
[](https://github.com/astoilkov/{{data.name}}/actions/workflows/main.yml) | ||
|
||
## Install | ||
|
||
```bash | ||
npm install {{data.name}} | ||
``` | ||
|
||
## Why | ||
|
||
## Usage | ||
|
||
## API | ||
|
||
## Alternatives | ||
|
||
## Related |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { describe, expect, test } from "vitest"; | ||
|
||
describe("{{data.name}}", () => { | ||
test("", () => { | ||
expect(true).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"module": "ES2022", | ||
|
||
"esModuleInterop": true, | ||
|
||
// From what I understand while reading the docs "classic" was introduced first and "classic" is by | ||
// default(except when "module": "commonjs") because of backwards compatibility. | ||
// | ||
// From the docs: "node module resolution is the most-commonly used in the TypeScript community and is | ||
// recommended for most projects." | ||
"moduleResolution": "node", | ||
|
||
// the npm package include ".js" files only so we need ".d.ts" files to be generated | ||
"declaration": true, | ||
|
||
// - ℹ️ https://www.typescriptlang.org/tsconfig#isolatedModules | ||
// - 😃 Deno requires "isolatedModules" to be set to `true` | ||
// - 😃 the stricter version - I always prefer the stricter version | ||
// - 😃 probably the future | ||
"isolatedModules": true, | ||
|
||
// strict options ensuring more stable code | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"allowUnreachableCode": false, | ||
"noUncheckedIndexedAccess": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"exactOptionalPropertyTypes": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"include": ["index.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from "vitest/config"; | ||
|
||
export default defineConfig({ | ||
test: { | ||
// run tests on root and in /test folder with .ts and .tsx extensions | ||
include: ["./test.ts?(x)", "./test/**/**.ts?(x)"], | ||
|
||
// restores original implementation (after each test is finished) when calling | ||
// `jest.spyOn()` inside of a test: https://vitest.dev/config/#restoremocks | ||
restoreMocks: true, | ||
|
||
// adds jsdom (https://github.com/jsdom/jsdom) APIs to tests | ||
environment: "jsdom", | ||
|
||
coverage: { | ||
enabled: true, | ||
extension: "js", | ||
include: ["src/**/*"], | ||
}, | ||
}, | ||
}); |