use new template
This commit is contained in:
+4
-4
@@ -1,6 +1,6 @@
|
||||
.idea/
|
||||
._*
|
||||
.DS_Store
|
||||
bun.lockb
|
||||
package-lock.json
|
||||
._*
|
||||
.idea/
|
||||
.DS_Store
|
||||
node_modules/
|
||||
dist/
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
.woodpecker/
|
||||
test/
|
||||
.gitignore
|
||||
README.md
|
||||
.prettierignore
|
||||
.prettierrc
|
||||
eslint.config.ts
|
||||
@@ -0,0 +1,3 @@
|
||||
.woodpecker
|
||||
node_modules
|
||||
dist
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"bracketSpacing": false,
|
||||
"printWidth": 120,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": true,
|
||||
"trailingComma": "none"
|
||||
}
|
||||
+36
-4
@@ -1,6 +1,6 @@
|
||||
when:
|
||||
- path:
|
||||
include: ['index.ts']
|
||||
include: ['**/*.{js,jsx,ts,tsx}']
|
||||
|
||||
steps:
|
||||
install:
|
||||
@@ -10,10 +10,42 @@ steps:
|
||||
commands:
|
||||
- npm install
|
||||
|
||||
test:
|
||||
image: oven/bun
|
||||
typecheck:
|
||||
image: node
|
||||
when:
|
||||
- event: [pull_request, push, manual]
|
||||
depends_on: install
|
||||
commands:
|
||||
- bun test
|
||||
- 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
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Miscellaneous
|
||||
Various helpers I often use in TypeScript but that are impossible to categorize.
|
||||
|
||||
In fact, it is just two functions about base64 and number arrays.
|
||||
@@ -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'])
|
||||
])
|
||||
+20
-5
@@ -5,17 +5,32 @@
|
||||
"author": "Pascal Perrenoud <pascal@pband.ch>",
|
||||
|
||||
"scripts": {
|
||||
"test": "bun test"
|
||||
"check": "clear ; npm run typecheck && npm run lint && npm run check:fmt && npm run test ; 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}",
|
||||
"test": "bun test",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"log": "git+https://git.pband.ch/typescript/log.git"
|
||||
"log": "git+ssh://git@git.pband.ch:typescript/log.git#main"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "^1.0.11"
|
||||
"@eslint/js": "^9.35.0",
|
||||
"@types/bun": "^1.2.21",
|
||||
"bun": "^1.2.21",
|
||||
"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"
|
||||
},
|
||||
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"files": ["index.ts"]
|
||||
"main": "./src/index.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ import logger from 'log'
|
||||
const log = logger('misc')
|
||||
|
||||
export function a2str(buf: Uint8Array) : string {
|
||||
// @ts-ignore
|
||||
return String.fromCharCode.apply(null, buf)
|
||||
return String.fromCharCode.apply(null, [...buf])
|
||||
}
|
||||
export function str2a(str: string) : Uint8Array {
|
||||
const buf = new Uint8Array(str.length)
|
||||
@@ -1,4 +1,4 @@
|
||||
import {a2b64, a2str, b642a, str2a} from './index'
|
||||
import {a2b64, a2str, b642a, str2a} from '..'
|
||||
|
||||
import {test, expect} from 'bun:test'
|
||||
|
||||
+8
-26
@@ -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"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user