diff --git a/examples/waspleau/.gitignore b/examples/cronjobs-analytics-waspleau/.gitignore similarity index 100% rename from examples/waspleau/.gitignore rename to examples/cronjobs-analytics-waspleau/.gitignore diff --git a/examples/hackathon/.wasproot b/examples/cronjobs-analytics-waspleau/.wasproot similarity index 100% rename from examples/hackathon/.wasproot rename to examples/cronjobs-analytics-waspleau/.wasproot diff --git a/examples/waspleau/Notes.md b/examples/cronjobs-analytics-waspleau/Notes.md similarity index 100% rename from examples/waspleau/Notes.md rename to examples/cronjobs-analytics-waspleau/Notes.md diff --git a/examples/waspleau/README.md b/examples/cronjobs-analytics-waspleau/README.md similarity index 100% rename from examples/waspleau/README.md rename to examples/cronjobs-analytics-waspleau/README.md diff --git a/examples/waspleau/main.wasp b/examples/cronjobs-analytics-waspleau/main.wasp similarity index 100% rename from examples/waspleau/main.wasp rename to examples/cronjobs-analytics-waspleau/main.wasp diff --git a/examples/waspleau/migrations/20211216021230_dummy/migration.sql b/examples/cronjobs-analytics-waspleau/migrations/20211216021230_dummy/migration.sql similarity index 100% rename from examples/waspleau/migrations/20211216021230_dummy/migration.sql rename to examples/cronjobs-analytics-waspleau/migrations/20211216021230_dummy/migration.sql diff --git a/examples/waspleau/migrations/20220518180354_add_metrics/migration.sql b/examples/cronjobs-analytics-waspleau/migrations/20220518180354_add_metrics/migration.sql similarity index 100% rename from examples/waspleau/migrations/20220518180354_add_metrics/migration.sql rename to examples/cronjobs-analytics-waspleau/migrations/20220518180354_add_metrics/migration.sql diff --git a/examples/waspleau/migrations/20220518182534_remove_dummy/migration.sql b/examples/cronjobs-analytics-waspleau/migrations/20220518182534_remove_dummy/migration.sql similarity index 100% rename from examples/waspleau/migrations/20220518182534_remove_dummy/migration.sql rename to examples/cronjobs-analytics-waspleau/migrations/20220518182534_remove_dummy/migration.sql diff --git a/examples/waspleau/migrations/20221124022424_rename_metric_model/migration.sql b/examples/cronjobs-analytics-waspleau/migrations/20221124022424_rename_metric_model/migration.sql similarity index 100% rename from examples/waspleau/migrations/20221124022424_rename_metric_model/migration.sql rename to examples/cronjobs-analytics-waspleau/migrations/20221124022424_rename_metric_model/migration.sql diff --git a/examples/thoughts/migrations/migration_lock.toml b/examples/cronjobs-analytics-waspleau/migrations/migration_lock.toml similarity index 100% rename from examples/thoughts/migrations/migration_lock.toml rename to examples/cronjobs-analytics-waspleau/migrations/migration_lock.toml diff --git a/examples/hackathon/src/.waspignore b/examples/cronjobs-analytics-waspleau/src/.waspignore similarity index 100% rename from examples/hackathon/src/.waspignore rename to examples/cronjobs-analytics-waspleau/src/.waspignore diff --git a/examples/waspleau/src/client/MainPage.jsx b/examples/cronjobs-analytics-waspleau/src/client/MainPage.jsx similarity index 100% rename from examples/waspleau/src/client/MainPage.jsx rename to examples/cronjobs-analytics-waspleau/src/client/MainPage.jsx diff --git a/examples/waspleau/src/client/WaspSourceHeader.jsx b/examples/cronjobs-analytics-waspleau/src/client/WaspSourceHeader.jsx similarity index 100% rename from examples/waspleau/src/client/WaspSourceHeader.jsx rename to examples/cronjobs-analytics-waspleau/src/client/WaspSourceHeader.jsx diff --git a/examples/waspleau/src/client/addWaspSourceHeader.jsx b/examples/cronjobs-analytics-waspleau/src/client/addWaspSourceHeader.jsx similarity index 100% rename from examples/waspleau/src/client/addWaspSourceHeader.jsx rename to examples/cronjobs-analytics-waspleau/src/client/addWaspSourceHeader.jsx diff --git a/examples/thoughts/src/client/jsconfig.json b/examples/cronjobs-analytics-waspleau/src/client/jsconfig.json similarity index 100% rename from examples/thoughts/src/client/jsconfig.json rename to examples/cronjobs-analytics-waspleau/src/client/jsconfig.json diff --git a/examples/waspleau/src/client/style.css b/examples/cronjobs-analytics-waspleau/src/client/style.css similarity index 100% rename from examples/waspleau/src/client/style.css rename to examples/cronjobs-analytics-waspleau/src/client/style.css diff --git a/examples/streaming/src/client/waspLogo.png b/examples/cronjobs-analytics-waspleau/src/client/waspLogo.png similarity index 100% rename from examples/streaming/src/client/waspLogo.png rename to examples/cronjobs-analytics-waspleau/src/client/waspLogo.png diff --git a/examples/waspleau/src/server/dashboard.js b/examples/cronjobs-analytics-waspleau/src/server/dashboard.js similarity index 100% rename from examples/waspleau/src/server/dashboard.js rename to examples/cronjobs-analytics-waspleau/src/server/dashboard.js diff --git a/examples/thoughts/src/server/jsconfig.json b/examples/cronjobs-analytics-waspleau/src/server/jsconfig.json similarity index 100% rename from examples/thoughts/src/server/jsconfig.json rename to examples/cronjobs-analytics-waspleau/src/server/jsconfig.json diff --git a/examples/waspleau/src/server/serverSetup.js b/examples/cronjobs-analytics-waspleau/src/server/serverSetup.js similarity index 100% rename from examples/waspleau/src/server/serverSetup.js rename to examples/cronjobs-analytics-waspleau/src/server/serverSetup.js diff --git a/examples/waspleau/src/server/workers/github.js b/examples/cronjobs-analytics-waspleau/src/server/workers/github.js similarity index 100% rename from examples/waspleau/src/server/workers/github.js rename to examples/cronjobs-analytics-waspleau/src/server/workers/github.js diff --git a/examples/waspleau/src/server/workers/loadTime.js b/examples/cronjobs-analytics-waspleau/src/server/workers/loadTime.js similarity index 100% rename from examples/waspleau/src/server/workers/loadTime.js rename to examples/cronjobs-analytics-waspleau/src/server/workers/loadTime.js diff --git a/examples/waspleau/src/server/workers/utils.js b/examples/cronjobs-analytics-waspleau/src/server/workers/utils.js similarity index 100% rename from examples/waspleau/src/server/workers/utils.js rename to examples/cronjobs-analytics-waspleau/src/server/workers/utils.js diff --git a/examples/thoughts/src/shared/jsconfig.json b/examples/cronjobs-analytics-waspleau/src/shared/jsconfig.json similarity index 100% rename from examples/thoughts/src/shared/jsconfig.json rename to examples/cronjobs-analytics-waspleau/src/shared/jsconfig.json diff --git a/examples/thoughts/.gitignore b/examples/db-seeding-thoughts/.gitignore similarity index 100% rename from examples/thoughts/.gitignore rename to examples/db-seeding-thoughts/.gitignore diff --git a/examples/streaming/src/.waspignore b/examples/db-seeding-thoughts/.waspignore similarity index 100% rename from examples/streaming/src/.waspignore rename to examples/db-seeding-thoughts/.waspignore diff --git a/examples/streaming/.wasproot b/examples/db-seeding-thoughts/.wasproot similarity index 100% rename from examples/streaming/.wasproot rename to examples/db-seeding-thoughts/.wasproot diff --git a/examples/thoughts/README.md b/examples/db-seeding-thoughts/README.md similarity index 100% rename from examples/thoughts/README.md rename to examples/db-seeding-thoughts/README.md diff --git a/examples/thoughts/main.wasp b/examples/db-seeding-thoughts/main.wasp similarity index 100% rename from examples/thoughts/main.wasp rename to examples/db-seeding-thoughts/main.wasp diff --git a/examples/thoughts/migrations/20210513205603_/migration.sql b/examples/db-seeding-thoughts/migrations/20210513205603_/migration.sql similarity index 100% rename from examples/thoughts/migrations/20210513205603_/migration.sql rename to examples/db-seeding-thoughts/migrations/20210513205603_/migration.sql diff --git a/examples/thoughts/migrations/20210713180928_attached_entities_to_user/migration.sql b/examples/db-seeding-thoughts/migrations/20210713180928_attached_entities_to_user/migration.sql similarity index 100% rename from examples/thoughts/migrations/20210713180928_attached_entities_to_user/migration.sql rename to examples/db-seeding-thoughts/migrations/20210713180928_attached_entities_to_user/migration.sql diff --git a/examples/thoughts/migrations/20210713182512_tags_unique/migration.sql b/examples/db-seeding-thoughts/migrations/20210713182512_tags_unique/migration.sql similarity index 100% rename from examples/thoughts/migrations/20210713182512_tags_unique/migration.sql rename to examples/db-seeding-thoughts/migrations/20210713182512_tags_unique/migration.sql diff --git a/examples/thoughts/migrations/20220818151104_rename_email_to_username/migration.sql b/examples/db-seeding-thoughts/migrations/20220818151104_rename_email_to_username/migration.sql similarity index 100% rename from examples/thoughts/migrations/20220818151104_rename_email_to_username/migration.sql rename to examples/db-seeding-thoughts/migrations/20220818151104_rename_email_to_username/migration.sql diff --git a/examples/thoughts/migrations/20220818165835_getting_up_to_date/migration.sql b/examples/db-seeding-thoughts/migrations/20220818165835_getting_up_to_date/migration.sql similarity index 100% rename from examples/thoughts/migrations/20220818165835_getting_up_to_date/migration.sql rename to examples/db-seeding-thoughts/migrations/20220818165835_getting_up_to_date/migration.sql diff --git a/examples/waspello/migrations/migration_lock.toml b/examples/db-seeding-thoughts/migrations/migration_lock.toml similarity index 100% rename from examples/waspello/migrations/migration_lock.toml rename to examples/db-seeding-thoughts/migrations/migration_lock.toml diff --git a/examples/thoughts/src/client/Layout.css b/examples/db-seeding-thoughts/src/client/Layout.css similarity index 100% rename from examples/thoughts/src/client/Layout.css rename to examples/db-seeding-thoughts/src/client/Layout.css diff --git a/examples/thoughts/src/client/Layout.jsx b/examples/db-seeding-thoughts/src/client/Layout.jsx similarity index 100% rename from examples/thoughts/src/client/Layout.jsx rename to examples/db-seeding-thoughts/src/client/Layout.jsx diff --git a/examples/thoughts/src/client/LoginPage.jsx b/examples/db-seeding-thoughts/src/client/LoginPage.jsx similarity index 100% rename from examples/thoughts/src/client/LoginPage.jsx rename to examples/db-seeding-thoughts/src/client/LoginPage.jsx diff --git a/examples/thoughts/src/client/Main.css b/examples/db-seeding-thoughts/src/client/Main.css similarity index 100% rename from examples/thoughts/src/client/Main.css rename to examples/db-seeding-thoughts/src/client/Main.css diff --git a/examples/thoughts/src/client/MainPage.jsx b/examples/db-seeding-thoughts/src/client/MainPage.jsx similarity index 100% rename from examples/thoughts/src/client/MainPage.jsx rename to examples/db-seeding-thoughts/src/client/MainPage.jsx diff --git a/examples/thoughts/src/client/SignupPage.jsx b/examples/db-seeding-thoughts/src/client/SignupPage.jsx similarity index 100% rename from examples/thoughts/src/client/SignupPage.jsx rename to examples/db-seeding-thoughts/src/client/SignupPage.jsx diff --git a/examples/thoughts/src/client/Tag.css b/examples/db-seeding-thoughts/src/client/Tag.css similarity index 100% rename from examples/thoughts/src/client/Tag.css rename to examples/db-seeding-thoughts/src/client/Tag.css diff --git a/examples/thoughts/src/client/Tag.jsx b/examples/db-seeding-thoughts/src/client/Tag.jsx similarity index 100% rename from examples/thoughts/src/client/Tag.jsx rename to examples/db-seeding-thoughts/src/client/Tag.jsx diff --git a/examples/thoughts/src/client/TagsSidebar.css b/examples/db-seeding-thoughts/src/client/TagsSidebar.css similarity index 100% rename from examples/thoughts/src/client/TagsSidebar.css rename to examples/db-seeding-thoughts/src/client/TagsSidebar.css diff --git a/examples/thoughts/src/client/TagsSidebar.jsx b/examples/db-seeding-thoughts/src/client/TagsSidebar.jsx similarity index 100% rename from examples/thoughts/src/client/TagsSidebar.jsx rename to examples/db-seeding-thoughts/src/client/TagsSidebar.jsx diff --git a/examples/thoughts/src/client/Thought.css b/examples/db-seeding-thoughts/src/client/Thought.css similarity index 100% rename from examples/thoughts/src/client/Thought.css rename to examples/db-seeding-thoughts/src/client/Thought.css diff --git a/examples/thoughts/src/client/ThoughtsPage.css b/examples/db-seeding-thoughts/src/client/ThoughtsPage.css similarity index 100% rename from examples/thoughts/src/client/ThoughtsPage.css rename to examples/db-seeding-thoughts/src/client/ThoughtsPage.css diff --git a/examples/thoughts/src/client/ThoughtsPage.jsx b/examples/db-seeding-thoughts/src/client/ThoughtsPage.jsx similarity index 100% rename from examples/thoughts/src/client/ThoughtsPage.jsx rename to examples/db-seeding-thoughts/src/client/ThoughtsPage.jsx diff --git a/examples/thoughts/src/client/TopNavbar.css b/examples/db-seeding-thoughts/src/client/TopNavbar.css similarity index 100% rename from examples/thoughts/src/client/TopNavbar.css rename to examples/db-seeding-thoughts/src/client/TopNavbar.css diff --git a/examples/thoughts/src/client/TopNavbar.jsx b/examples/db-seeding-thoughts/src/client/TopNavbar.jsx similarity index 100% rename from examples/thoughts/src/client/TopNavbar.jsx rename to examples/db-seeding-thoughts/src/client/TopNavbar.jsx diff --git a/examples/thoughts/src/client/WaspSourceHeader.jsx b/examples/db-seeding-thoughts/src/client/WaspSourceHeader.jsx similarity index 100% rename from examples/thoughts/src/client/WaspSourceHeader.jsx rename to examples/db-seeding-thoughts/src/client/WaspSourceHeader.jsx diff --git a/examples/thoughts/src/client/addWaspSourceHeader.jsx b/examples/db-seeding-thoughts/src/client/addWaspSourceHeader.jsx similarity index 100% rename from examples/thoughts/src/client/addWaspSourceHeader.jsx rename to examples/db-seeding-thoughts/src/client/addWaspSourceHeader.jsx diff --git a/examples/waspello/src/client/jsconfig.json b/examples/db-seeding-thoughts/src/client/jsconfig.json similarity index 100% rename from examples/waspello/src/client/jsconfig.json rename to examples/db-seeding-thoughts/src/client/jsconfig.json diff --git a/examples/thoughts/src/client/waspLogo.png b/examples/db-seeding-thoughts/src/client/waspLogo.png similarity index 100% rename from examples/thoughts/src/client/waspLogo.png rename to examples/db-seeding-thoughts/src/client/waspLogo.png diff --git a/examples/thoughts/src/server/actions.js b/examples/db-seeding-thoughts/src/server/actions.js similarity index 100% rename from examples/thoughts/src/server/actions.js rename to examples/db-seeding-thoughts/src/server/actions.js diff --git a/examples/waspello/src/server/jsconfig.json b/examples/db-seeding-thoughts/src/server/jsconfig.json similarity index 100% rename from examples/waspello/src/server/jsconfig.json rename to examples/db-seeding-thoughts/src/server/jsconfig.json diff --git a/examples/thoughts/src/server/queries.js b/examples/db-seeding-thoughts/src/server/queries.js similarity index 100% rename from examples/thoughts/src/server/queries.js rename to examples/db-seeding-thoughts/src/server/queries.js diff --git a/examples/thoughts/src/server/seeds.js b/examples/db-seeding-thoughts/src/server/seeds.js similarity index 100% rename from examples/thoughts/src/server/seeds.js rename to examples/db-seeding-thoughts/src/server/seeds.js diff --git a/examples/waspello/src/shared/jsconfig.json b/examples/db-seeding-thoughts/src/shared/jsconfig.json similarity index 100% rename from examples/waspello/src/shared/jsconfig.json rename to examples/db-seeding-thoughts/src/shared/jsconfig.json diff --git a/examples/streaming/.gitignore b/examples/gpt-response-streaming/.gitignore similarity index 100% rename from examples/streaming/.gitignore rename to examples/gpt-response-streaming/.gitignore diff --git a/examples/thoughts/.wasproot b/examples/gpt-response-streaming/.wasproot similarity index 100% rename from examples/thoughts/.wasproot rename to examples/gpt-response-streaming/.wasproot diff --git a/examples/streaming/main.wasp b/examples/gpt-response-streaming/main.wasp similarity index 100% rename from examples/streaming/main.wasp rename to examples/gpt-response-streaming/main.wasp diff --git a/examples/thoughts/.waspignore b/examples/gpt-response-streaming/src/.waspignore similarity index 100% rename from examples/thoughts/.waspignore rename to examples/gpt-response-streaming/src/.waspignore diff --git a/examples/streaming/src/client/Main.css b/examples/gpt-response-streaming/src/client/Main.css similarity index 100% rename from examples/streaming/src/client/Main.css rename to examples/gpt-response-streaming/src/client/Main.css diff --git a/examples/streaming/src/client/MainPage.jsx b/examples/gpt-response-streaming/src/client/MainPage.jsx similarity index 100% rename from examples/streaming/src/client/MainPage.jsx rename to examples/gpt-response-streaming/src/client/MainPage.jsx diff --git a/examples/streaming/src/client/tsconfig.json b/examples/gpt-response-streaming/src/client/tsconfig.json similarity index 100% rename from examples/streaming/src/client/tsconfig.json rename to examples/gpt-response-streaming/src/client/tsconfig.json diff --git a/examples/hackathon/src/client/vite-env.d.ts b/examples/gpt-response-streaming/src/client/vite-env.d.ts similarity index 100% rename from examples/hackathon/src/client/vite-env.d.ts rename to examples/gpt-response-streaming/src/client/vite-env.d.ts diff --git a/examples/todo-typescript/src/client/waspLogo.png b/examples/gpt-response-streaming/src/client/waspLogo.png similarity index 100% rename from examples/todo-typescript/src/client/waspLogo.png rename to examples/gpt-response-streaming/src/client/waspLogo.png diff --git a/examples/streaming/src/server/streaming.ts b/examples/gpt-response-streaming/src/server/streaming.ts similarity index 100% rename from examples/streaming/src/server/streaming.ts rename to examples/gpt-response-streaming/src/server/streaming.ts diff --git a/examples/streaming/src/server/tsconfig.json b/examples/gpt-response-streaming/src/server/tsconfig.json similarity index 100% rename from examples/streaming/src/server/tsconfig.json rename to examples/gpt-response-streaming/src/server/tsconfig.json diff --git a/examples/hackathon/src/shared/tsconfig.json b/examples/gpt-response-streaming/src/shared/tsconfig.json similarity index 100% rename from examples/hackathon/src/shared/tsconfig.json rename to examples/gpt-response-streaming/src/shared/tsconfig.json diff --git a/examples/hackathon/.gitignore b/examples/hackathon-submissions/.gitignore similarity index 100% rename from examples/hackathon/.gitignore rename to examples/hackathon-submissions/.gitignore diff --git a/examples/todo-typescript/.wasproot b/examples/hackathon-submissions/.wasproot similarity index 100% rename from examples/todo-typescript/.wasproot rename to examples/hackathon-submissions/.wasproot diff --git a/examples/hackathon/README.md b/examples/hackathon-submissions/README.md similarity index 100% rename from examples/hackathon/README.md rename to examples/hackathon-submissions/README.md diff --git a/examples/hackathon/main.wasp b/examples/hackathon-submissions/main.wasp similarity index 95% rename from examples/hackathon/main.wasp rename to examples/hackathon-submissions/main.wasp index 198a0961d..0d74ec0f3 100644 --- a/examples/hackathon/main.wasp +++ b/examples/hackathon-submissions/main.wasp @@ -12,7 +12,7 @@ app hackathonBetaSubmissions { } entity Submission {=psl - name String @id @unique + name String @id @unique email String @unique github String description String diff --git a/examples/hackathon/postcss.config.cjs b/examples/hackathon-submissions/postcss.config.cjs similarity index 100% rename from examples/hackathon/postcss.config.cjs rename to examples/hackathon-submissions/postcss.config.cjs diff --git a/examples/todo-typescript/src/.waspignore b/examples/hackathon-submissions/src/.waspignore similarity index 100% rename from examples/todo-typescript/src/.waspignore rename to examples/hackathon-submissions/src/.waspignore diff --git a/examples/hackathon/src/client/Main.css b/examples/hackathon-submissions/src/client/Main.css similarity index 100% rename from examples/hackathon/src/client/Main.css rename to examples/hackathon-submissions/src/client/Main.css diff --git a/examples/hackathon/src/client/MainPage.tsx b/examples/hackathon-submissions/src/client/MainPage.tsx similarity index 100% rename from examples/hackathon/src/client/MainPage.tsx rename to examples/hackathon-submissions/src/client/MainPage.tsx diff --git a/examples/hackathon/src/client/betathonLogo.png b/examples/hackathon-submissions/src/client/betathonLogo.png similarity index 100% rename from examples/hackathon/src/client/betathonLogo.png rename to examples/hackathon-submissions/src/client/betathonLogo.png diff --git a/examples/hackathon/src/client/components/Navbar.tsx b/examples/hackathon-submissions/src/client/components/Navbar.tsx similarity index 100% rename from examples/hackathon/src/client/components/Navbar.tsx rename to examples/hackathon-submissions/src/client/components/Navbar.tsx diff --git a/examples/hackathon/src/client/components/Projects.tsx b/examples/hackathon-submissions/src/client/components/Projects.tsx similarity index 100% rename from examples/hackathon/src/client/components/Projects.tsx rename to examples/hackathon-submissions/src/client/components/Projects.tsx diff --git a/examples/hackathon/src/client/components/SubmissionForm.tsx b/examples/hackathon-submissions/src/client/components/SubmissionForm.tsx similarity index 100% rename from examples/hackathon/src/client/components/SubmissionForm.tsx rename to examples/hackathon-submissions/src/client/components/SubmissionForm.tsx diff --git a/examples/hackathon/src/client/tsconfig.json b/examples/hackathon-submissions/src/client/tsconfig.json similarity index 100% rename from examples/hackathon/src/client/tsconfig.json rename to examples/hackathon-submissions/src/client/tsconfig.json diff --git a/examples/streaming/src/client/vite-env.d.ts b/examples/hackathon-submissions/src/client/vite-env.d.ts similarity index 100% rename from examples/streaming/src/client/vite-env.d.ts rename to examples/hackathon-submissions/src/client/vite-env.d.ts diff --git a/examples/hackathon/src/client/waspLogo.png b/examples/hackathon-submissions/src/client/waspLogo.png similarity index 100% rename from examples/hackathon/src/client/waspLogo.png rename to examples/hackathon-submissions/src/client/waspLogo.png diff --git a/examples/hackathon/src/server/actions.js b/examples/hackathon-submissions/src/server/actions.js similarity index 100% rename from examples/hackathon/src/server/actions.js rename to examples/hackathon-submissions/src/server/actions.js diff --git a/examples/hackathon/src/server/queries.js b/examples/hackathon-submissions/src/server/queries.js similarity index 100% rename from examples/hackathon/src/server/queries.js rename to examples/hackathon-submissions/src/server/queries.js diff --git a/examples/hackathon/src/server/tsconfig.json b/examples/hackathon-submissions/src/server/tsconfig.json similarity index 100% rename from examples/hackathon/src/server/tsconfig.json rename to examples/hackathon-submissions/src/server/tsconfig.json diff --git a/examples/streaming/src/shared/tsconfig.json b/examples/hackathon-submissions/src/shared/tsconfig.json similarity index 100% rename from examples/streaming/src/shared/tsconfig.json rename to examples/hackathon-submissions/src/shared/tsconfig.json diff --git a/examples/hackathon/tailwind.config.cjs b/examples/hackathon-submissions/tailwind.config.cjs similarity index 100% rename from examples/hackathon/tailwind.config.cjs rename to examples/hackathon-submissions/tailwind.config.cjs diff --git a/examples/todo-typescript/.gitignore b/examples/todo-app-in-typescript/.gitignore similarity index 100% rename from examples/todo-typescript/.gitignore rename to examples/todo-app-in-typescript/.gitignore diff --git a/examples/waspello/.wasproot b/examples/todo-app-in-typescript/.wasproot similarity index 100% rename from examples/waspello/.wasproot rename to examples/todo-app-in-typescript/.wasproot diff --git a/examples/todo-typescript/main.wasp b/examples/todo-app-in-typescript/main.wasp similarity index 100% rename from examples/todo-typescript/main.wasp rename to examples/todo-app-in-typescript/main.wasp diff --git a/examples/todo-typescript/migrations/20221219114539_init/migration.sql b/examples/todo-app-in-typescript/migrations/20221219114539_init/migration.sql similarity index 100% rename from examples/todo-typescript/migrations/20221219114539_init/migration.sql rename to examples/todo-app-in-typescript/migrations/20221219114539_init/migration.sql diff --git a/examples/todo-typescript/migrations/migration_lock.toml b/examples/todo-app-in-typescript/migrations/migration_lock.toml similarity index 100% rename from examples/todo-typescript/migrations/migration_lock.toml rename to examples/todo-app-in-typescript/migrations/migration_lock.toml diff --git a/examples/waspello/src/.waspignore b/examples/todo-app-in-typescript/src/.waspignore similarity index 100% rename from examples/waspello/src/.waspignore rename to examples/todo-app-in-typescript/src/.waspignore diff --git a/examples/todo-typescript/src/client/LoginPage.tsx b/examples/todo-app-in-typescript/src/client/LoginPage.tsx similarity index 100% rename from examples/todo-typescript/src/client/LoginPage.tsx rename to examples/todo-app-in-typescript/src/client/LoginPage.tsx diff --git a/examples/todo-typescript/src/client/Main.css b/examples/todo-app-in-typescript/src/client/Main.css similarity index 100% rename from examples/todo-typescript/src/client/Main.css rename to examples/todo-app-in-typescript/src/client/Main.css diff --git a/examples/todo-typescript/src/client/MainPage.tsx b/examples/todo-app-in-typescript/src/client/MainPage.tsx similarity index 100% rename from examples/todo-typescript/src/client/MainPage.tsx rename to examples/todo-app-in-typescript/src/client/MainPage.tsx diff --git a/examples/todo-typescript/src/client/SignupPage.tsx b/examples/todo-app-in-typescript/src/client/SignupPage.tsx similarity index 100% rename from examples/todo-typescript/src/client/SignupPage.tsx rename to examples/todo-app-in-typescript/src/client/SignupPage.tsx diff --git a/examples/todo-app-in-typescript/src/client/tsconfig.json b/examples/todo-app-in-typescript/src/client/tsconfig.json new file mode 100644 index 000000000..1ea6fb383 --- /dev/null +++ b/examples/todo-app-in-typescript/src/client/tsconfig.json @@ -0,0 +1,55 @@ +// =============================== IMPORTANT ================================= +// +// This file is only used for Wasp IDE support. You can change it to configure +// your IDE checks, but none of these options will affect the TypeScript +// compiler. Proper TS compiler configuration in Wasp is coming soon :) +{ + "compilerOptions": { + // JSX support + "jsx": "preserve", + "strict": true, + // Allow default imports. + "esModuleInterop": true, + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], + "allowJs": true, + // Wasp needs the following settings enable IDE support in your source + // files. Editing them might break features like import autocompletion and + // definition lookup. Don't change them unless you know what you're doing. + // + // The relative path to the generated web app's root directory. This must be + // set to define the "paths" option. + "baseUrl": "../../../todo-app-in-typescript/.wasp/out/web-app", + "paths": { + // Resolve all "@wasp" imports to the generated source code. + "@wasp/*": [ + "../../../todo-app-in-typescript/src/client/src/*" + ], + // Resolve all non-relative imports to the correct node module. Source: + // https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping + "*": [ + // Start by looking for the definiton inside the node modules root + // directory... + "../../../todo-app-in-typescript/src/client/node_modules/*", + // ... If that fails, try to find it inside definitely-typed type + // definitions. + "../../../todo-app-in-typescript/src/client/node_modules/@types/*" + ] + }, + // Correctly resolve types: https://www.typescriptlang.org/tsconfig#typeRoots + "typeRoots": [ + "../../../todo-app-in-typescript/.wasp/out/web-app/node_modules/@types" + ], + // Since this TS config is used only for IDE support and not for + // compilation, the following directory doesn't exist. We need to specify + // it to prevent this error: + // https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file + "outDir": "../../../todo-app-in-typescript/src/client/phantom" + }, + "exclude": [ + "../../../todo-app-in-typescript/src/client/phantom" + ], +} \ No newline at end of file diff --git a/examples/todo-typescript/src/client/types.ts b/examples/todo-app-in-typescript/src/client/types.ts similarity index 100% rename from examples/todo-typescript/src/client/types.ts rename to examples/todo-app-in-typescript/src/client/types.ts diff --git a/examples/todo-typescript/src/client/vite-env.d.ts b/examples/todo-app-in-typescript/src/client/vite-env.d.ts similarity index 100% rename from examples/todo-typescript/src/client/vite-env.d.ts rename to examples/todo-app-in-typescript/src/client/vite-env.d.ts diff --git a/examples/waspello/src/client/waspLogo.png b/examples/todo-app-in-typescript/src/client/waspLogo.png similarity index 100% rename from examples/waspello/src/client/waspLogo.png rename to examples/todo-app-in-typescript/src/client/waspLogo.png diff --git a/examples/todo-typescript/src/server/actions.ts b/examples/todo-app-in-typescript/src/server/actions.ts similarity index 100% rename from examples/todo-typescript/src/server/actions.ts rename to examples/todo-app-in-typescript/src/server/actions.ts diff --git a/examples/todo-typescript/src/server/queries.ts b/examples/todo-app-in-typescript/src/server/queries.ts similarity index 100% rename from examples/todo-typescript/src/server/queries.ts rename to examples/todo-app-in-typescript/src/server/queries.ts diff --git a/examples/todo-typescript/src/server/serverTypes.ts b/examples/todo-app-in-typescript/src/server/serverTypes.ts similarity index 100% rename from examples/todo-typescript/src/server/serverTypes.ts rename to examples/todo-app-in-typescript/src/server/serverTypes.ts diff --git a/examples/todo-typescript/src/server/tsconfig.json b/examples/todo-app-in-typescript/src/server/tsconfig.json similarity index 100% rename from examples/todo-typescript/src/server/tsconfig.json rename to examples/todo-app-in-typescript/src/server/tsconfig.json diff --git a/examples/todo-typescript/src/shared/tsconfig.json b/examples/todo-app-in-typescript/src/shared/tsconfig.json similarity index 100% rename from examples/todo-typescript/src/shared/tsconfig.json rename to examples/todo-app-in-typescript/src/shared/tsconfig.json diff --git a/examples/waspello/.gitignore b/examples/trello-clone-waspello/.gitignore similarity index 100% rename from examples/waspello/.gitignore rename to examples/trello-clone-waspello/.gitignore diff --git a/examples/waspleau/.wasproot b/examples/trello-clone-waspello/.wasproot similarity index 100% rename from examples/waspleau/.wasproot rename to examples/trello-clone-waspello/.wasproot diff --git a/examples/waspello/README.md b/examples/trello-clone-waspello/README.md similarity index 100% rename from examples/waspello/README.md rename to examples/trello-clone-waspello/README.md diff --git a/examples/waspello/env.server b/examples/trello-clone-waspello/env.server similarity index 100% rename from examples/waspello/env.server rename to examples/trello-clone-waspello/env.server diff --git a/examples/waspello/fly.toml b/examples/trello-clone-waspello/fly.toml similarity index 100% rename from examples/waspello/fly.toml rename to examples/trello-clone-waspello/fly.toml diff --git a/examples/waspello/main.wasp b/examples/trello-clone-waspello/main.wasp similarity index 100% rename from examples/waspello/main.wasp rename to examples/trello-clone-waspello/main.wasp diff --git a/examples/waspello/migrations/20211002184633_added_waspello_entities/migration.sql b/examples/trello-clone-waspello/migrations/20211002184633_added_waspello_entities/migration.sql similarity index 100% rename from examples/waspello/migrations/20211002184633_added_waspello_entities/migration.sql rename to examples/trello-clone-waspello/migrations/20211002184633_added_waspello_entities/migration.sql diff --git a/examples/waspello/migrations/20220211211659_upgrade_prisma_to_3_9_1/migration.sql b/examples/trello-clone-waspello/migrations/20220211211659_upgrade_prisma_to_3_9_1/migration.sql similarity index 100% rename from examples/waspello/migrations/20220211211659_upgrade_prisma_to_3_9_1/migration.sql rename to examples/trello-clone-waspello/migrations/20220211211659_upgrade_prisma_to_3_9_1/migration.sql diff --git a/examples/waspello/migrations/20220818151104_rename_email_to_username/migration.sql b/examples/trello-clone-waspello/migrations/20220818151104_rename_email_to_username/migration.sql similarity index 100% rename from examples/waspello/migrations/20220818151104_rename_email_to_username/migration.sql rename to examples/trello-clone-waspello/migrations/20220818151104_rename_email_to_username/migration.sql diff --git a/examples/waspello/migrations/20221122161320_added_social_login_with_google/migration.sql b/examples/trello-clone-waspello/migrations/20221122161320_added_social_login_with_google/migration.sql similarity index 100% rename from examples/waspello/migrations/20221122161320_added_social_login_with_google/migration.sql rename to examples/trello-clone-waspello/migrations/20221122161320_added_social_login_with_google/migration.sql diff --git a/examples/waspleau/migrations/migration_lock.toml b/examples/trello-clone-waspello/migrations/migration_lock.toml similarity index 100% rename from examples/waspleau/migrations/migration_lock.toml rename to examples/trello-clone-waspello/migrations/migration_lock.toml diff --git a/examples/waspello/postcss.config.cjs b/examples/trello-clone-waspello/postcss.config.cjs similarity index 100% rename from examples/waspello/postcss.config.cjs rename to examples/trello-clone-waspello/postcss.config.cjs diff --git a/examples/waspleau/src/.waspignore b/examples/trello-clone-waspello/src/.waspignore similarity index 100% rename from examples/waspleau/src/.waspignore rename to examples/trello-clone-waspello/src/.waspignore diff --git a/examples/waspello/src/client/Auth/EmailAndPassForm.jsx b/examples/trello-clone-waspello/src/client/Auth/EmailAndPassForm.jsx similarity index 100% rename from examples/waspello/src/client/Auth/EmailAndPassForm.jsx rename to examples/trello-clone-waspello/src/client/Auth/EmailAndPassForm.jsx diff --git a/examples/waspello/src/client/Auth/GoogleAuthButton.jsx b/examples/trello-clone-waspello/src/client/Auth/GoogleAuthButton.jsx similarity index 100% rename from examples/waspello/src/client/Auth/GoogleAuthButton.jsx rename to examples/trello-clone-waspello/src/client/Auth/GoogleAuthButton.jsx diff --git a/examples/waspello/src/client/LoginPage.jsx b/examples/trello-clone-waspello/src/client/LoginPage.jsx similarity index 100% rename from examples/waspello/src/client/LoginPage.jsx rename to examples/trello-clone-waspello/src/client/LoginPage.jsx diff --git a/examples/waspello/src/client/Main.css b/examples/trello-clone-waspello/src/client/Main.css similarity index 100% rename from examples/waspello/src/client/Main.css rename to examples/trello-clone-waspello/src/client/Main.css diff --git a/examples/waspello/src/client/MainPage.jsx b/examples/trello-clone-waspello/src/client/MainPage.jsx similarity index 100% rename from examples/waspello/src/client/MainPage.jsx rename to examples/trello-clone-waspello/src/client/MainPage.jsx diff --git a/examples/waspello/src/client/Navbar.css b/examples/trello-clone-waspello/src/client/Navbar.css similarity index 100% rename from examples/waspello/src/client/Navbar.css rename to examples/trello-clone-waspello/src/client/Navbar.css diff --git a/examples/waspello/src/client/Navbar.jsx b/examples/trello-clone-waspello/src/client/Navbar.jsx similarity index 100% rename from examples/waspello/src/client/Navbar.jsx rename to examples/trello-clone-waspello/src/client/Navbar.jsx diff --git a/examples/waspello/src/client/PositionContext.jsx b/examples/trello-clone-waspello/src/client/PositionContext.jsx similarity index 100% rename from examples/waspello/src/client/PositionContext.jsx rename to examples/trello-clone-waspello/src/client/PositionContext.jsx diff --git a/examples/waspello/src/client/Signup.css b/examples/trello-clone-waspello/src/client/Signup.css similarity index 100% rename from examples/waspello/src/client/Signup.css rename to examples/trello-clone-waspello/src/client/Signup.css diff --git a/examples/waspello/src/client/SignupPage.jsx b/examples/trello-clone-waspello/src/client/SignupPage.jsx similarity index 100% rename from examples/waspello/src/client/SignupPage.jsx rename to examples/trello-clone-waspello/src/client/SignupPage.jsx diff --git a/examples/waspello/src/client/UserPageLayout.css b/examples/trello-clone-waspello/src/client/UserPageLayout.css similarity index 100% rename from examples/waspello/src/client/UserPageLayout.css rename to examples/trello-clone-waspello/src/client/UserPageLayout.css diff --git a/examples/waspello/src/client/UserPageLayout.jsx b/examples/trello-clone-waspello/src/client/UserPageLayout.jsx similarity index 100% rename from examples/waspello/src/client/UserPageLayout.jsx rename to examples/trello-clone-waspello/src/client/UserPageLayout.jsx diff --git a/examples/waspello/src/client/WaspSourceHeader.jsx b/examples/trello-clone-waspello/src/client/WaspSourceHeader.jsx similarity index 100% rename from examples/waspello/src/client/WaspSourceHeader.jsx rename to examples/trello-clone-waspello/src/client/WaspSourceHeader.jsx diff --git a/examples/waspello/src/client/addWaspSourceHeader.jsx b/examples/trello-clone-waspello/src/client/addWaspSourceHeader.jsx similarity index 100% rename from examples/waspello/src/client/addWaspSourceHeader.jsx rename to examples/trello-clone-waspello/src/client/addWaspSourceHeader.jsx diff --git a/examples/waspello/src/client/google-logo.svg b/examples/trello-clone-waspello/src/client/google-logo.svg similarity index 100% rename from examples/waspello/src/client/google-logo.svg rename to examples/trello-clone-waspello/src/client/google-logo.svg diff --git a/examples/waspleau/src/client/jsconfig.json b/examples/trello-clone-waspello/src/client/jsconfig.json similarity index 100% rename from examples/waspleau/src/client/jsconfig.json rename to examples/trello-clone-waspello/src/client/jsconfig.json diff --git a/examples/waspleau/src/client/waspLogo.png b/examples/trello-clone-waspello/src/client/waspLogo.png similarity index 100% rename from examples/waspleau/src/client/waspLogo.png rename to examples/trello-clone-waspello/src/client/waspLogo.png diff --git a/examples/waspello/src/client/waspello-logo-navbar.svg b/examples/trello-clone-waspello/src/client/waspello-logo-navbar.svg similarity index 100% rename from examples/waspello/src/client/waspello-logo-navbar.svg rename to examples/trello-clone-waspello/src/client/waspello-logo-navbar.svg diff --git a/examples/waspello/src/client/waspello-logo.svg b/examples/trello-clone-waspello/src/client/waspello-logo.svg similarity index 100% rename from examples/waspello/src/client/waspello-logo.svg rename to examples/trello-clone-waspello/src/client/waspello-logo.svg diff --git a/examples/waspello/src/server/actions.js b/examples/trello-clone-waspello/src/server/actions.js similarity index 100% rename from examples/waspello/src/server/actions.js rename to examples/trello-clone-waspello/src/server/actions.js diff --git a/examples/waspleau/src/server/jsconfig.json b/examples/trello-clone-waspello/src/server/jsconfig.json similarity index 100% rename from examples/waspleau/src/server/jsconfig.json rename to examples/trello-clone-waspello/src/server/jsconfig.json diff --git a/examples/waspello/src/server/queries.js b/examples/trello-clone-waspello/src/server/queries.js similarity index 100% rename from examples/waspello/src/server/queries.js rename to examples/trello-clone-waspello/src/server/queries.js diff --git a/examples/waspleau/src/shared/jsconfig.json b/examples/trello-clone-waspello/src/shared/jsconfig.json similarity index 100% rename from examples/waspleau/src/shared/jsconfig.json rename to examples/trello-clone-waspello/src/shared/jsconfig.json diff --git a/examples/waspello/tailwind.config.cjs b/examples/trello-clone-waspello/tailwind.config.cjs similarity index 100% rename from examples/waspello/tailwind.config.cjs rename to examples/trello-clone-waspello/tailwind.config.cjs diff --git a/examples/websockets-realtime-voting/.gitignore b/examples/websockets-realtime-voting/.gitignore new file mode 100644 index 000000000..4ec620481 --- /dev/null +++ b/examples/websockets-realtime-voting/.gitignore @@ -0,0 +1,4 @@ +/.wasp/ +/.env.server +/.env.client +.DS_Store diff --git a/examples/websockets-realtime-voting/.wasproot b/examples/websockets-realtime-voting/.wasproot new file mode 100644 index 000000000..ca2cfdb48 --- /dev/null +++ b/examples/websockets-realtime-voting/.wasproot @@ -0,0 +1 @@ +File marking the root of Wasp project. diff --git a/examples/websockets-realtime-voting/README.md b/examples/websockets-realtime-voting/README.md new file mode 100644 index 000000000..c7843df7f --- /dev/null +++ b/examples/websockets-realtime-voting/README.md @@ -0,0 +1,45 @@ +# Using Websockets in Wasp + +This is an example real-time, Websockets app built with Wasp in TypeScript to showcase the ease of use and integration of Websockets in Wasp. It's really NEAT! + +[![wasp websockets app](image.png)](https://www.youtube.com/watch?v=Twy-2P0Co6M) + +You can try out a deployed version of the app here: https://websockets-client-production.up.railway.app/ + +This app also includes Wasp's integrated auth and a voting system (again, neat!). + +## Running the app + +*If you get stuck at any point, feel free to join our [Discord server](https://discord.gg/rzdnErX) and ask questions there. We are happy to help!* + +First, clone the this repo: +```bash +git clone https://github.com/wasp-lang/wasp.git +``` + +Make sure you've downloaded and installed Wasp +```bash +curl -sSL https://get.wasp-lang.dev/installer.sh | sh +``` + +Then navigate to the project directory +```bash +cd examples/websockets-realtime-voting +``` + +```bash +wasp db migrate-dev +``` + +start the app! (this also installs all dependencies) +```bash +wasp start +``` + +Check out the `src/server/websocket.ts` and `src/client/pages/MainPage.tsx` to see how Websockets are used in Wasp. + +## Need Help? + +Wasp Docs: https://wasp-lang.dev/docs + +Feel free to join our [Discord server](https://discord.gg/rzdnErX) and ask questions there. We are happy to help! \ No newline at end of file diff --git a/examples/websockets-realtime-voting/image.png b/examples/websockets-realtime-voting/image.png new file mode 100644 index 000000000..3e3f38873 Binary files /dev/null and b/examples/websockets-realtime-voting/image.png differ diff --git a/examples/websockets-realtime-voting/main.wasp b/examples/websockets-realtime-voting/main.wasp new file mode 100644 index 000000000..d0bad794f --- /dev/null +++ b/examples/websockets-realtime-voting/main.wasp @@ -0,0 +1,45 @@ +app whereDoWeEat { + wasp: { + version: "^0.11.6" + }, + title: "where-do-we-eat", + client: { + rootComponent: import { Layout } from "@client/Layout.jsx", + }, + auth: { + userEntity: User, + onAuthFailedRedirectTo: "/login", + methods: { + usernameAndPassword: {} + } + }, + dependencies: [ + ("flowbite", "1.6.6"), + ("flowbite-react", "0.4.9") + ], + webSocket: { + fn: import { webSocketFn } from "@server/ws-server.js", + } +} + +entity User {=psl + id Int @id @default(autoincrement()) + username String @unique + password String +psl=} + +route RootRoute { path: "/", to: MainPage } +page MainPage { + component: import Main from "@client/MainPage.tsx", + authRequired: true +} + +route LoginRoute { path: "/login", to: LoginPage } +page LoginPage { + component: import { LoginPage } from "@client/pages/LoginPage.jsx" +} + +route RegisterRoute { path: "/signup", to: RegisterPage } +page RegisterPage { + component: import { SignupPage } from "@client/pages/SignupPage.jsx" +} \ No newline at end of file diff --git a/examples/websockets-realtime-voting/postcss.config.cjs b/examples/websockets-realtime-voting/postcss.config.cjs new file mode 100644 index 000000000..96bb01e7d --- /dev/null +++ b/examples/websockets-realtime-voting/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} \ No newline at end of file diff --git a/examples/websockets-realtime-voting/src/.waspignore b/examples/websockets-realtime-voting/src/.waspignore new file mode 100644 index 000000000..1c432f30d --- /dev/null +++ b/examples/websockets-realtime-voting/src/.waspignore @@ -0,0 +1,3 @@ +# Ignore editor tmp files +**/*~ +**/#*# diff --git a/examples/websockets-realtime-voting/src/client/Layout.jsx b/examples/websockets-realtime-voting/src/client/Layout.jsx new file mode 100644 index 000000000..6b052c05b --- /dev/null +++ b/examples/websockets-realtime-voting/src/client/Layout.jsx @@ -0,0 +1,71 @@ +// @ts-check +import "./Main.css"; + +import { Flowbite, Dropdown, Navbar, Avatar } from "flowbite-react"; +import Logo from "./logo.png"; +import useAuth from "@wasp/auth/useAuth"; +import logout from "@wasp/auth/logout"; + +const customTheme = { + button: { + color: { + primary: "bg-red-500 hover:bg-red-600", + }, + }, +}; + +export const Layout = ({ children }) => { + const { data: user } = useAuth(); + return ( + +
+ + + Flowbite React Logo + + Undecisive Fox App + + + {user && ( +
+ + } + > + + {user.username} + + Dashboard + Settings + Earnings + + Sign out + + +
+ )} + {/* + +

Home

+
+ About + Services + Pricing + Contact +
*/} +
+
{children}
+
+
+ ); +}; diff --git a/examples/websockets-realtime-voting/src/client/Main.css b/examples/websockets-realtime-voting/src/client/Main.css new file mode 100644 index 000000000..b5c61c956 --- /dev/null +++ b/examples/websockets-realtime-voting/src/client/Main.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/examples/websockets-realtime-voting/src/client/MainPage.tsx b/examples/websockets-realtime-voting/src/client/MainPage.tsx new file mode 100644 index 000000000..1592625ba --- /dev/null +++ b/examples/websockets-realtime-voting/src/client/MainPage.tsx @@ -0,0 +1,94 @@ +import { useState, useMemo, useEffect } from "react"; +import { Button, Card } from "flowbite-react"; +import { + useSocketListener, + useSocket, + ServerToClientPayload, +} from "@wasp/webSocket"; +import useAuth from "@wasp/auth/useAuth"; + +const MainPage = () => { + const { data: user } = useAuth(); + const [poll, setPoll] = useState | null>( + null + ); + const totalVotes = useMemo(() => { + return ( + poll?.options.reduce((acc, option) => acc + option.votes.length, 0) ?? 0 + ); + }, [poll]); + + const { socket } = useSocket(); + + useSocketListener("updateState", (newState) => { + setPoll(newState); + }); + + useEffect(() => { + socket.emit("askForStateUpdate"); + }, []); + + function handleVote(optionId: number) { + socket.emit("vote", optionId); + } + + return ( +
+

{poll?.question ?? "Loading..."}

+ {poll && ( +

+ Cast your vote for one of the options. +

+ )} + {poll && ( +
+ {poll.options.map((option) => ( + +
+
+

{option.text}

+

{option.description}

+
+
+ {user && !option.votes.includes(user.username) ? ( + + ) : ( + + )} + {!user} +
+ {option.votes.length > 0 && ( +
+ {option.votes.map((vote) => ( +
+
+
{vote}
+
+ ))} +
+ )} +
+
+ {option.votes.length} / {totalVotes} +
+
0 + ? (option.votes.length / totalVotes) * 100 + : 0 + }%`, + }} + >
+
+ ))} +
+ )} +
+ ); +}; +export default MainPage; diff --git a/examples/websockets-realtime-voting/src/client/logo.png b/examples/websockets-realtime-voting/src/client/logo.png new file mode 100644 index 000000000..f39ebd1d9 Binary files /dev/null and b/examples/websockets-realtime-voting/src/client/logo.png differ diff --git a/examples/websockets-realtime-voting/src/client/pages/LoginPage.jsx b/examples/websockets-realtime-voting/src/client/pages/LoginPage.jsx new file mode 100644 index 000000000..2338088ac --- /dev/null +++ b/examples/websockets-realtime-voting/src/client/pages/LoginPage.jsx @@ -0,0 +1,13 @@ +import { LoginForm } from "@wasp/auth/forms/Login"; +import { Link } from "react-router-dom"; + +export function LoginPage() { + return ( +
+ +
+ Sign up instead +
+
+ ); +} diff --git a/examples/websockets-realtime-voting/src/client/pages/SignupPage.jsx b/examples/websockets-realtime-voting/src/client/pages/SignupPage.jsx new file mode 100644 index 000000000..884be74de --- /dev/null +++ b/examples/websockets-realtime-voting/src/client/pages/SignupPage.jsx @@ -0,0 +1,5 @@ +import { SignupForm } from "@wasp/auth/forms/Signup"; + +export function SignupPage() { + return +} \ No newline at end of file diff --git a/examples/todo-typescript/src/client/tsconfig.json b/examples/websockets-realtime-voting/src/client/tsconfig.json similarity index 100% rename from examples/todo-typescript/src/client/tsconfig.json rename to examples/websockets-realtime-voting/src/client/tsconfig.json diff --git a/examples/websockets-realtime-voting/src/client/vite-env.d.ts b/examples/websockets-realtime-voting/src/client/vite-env.d.ts new file mode 100644 index 000000000..1623b9c79 --- /dev/null +++ b/examples/websockets-realtime-voting/src/client/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/websockets-realtime-voting/src/client/waspLogo.png b/examples/websockets-realtime-voting/src/client/waspLogo.png new file mode 100644 index 000000000..d39a9443a Binary files /dev/null and b/examples/websockets-realtime-voting/src/client/waspLogo.png differ diff --git a/examples/websockets-realtime-voting/src/server/tsconfig.json b/examples/websockets-realtime-voting/src/server/tsconfig.json new file mode 100644 index 000000000..70a79b44e --- /dev/null +++ b/examples/websockets-realtime-voting/src/server/tsconfig.json @@ -0,0 +1,48 @@ +// =============================== IMPORTANT ================================= +// +// This file is only used for Wasp IDE support. You can change it to configure +// your IDE checks, but none of these options will affect the TypeScript +// compiler. Proper TS compiler configuration in Wasp is coming soon :) +{ + "compilerOptions": { + // Allows default imports. + "esModuleInterop": true, + "allowJs": true, + "strict": true, + // Wasp needs the following settings enable IDE support in your source + // files. Editing them might break features like import autocompletion and + // definition lookup. Don't change them unless you know what you're doing. + // + // The relative path to the generated web app's root directory. This must be + // set to define the "paths" option. + "baseUrl": "../../.wasp/out/server/", + "paths": { + // Resolve all "@wasp" imports to the generated source code. + "@wasp/*": [ + "src/*" + ], + // Resolve all non-relative imports to the correct node module. Source: + // https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping + "*": [ + // Start by looking for the definiton inside the node modules root + // directory... + "node_modules/*", + // ... If that fails, try to find it inside definitely-typed type + // definitions. + "node_modules/@types/*" + ] + }, + // Correctly resolve types: https://www.typescriptlang.org/tsconfig#typeRoots + "typeRoots": [ + "../../.wasp/out/server/node_modules/@types" + ], + // Since this TS config is used only for IDE support and not for + // compilation, the following directory doesn't exist. We need to specify + // it to prevent this error: + // https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file + "outDir": "phantom", + }, + "exclude": [ + "phantom" + ], +} \ No newline at end of file diff --git a/examples/websockets-realtime-voting/src/server/ws-server.ts b/examples/websockets-realtime-voting/src/server/ws-server.ts new file mode 100644 index 000000000..07e2b1b60 --- /dev/null +++ b/examples/websockets-realtime-voting/src/server/ws-server.ts @@ -0,0 +1,84 @@ +import { WebSocketDefinition } from "@wasp/webSocket" +import { User } from "@wasp/entities" + +type PollState = { + question: string + options: { + id: number + text: string + description: string + votes: string[] + }[] +} + +interface ServerToClientEvents { + updateState: (state: PollState) => void +} +interface ClientToServerEvents { + vote: (optionId: number) => void; + askForStateUpdate: () => void; +} +interface InterServerEvents {} +interface SocketData { + user: User; +} + +export const webSocketFn: WebSocketDefinition< +ClientToServerEvents, +ServerToClientEvents, +InterServerEvents, +SocketData +> = (io, context) => { + const poll: PollState = { + question: "What are eating for lunch ✨ Let's order", + options: [ + { + id: 1, + text: "Party Pizza Place", + description: "Best pizza in town", + votes: [], + }, + { + id: 2, + text: "Best Burger Joint", + description: "Best burger in town", + votes: [], + }, + { + id: 3, + text: "Sus Sushi Place", + description: "Best sushi in town", + votes: [], + }, + ], + }; + io.on('connection', (socket) => { + if (!socket.data.user) { + console.log('Socket connected without user'); + return; + } + + console.log('Socket connected: ', socket.data.user?.username); + socket.on("askForStateUpdate", () => { + socket.emit('updateState', poll); + }); + + socket.on("vote", (optionId) => { + // If user has already voted, remove their vote. + poll.options.forEach((option) => { + option.votes = option.votes.filter((username) => username !== socket.data.user.username); + }); + // And then add their vote to the new option. + const option = poll.options.find((o) => o.id === optionId); + if (!option) { + return; + } + option.votes.push(socket.data.user.username); + io.emit('updateState', poll); + }); + + socket.on('disconnect', () => { + console.log('Socket disconnected: ', socket.data.user?.username); + }); + }); +} \ No newline at end of file diff --git a/examples/websockets-realtime-voting/src/shared/tsconfig.json b/examples/websockets-realtime-voting/src/shared/tsconfig.json new file mode 100644 index 000000000..20fcac843 --- /dev/null +++ b/examples/websockets-realtime-voting/src/shared/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + // Enable default imports in TypeScript. + "esModuleInterop": true, + "allowJs": true, + // The following settings enable IDE support in user-provided source files. + // Editing them might break features like import autocompletion and + // definition lookup. Don't change them unless you know what you're doing. + // + // The relative path to the generated web app's root directory. This must be + // set to define the "paths" option. + "baseUrl": "../../.wasp/out/server/", + "paths": { + // Resolve all non-relative imports to the correct node module. Source: + // https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping + "*": [ + // Start by looking for the definiton inside the node modules root + // directory... + "node_modules/*", + // ... If that fails, try to find it inside definitely-typed type + // definitions. + "node_modules/@types/*" + ] + }, + // Correctly resolve types: https://www.typescriptlang.org/tsconfig#typeRoots + "typeRoots": ["../../.wasp/out/server/node_modules/@types"] + } +} diff --git a/examples/websockets-realtime-voting/tailwind.config.cjs b/examples/websockets-realtime-voting/tailwind.config.cjs new file mode 100644 index 000000000..471c979b6 --- /dev/null +++ b/examples/websockets-realtime-voting/tailwind.config.cjs @@ -0,0 +1,11 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + "./src/**/*.{js,jsx,ts,tsx}", + "node_modules/flowbite-react/**/*.{js,jsx,ts,tsx}", + ], + theme: { + extend: {}, + }, + plugins: [require("flowbite/plugin")], +}; diff --git a/web/blog/2023-10-12-on-importance-of-naming-in-programming.md b/web/blog/2023-10-12-on-importance-of-naming-in-programming.md index 18a71b405..1a18da8b3 100644 --- a/web/blog/2023-10-12-on-importance-of-naming-in-programming.md +++ b/web/blog/2023-10-12-on-importance-of-naming-in-programming.md @@ -1,5 +1,5 @@ --- -title: "On Importance of Naming in Programming" +title: "On the Importance of Naming in Programming" authors: [martinsos] image: /img/on-importance-of-naming-in-programming/variables-naming-pet-white.png tags: [programming, clean-code] diff --git a/web/docs/data-model/backends.md b/web/docs/data-model/backends.md index 9eb93e867..938edff35 100644 --- a/web/docs/data-model/backends.md +++ b/web/docs/data-model/backends.md @@ -45,11 +45,11 @@ app MyApp { } ``` -2. Delete all the old migrations, since they are SQLite migrations and can't be used with PostgreSQL: +2. Delete all the old migrations, since they are SQLite migrations and can't be used with PostgreSQL, as well as the SQLite database by running [`wasp clean`](https://wasp-lang.dev/docs/general/cli#project-commands): - ```bash - rm -r migrations/ - ``` +```bash +rm -r migrations/ +wasp clean 3. Ensure your new database is running (check the [section on connecing to a database](#connecting-to-a-database) to see how). Leave it running, since we need it for the next step. 4. In a different terminal, run `wasp db migrate-dev` to apply the changes and create a new initial migration.