From faba67239120234d9af276eb5102fba0396fca6d Mon Sep 17 00:00:00 2001 From: Jonghyeon Ko Date: Sat, 4 Nov 2023 16:11:42 +0900 Subject: [PATCH] chore(vitest, tsup): use built file --- configs/eslint-config-ts/noimport.js | 2 ++ configs/tsup/.eslintrc.cjs | 1 - configs/tsup/package.json | 11 ++++------- configs/tsup/src/index.d.ts | 2 ++ configs/tsup/src/{index.ts => index.js} | 5 ++--- configs/tsup/tsconfig.json | 7 ------- configs/vitest/.eslintrc.cjs | 1 - configs/vitest/package.json | 11 ++++------- configs/vitest/src/index.d.ts | 2 ++ configs/vitest/src/{index.ts => index.js} | 7 +++++-- configs/vitest/tsconfig.json | 7 ------- 11 files changed, 21 insertions(+), 35 deletions(-) create mode 100644 configs/tsup/src/index.d.ts rename configs/tsup/src/{index.ts => index.js} (70%) delete mode 100644 configs/tsup/tsconfig.json create mode 100644 configs/vitest/src/index.d.ts rename configs/vitest/src/{index.ts => index.js} (77%) delete mode 100644 configs/vitest/tsconfig.json diff --git a/configs/eslint-config-ts/noimport.js b/configs/eslint-config-ts/noimport.js index 22954e016..7c964d2a2 100644 --- a/configs/eslint-config-ts/noimport.js +++ b/configs/eslint-config-ts/noimport.js @@ -16,5 +16,7 @@ module.exports = { 'jsdoc/require-returns': 'off', 'jsdoc/require-jsdoc': 'off', 'jsdoc/check-param-names': 'error', + 'jsdoc/check-tag-names': 'off', + 'jsdoc/no-types': 'off', }, } diff --git a/configs/tsup/.eslintrc.cjs b/configs/tsup/.eslintrc.cjs index 1c8a0da6e..d4c9fa22f 100644 --- a/configs/tsup/.eslintrc.cjs +++ b/configs/tsup/.eslintrc.cjs @@ -2,5 +2,4 @@ module.exports = { root: true, extends: ['@suspensive/eslint-config-ts'], - ignorePatterns: ['*.js*', 'dist', 'coverage'], } diff --git a/configs/tsup/package.json b/configs/tsup/package.json index 9304b2e82..d91957296 100644 --- a/configs/tsup/package.json +++ b/configs/tsup/package.json @@ -2,13 +2,10 @@ "name": "@suspensive/tsup", "version": "0.0.0", "private": true, - "main": "dist/index.js", - "types": "dist/index.d.ts", + "type": "module", + "main": "src/index.js", + "types": "src/index.d.ts", "scripts": { - "build": "tsc", - "clean": "rimraf ./dist", - "lint": "eslint .", - "prepack": "pnpm build", - "type:check": "tsc --noEmit" + "lint": "eslint ." } } diff --git a/configs/tsup/src/index.d.ts b/configs/tsup/src/index.d.ts new file mode 100644 index 000000000..50be7d271 --- /dev/null +++ b/configs/tsup/src/index.d.ts @@ -0,0 +1,2 @@ +import type { Options } from 'tsup' +export declare const options: Options diff --git a/configs/tsup/src/index.ts b/configs/tsup/src/index.js similarity index 70% rename from configs/tsup/src/index.ts rename to configs/tsup/src/index.js index 11aacdcf7..9ee698fcf 100644 --- a/configs/tsup/src/index.ts +++ b/configs/tsup/src/index.js @@ -1,6 +1,5 @@ -import type { Options } from 'tsup' - -export const options: Options = { +/** @type {import('tsup').Options} */ +export const options = { banner: { js: '"use client"' }, format: ['cjs', 'esm'], entry: ['src/*.{ts,tsx}', '!**/*.{spec,test,test-d}.*'], diff --git a/configs/tsup/tsconfig.json b/configs/tsup/tsconfig.json deleted file mode 100644 index 393dd191d..000000000 --- a/configs/tsup/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "@suspensive/tsconfig/base.json", - "include": ["./src"], - "compilerOptions": { - "outDir": "dist" - } -} diff --git a/configs/vitest/.eslintrc.cjs b/configs/vitest/.eslintrc.cjs index 1c8a0da6e..d4c9fa22f 100644 --- a/configs/vitest/.eslintrc.cjs +++ b/configs/vitest/.eslintrc.cjs @@ -2,5 +2,4 @@ module.exports = { root: true, extends: ['@suspensive/eslint-config-ts'], - ignorePatterns: ['*.js*', 'dist', 'coverage'], } diff --git a/configs/vitest/package.json b/configs/vitest/package.json index d61ee2f9e..d7364bb96 100644 --- a/configs/vitest/package.json +++ b/configs/vitest/package.json @@ -2,13 +2,10 @@ "name": "@suspensive/vitest", "version": "0.0.0", "private": true, - "main": "dist/index.js", - "types": "dist/index.d.ts", + "type": "module", + "main": "src/index.js", + "types": "src/index.d.ts", "scripts": { - "build": "tsc", - "clean": "rimraf ./dist", - "lint": "eslint .", - "prepack": "pnpm build", - "type:check": "tsc --noEmit" + "lint": "eslint ." } } diff --git a/configs/vitest/src/index.d.ts b/configs/vitest/src/index.d.ts new file mode 100644 index 000000000..50a8a012d --- /dev/null +++ b/configs/vitest/src/index.d.ts @@ -0,0 +1,2 @@ +import type { UserConfig } from 'vitest/config' +export declare const forPackage: (userConfig?: UserConfig) => UserConfig diff --git a/configs/vitest/src/index.ts b/configs/vitest/src/index.js similarity index 77% rename from configs/vitest/src/index.ts rename to configs/vitest/src/index.js index 7d347db1a..192dd7b76 100644 --- a/configs/vitest/src/index.ts +++ b/configs/vitest/src/index.js @@ -1,8 +1,11 @@ import fs from 'fs' import path, { dirname } from 'path' -import type { UserConfig } from 'vitest/config' -export const forPackage = (userConfig?: UserConfig): UserConfig => { +/** + * @param {import('vitest').UserConfig} userConfig + * @returns {import('vitest').UserConfig} + */ +export const forPackage = (userConfig) => { const packageJsonPath = path.resolve(dirname('.'), 'package.json') const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')) diff --git a/configs/vitest/tsconfig.json b/configs/vitest/tsconfig.json deleted file mode 100644 index 393dd191d..000000000 --- a/configs/vitest/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "@suspensive/tsconfig/base.json", - "include": ["./src"], - "compilerOptions": { - "outDir": "dist" - } -}