Skip to content

Commit

Permalink
Merge pull request #53 from BKWLD/vite-build
Browse files Browse the repository at this point in the history
Switch to Vite based build
  • Loading branch information
weotch authored Sep 30, 2024
2 parents 8f285b8 + 29e050c commit 14ac35f
Show file tree
Hide file tree
Showing 21 changed files with 1,143 additions and 38 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"scripts": {
"build": "lerna run build",
"test": "lerna run test --concurrency 1",
"typecheck": "lerna run typecheck",
"prepare": "yarn build"
},
"dependencies": {},
Expand Down
11 changes: 8 additions & 3 deletions packages/contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"dist/**/*"
],
"scripts": {
"build": "rm -rf dist/* && tsc",
"test": "cypress run --component"
"build": "vite build",
"test": "cypress run --component",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@react-visual/react": "^1.1.0"
Expand All @@ -23,10 +24,14 @@
"devDependencies": {
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.3.2",
"cypress": "^13.13.3",
"react": "^18",
"react-dom": "^18.2.0",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"vite": "^5.4.8",
"vite-plugin-dts": "^4.2.3",
"vite-plugin-externalize-deps": "^0.8.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/contentful/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ContentfulVisual from './ContentfulVisual'

export default ContentfulVisual
export {
export type {
ContentfulVisualProps,
ContentfulImageAsset,
ContentfulAsset,
Expand Down
2 changes: 1 addition & 1 deletion packages/contentful/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.build.json",
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "./dist/"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/contentful/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from "vite";
import sharedConfig from "../../vite.config.shared";

export default mergeConfig(sharedConfig, {});
11 changes: 8 additions & 3 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"dist/**/*"
],
"scripts": {
"build": "rm -rf dist/* && tsc",
"test": "cypress run --component"
"build": "vite build",
"test": "cypress run --component",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@react-visual/react": "^1.1.0"
Expand All @@ -24,11 +25,15 @@
"devDependencies": {
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.3.2",
"cypress": "^13.13.3",
"next": "^14",
"react": "^18",
"react-dom": "^18.2.0",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"vite": "^5.4.8",
"vite-plugin-dts": "^4.2.3",
"vite-plugin-externalize-deps": "^0.8.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NextVisual from './NextVisual'

export default NextVisual
export { NextVisualProps } from './types/nextVisualTypes'
export type { NextVisualProps } from './types/nextVisualTypes'
2 changes: 1 addition & 1 deletion packages/next/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.build.json",
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "./dist/"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/next/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from "vite";
import sharedConfig from "../../vite.config.shared";

export default mergeConfig(sharedConfig, {});
10 changes: 7 additions & 3 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"dist/**/*"
],
"scripts": {
"build": "rm -rf dist/* && tsc",
"test": "cypress run --component"
"build": "vite build",
"test": "cypress run --component",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@react-hook/media-query": "^1.1.1",
Expand All @@ -24,10 +25,13 @@
"devDependencies": {
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.3.2",
"cypress": "^13.13.3",
"react": "^18",
"react-dom": "^18.2.0",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"vite": "^5.4.8",
"vite-plugin-dts": "^4.2.3"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { collectDataAttributes } from './lib/attributes'

export default ReactVisual
export { LazyVideo, VisualWrapper, collectDataAttributes }
export {
export type {
ReactVisualProps,
ObjectFit,
ObjectFitOption,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.build.json",
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "./dist/"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/react/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from "vite";
import sharedConfig from "../../vite.config.shared";

export default mergeConfig(sharedConfig, {});
11 changes: 8 additions & 3 deletions packages/sanity-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"dist/**/*"
],
"scripts": {
"build": "rm -rf dist/* && tsc",
"test": "cypress run --component"
"build": "vite build",
"test": "cypress run --component",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@react-visual/next": "^1.1.0",
Expand All @@ -26,11 +27,15 @@
"devDependencies": {
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.3.2",
"cypress": "^13.13.3",
"next": "^14",
"react": "^18",
"react-dom": "^18.2.0",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"vite": "^5.4.8",
"vite-plugin-dts": "^4.2.3",
"vite-plugin-externalize-deps": "^0.8.0"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/sanity-next/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SanityNextVisual from './SanityNextVisual'

export default SanityNextVisual
export { SanityNextVisualProps } from './types/sanityNextVisualTypes'
export { ObjectFitOption } from '@react-visual/react'
export type { SanityNextVisualProps } from './types/sanityNextVisualTypes'
export type { ObjectFitOption } from '@react-visual/react'
export { makeImageUrl, makeImageBuilder, makeFileUrl } from './lib/urlBuilding'
2 changes: 1 addition & 1 deletion packages/sanity-next/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.build.json",
"extends": "../../tsconfig.shared.json",
"compilerOptions": {
"outDir": "./dist/"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/sanity-next/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from "vite";
import sharedConfig from "../../vite.config.shared";

export default mergeConfig(sharedConfig, {});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.build.json",
"extends": "./tsconfig.shared.json",
"compilerOptions": {
"baseUrl": "./"
},
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.build.json → tsconfig.shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"compilerOptions": {
"target": "es2022",
"module": "es2022",
"declaration": true,
"outDir": "./dist",
"strict": true,
"jsx": "react-jsx",

Expand Down
18 changes: 18 additions & 0 deletions vite.config.shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";
import { externalizeDeps } from "vite-plugin-externalize-deps";

export default {
plugins: [
react(),
dts(),
externalizeDeps()
],
build: {
lib: {
entry: "src/index.ts",
formats: ["es"], // Just export ES6 modules
fileName: 'index',
},
},
} as const;
Loading

0 comments on commit 14ac35f

Please sign in to comment.