From f1d6731417f2ad66ccc27a10c1ae7d638350e01e Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Wed, 1 Jul 2026 07:24:35 +0300 Subject: [PATCH] chore: scaffold carousel package and tooling --- .gitignore | 15 +++++++++++++++ .npmrc | 2 ++ .size-limit.json | 5 +++++ .yarnrc.yml | 1 + biome.json | 14 ++++++++++++++ lefthook.yml | 11 +++++++++++ package.json | 39 +++++++++++++++++++++++++++++++++++++++ src/index.ts | 1 + tsconfig.json | 13 +++++++++++++ tsup.config.ts | 10 ++++++++++ vitest.config.ts | 13 +++++++++++++ 11 files changed, 124 insertions(+) create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .size-limit.json create mode 100644 .yarnrc.yml create mode 100644 biome.json create mode 100644 lefthook.yml create mode 100644 package.json create mode 100644 src/index.ts create mode 100644 tsconfig.json create mode 100644 tsup.config.ts create mode 100644 vitest.config.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d71634f --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# build / tooling +node_modules +.yarn/* +!.yarn/releases +dist +coverage +test-results +playwright-report + +# local-only docs +docs/ +logs_llm/ + +*.md +!README.md diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..074cac7 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +@ilia:registry=https://git.allmy.work/api/packages/ilia/npm/ +//git.allmy.work/api/packages/ilia/npm/:_authToken=${NODE_AUTH_TOKEN} diff --git a/.size-limit.json b/.size-limit.json new file mode 100644 index 0000000..fb6a3a5 --- /dev/null +++ b/.size-limit.json @@ -0,0 +1,5 @@ +[ + { "name": "core", "path": "dist/index.js", "limit": "1 KB" }, + { "name": "dots", "path": "dist/dots.js", "limit": "0.6 KB" }, + { "name": "autoplay", "path": "dist/autoplay.js", "limit": "0.6 KB" } +] diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..248473e --- /dev/null +++ b/biome.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.4.13/schema.json", + "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, + "files": { "includes": ["src/**/*", "tests/**/*", "e2e/**/*", "*.ts", "*.json"] }, + "formatter": { "enabled": true, "indentStyle": "space", "indentWidth": 2, "lineWidth": 120 }, + "linter": { "enabled": true, "rules": { "recommended": true } }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "semicolons": "always", + "trailingCommas": "all" + } + } +} diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..f92742c --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,11 @@ +pre-commit: + parallel: true + commands: + biome-check: + glob: "*.{ts,json,css}" + run: yarn biome check --write {staged_files} + stage_fixed: true + typecheck: + run: yarn check + tests: + run: yarn test diff --git a/package.json b/package.json new file mode 100644 index 0000000..934fb62 --- /dev/null +++ b/package.json @@ -0,0 +1,39 @@ +{ + "name": "@ilia/carousel", + "version": "0.0.0", + "type": "module", + "sideEffects": ["*.css"], + "packageManager": "yarn@4.11.0", + "publishConfig": { + "registry": "https://git.allmy.work/api/packages/ilia/npm/" + }, + "exports": { + ".": "./dist/index.js", + "./dots": "./dist/dots.js", + "./autoplay": "./dist/autoplay.js", + "./carousel.css": "./src/carousel.css" + }, + "files": ["dist", "src/carousel.css"], + "scripts": { + "build": "tsup", + "check": "tsc --noEmit", + "lint": "biome check .", + "format": "biome format --write .", + "test": "vitest run", + "test:coverage": "vitest run --coverage", + "test:e2e": "playwright test", + "size": "size-limit" + }, + "devDependencies": { + "@biomejs/biome": "^2", + "@playwright/test": "^1", + "@size-limit/preset-small-lib": "^11", + "@vitest/coverage-v8": "^2", + "jsdom": "^25", + "lefthook": "^1", + "size-limit": "^11", + "tsup": "^8", + "typescript": "^5", + "vitest": "^2" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d38c4e0 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "strict": true, + "verbatimModuleSyntax": true, + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "noEmit": true, + "skipLibCheck": true + }, + "include": ["src", "tests"] +} diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..9c84cf6 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/index.ts', 'src/dots.ts', 'src/autoplay.ts'], + format: 'esm', + dts: true, + clean: true, + // unminified on purpose — consumer bundlers minify. size-limit measures the + // minified+gzipped size for budgeting. +}); diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..9b61fbc --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + environment: 'jsdom', + include: ['tests/**/*.test.ts'], + coverage: { + provider: 'v8', + include: ['src/**/*.ts'], + thresholds: { lines: 90, branches: 90, functions: 90, statements: 90 }, + }, + }, +});