Merge branch 'master' into fix-ts-vitest-installation

This commit is contained in:
Alexandre
2022-08-27 11:14:35 +02:00
committed by GitHub
52 changed files with 10445 additions and 4512 deletions
+6 -6
View File
@@ -13,14 +13,14 @@
},
"license": "MIT",
"devDependencies": {
"@testing-library/jest-dom": "^5.16.3",
"jsdom": "^19.0.0",
"@testing-library/jest-dom": "^5.16.5",
"jsdom": "^20.0.0",
"solid-testing-library": "^0.3.0",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6",
"vitest": "^0.7.11"
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0",
"vitest": "^0.22.1"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+648 -462
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -20,9 +20,11 @@ export default defineConfig({
// isolate: false,
},
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
resolve: {
conditions: ['development', 'browser'],
+3 -3
View File
@@ -10,10 +10,10 @@
},
"license": "MIT",
"devDependencies": {
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6"
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+340 -300
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -3,8 +3,10 @@ import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+3 -3
View File
@@ -5,9 +5,9 @@
"prepare": "husky install"
},
"devDependencies": {
"husky": "^7.0.4",
"lint-staged": "^12.3.7",
"prettier": "^2.6.1"
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1"
},
"lint-staged": {
"*.{js,json,md,yml,ts,tsx,jsx,css,scss}": "prettier --write"
+85 -74
View File
@@ -1,14 +1,14 @@
lockfileVersion: 5.3
lockfileVersion: 5.4
specifiers:
husky: ^7.0.4
lint-staged: ^12.3.7
prettier: ^2.6.1
husky: ^8.0.1
lint-staged: ^13.0.3
prettier: ^2.7.1
devDependencies:
husky: 7.0.4
lint-staged: 12.3.7
prettier: 2.6.1
husky: 8.0.1
lint-staged: 13.0.3
prettier: 2.7.1
packages:
@@ -100,13 +100,13 @@ packages:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
dev: true
/colorette/2.0.16:
resolution: {integrity: sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==}
/colorette/2.0.19:
resolution: {integrity: sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==}
dev: true
/commander/8.3.0:
resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==}
engines: {node: '>= 12'}
/commander/9.3.0:
resolution: {integrity: sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==}
engines: {node: ^12.20.0 || >=14}
dev: true
/cross-spawn/7.0.3:
@@ -118,7 +118,7 @@ packages:
which: 2.0.2
dev: true
/debug/4.3.4_supports-color@9.2.1:
/debug/4.3.4:
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
engines: {node: '>=6.0'}
peerDependencies:
@@ -128,7 +128,6 @@ packages:
optional: true
dependencies:
ms: 2.1.2
supports-color: 9.2.1
dev: true
/eastasianwidth/0.2.0:
@@ -143,19 +142,19 @@ packages:
resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==}
dev: true
/execa/5.1.1:
resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}
engines: {node: '>=10'}
/execa/6.1.0:
resolution: {integrity: sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dependencies:
cross-spawn: 7.0.3
get-stream: 6.0.1
human-signals: 2.1.0
is-stream: 2.0.1
human-signals: 3.0.1
is-stream: 3.0.0
merge-stream: 2.0.0
npm-run-path: 4.0.1
onetime: 5.1.2
npm-run-path: 5.1.0
onetime: 6.0.0
signal-exit: 3.0.7
strip-final-newline: 2.0.0
strip-final-newline: 3.0.0
dev: true
/fill-range/7.0.1:
@@ -170,14 +169,14 @@ packages:
engines: {node: '>=10'}
dev: true
/human-signals/2.1.0:
resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
engines: {node: '>=10.17.0'}
/human-signals/3.0.1:
resolution: {integrity: sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==}
engines: {node: '>=12.20.0'}
dev: true
/husky/7.0.4:
resolution: {integrity: sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==}
engines: {node: '>=12'}
/husky/8.0.1:
resolution: {integrity: sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==}
engines: {node: '>=14'}
hasBin: true
dev: true
@@ -201,41 +200,41 @@ packages:
engines: {node: '>=0.12.0'}
dev: true
/is-stream/2.0.1:
resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==}
engines: {node: '>=8'}
/is-stream/3.0.0:
resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dev: true
/isexe/2.0.0:
resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=}
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
dev: true
/lilconfig/2.0.4:
resolution: {integrity: sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==}
/lilconfig/2.0.5:
resolution: {integrity: sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==}
engines: {node: '>=10'}
dev: true
/lint-staged/12.3.7:
resolution: {integrity: sha512-/S4D726e2GIsDVWIk1XGvheCaDm1SJRQp8efamZFWJxQMVEbOwSysp7xb49Oo73KYCdy97mIWinhlxcoNqIfIQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
/lint-staged/13.0.3:
resolution: {integrity: sha512-9hmrwSCFroTSYLjflGI8Uk+GWAwMB4OlpU4bMJEAT5d/llQwtYKoim4bLOyLCuWFAhWEupE0vkIFqtw/WIsPug==}
engines: {node: ^14.13.1 || >=16.0.0}
hasBin: true
dependencies:
cli-truncate: 3.1.0
colorette: 2.0.16
commander: 8.3.0
debug: 4.3.4_supports-color@9.2.1
execa: 5.1.1
lilconfig: 2.0.4
colorette: 2.0.19
commander: 9.3.0
debug: 4.3.4
execa: 6.1.0
lilconfig: 2.0.5
listr2: 4.0.5
micromatch: 4.0.5
normalize-path: 3.0.0
object-inspect: 1.12.0
pidtree: 0.5.0
object-inspect: 1.12.2
pidtree: 0.6.0
string-argv: 0.3.1
supports-color: 9.2.1
yaml: 1.10.2
yaml: 2.1.1
transitivePeerDependencies:
- enquirer
- supports-color
dev: true
/listr2/4.0.5:
@@ -248,11 +247,11 @@ packages:
optional: true
dependencies:
cli-truncate: 2.1.0
colorette: 2.0.16
colorette: 2.0.19
log-update: 4.0.0
p-map: 4.0.0
rfdc: 1.3.0
rxjs: 7.5.5
rxjs: 7.5.6
through: 2.3.8
wrap-ansi: 7.0.0
dev: true
@@ -284,6 +283,11 @@ packages:
engines: {node: '>=6'}
dev: true
/mimic-fn/4.0.0:
resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==}
engines: {node: '>=12'}
dev: true
/ms/2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: true
@@ -293,15 +297,15 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/npm-run-path/4.0.1:
resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
engines: {node: '>=8'}
/npm-run-path/5.1.0:
resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dependencies:
path-key: 3.1.1
path-key: 4.0.0
dev: true
/object-inspect/1.12.0:
resolution: {integrity: sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==}
/object-inspect/1.12.2:
resolution: {integrity: sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==}
dev: true
/onetime/5.1.2:
@@ -311,6 +315,13 @@ packages:
mimic-fn: 2.1.0
dev: true
/onetime/6.0.0:
resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==}
engines: {node: '>=12'}
dependencies:
mimic-fn: 4.0.0
dev: true
/p-map/4.0.0:
resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==}
engines: {node: '>=10'}
@@ -323,19 +334,24 @@ packages:
engines: {node: '>=8'}
dev: true
/path-key/4.0.0:
resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==}
engines: {node: '>=12'}
dev: true
/picomatch/2.3.1:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
engines: {node: '>=8.6'}
dev: true
/pidtree/0.5.0:
resolution: {integrity: sha512-9nxspIM7OpZuhBxPg73Zvyq7j1QMPMPsGKTqRc2XOaFQauDvoNz9fM1Wdkjmeo7l9GXOZiRs97sPkuayl39wjA==}
/pidtree/0.6.0:
resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==}
engines: {node: '>=0.10'}
hasBin: true
dev: true
/prettier/2.6.1:
resolution: {integrity: sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A==}
/prettier/2.7.1:
resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==}
engines: {node: '>=10.13.0'}
hasBin: true
dev: true
@@ -352,10 +368,10 @@ packages:
resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==}
dev: true
/rxjs/7.5.5:
resolution: {integrity: sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==}
/rxjs/7.5.6:
resolution: {integrity: sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==}
dependencies:
tslib: 2.3.1
tslib: 2.4.0
dev: true
/shebang-command/2.0.0:
@@ -437,18 +453,13 @@ packages:
ansi-regex: 6.0.1
dev: true
/strip-final-newline/2.0.0:
resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==}
engines: {node: '>=6'}
dev: true
/supports-color/9.2.1:
resolution: {integrity: sha512-Obv7ycoCTG51N7y175StI9BlAXrmgZrFhZOb0/PyjHBher/NmsdBgbbQ1Inhq+gIhz6+7Gb+jWF2Vqi7Mf1xnQ==}
/strip-final-newline/3.0.0:
resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==}
engines: {node: '>=12'}
dev: true
/through/2.3.8:
resolution: {integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=}
resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
dev: true
/to-regex-range/5.0.1:
@@ -458,8 +469,8 @@ packages:
is-number: 7.0.0
dev: true
/tslib/2.3.1:
resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==}
/tslib/2.4.0:
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
dev: true
/type-fest/0.21.3:
@@ -493,7 +504,7 @@ packages:
strip-ansi: 6.0.1
dev: true
/yaml/1.10.2:
resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==}
engines: {node: '>= 6'}
/yaml/2.1.1:
resolution: {integrity: sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw==}
engines: {node: '>= 14'}
dev: true
+7 -7
View File
@@ -9,14 +9,14 @@
},
"license": "MIT",
"devDependencies": {
"sass": "^1.49.9",
"typescript": "^4.6.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6"
"sass": "^1.54.5",
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"@popperjs/core": "^2.11.4",
"bootstrap": "^5.1.3",
"solid-js": "^1.3.13"
"@popperjs/core": "^2.11.6",
"bootstrap": "^5.2.0",
"solid-js": "^1.5.1"
}
}
+363 -323
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -3,8 +3,10 @@ import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+8
View File
@@ -0,0 +1,8 @@
{
"presets": [
"@babel/preset-env",
"babel-preset-solid",
// only if you use TS with solid-jest
"@babel/preset-typescript"
]
}
+2
View File
@@ -0,0 +1,2 @@
node_modules
dist
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" />
<title>Solid App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="/src/index.tsx" type="module"></script>
</body>
</html>
+3
View File
@@ -0,0 +1,3 @@
import "regenerator-runtime/runtime";
import "@testing-library/jest-dom";
import "@testing-library/jest-dom/extend-expect";
+41
View File
@@ -0,0 +1,41 @@
{
"name": "ts-jest-template-solid",
"version": "0.0.0",
"description": "",
"scripts": {
"start": "vite",
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"test": "jest"
},
"jest": {
"preset": "solid-jest/preset/browser",
"setupFilesAfterEnv": [
"<rootDir>/jest-setup.ts"
]
},
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.18.13",
"@babel/preset-env": "^7.18.10",
"@babel/preset-typescript": "^7.18.6",
"@testing-library/jest-dom": "^5.16.5",
"@types/jest": "^28.1.8",
"babel-jest": "^29.0.1",
"babel-preset-jest": "^29.0.0",
"babel-preset-solid": "^1.5.1",
"jest": "^29.0.1",
"jest-environment-jsdom": "^29.0.1",
"jsdom": "^20.0.0",
"regenerator-runtime": "0.13.9",
"solid-jest": "^0.2.0",
"solid-testing-library": "^0.3.0",
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.5.1"
}
}
+4761
View File
File diff suppressed because it is too large Load Diff
+5
View File
@@ -0,0 +1,5 @@
import { render } from 'solid-js/web';
import { TodoList } from './todo-list';
render(() => <TodoList />, document.getElementById('root') as HTMLElement);
+38
View File
@@ -0,0 +1,38 @@
import { render, fireEvent } from 'solid-testing-library';
import { TodoList } from './todo-list';
describe('<TodoList />', () => {
test('it will render an text input and a button', () => {
const { getByPlaceholderText, getByText, unmount } = render(() => <TodoList />);
expect(getByPlaceholderText('new todo here')).toBeInTheDocument();
expect(getByText('Add Todo')).toBeInTheDocument();
unmount();
});
test('it will add a new todo', async () => {
const { getByPlaceholderText, getByText, unmount } = render(() => <TodoList />);
const input = getByPlaceholderText('new todo here') as HTMLInputElement;
const button = getByText('Add Todo');
input.value = 'test new todo';
fireEvent.click(button as HTMLInputElement);
expect(input.value).toBe('');
expect(getByText(/test new todo/)).toBeInTheDocument();
unmount();
});
test('it will mark a todo as completed', async () => {
const { getByPlaceholderText, findByRole, getByText, unmount } = render(() => <TodoList />);
const input = getByPlaceholderText('new todo here') as HTMLInputElement;
const button = getByText('Add Todo') as HTMLButtonElement;
input.value = 'mark new todo as completed';
fireEvent.click(button);
const completed = await findByRole('checkbox') as HTMLInputElement;
expect(completed?.checked).toBe(false);
fireEvent.click(completed);
expect(completed?.checked).toBe(true);
const text = getByText('mark new todo as completed') as HTMLSpanElement;
expect(text).toHaveStyle({ 'text-decoration': 'line-through' });
unmount();
});
});
+49
View File
@@ -0,0 +1,49 @@
import { For, createSignal } from 'solid-js';
type Todo = { id: number, text: string, completed: boolean };
export const TodoList = () => {
let input!: HTMLInputElement;
let todoId = 0;
const [todos, setTodos] = createSignal<Todo[]>([])
const addTodo = (text: string) => {
setTodos([...todos(), { id: ++todoId, text, completed: false }]);
}
const toggleTodo = (id: number) => {
setTodos(todos().map(todo =>
todo.id === id ? { ...todo, completed: !todo.completed } : todo)
);
}
return (
<>
<div>
<input placeholder="new todo here" ref={input} />
<button
onClick={() => {
if (!input.value.trim()) return;
addTodo(input.value);
input.value = "";
}}
>
Add Todo
</button>
</div>
<For each={todos()}>
{(todo) => {
const { id, text } = todo;
return <div>
<input
type="checkbox"
checked={todo.completed}
onchange={[toggleTodo, id]}
/>
<span
style={{ "text-decoration": todo.completed ? "line-through" : "none" }}
>{text}</span>
</div>
}}
</For>
</>
);
}
+16
View File
@@ -0,0 +1,16 @@
{
"types": ["jest", "@testing-library/jest-dom"],
"compilerOptions": {
"strict": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"types": ["vite/client"],
"noEmit": true,
"isolatedModules": true
}
}
+12
View File
@@ -0,0 +1,12 @@
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
},
});
+4 -4
View File
@@ -9,11 +9,11 @@
},
"license": "MIT",
"devDependencies": {
"typescript": "^4.6.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6"
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+344 -304
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -3,8 +3,10 @@ import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+5 -5
View File
@@ -9,12 +9,12 @@
},
"license": "MIT",
"devDependencies": {
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6",
"vite-plugin-windicss": "^1.8.3"
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0",
"vite-plugin-windicss": "^1.8.7"
},
"dependencies": {
"solid-app-router": "^0.3.2",
"solid-js": "^1.3.13"
"solid-app-router": "^0.4.2",
"solid-js": "^1.5.1"
}
}
+373 -332
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -6,6 +6,5 @@ export default defineConfig({
plugins: [solidPlugin(), WindiCSS()],
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+5 -5
View File
@@ -9,12 +9,12 @@
},
"license": "MIT",
"devDependencies": {
"sass": "^1.49.9",
"typescript": "^4.6.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6"
"sass": "^1.54.5",
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+353 -313
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -3,8 +3,10 @@ import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+7 -7
View File
@@ -9,14 +9,14 @@
},
"license": "MIT",
"devDependencies": {
"autoprefixer": "^10.4.4",
"postcss": "^8.4.12",
"tailwindcss": "^3.0.23",
"typescript": "^4.6.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6"
"autoprefixer": "^10.4.8",
"postcss": "^8.4.16",
"tailwindcss": "^3.1.8",
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+445 -457
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./index.html',
+3 -1
View File
@@ -3,8 +3,10 @@ import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+6 -6
View File
@@ -9,13 +9,13 @@
},
"license": "MIT",
"devDependencies": {
"@unocss/preset-mini": "^0.30.4",
"@unocss/vite": "^0.30.4",
"typescript": "^4.6.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6"
"@unocss/preset-mini": "^0.45.13",
"@unocss/vite": "^0.45.13",
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+401 -357
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -9,8 +9,10 @@ export default defineConfig({
// your config or in uno.config.ts
}),
],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+9 -9
View File
@@ -11,18 +11,18 @@
},
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.17.8",
"babel-preset-solid": "^1.3.13",
"jsdom": "^19.0.0",
"@babel/core": "^7.18.13",
"babel-preset-solid": "^1.5.1",
"jsdom": "^20.0.0",
"solid-dom-testing": "^0.0.3",
"solid-register": "^0.1.5",
"solid-register": "^0.2.5",
"solid-testing-library": "^0.3.0",
"typescript": "^4.6.3",
"uvu": "^0.5.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6"
"typescript": "^4.8.2",
"uvu": "^0.5.6",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+676 -403
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,4 +2,4 @@ import { render } from 'solid-js/web';
import { TodoList } from './todo-list';
render(() => <TodoList />, document.getElementById('root'));
render(() => <TodoList />, document.getElementById('root') as HTMLElement);
+3 -1
View File
@@ -3,8 +3,10 @@ import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+7 -7
View File
@@ -13,16 +13,16 @@
},
"license": "MIT",
"devDependencies": {
"@testing-library/jest-dom": "^5.16.3",
"@types/testing-library__jest-dom": "^5.14.3",
"jsdom": "^19.0.0",
"@testing-library/jest-dom": "^5.16.5",
"jsdom": "^20.0.0",
"solid-testing-library": "^0.3.0",
"typescript": "^4.6.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6",
"vitest": "^0.7.11"
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0",
"vitest": "^0.22.1"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+642 -466
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,4 +2,4 @@ import { render } from 'solid-js/web';
import { TodoList } from './todo-list';
render(() => <TodoList />, document.getElementById('root'));
render(() => <TodoList />, document.getElementById('root') as HTMLElement);
+4 -2
View File
@@ -6,6 +6,9 @@ import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
test: {
environment: 'jsdom',
globals: true,
@@ -25,9 +28,8 @@ export default defineConfig({
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
resolve: {
conditions: ['development', 'browser'],
}
},
});
+5 -5
View File
@@ -9,12 +9,12 @@
},
"license": "MIT",
"devDependencies": {
"typescript": "^4.6.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6",
"vite-plugin-windicss": "^1.8.3"
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0",
"vite-plugin-windicss": "^1.8.7"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+372 -331
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -11,8 +11,10 @@ export default defineConfig({
},
}),
],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
+4 -4
View File
@@ -10,11 +10,11 @@
},
"license": "MIT",
"devDependencies": {
"typescript": "^4.6.3",
"vite": "^2.8.6",
"vite-plugin-solid": "^2.2.6"
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.3.13"
"solid-js": "^1.5.1"
}
}
+344 -304
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -3,8 +3,10 @@ import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});