Skip to content

Commit

Permalink
🐛 replace vite in favour of rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
mlshv committed Dec 1, 2022
1 parent 769b2f4 commit caacfe2
Show file tree
Hide file tree
Showing 8 changed files with 2,273 additions and 1,444 deletions.
11 changes: 1 addition & 10 deletions .storybook/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ module.exports = {
],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-vite',
},
async viteFinal(config) {
return {
...config,
define: {
...config.define,
global: 'window',
},
}
// builder: '@storybook/builder-vite',
},
}
12 changes: 0 additions & 12 deletions index.html

This file was deleted.

3,533 changes: 2,193 additions & 1,340 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "@letoxyz/swipeout",
"version": "1.0.1",
"type": "module",
"main": "./dist/Swipeout.js",
"module": "./dist/Swipeout.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/Swipeout.js",
"require": "./dist/Swipeout.umd.js"
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
},
"./style.css": "./dist/style.css"
},
Expand All @@ -24,7 +24,7 @@
"start": "npm run storybook",
"dev": "npm run storybook",
"storybook": "start-storybook -p 6006",
"build": "tsc && vite build",
"build": "rollup -c",
"prepack": "cp package.json dist && json -f dist/package.json -I -e \"delete this.devDependencies\"",
"prepublish": "npm run build && npm run prepack",
"build-storybook": "build-storybook"
Expand All @@ -41,11 +41,14 @@
"devDependencies": {
"@babel/core": "7.20.2",
"@react-spring/types": "9.5.5",
"@rollup/plugin-commonjs": "23.0.3",
"@rollup/plugin-node-resolve": "15.0.1",
"@rollup/plugin-terser": "0.1.0",
"@rollup/plugin-typescript": "10.0.1",
"@storybook/addon-actions": "6.5.13",
"@storybook/addon-essentials": "6.5.13",
"@storybook/addon-interactions": "6.5.13",
"@storybook/addon-links": "6.5.13",
"@storybook/builder-vite": "0.2.5",
"@storybook/react": "6.5.13",
"@storybook/testing-library": "0.0.13",
"@types/react": "18.0.24",
Expand All @@ -54,10 +57,12 @@
"babel-loader": "8.3.0",
"json": "11.0.0",
"postcss": "8.4.18",
"rollup": "3.5.1",
"rollup-plugin-dts": "5.0.0",
"rollup-plugin-peer-deps-external": "2.2.4",
"rollup-plugin-postcss": "4.0.2",
"tailwindcss": "3.2.2",
"typescript": "4.6.4",
"vite": "3.2.3",
"vite-plugin-dts": "1.7.0"
"typescript": "4.6.4"
},
"overrides": {
"jest-mock": "28.1.0"
Expand Down
43 changes: 43 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import dts from 'rollup-plugin-dts'
import terser from '@rollup/plugin-terser'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss'

import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const pkg = require('./package.json')

export default [
{
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
},
{
file: pkg.module,
format: 'esm',
sourcemap: true,
},
],
plugins: [
peerDepsExternal(),
resolve(),
commonjs(),
typescript({ tsconfig: './tsconfig.json' }),
terser(),
postcss(),
],
},
{
input: 'dist/esm/types/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
plugins: [dts()],
external: [/\.css$/],
},
]
41 changes: 22 additions & 19 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"compilerOptions": {
"target": "es6",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"compilerOptions": {
"target": "es6",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "node",
"emitDeclarationOnly": true,
"resolveJsonModule": true,
"isolatedModules": true,
"declaration": true,
"declarationDir": "types",
"sourceMap": true,
"outDir": "dist",
"jsx": "react-jsx"
},
"include": ["src"]
}
10 changes: 0 additions & 10 deletions tsconfig.node.json

This file was deleted.

44 changes: 0 additions & 44 deletions vite.config.ts

This file was deleted.

0 comments on commit caacfe2

Please sign in to comment.