From 80427068ea8c78f7cee667d97741d4b2dd68cb11 Mon Sep 17 00:00:00 2001 From: Badri Sunderarajan Date: Fri, 5 Aug 2022 10:27:32 +0530 Subject: [PATCH] Validate fields (and auto-update slug) The slug is intelligently computed from the other fields, until the user decides to manually override it. --- package.json | 12 ++++---- src/App.svelte | 76 +++++++++++++++++++++++++++++++++++++++++++++++--- yarn.lock | 10 +++++++ 3 files changed, 89 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 4012e8a..4f3cf50 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,8 @@ "devDependencies": { "@rollup/plugin-commonjs": "^17.0.0", "@rollup/plugin-node-resolve": "^11.0.0", + "@rollup/plugin-typescript": "^8.0.0", + "@tsconfig/svelte": "^2.0.0", "rollup": "^2.3.4", "rollup-plugin-css-only": "^3.1.0", "rollup-plugin-livereload": "^2.0.0", @@ -19,12 +21,12 @@ "svelte": "^3.0.0", "svelte-check": "^2.0.0", "svelte-preprocess": "^4.0.0", - "@rollup/plugin-typescript": "^8.0.0", - "typescript": "^4.0.0", "tslib": "^2.0.0", - "@tsconfig/svelte": "^2.0.0" + "typescript": "^4.0.0" }, "dependencies": { - "sirv-cli": "^2.0.0" + "email-validator": "^2.0.4", + "sirv-cli": "^2.0.0", + "slug": "^5.3.0" } -} \ No newline at end of file +} diff --git a/src/App.svelte b/src/App.svelte index 7105c61..f3a5ed4 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,12 +1,80 @@ @@ -21,17 +89,17 @@
- +
- +
- +
diff --git a/yarn.lock b/yarn.lock index 951c39b..25a5301 100644 --- a/yarn.lock +++ b/yarn.lock @@ -309,6 +309,11 @@ detect-indent@^6.0.0: resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== +email-validator@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/email-validator/-/email-validator-2.0.4.tgz#b8dfaa5d0dae28f1b03c95881d904d4e40bfe7ed" + integrity sha512-gYCwo7kh5S3IDyZPLZf6hSS0MnZT8QmJFqYvbqlDZSbwdZlY6QZWxJ4i/6UhITOJ4XzyI647Bm2MXKCLqnJ4nQ== + es6-promise@^3.1.2: version "3.3.1" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613" @@ -786,6 +791,11 @@ sirv@^2.0.0: mrmime "^1.0.0" totalist "^3.0.0" +slug@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/slug/-/slug-5.3.0.tgz#d63d3a5a88d5508c1adcf2b8aeeb045c3f43760b" + integrity sha512-h7yD2UDVyMcQRv/WLSjq7HDH6ToO/22MB381zfx6/ebtdWUlGcyxpJNVHl6WFvKjIMHf5ZxANFp/srsy4mfT/w== + sorcery@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/sorcery/-/sorcery-0.10.0.tgz#8ae90ad7d7cb05fc59f1ab0c637845d5c15a52b7"