Skip to content

Commit

Permalink
chore(vitest, tsup): use built file (#292)
Browse files Browse the repository at this point in the history
fix #291 

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

I used built file to remove unncessary compile time for
@suspensive/tsup, @suspensive/vitest but with sustain their TypeScript
autocomplete internally, externally for user of them

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/suspensive/react/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
  • Loading branch information
manudeli authored Nov 6, 2023
1 parent 9e93021 commit c5ff26b
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 35 deletions.
2 changes: 2 additions & 0 deletions configs/eslint-config-ts/noimport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
}
1 change: 0 additions & 1 deletion configs/tsup/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
module.exports = {
root: true,
extends: ['@suspensive/eslint-config-ts'],
ignorePatterns: ['*.js*', 'dist', 'coverage'],
}
11 changes: 4 additions & 7 deletions configs/tsup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ."
}
}
2 changes: 2 additions & 0 deletions configs/tsup/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { Options } from 'tsup'
export declare const options: Options
5 changes: 2 additions & 3 deletions configs/tsup/src/index.ts → configs/tsup/src/index.js
Original file line number Diff line number Diff line change
@@ -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}.*'],
Expand Down
7 changes: 0 additions & 7 deletions configs/tsup/tsconfig.json

This file was deleted.

1 change: 0 additions & 1 deletion configs/vitest/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
module.exports = {
root: true,
extends: ['@suspensive/eslint-config-ts'],
ignorePatterns: ['*.js*', 'dist', 'coverage'],
}
11 changes: 4 additions & 7 deletions configs/vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ."
}
}
2 changes: 2 additions & 0 deletions configs/vitest/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { UserConfig } from 'vitest/config'
export declare const forPackage: (userConfig?: UserConfig) => UserConfig
7 changes: 5 additions & 2 deletions configs/vitest/src/index.ts → configs/vitest/src/index.js
Original file line number Diff line number Diff line change
@@ -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'))

Expand Down
7 changes: 0 additions & 7 deletions configs/vitest/tsconfig.json

This file was deleted.

0 comments on commit c5ff26b

Please sign in to comment.