diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e8e8f0c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,79 @@ +name: 'ci' +on: + push: + branches: + - '**' + pull_request: + branches: + - main + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + build-and-typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - name: Set node version to 16 + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'pnpm' + + - run: pnpm install + + - name: Run build & tsc + run: pnpm run build + + unit-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - name: Set node version to 16 + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'pnpm' + + - run: pnpm install + + - name: Run unit tests + run: pnpm run test:unit + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - name: Set node version to 16 + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'pnpm' + + - run: pnpm install + + - name: Lint codebase + run: pnpm run lint + + size: + runs-on: ubuntu-latest + env: + CI_JOB_NUMBER: 1 + steps: + - uses: actions/checkout@v1 + - uses: andresz1/size-limit-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 0f44602..154c489 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,10 @@ "./package.json": "./package.json" }, "files": [ - "dist", "README.md", "LICENSE", "src" + "dist", + "README.md", + "LICENSE", + "src" ], "scripts": { "dev": "vite", @@ -42,14 +45,17 @@ "type-check": "tsc --noEmit -p tsconfig.vitest.json --composite false", "test:unit": "vitest --environment jsdom --root src/", "test:ci": "vitest --environment jsdom --root src/ --run", - "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" - }, - "dependencies": { - "type-fest": "^3.2.0", - "vue": "^3.2.41" + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix" }, + "size-limit": [ + { + "path": "dist/index.cjs", + "limit": "2kB" + } + ], "devDependencies": { "@rushstack/eslint-patch": "^1.1.4", + "@size-limit/preset-small-lib": "^8.1.0", "@types/jsdom": "^20.0.0", "@types/node": "^16.11.68", "@vitejs/plugin-vue": "^3.1.2", @@ -62,9 +68,21 @@ "jsdom": "^20.0.1", "npm-run-all": "^4.1.5", "prettier": "^2.7.1", + "size-limit": "^8.1.0", + "type-fest": "^3.2.0", "typescript": "~4.7.4", "vite": "^3.1.8", "vitest": "^0.24.3", + "vue": "^3.2.41", "vue-tsc": "^1.0.8" + }, + "peerDependencies": { + "vue": "^3.2" + }, + "peerDependenciesMeta": { + "vue": { + "optional": true + } } + } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 684c769..76ce080 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,6 +2,7 @@ lockfileVersion: 5.4 specifiers: '@rushstack/eslint-patch': ^1.1.4 + '@size-limit/preset-small-lib': ^8.1.0 '@types/jsdom': ^20.0.0 '@types/node': ^16.11.68 '@vitejs/plugin-vue': ^3.1.2 @@ -14,6 +15,7 @@ specifiers: jsdom: ^20.0.1 npm-run-all: ^4.1.5 prettier: ^2.7.1 + size-limit: ^8.1.0 type-fest: ^3.2.0 typescript: ~4.7.4 vite: ^3.1.8 @@ -22,11 +24,11 @@ specifiers: vue-tsc: ^1.0.8 dependencies: - type-fest: 3.2.0 vue: 3.2.41 devDependencies: '@rushstack/eslint-patch': 1.2.0 + '@size-limit/preset-small-lib': 8.1.0_size-limit@8.1.0 '@types/jsdom': 20.0.0 '@types/node': 16.18.2 '@vitejs/plugin-vue': 3.2.0_vite@3.2.1+vue@3.2.41 @@ -39,6 +41,8 @@ devDependencies: jsdom: 20.0.1 npm-run-all: 4.1.5 prettier: 2.7.1 + size-limit: 8.1.0 + type-fest: 3.2.0 typescript: 4.7.4 vite: 3.2.1 vitest: 0.24.3_jsdom@20.0.1 @@ -149,6 +153,37 @@ packages: resolution: {integrity: sha512-sXo/qW2/pAcmT43VoRKOJbDOfV3cYpq3szSVfIThQXNt+E4DfKj361vaAt3c88U5tPUxzEswam7GW48PJqtKAg==} dev: true + /@size-limit/esbuild/8.1.0_size-limit@8.1.0: + resolution: {integrity: sha512-Lq+vJAUO13RXbiNF4bZOB07LmzMURkbV8Z6dhAkhTdAVWYLUn0zjfIe3O6IMwhj9dqJ0WtadhKHJvNQKG+po3w==} + engines: {node: ^14.0.0 || ^16.0.0 || >=18.0.0} + peerDependencies: + size-limit: 8.1.0 + dependencies: + esbuild: 0.15.12 + nanoid: 3.3.4 + size-limit: 8.1.0 + dev: true + + /@size-limit/file/8.1.0_size-limit@8.1.0: + resolution: {integrity: sha512-Ur+NgJSRHBnbQBrD8X2doxXYdBcVJsMxe2KfWrUmnZ6wYz09YKhQ1iYLqNztjf2yf/JEp00zp1vyhmimUQfUHQ==} + engines: {node: ^14.0.0 || ^16.0.0 || >=18.0.0} + peerDependencies: + size-limit: 8.1.0 + dependencies: + semver: 7.3.7 + size-limit: 8.1.0 + dev: true + + /@size-limit/preset-small-lib/8.1.0_size-limit@8.1.0: + resolution: {integrity: sha512-fs0XD0+rN4SVKGUwae7VMX1uDqK+oUYNGlPe7E0oKhwAH6ek08iH8qiEm0q9IKDrsCfZ9/d/pqNpg9di3p1SVw==} + peerDependencies: + size-limit: 8.1.0 + dependencies: + '@size-limit/esbuild': 8.1.0_size-limit@8.1.0 + '@size-limit/file': 8.1.0_size-limit@8.1.0 + size-limit: 8.1.0 + dev: true + /@tootallnate/once/2.0.0: resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} @@ -559,6 +594,14 @@ packages: color-convert: 2.0.1 dev: true + /anymatch/3.1.2: + resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + /argparse/2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} dev: true @@ -580,6 +623,11 @@ packages: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: true + /binary-extensions/2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + /boolbase/1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} dev: true @@ -604,6 +652,11 @@ packages: fill-range: 7.0.1 dev: true + /bytes-iec/3.1.1: + resolution: {integrity: sha512-fey6+4jDK7TFtFg/klGSvNKJctyU7n2aQdnM+CO0ruLPbqqMOM8Tio0Pc+deqUeVKX1tL5DQep1zQ7+37aTAsA==} + engines: {node: '>= 0.8'} + dev: true + /call-bind/1.0.2: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} dependencies: @@ -650,6 +703,25 @@ packages: resolution: {integrity: sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==} dev: true + /chokidar/3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.2 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.2 + dev: true + + /ci-job-number/1.2.2: + resolution: {integrity: sha512-CLOGsVDrVamzv8sXJGaILUVI6dsuAkouJP/n6t+OxLPeeA4DDby7zn9SB6EUpa1H7oIKoE+rMmkW80zYsFfUjA==} + dev: true + /color-convert/1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -1567,6 +1639,13 @@ packages: has-bigints: 1.0.2 dev: true + /is-binary-path/2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + /is-boolean-object/1.1.2: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} @@ -1749,6 +1828,11 @@ packages: type-check: 0.4.0 dev: true + /lilconfig/2.0.6: + resolution: {integrity: sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==} + engines: {node: '>=10'} + dev: true + /load-json-file/4.0.0: resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} engines: {node: '>=4'} @@ -1840,6 +1924,12 @@ packages: brace-expansion: 2.0.1 dev: true + /mkdirp/1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + dev: true + /ms/2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true @@ -1853,6 +1943,12 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /nanospinner/1.1.0: + resolution: {integrity: sha512-yFvNYMig4AthKYfHFl1sLj7B2nkHL4lzdig4osvl9/LdGbXwrdFRoqBS98gsEsOakr0yH+r5NZ/1Y9gdVB8trA==} + dependencies: + picocolors: 1.0.0 + dev: true + /natural-compare/1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true @@ -1870,6 +1966,11 @@ packages: validate-npm-package-license: 3.0.4 dev: true + /normalize-path/3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + /npm-run-all/4.1.5: resolution: {integrity: sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==} engines: {node: '>= 4'} @@ -2104,6 +2205,13 @@ packages: path-type: 3.0.0 dev: true + /readdirp/3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + /regexp.prototype.flags/1.4.3: resolution: {integrity: sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==} engines: {node: '>= 0.4'} @@ -2186,6 +2294,14 @@ packages: hasBin: true dev: true + /semver/7.3.7: + resolution: {integrity: sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + /semver/7.3.8: resolution: {integrity: sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==} engines: {node: '>=10'} @@ -2230,6 +2346,21 @@ packages: object-inspect: 1.12.2 dev: true + /size-limit/8.1.0: + resolution: {integrity: sha512-bUL+Uyyt/G+a1XzKlI2WKHVDepmXtqMDhF65pdtjccheiQTNjExWW4nFefgbRL2QgNTzRfK6ayFKjO3o4ER4gg==} + engines: {node: ^14.0.0 || ^16.0.0 || >=18.0.0} + hasBin: true + dependencies: + bytes-iec: 3.1.1 + chokidar: 3.5.3 + ci-job-number: 1.2.2 + globby: 11.1.0 + lilconfig: 2.0.6 + mkdirp: 1.0.4 + nanospinner: 1.1.0 + picocolors: 1.0.0 + dev: true + /slash/3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -2426,7 +2557,7 @@ packages: /type-fest/3.2.0: resolution: {integrity: sha512-Il3wdLRzWvbAEtocgxGQA9YOoRVeVUGOMBtel5LdEpNeEAol6GJTLw8GbX6Z8EIMfvfhoOXs2bwOijtAZdK5og==} engines: {node: '>=14.16'} - dev: false + dev: true /typescript/4.7.4: resolution: {integrity: sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==}