Skip to content

Commit

Permalink
Switch test-app to vite
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight committed Sep 14, 2024
1 parent eb9f823 commit 3284fa0
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 311 deletions.
77 changes: 0 additions & 77 deletions examples/test-app/build.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
<html>
<head>
<title>Test client</title>
<link rel="icon" href="/favicon.svg" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<script defer src="/js/main.js"></script>
<style type="text/css">
@import "/js/main.css";
</style>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
18 changes: 8 additions & 10 deletions examples/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "test-app",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "tsx build.ts dev",
"build": "tsx build.ts build",
Expand All @@ -11,29 +12,26 @@
"@parcnet/app-connector": "workspace:*",
"@parcnet/podspec": "workspace:*",
"@pcd/pod": "0.1.5",
"dotenv": "^16.0.3",
"json-bigint": "^1.0.0",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1"
"react-icons": "^5.0.1",
"vite-plugin-node-polyfills": "^0.22.0"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.14",
"@types/json-bigint": "^1.0.1",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.0.1",
"daisyui": "^4.12.10",
"esbuild": "^0.23.1",
"esbuild-plugin-tailwindcss": "^1.2.1",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"tsx": "^4.19.0",
"typescript": "^5.5"
"postcss": "^8.4.41",
"tailwindcss": "^3.4.10",
"typescript": "^5.5",
"vite": "^5.4.4"
}
}
6 changes: 6 additions & 0 deletions examples/test-app/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
};
3 changes: 3 additions & 0 deletions examples/test-app/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
12 changes: 7 additions & 5 deletions examples/test-app/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ReactNode } from "react";
import { ReactNode, StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "../styles/index.css";
import { GPC } from "./apis/GPC";
import { Identity } from "./apis/Identity";
import { PODSection } from "./apis/PODSection";
Expand All @@ -9,6 +8,7 @@ import {
ParcnetClientProvider,
useParcnetClient
} from "./hooks/useParcnetClient";
import "./index.css";
import { getConnectionInfo } from "./utils";

const zapp = {
Expand Down Expand Up @@ -36,9 +36,11 @@ export default function Main(): ReactNode {

function App(): ReactNode {
return (
<ParcnetClientProvider zapp={zapp} connectionInfo={getConnectionInfo()}>
<Main />
</ParcnetClientProvider>
<StrictMode>
<ParcnetClientProvider zapp={zapp} connectionInfo={getConnectionInfo()}>
<Main />
</ParcnetClientProvider>
</StrictMode>
);
}
const root = createRoot(
Expand Down
3 changes: 0 additions & 3 deletions examples/test-app/styles/index.css

This file was deleted.

21 changes: 21 additions & 0 deletions examples/test-app/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

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

/* Linting */
"strict": true
},
"include": ["src"]
}
18 changes: 5 additions & 13 deletions examples/test-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"downlevelIteration": true,
"jsx": "react-jsx",
"lib": ["ES2020", "DOM"],
"module": "ES2020",
"moduleResolution": "Bundler",
"esModuleInterop": true,
"strict": true,
"sourceMap": true
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "../../node_modules"]
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}
19 changes: 19 additions & 0 deletions examples/test-app/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,

/* Linting */
"strict": true
},
"include": ["vite.config.ts"]
}
20 changes: 20 additions & 0 deletions examples/test-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import { nodePolyfills } from "vite-plugin-node-polyfills";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
nodePolyfills({
include: ["assert", "buffer"]
})
],
esbuild: {
target: "es2020"
},
server: {
port: 3200
},
clearScreen: false
});
4 changes: 2 additions & 2 deletions packages/app-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"version": "0.0.2",
"license": "GPL-3.0-or-later",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.mjs",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "src/index.ts",
"scripts": {
"lint": "eslint . --max-warnings 0",
Expand Down
8 changes: 7 additions & 1 deletion packages/eslint-config/eslint.base.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ export default tseslint.config(
...tseslint.configs.stylisticTypeChecked,

{
ignores: ["**/node_modules/*", "**/dist/", "**/vitest.config.ts"] // global ignore with single ignore key
ignores: [
"**/node_modules/*",
"**/dist/",
"**/vitest.config.ts",
"**/vite.config.ts",
"**/tailwind.config.ts"
] // global ignore with single ignore key
},
{
languageOptions: {
Expand Down
Loading

0 comments on commit 3284fa0

Please sign in to comment.