mirror of
https://github.com/immich-app/walkrs.git
synced 2026-09-30 13:32:57 +08:00
chore: esm (#60)
This commit is contained in:
@@ -50,6 +50,9 @@ jobs:
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
if: ${{ !cancelled() }}
|
||||
- name: Check TypeScript types
|
||||
run: pnpm check
|
||||
if: ${{ !cancelled() }}
|
||||
- name: Run tests
|
||||
run: pnpm test
|
||||
if: ${{ !cancelled() }}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
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 os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#!/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 { join } from 'node:path';
|
||||
|
||||
|
||||
+1
-6
@@ -2,13 +2,8 @@ import js from '@eslint/js';
|
||||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
||||
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
||||
import globals from 'globals';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import typescriptEslint from 'typescript-eslint';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
export default typescriptEslint.config([
|
||||
eslintPluginUnicorn.configs.recommended,
|
||||
eslintPluginPrettierRecommended,
|
||||
@@ -29,7 +24,7 @@ export default typescriptEslint.config([
|
||||
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir: __dirname,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -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 = {
|
||||
path?: string;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"build:debug": "napi build --platform --esm -o dist",
|
||||
"build:release": "napi build --platform --release --esm -o dist",
|
||||
"test": "vitest --config test/vitest.config.mjs",
|
||||
"check": "tsc --noEmit",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"ts:check": "tsc --noEmit",
|
||||
"ts:format": "prettier --check .",
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import swc from 'unplugin-swc';
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
root: './',
|
||||
root: projectRoot,
|
||||
globals: true,
|
||||
include: ['test/**/*.spec.ts'],
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
include: ['test/**'],
|
||||
},
|
||||
server: {
|
||||
deps: {
|
||||
fallbackCJS: true,
|
||||
},
|
||||
},
|
||||
env: {
|
||||
TZ: 'UTC',
|
||||
},
|
||||
|
||||
+9
-6
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2023"],
|
||||
"target": "ES2024",
|
||||
"module": "NodeNext",
|
||||
"lib": ["ES2024"],
|
||||
"declaration": true,
|
||||
"declarationDir": "./dist",
|
||||
"outDir": "./dist",
|
||||
@@ -11,11 +11,14 @@
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "bundler",
|
||||
"moduleResolution": "NodeNext",
|
||||
"isolatedModules": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"bench/*": ["./bench/*"]
|
||||
},
|
||||
"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"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user