diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4f4d652 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 + +[*.js] +indent_style = space +indent_size = 2 + +[{package.json,*.yml,*.cjson}] +indent_style = space +indent_size = 2 diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..9c62828 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +node_modules +coverage +dist diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..c80d5f3 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,4 @@ +{ + "extends": ["eslint-config-unjs"], + "rules": {} +} diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 0000000..b229e98 --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,26 @@ +name: autofix.ci # needed to securely identify the workflow + +on: + pull_request: + push: + branches: ["main"] + +permissions: + contents: read + +jobs: + autofix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: "pnpm" + - run: pnpm install + - name: Fix lint issues + run: pnpm run lint:fix + - uses: autofix-ci/action@8caa572fd27b0019a65e4c695447089c8d3138b9 + with: + commit-message: "chore: apply automated fixes" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b485602 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: ci + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: "pnpm" + - run: pnpm install + - run: pnpm lint + - run: pnpm test:types + - run: pnpm build + - run: pnpm vitest --coverage + - uses: codecov/codecov-action@v3 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3ea3e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +node_modules +coverage +dist +types +.vscode +.DS_Store +.eslintcache +*.log* +*.conf* +*.env* diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..244229e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) + +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8058fa3 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# packageName + +[![npm version][npm-version-src]][npm-version-href] +[![npm downloads][npm-downloads-src]][npm-downloads-href] +[![bundle][bundle-src]][bundle-href] +[![Codecov][codecov-src]][codecov-href] + +This is my package description. + +## Usage + +Install package: + +```sh +# npm +npm install packageName + +# yarn +yarn add packageName + +# pnpm +pnpm install packageName + +# bun +bun install packageName +``` + +Import: + +```js +// ESM +import {} from "packageName"; + +// CommonJS +const {} = require("packageName"); +``` + +## Development + +- Clone this repository +- Install latest LTS version of [Node.js](https://nodejs.org/en/) +- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` +- Install dependencies using `pnpm install` +- Run interactive tests using `pnpm dev` + +## License + +Made with 💛 + +Published under [MIT License](./LICENSE). + + + +[npm-version-src]: https://img.shields.io/npm/v/packageName?style=flat&colorA=18181B&colorB=F0DB4F +[npm-version-href]: https://npmjs.com/package/packageName +[npm-downloads-src]: https://img.shields.io/npm/dm/packageName?style=flat&colorA=18181B&colorB=F0DB4F +[npm-downloads-href]: https://npmjs.com/package/packageName +[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/packageName/main?style=flat&colorA=18181B&colorB=F0DB4F +[codecov-href]: https://codecov.io/gh/unjs/packageName +[bundle-src]: https://img.shields.io/bundlephobia/minzip/packageName?style=flat&colorA=18181B&colorB=F0DB4F +[bundle-href]: https://bundlephobia.com/result?p=packageName diff --git a/package.json b/package.json new file mode 100644 index 0000000..c023482 --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "packageName", + "version": "0.0.0", + "description": "", + "repository": "unjs/packageName", + "license": "MIT", + "sideEffects": false, + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + } + }, + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "unbuild", + "dev": "vitest dev", + "play": "jiti playground", + "lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test", + "lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w", + "prepack": "pnpm run build", + "release": "pnpm test && changelogen --release && npm publish && git push --follow-tags", + "test": "pnpm lint && pnpm test:types && vitest run --coverage", + "test:types": "tsc --noEmit --skipLibCheck" + }, + "devDependencies": { + "@types/node": "^20.8.9", + "@vitest/coverage-v8": "^0.34.6", + "changelogen": "^0.5.5", + "eslint": "^8.52.0", + "eslint-config-unjs": "^0.2.1", + "jiti": "^1.20.0", + "prettier": "^3.0.3", + "typescript": "^5.2.2", + "unbuild": "^2.0.0", + "vitest": "^0.34.6" + }, + "packageManager": "pnpm@8.10.0" +} diff --git a/playground/index.ts b/playground/index.ts new file mode 100644 index 0000000..fadbf84 --- /dev/null +++ b/playground/index.ts @@ -0,0 +1,3 @@ +import { test } from "../src"; + +console.log(test()); diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..57fe916 --- /dev/null +++ b/renovate.json @@ -0,0 +1,3 @@ +{ + "extends": ["github>unjs/renovate-config"] +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..149b0a1 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,3 @@ +export function test() { + return "works!"; +} diff --git a/test/index.test.ts b/test/index.test.ts new file mode 100644 index 0000000..89d75f4 --- /dev/null +++ b/test/index.test.ts @@ -0,0 +1,8 @@ +import { expect, it, describe } from "vitest"; +import {} from "../src"; + +describe("packageName", () => { + it.todo("pass", () => { + expect(true).toBe(true); + }); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..e9588d9 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "Node", + "esModuleInterop": true, + "strict": true + }, + "include": ["src"] +}