Skip to content

Commit

Permalink
Refactor to vite please
Browse files Browse the repository at this point in the history
  • Loading branch information
moishinetzer committed Jan 24, 2023
1 parent 5050dad commit 9f94778
Show file tree
Hide file tree
Showing 9 changed files with 3,550 additions and 2,287 deletions.
5,760 changes: 3,508 additions & 2,252 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,34 @@
"license": "MIT",
"version": "0.0.9",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"main": "dist/index.umd.js",
"module": "dist/index.js",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.umd.js"
},
"files": [
"dist"
],
"scripts": {
"dev": "vite",
"build": "tsup",
"preview": "vite preview",
"build": "vite build",
"check": "tsc",
"release": "npm run check && npm run build && changeset publish"
},
"dependencies": {
"postcss": "^8.4.21",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"rollup-plugin-postcss": "^4.0.2"
},
"devDependencies": {
"@changesets/cli": "^2.26.0",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@vitejs/plugin-react-swc": "^3.0.0",
"tsup": "^6.5.0",
"typescript": "^4.9.3",
"vite": "^4.0.0"
"vite": "^4.0.0",
"vite-plugin-dts": "^1.7.1"
}
}
13 changes: 13 additions & 0 deletions src/Button.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.button {
background-color: #4caf50;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
}
4 changes: 2 additions & 2 deletions src/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styles from "./index.module.css";
import style from "./Button.module.css";

export function Button() {
return <button className={styles.button}>This is the pbandj button</button>;
return <button className={style.button}>This is the pbandj button</button>;
}
8 changes: 8 additions & 0 deletions src/Div.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* funky red div */
.div {
color: white;
background-color: red;
border: none;
padding: 4rem;
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
}
9 changes: 2 additions & 7 deletions src/Div.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import "./App.css";
import "./index.css";
import "./Div.css";

export function Div() {
return (
<div>
<h1>Div Word</h1>
</div>
);
return <div className="div">Div Word</div>;
}
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import "./index.css";
export * from "./Button";
export * from "./Div";
13 changes: 0 additions & 13 deletions tsup.config.ts

This file was deleted.

9 changes: 5 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { resolve } from "path";
import dts from "vite-plugin-dts";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [react(), dts()],
// Build components from src/index.ts
build: {
lib: {
entry: "src/index.ts",
entry: resolve(__dirname, "src/index.ts"),
name: "pbandj",
formats: ["es", "umd"],
fileName: (format) => `index.${format}.js`,
fileName: "index",
},
rollupOptions: {
external: ["react", "react-dom"],
Expand Down

0 comments on commit 9f94778

Please sign in to comment.