chore: esm (#60)

This commit is contained in:
Jonathan Jogenfors
2026-09-26 18:22:54 -04:00
committed by GitHub
parent 54507514b4
commit 095f84a626
8 changed files with 24 additions and 21 deletions
+3
View File
@@ -50,6 +50,9 @@ jobs:
- name: Build - name: Build
run: pnpm build run: pnpm build
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
- name: Check TypeScript types
run: pnpm check
if: ${{ !cancelled() }}
- name: Run tests - name: Run tests
run: pnpm test run: pnpm test
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
import { walk } from '@immich/walkrs'; import { walk } from '@immich/walkrs';
import { BENCH_DIR, DATASETS } from 'bench/constants'; import { BENCH_DIR, DATASETS } from 'bench/constants.js';
import fs from 'node:fs'; import fs from 'node:fs';
import os from 'node:os'; import os from 'node:os';
import path from 'node:path'; import path from 'node:path';
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
import { BENCH_DIR, DATASETS, DatasetConfig } from 'bench/constants'; import { BENCH_DIR, DATASETS, type DatasetConfig } from 'bench/constants.js';
import { promises as fs } from 'node:fs'; import { promises as fs } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
+1 -6
View File
@@ -2,13 +2,8 @@ import js from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import eslintPluginUnicorn from 'eslint-plugin-unicorn'; import eslintPluginUnicorn from 'eslint-plugin-unicorn';
import globals from 'globals'; import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import typescriptEslint from 'typescript-eslint'; import typescriptEslint from 'typescript-eslint';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default typescriptEslint.config([ export default typescriptEslint.config([
eslintPluginUnicorn.configs.recommended, eslintPluginUnicorn.configs.recommended,
eslintPluginPrettierRecommended, eslintPluginPrettierRecommended,
@@ -29,7 +24,7 @@ export default typescriptEslint.config([
parserOptions: { parserOptions: {
project: 'tsconfig.json', project: 'tsconfig.json',
tsconfigRootDir: __dirname, tsconfigRootDir: import.meta.dirname,
}, },
}, },
+3 -1
View File
@@ -1,4 +1,6 @@
export { WalkOptions } from '../dist/index.js'; import type { WalkOptions } from '../dist/index.js';
export type { WalkOptions } from '../dist/index.js';
export type WalkError = { export type WalkError = {
path?: string; path?: string;
+1
View File
@@ -36,6 +36,7 @@
"build:debug": "napi build --platform --esm -o dist", "build:debug": "napi build --platform --esm -o dist",
"build:release": "napi build --platform --release --esm -o dist", "build:release": "napi build --platform --release --esm -o dist",
"test": "vitest --config test/vitest.config.mjs", "test": "vitest --config test/vitest.config.mjs",
"check": "tsc --noEmit",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"ts:check": "tsc --noEmit", "ts:check": "tsc --noEmit",
"ts:format": "prettier --check .", "ts:format": "prettier --check .",
+5 -6
View File
@@ -1,21 +1,20 @@
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import swc from 'unplugin-swc'; import swc from 'unplugin-swc';
import tsconfigPaths from 'vite-tsconfig-paths'; import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config'; import { defineConfig } from 'vitest/config';
const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
export default defineConfig({ export default defineConfig({
test: { test: {
root: './', root: projectRoot,
globals: true, globals: true,
include: ['test/**/*.spec.ts'], include: ['test/**/*.spec.ts'],
coverage: { coverage: {
provider: 'v8', provider: 'v8',
include: ['test/**'], include: ['test/**'],
}, },
server: {
deps: {
fallbackCJS: true,
},
},
env: { env: {
TZ: 'UTC', TZ: 'UTC',
}, },
+9 -6
View File
@@ -1,8 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2020", "target": "ES2024",
"module": "ESNext", "module": "NodeNext",
"lib": ["ES2023"], "lib": ["ES2024"],
"declaration": true, "declaration": true,
"declarationDir": "./dist", "declarationDir": "./dist",
"outDir": "./dist", "outDir": "./dist",
@@ -11,11 +11,14 @@
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"moduleResolution": "bundler", "moduleResolution": "NodeNext",
"isolatedModules": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"baseUrl": ".", "paths": {
"bench/*": ["./bench/*"]
},
"rootDir": "." "rootDir": "."
}, },
"include": ["test/**/*.ts", "bench/**/*.ts", "types/**/*.d.ts"], "include": ["test/**/*.ts", "bench/**/*.ts", "example/**/*.ts", "lib/**/*.d.ts", "types/**/*.d.ts"],
"exclude": ["node_modules", "dist", "target"] "exclude": ["node_modules", "dist", "target"]
} }