Skip to content

Commit

Permalink
fix(svg): change to tsup (#220)
Browse files Browse the repository at this point in the history
Signed-off-by: Antonette Caldwell <[email protected]>
  • Loading branch information
nebula-aac authored Nov 3, 2023
1 parent 3ceaed6 commit 2a7ef62
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 106 deletions.
4 changes: 2 additions & 2 deletions packages/svg/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module.exports = {
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
ignorePatterns: ['dist', '.eslintrc.cjs', 'tsup.config.ts'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
plugins: ['react'],
Expand Down
18 changes: 9 additions & 9 deletions packages/svg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
"type": "module",
"exports": {
".": {
"import": "./dist/index.es.js",
"require": "./dist/index.cjs.js",
"import": "./dist/index.js",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc && NODE_ENV=production vite build",
"build": "NODE_ENV=production tsup",
"dev": "NODE_ENV=development tsup",
"coverage": "jest --coverage",
"dev": "NODE_ENV=development vite",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"test": "jest"
},
Expand All @@ -34,9 +34,9 @@
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"typescript": "^5.0.2",
"vite": "^4.5.0",
"vite-plugin-dts": "^3.5.3"
"tsconfig": "workspace:^",
"tsup": "^7.2.0",
"typescript": "^5.0.2"
},
"publishConfig": {
"access": "public"
Expand Down
38 changes: 14 additions & 24 deletions packages/svg/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
"extends": "tsconfig/react-library.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"base": ["src/base/*"],
"custom": ["src/custom/*"]
},
"declarationMap": true,
"emitDeclarationOnly": true
},
"include": ["."],
"exclude": ["dist", "build", "node_modules", "**/*.d.ts", "tsup.config.ts"]
}

10 changes: 0 additions & 10 deletions packages/svg/tsconfig.node.json

This file was deleted.

16 changes: 16 additions & 0 deletions packages/svg/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from 'tsup';

const env = process.env.NODE_ENV;

export default defineConfig({
entry: ['src/index.ts'],
bundle: env === 'production',
clean: true,
dts: true,
format: ['esm', 'cjs'],
external: ['react'],
splitting: true,
minify: env === 'production',
skipNodeModulesBundle: true,
watch: env === 'development'
});
51 changes: 0 additions & 51 deletions packages/svg/vite.config.ts

This file was deleted.

Loading

0 comments on commit 2a7ef62

Please sign in to comment.