From f86918832c84d53f847063a1f5842a74a8a79ec5 Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Thu, 2 Mar 2023 17:18:53 +0100 Subject: [PATCH 1/3] Simplify simple example for codesandbox --- examples/simple/index-webpack.html | 40 ------------------------ examples/simple/package.json | 13 ++------ examples/simple/sandbox.config.json | 2 +- examples/simple/webpack.config.js | 48 ----------------------------- package.json | 2 +- 5 files changed, 4 insertions(+), 101 deletions(-) delete mode 100644 examples/simple/index-webpack.html delete mode 100644 examples/simple/webpack.config.js diff --git a/examples/simple/index-webpack.html b/examples/simple/index-webpack.html deleted file mode 100644 index c6f625c84f9..00000000000 --- a/examples/simple/index-webpack.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - React Admin - - - - -
- - - - diff --git a/examples/simple/package.json b/examples/simple/package.json index e0e5b4d2c69..910ccfe0391 100644 --- a/examples/simple/package.json +++ b/examples/simple/package.json @@ -3,8 +3,7 @@ "version": "4.8.1", "private": true, "scripts": { - "dev": "webpack-dev-server --progress --color --hot --mode development", - "start": "vite", + "dev": "vite", "build": "vite build", "serve": "vite preview", "type-check": "tsc --noEmit" @@ -35,16 +34,8 @@ "@babel/preset-react": "^7.12.10", "@hookform/devtools": "^4.0.2", "@vitejs/plugin-react": "^2.2.0", - "html-loader": "~3.1.0", - "html-webpack-plugin": "~5.5.0", - "ignore-not-found-export-plugin": "^1.0.1", "react-app-polyfill": "^1.0.4", - "style-loader": "~3.3.1", - "ts-loader": "^9.2.8", "typescript": "^4.4.0", - "vite": "^3.2.0", - "webpack": "~5.70.0", - "webpack-cli": "^4.10.0", - "webpack-dev-server": "~4.7.4" + "vite": "^3.2.0" } } diff --git a/examples/simple/sandbox.config.json b/examples/simple/sandbox.config.json index e31ef8aa2e3..9a484ff47c8 100644 --- a/examples/simple/sandbox.config.json +++ b/examples/simple/sandbox.config.json @@ -4,6 +4,6 @@ "view": "browser", "template": "node", "container": { - "node": "14" + "node": "16" } } diff --git a/examples/simple/webpack.config.js b/examples/simple/webpack.config.js deleted file mode 100644 index 15e9a622a13..00000000000 --- a/examples/simple/webpack.config.js +++ /dev/null @@ -1,48 +0,0 @@ -const path = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); - -module.exports = { - mode: 'development', - entry: { - polyfills: './src/polyfills.ts', - index: './src/index.tsx', - }, - output: { - path: path.resolve(__dirname, './output'), - filename: '[id].bundle.js', - }, - devtool: 'cheap-module-source-map', - resolve: { - extensions: ['.ts', '.js', '.tsx', '.json'], - }, - module: { - rules: [ - { - test: /\.(t|j)sx?$/, - exclude: /node_modules/, - use: { - loader: 'ts-loader', - options: { - transpileOnly: true, - }, - }, - }, - { - test: /\.html$/, - exclude: /node_modules/, - use: { loader: 'html-loader' }, - }, - ], - }, - plugins: [ - new HtmlWebpackPlugin({ - template: './index-webpack.html', - }), - ], - devServer: { - allowedHosts: 'all', - }, - stats: { - children: true, - }, -}; diff --git a/package.json b/package.json index 3b97828d7f3..7dca9ff6266 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "doc": "cd docs && jekyll server . --watch", "lint": "eslint --ext .js,.ts,.tsx \"./packages/**/src/**/*.{js,ts,tsx}\" \"./examples/**/src/**/*.{js,ts,tsx}\" \"./cypress/**/*.{js,ts,tsx}\"", "prettier": "prettier --config ./.prettierrc.js --write --list-different \"packages/*/src/**/*.{js,json,ts,tsx,css,md}\" \"examples/*/src/**/*.{js,ts,json,tsx,css,md}\" \"cypress/**/*.{js,ts,json,tsx,css,md}\"", - "run-simple": "cd examples/simple && yarn start", + "run-simple": "cd examples/simple && yarn dev", "run-no-code": "cd examples/no-code && yarn dev", "run-tutorial": "cd examples/tutorial && yarn dev", "run-demo": "cd examples/demo && cross-env REACT_APP_DATA_PROVIDER=rest yarn dev", From 00dc7a73d073185d7f36fcc2055ac2896b0f66ec Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Thu, 2 Mar 2023 17:25:49 +0100 Subject: [PATCH 2/3] Ignore aliases in codesandbox --- examples/simple/vite.config.js | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/examples/simple/vite.config.js b/examples/simple/vite.config.js index fd67a6d9399..6f02a3e5a28 100644 --- a/examples/simple/vite.config.js +++ b/examples/simple/vite.config.js @@ -2,22 +2,27 @@ import react from '@vitejs/plugin-react'; import path from 'path'; import fs from 'fs'; -const packages = fs.readdirSync(path.resolve(__dirname, '../../packages')); -const aliases = packages.map(dirName => { - const packageJson = require(path.resolve( - __dirname, - '../../packages', - dirName, - 'package.json' - )); - return { - find: new RegExp(`^${packageJson.name}$`), - replacement: path.resolve( +// In codesandbox, we won't have the packages folder +// We ignore errors in this case +let aliases = []; +try { + const packages = fs.readdirSync(path.resolve(__dirname, '../../packages')); + aliases = packages.map(dirName => { + const packageJson = require(path.resolve( __dirname, - `../../packages/${packageJson.name}/src` - ), - }; -}, {}); + '../../packages', + dirName, + 'package.json' + )); + return { + find: new RegExp(`^${packageJson.name}$`), + replacement: path.resolve( + __dirname, + `../../packages/${packageJson.name}/src` + ), + }; + }, {}); +} catch {} /** * https://vitejs.dev/config/ From dbc6ab5e49258f05948f565990babb9487f190e2 Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Thu, 2 Mar 2023 17:27:00 +0100 Subject: [PATCH 3/3] Update yarn.lock --- yarn.lock | 163 ++++-------------------------------------------------- 1 file changed, 10 insertions(+), 153 deletions(-) diff --git a/yarn.lock b/yarn.lock index cb80169b061..6a6613e5d33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2025,7 +2025,7 @@ __metadata: languageName: node linkType: hard -"@discoveryjs/json-ext@npm:^0.5.0, @discoveryjs/json-ext@npm:^0.5.3": +"@discoveryjs/json-ext@npm:^0.5.3": version: 0.5.7 resolution: "@discoveryjs/json-ext@npm:0.5.7" checksum: e10f1b02b78e4812646ddf289b7d9f2cb567d336c363b266bd50cd223cf3de7c2c74018d91cd2613041568397ef3a4a2b500aba588c6e5bd78c38374ba68f38c @@ -7513,39 +7513,6 @@ __metadata: languageName: node linkType: hard -"@webpack-cli/configtest@npm:^1.2.0": - version: 1.2.0 - resolution: "@webpack-cli/configtest@npm:1.2.0" - peerDependencies: - webpack: 4.x.x || 5.x.x - webpack-cli: 4.x.x - checksum: 560e4dbd92fc6e4f574654fb1325b90d02c634bcdf8564c22b0e44c1ecf8db828fbea9f20d0546fa809002bd27b1b6f544f74b13bd5ccdee64e8e9368df46cc2 - languageName: node - linkType: hard - -"@webpack-cli/info@npm:^1.5.0": - version: 1.5.0 - resolution: "@webpack-cli/info@npm:1.5.0" - dependencies: - envinfo: ^7.7.3 - peerDependencies: - webpack-cli: 4.x.x - checksum: 3e7c7ceb30b15fecdf5b5492494fbc76accee27748445c04f2bf66d0c036793b59ae7c27f5f4f6013a500aeae82762244c51f49c1de3d046e0b2dcfe163b642b - languageName: node - linkType: hard - -"@webpack-cli/serve@npm:^1.7.0": - version: 1.7.0 - resolution: "@webpack-cli/serve@npm:1.7.0" - peerDependencies: - webpack-cli: 4.x.x - peerDependenciesMeta: - webpack-dev-server: - optional: true - checksum: a2045c6ada073c517820424f97264a99c809e8bfdef866f5af7ceaefff44580351e9713b06d68e326469bd170111e370942825adcdac7eb242b2ee4343458a81 - languageName: node - linkType: hard - "@wry/context@npm:^0.6.0": version: 0.6.1 resolution: "@wry/context@npm:0.6.1" @@ -9926,7 +9893,7 @@ __metadata: languageName: node linkType: hard -"colorette@npm:^2.0.10, colorette@npm:^2.0.14, colorette@npm:^2.0.16, colorette@npm:^2.0.17": +"colorette@npm:^2.0.10, colorette@npm:^2.0.16, colorette@npm:^2.0.17": version: 2.0.19 resolution: "colorette@npm:2.0.19" checksum: 2bcc9134095750fece6e88167011499b964b78bf0ea953469130ddb1dba3c8fe6c03debb0ae181e710e2be10900d117460f980483a7df4ba4a1bac3b182ecb64 @@ -9987,7 +9954,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^7.0.0, commander@npm:^7.2.0": +"commander@npm:^7.2.0": version: 7.2.0 resolution: "commander@npm:7.2.0" checksum: 8d690ff13b0356df7e0ebbe6c59b4712f754f4b724d4f473d3cc5b3fdcf978e3a5dc3078717858a2ceb50b0f84d0660a7f22a96cdc50fb877d0c9bb31593d23a @@ -11915,7 +11882,7 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.9.2": +"enhanced-resolve@npm:^5.9.2": version: 5.9.2 resolution: "enhanced-resolve@npm:5.9.2" dependencies: @@ -11955,7 +11922,7 @@ __metadata: languageName: node linkType: hard -"envinfo@npm:^7.7.3, envinfo@npm:^7.7.4": +"envinfo@npm:^7.7.4": version: 7.8.1 resolution: "envinfo@npm:7.8.1" bin: @@ -13240,13 +13207,6 @@ __metadata: languageName: node linkType: hard -"fastest-levenshtein@npm:^1.0.12": - version: 1.0.12 - resolution: "fastest-levenshtein@npm:1.0.12" - checksum: 1755f98942952d5acd773eef03f9f9f046d95c447b10d1ef672df65a40f9a4d3f176ef60ae93e465f1c2bae127b7eb047d4df7e0dce492805bda76aff325dc88 - languageName: node - linkType: hard - "fastq@npm:^1.6.0": version: 1.13.0 resolution: "fastq@npm:1.13.0" @@ -14734,18 +14694,6 @@ __metadata: languageName: node linkType: hard -"html-loader@npm:~3.1.0": - version: 3.1.0 - resolution: "html-loader@npm:3.1.0" - dependencies: - html-minifier-terser: ^6.0.2 - parse5: ^6.0.1 - peerDependencies: - webpack: ^5.0.0 - checksum: 2304dc78569caaef38d0484c6da5f6eaba53ffbb25a2bfbaef96bedc99f097b6bf32e2a4e2b5ce55915160533d62bdae9ce5a7584ed02b03819bb7c598971a73 - languageName: node - linkType: hard - "html-minifier-terser@npm:^6.0.2": version: 6.1.0 resolution: "html-minifier-terser@npm:6.1.0" @@ -15034,15 +14982,6 @@ __metadata: languageName: node linkType: hard -"ignore-not-found-export-plugin@npm:^1.0.1": - version: 1.0.1 - resolution: "ignore-not-found-export-plugin@npm:1.0.1" - peerDependencies: - webpack: ^4.0.0 - checksum: 19217e7e352cb1a3b1391c72a3a8a2bb9ad1ff370cfce871e198392780b7cac76a0c2118ae8de9c3346533a1c7d56268684095ed111a858e48e962a220e11f2d - languageName: node - linkType: hard - "ignore-styles@npm:~5.0.1": version: 5.0.1 resolution: "ignore-styles@npm:5.0.1" @@ -18314,7 +18253,7 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.0, micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5": +"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5": version: 4.0.5 resolution: "micromatch@npm:4.0.5" dependencies: @@ -19909,7 +19848,7 @@ __metadata: languageName: node linkType: hard -"parse5@npm:6.0.1, parse5@npm:^6.0.0, parse5@npm:^6.0.1": +"parse5@npm:6.0.1, parse5@npm:^6.0.0": version: 6.0.1 resolution: "parse5@npm:6.0.1" checksum: 595821edc094ecbcfb9ddcb46a3e1fe3a718540f8320eff08b8cf6742a5114cce2d46d45f95c26191c11b184dcaf4e2960abcd9c5ed9eb9393ac9a37efcfdecb @@ -22966,15 +22905,6 @@ __metadata: languageName: node linkType: hard -"rechoir@npm:^0.7.0": - version: 0.7.1 - resolution: "rechoir@npm:0.7.1" - dependencies: - resolve: ^1.9.0 - checksum: 22c565f89845f8b9a0574d8bbc157fe489612d2882d036b5520640d4395dc837a997225de535513a847c5fcc47b7e0530b8c84e0ca51fa17dff44a83f41b2568 - languageName: node - linkType: hard - "recompose@npm:^0.30.0": version: 0.30.0 resolution: "recompose@npm:0.30.0" @@ -23412,7 +23342,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.10.0, resolve@npm:^1.12.0, resolve@npm:^1.14.2, resolve@npm:^1.17.0, resolve@npm:^1.18.1, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.21.0, resolve@npm:^1.3.2, resolve@npm:^1.9.0": +"resolve@npm:^1.10.0, resolve@npm:^1.12.0, resolve@npm:^1.14.2, resolve@npm:^1.17.0, resolve@npm:^1.18.1, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.21.0, resolve@npm:^1.3.2": version: 1.22.0 resolution: "resolve@npm:1.22.0" dependencies: @@ -23448,7 +23378,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.12.0#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.17.0#~builtin, resolve@patch:resolve@^1.18.1#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.21.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.9.0#~builtin": +"resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.12.0#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.17.0#~builtin, resolve@patch:resolve@^1.18.1#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.21.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin": version: 1.22.0 resolution: "resolve@patch:resolve@npm%3A1.22.0#~builtin::version=1.22.0&hash=07638b" dependencies: @@ -24134,9 +24064,6 @@ __metadata: "@mui/icons-material": ^5.0.1 "@mui/material": ^5.0.2 "@vitejs/plugin-react": ^2.2.0 - html-loader: ~3.1.0 - html-webpack-plugin: ~5.5.0 - ignore-not-found-export-plugin: ^1.0.1 jsonexport: ^3.2.0 lodash: ~4.17.5 prop-types: ^15.7.2 @@ -24154,13 +24081,8 @@ __metadata: react-query: ^3.32.1 react-router: ^6.1.0 react-router-dom: ^6.1.0 - style-loader: ~3.3.1 - ts-loader: ^9.2.8 typescript: ^4.4.0 vite: ^3.2.0 - webpack: ~5.70.0 - webpack-cli: ^4.10.0 - webpack-dev-server: ~4.7.4 languageName: unknown linkType: soft @@ -25662,21 +25584,6 @@ __metadata: languageName: node linkType: hard -"ts-loader@npm:^9.2.8": - version: 9.2.8 - resolution: "ts-loader@npm:9.2.8" - dependencies: - chalk: ^4.1.0 - enhanced-resolve: ^5.0.0 - micromatch: ^4.0.0 - semver: ^7.3.4 - peerDependencies: - typescript: "*" - webpack: ^5.0.0 - checksum: b7943d20ded69653222ed58c751183a13eb5a0de8c7ff7d44d2adce75c605ac40182fe08d76cf64dbe913225712213e98e4ddb00ea26623b02ae513fa34fa4f4 - languageName: node - linkType: hard - "ts-pnp@npm:^1.1.6": version: 1.2.0 resolution: "ts-pnp@npm:1.2.0" @@ -26625,39 +26532,6 @@ __metadata: languageName: node linkType: hard -"webpack-cli@npm:^4.10.0": - version: 4.10.0 - resolution: "webpack-cli@npm:4.10.0" - dependencies: - "@discoveryjs/json-ext": ^0.5.0 - "@webpack-cli/configtest": ^1.2.0 - "@webpack-cli/info": ^1.5.0 - "@webpack-cli/serve": ^1.7.0 - colorette: ^2.0.14 - commander: ^7.0.0 - cross-spawn: ^7.0.3 - fastest-levenshtein: ^1.0.12 - import-local: ^3.0.2 - interpret: ^2.2.0 - rechoir: ^0.7.0 - webpack-merge: ^5.7.3 - peerDependencies: - webpack: 4.x.x || 5.x.x - peerDependenciesMeta: - "@webpack-cli/generators": - optional: true - "@webpack-cli/migrate": - optional: true - webpack-bundle-analyzer: - optional: true - webpack-dev-server: - optional: true - bin: - webpack-cli: bin/cli.js - checksum: e144821a3eaf8c2598e80d6bc8b1b4035e6f5cb0046b3090ad0f858f87480f007127d5c5efa83c79436df3f31e0c0d6033fd9ea93526395984ef986ba5d72aa3 - languageName: node - linkType: hard - "webpack-dev-middleware@npm:^4.1.0": version: 4.3.0 resolution: "webpack-dev-middleware@npm:4.3.0" @@ -26674,7 +26548,7 @@ __metadata: languageName: node linkType: hard -"webpack-dev-server@npm:^4.6.0, webpack-dev-server@npm:~4.7.4": +"webpack-dev-server@npm:^4.6.0": version: 4.7.4 resolution: "webpack-dev-server@npm:4.7.4" dependencies: @@ -26752,16 +26626,6 @@ __metadata: languageName: node linkType: hard -"webpack-merge@npm:^5.7.3": - version: 5.8.0 - resolution: "webpack-merge@npm:5.8.0" - dependencies: - clone-deep: ^4.0.1 - wildcard: ^2.0.0 - checksum: 400eaaba69d2240d51dc7a4427dde37849a8f2fdf93731be6a8aad34d70d55bb38cb10c5001c7b339fc91f8c8547e782ecbd79eff24ad861e21e6a4c5dc959fb - languageName: node - linkType: hard - "webpack-sources@npm:^1.4.3": version: 1.4.3 resolution: "webpack-sources@npm:1.4.3" @@ -26977,13 +26841,6 @@ __metadata: languageName: node linkType: hard -"wildcard@npm:^2.0.0": - version: 2.0.0 - resolution: "wildcard@npm:2.0.0" - checksum: 4e22a45f4fa7f0f0d3e11860ee9ce9225246d41af6ec507e6a7d64c2692afb40d695b92c8f801deda8d3536007c2ec07981079fd0c8bb38b8521de072b33ab7a - languageName: node - linkType: hard - "word-wrap@npm:^1.2.3, word-wrap@npm:~1.2.3": version: 1.2.3 resolution: "word-wrap@npm:1.2.3"