From f338e82e72d9f2f84408c33815aeb3c81fc46a81 Mon Sep 17 00:00:00 2001 From: Pascal Perrenoud Date: Thu, 22 Jan 2026 10:26:18 +0100 Subject: [PATCH] Use modern template --- .gitignore | 6 ++--- .npmignore | 7 ++++++ .prettierignore | 3 +++ .prettierrc | 11 +++++++++ .woodpecker/test.yml | 51 ++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ eslint.config.ts | 15 ++++++++++++ package.json | 28 ++++++++++++++++++---- index.ts => src/index.ts | 0 tsconfig.json | 34 +++++++-------------------- 10 files changed, 123 insertions(+), 34 deletions(-) create mode 100644 .npmignore create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 .woodpecker/test.yml create mode 100644 README.md create mode 100644 eslint.config.ts rename index.ts => src/index.ts (100%) diff --git a/.gitignore b/.gitignore index fa5646b..7f82a6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -bun.lockb package-lock.json -node_modules/ -.idea/ ._* +.idea/ .DS_Store +node_modules/ +dist/ diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..aa0e10b --- /dev/null +++ b/.npmignore @@ -0,0 +1,7 @@ +.woodpecker/ +test/ +.gitignore +README.md +.prettierignore +.prettierrc +eslint.config.ts diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..84af45f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +.woodpecker +node_modules +dist diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..9e19544 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "arrowParens": "avoid", + "tabWidth": 2, + "useTabs": false, + "bracketSpacing": false, + "printWidth": 120, + "semi": false, + "singleQuote": true, + "jsxSingleQuote": true, + "trailingComma": "none" +} diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 0000000..3288aaa --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,51 @@ +when: + - path: + include: ['**/*.{js,jsx,ts,tsx}'] + +steps: + install: + image: node + when: + - event: [pull_request, push, manual] + commands: + - npm install + + typecheck: + image: node + when: + - event: [pull_request, push, manual] + depends_on: install + commands: + - npm run typecheck + + lint: + image: node + when: + - event: [pull_request, push, manual] + depends_on: install + commands: + - npm run lint + + fmt: + image: node + when: + - event: [pull_request, push, manual] + depends_on: install + commands: + - npm run check:fmt + + test: + image: node + when: + - event: [pull_request, push, manual] + depends_on: install + commands: + - npm run test + + check: + image: node + when: + - event: [pull_request, push, manual] + depends_on: install + commands: + - npm run check diff --git a/README.md b/README.md new file mode 100644 index 0000000..c909837 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Console logger +Using package [log](https://git.pband.ch/typescript/log), logs to console diff --git a/eslint.config.ts b/eslint.config.ts new file mode 100644 index 0000000..754d790 --- /dev/null +++ b/eslint.config.ts @@ -0,0 +1,15 @@ +import js from '@eslint/js' +import globals from 'globals' +import tseslint from 'typescript-eslint' +import {defineConfig, globalIgnores} from 'eslint/config' + +export default defineConfig([ + tseslint.configs.recommended, + { + files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + plugins: {js}, + extends: ['js/recommended'], + languageOptions: {globals: {...globals.browser, ...globals.node}} + }, + globalIgnores(['dist']) +]) diff --git a/package.json b/package.json index f6a8cbd..8f1df7e 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,32 @@ "name": "logger-console", "description": "Logger to console, for client and server", "version": "1.0.0", - "author": "Pascal Perrenoud ", - "module": "index.ts", - "type": "module", - "files": ["index.ts"], + "scripts": { + "check": "clear ; npm run typecheck && npm run lint && npm run check:fmt && clear && echo 'OK'", + "check:fmt": "npx prettier -c **/*.{js,jsx,ts,tsx}", + "fmt": "prettier --write **/*.{js,jsx,ts,tsx}", + "lint": "eslint **/*.{js,jsx,ts,tsx}", + "typecheck": "tsc --noEmit" + }, "dependencies": { - "log": "git+https://git.pband.ch/typescript/log.git" + "log": "git+ssh://git@git.pband.ch:typescript/log.git" + }, + "devDependencies": { + "@eslint/js": "^9.35.0", + "eslint": "^9.35.0", + "globals": "^16.4.0", + "jiti": "^2.5.1", + "prettier": "^3.6.2", + "typescript": "^5.9.2", + "typescript-eslint": "^8.43.0" + }, + + "type": "module", + "main": "./src/index.ts", + "exports": { + ".": "./src/index.ts" } } diff --git a/index.ts b/src/index.ts similarity index 100% rename from index.ts rename to src/index.ts diff --git a/tsconfig.json b/tsconfig.json index 3d49bf0..5dc8e0f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,32 +1,14 @@ { "compilerOptions": { - // Enable latest features - "lib": ["ESNext","dom"], - "target": "ESNext", + "target": "ES2020", "module": "ESNext", - "moduleDetection": "force", - "allowJs": true, - "checkJs": true, - - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, - - // Best practices + "moduleResolution": "node", + "declaration": true, + "outDir": "dist", + "rootDir": "./src", "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "forceConsistentCasingInFileNames": true, - "noPropertyAccessFromIndexSignature": false + "esModuleInterop": true, + "skipLibCheck": true }, - - "include": [ - "index.ts", - ] + "include": ["src"] }