Skip to content

Commit

Permalink
feat: add finalizations for vite and nextjs config
Browse files Browse the repository at this point in the history
  • Loading branch information
Renato Pozzi committed Feb 12, 2024
1 parent b4c3b59 commit 507289b
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 166 deletions.
222 changes: 111 additions & 111 deletions assets/data/images.ts

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions examples/with-nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { images } from "../../../../assets/data/images";
import { Masonry } from "../../../../libs/react-plock";
import { images } from "@assets/data/images";
import { Masonry } from "@local/lib";

export default function Home() {
return (
Expand All @@ -13,10 +13,12 @@ export default function Home() {
media: [640, 1024, 1280],
}}
render={(item, idx) => (
// eslint-disable-next-line @next/next/no-img-element
<img
key={idx}
src={item}
loading="lazy"
alt="Unsplash Image"
style={{ width: "100%", height: "auto" }}
/>
)}
Expand Down
4 changes: 3 additions & 1 deletion examples/with-nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl": ".",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
Expand All @@ -19,7 +20,8 @@
],
"paths": {
"@/*": ["./src/*"],
"local": ["../../libs/react-plock/*"]
"@local/lib": ["../../libs/react-plock/index"],
"@assets/*": ["../../assets/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
Expand Down
3 changes: 2 additions & 1 deletion examples/with-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"vite-tsconfig-paths": "^4.3.1"
},
"devDependencies": {
"@types/react": "^18.0.27",
Expand Down
5 changes: 2 additions & 3 deletions examples/with-vite/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { images } from "@assets/data/images";
import { Masonry } from "@local/lib";
import React from "react";
import ReactDOM from "react-dom/client";
import { images } from "../../../assets/data/images";
import { Masonry } from "../../../libs/react-plock";

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
Expand All @@ -21,6 +21,5 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
/>
)}
/>
);
</React.StrictMode>
);
7 changes: 6 additions & 1 deletion examples/with-vite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl": ".",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
Expand All @@ -14,7 +15,11 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"paths": {
"@local/lib": ["../../libs/react-plock/index"],
"@assets/*": ["../../assets/*"]
}
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
Expand Down
9 changes: 5 additions & 4 deletions examples/with-vite/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
plugins: [react(), tsconfigPaths()],
});
8 changes: 4 additions & 4 deletions libs/react-plock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "react-plock",
"version": "3.0.2",
"description": "The 1kB Masonry Grid for React",
"author": "Renato Pozzi <renato.pozzi.dev@gmail.com>",
"homepage": "https://github.com/itsrennyman/react-plock#readme",
"author": "Renato Pozzi <askides@proton.me>",
"homepage": "https://github.com/askides/react-plock#readme",
"license": "ISC",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
Expand All @@ -16,14 +16,14 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/itsrennyman/react-plock.git"
"url": "git+https://github.com/askides/react-plock.git"
},
"scripts": {
"build": "tsup index.ts --dts --minify",
"test": "jest"
},
"bugs": {
"url": "https://github.com/itsrennyman/react-plock/issues"
"url": "https://github.com/askides/react-plock/issues"
},
"peerDependencies": {
"react": "^18.2.0"
Expand Down
1 change: 0 additions & 1 deletion libs/react-plock/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"jsx": "react",
"outDir": "./dist"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"@types/node": "^18.14.4",
"lerna": "^6.5.1",
"tsup": "^6.6.3",
"typescript": "^4.9.5"
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit 507289b

Please sign in to comment.