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
|
- 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
@@ -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
@@ -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
@@ -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,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
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 = {
|
export type WalkError = {
|
||||||
path?: string;
|
path?: string;
|
||||||
|
|||||||
@@ -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 .",
|
||||||
|
|||||||
@@ -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
@@ -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"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user