diff --git a/apps/docs/.eslintrc.json b/apps/docs/.eslintrc.json new file mode 100644 index 0000000..a1428e7 --- /dev/null +++ b/apps/docs/.eslintrc.json @@ -0,0 +1,13 @@ +{ + "extends": ["next/core-web-vitals"], + "ignorePatterns": [ + "node_modules/", + ".next/", + "out/" + ], + "rules": { + "import/no-anonymous-default-export": "off", + "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], + "@typescript-eslint/no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }] + } +} diff --git a/apps/docs/package.json b/apps/docs/package.json index 636a21b..b84abb5 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -5,7 +5,8 @@ "version": "1.0.0", "scripts": { "dev": "next dev", - "build:apps": "next build" + "build:apps": "next build", + "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'" }, "dependencies": { "next": "^14.1.1", diff --git a/apps/playground/frontend/package.json b/apps/playground/frontend/package.json index bc65efa..487d207 100644 --- a/apps/playground/frontend/package.json +++ b/apps/playground/frontend/package.json @@ -25,6 +25,7 @@ "tailwindcss": "^4.1.11" }, "devDependencies": { + "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@eslint/js": "^9.30.1", "@originjs/vite-plugin-commonjs": "^1.0.3", "@rolldown/pluginutils": "^1.0.0-beta.29", @@ -34,10 +35,12 @@ "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.7.0", + "buffer": "^6.0.3", "eslint": "^9.30.1", "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.20", "globals": "^16.3.0", + "rollup-plugin-node-polyfills": "^0.2.1", "tw-animate-css": "^1.3.6", "typescript": "~5.8.3", "typescript-eslint": "^8.35.1", diff --git a/apps/playground/frontend/src/global.ts b/apps/playground/frontend/src/global.ts new file mode 100644 index 0000000..75cef6b --- /dev/null +++ b/apps/playground/frontend/src/global.ts @@ -0,0 +1,10 @@ +import { Buffer } from 'buffer'; + +// @ts-expect-error - We're adding process.env to globalThis for compatibility with Node.js modules +globalThis.process = { + env: { + NODE_ENV: import.meta.env.MODE, // Map `MODE` to `process.env.NODE_ENV`. + }, +}; + +globalThis.Buffer = Buffer; \ No newline at end of file diff --git a/apps/playground/frontend/src/main.tsx b/apps/playground/frontend/src/main.tsx index 6f4ac9b..8090697 100644 --- a/apps/playground/frontend/src/main.tsx +++ b/apps/playground/frontend/src/main.tsx @@ -2,6 +2,7 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' import App from './App.tsx' import './index.css' +import '@/global.ts' createRoot(document.getElementById('root')!).render(