Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example apps to account for recent changes #809

Merged
merged 87 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
4e09b34
Separate ext code to client and server
sodic Oct 12, 2022
86e70fe
Use skeleton in createNewProject and refactor
sodic Oct 14, 2022
bb4107e
Refactor Lib.hs to use ExceptT
sodic Oct 14, 2022
cc7f353
Fix formatting
sodic Oct 14, 2022
492f247
Pop up returns
sodic Oct 14, 2022
d88e204
Extract liftIO and add a do block
sodic Oct 17, 2022
51b426a
Address some review comments
sodic Oct 24, 2022
789dc8f
Add skeleton comment
sodic Oct 24, 2022
6d29601
Extract common CommandError message
sodic Oct 24, 2022
11846e7
Separate skeleton comment into two rows
sodic Oct 24, 2022
4f834ec
Move server and client dirs into src
sodic Oct 24, 2022
385b35c
Simplify maybeToEither
sodic Oct 25, 2022
a7753d2
Further refactor Lib.hs
sodic Oct 25, 2022
53dc889
Further simplify skeleton comment
sodic Oct 25, 2022
8388b0f
Merge branch 'main' into filip-change-project-structure
sodic Oct 25, 2022
40f56d2
Add shared code directory to project structure
sodic Oct 31, 2022
936116b
Update e2e test inputs
sodic Oct 31, 2022
1d4e0d8
Update e2e test outputs
sodic Oct 31, 2022
dc753f4
Fix formatting
sodic Oct 31, 2022
281c3cf
Fix bug in compile function
sodic Oct 31, 2022
a64832c
Change map to fmap in compile function
sodic Oct 31, 2022
b30e3de
Fix formatting
sodic Oct 31, 2022
f40a8ce
Force git to include empty directories
sodic Oct 31, 2022
ddc8682
Remove extra empty line from .gitkeep files
sodic Oct 31, 2022
94a11a7
Add .jsconfig to enable go-to-definition
sodic Oct 31, 2022
eb29d50
Watch shared directory for changes
sodic Oct 31, 2022
c85fee3
Merge remote-tracking branch 'origin/filip-change-project-structure' …
sodic Oct 31, 2022
efca38a
Add final newline to jsconfigs
sodic Oct 31, 2022
9fa7e9a
Fix regular and e2e tests
sodic Oct 31, 2022
fd5d9db
Merge remote-tracking branch 'origin/filip-change-project-structure' …
sodic Oct 31, 2022
661b282
Update e2e tests
sodic Oct 31, 2022
8674887
Fix cli template packaging and update todoApp
sodic Nov 4, 2022
997fe72
Merge remote-tracking branch 'origin/main' into filip-change-project-…
sodic Nov 4, 2022
0cb6369
Add a shared function demo to todoApp
sodic Nov 4, 2022
25a1a54
Merge remote-tracking branch 'origin/filip-change-project-structure' …
sodic Nov 4, 2022
8bb94cc
Update waspc and e2e tests
sodic Nov 4, 2022
5f47855
Fix compiler warnings and rename function
sodic Nov 4, 2022
54e0b02
Rename mkError to mkParserError
sodic Nov 4, 2022
0ae2631
Remove redundant empty line
sodic Nov 4, 2022
c5c326e
Merge remote-tracking branch 'origin/main' into filip-change-project-…
sodic Nov 4, 2022
fc76fb6
Fix test warnings
sodic Nov 4, 2022
dc29140
Fix formatting
sodic Nov 4, 2022
36e5766
Merge remote-tracking branch 'origin/main' into filip-change-project-…
sodic Nov 7, 2022
ca662e8
Update waspc.cabal with jsconfigs
sodic Nov 7, 2022
b13cd32
Merge remote-tracking branch 'origin/filip-change-project-structure' …
sodic Nov 7, 2022
cd101ab
Merge branch 'main' into filip-change-project-structure
sodic Nov 7, 2022
d10e877
Minimize jsconfig.json files
sodic Nov 7, 2022
cb3351c
Add jsconfigs to waspc todoApp
sodic Nov 7, 2022
48d7e27
Update e2e tests
sodic Nov 7, 2022
0ab3560
Update e2e tests
sodic Nov 7, 2022
bed02f1
Merge branch 'main' into filip-change-project-structure
sodic Nov 7, 2022
ee84bce
Update docs for new project structure
sodic Nov 9, 2022
313d2b7
Update todoApp example to new structure
sodic Nov 9, 2022
bbef734
Update ItWaspsOnMyMachine
sodic Nov 9, 2022
3a93ab4
Update thoughts
sodic Nov 9, 2022
28b841d
Update Waspello to new structure
sodic Nov 9, 2022
42dfff9
Update Waspleau to new structure
sodic Nov 9, 2022
8eb1c76
Update Realworld to new structure, fix warnings
sodic Nov 9, 2022
f384d14
Fix directory tree watching on wasp start
sodic Nov 9, 2022
2a214ec
Merge branch 'filip-change-project-structure' into filip-js-go-to-def…
sodic Nov 9, 2022
485190d
Merge branch 'filip-js-go-to-definition' into filip-update-docs-new-s…
sodic Nov 9, 2022
d4a4c07
Implement review feedback
sodic Nov 9, 2022
399057c
Fix typo in docs
sodic Nov 9, 2022
96b6b1e
Fix typo in docs
sodic Nov 9, 2022
87c7c71
Fix another typo in docs
sodic Nov 9, 2022
8e88877
Add src prefix to file path in docs
sodic Nov 9, 2022
da2eb32
Merge branch 'filip-change-project-structure' into filip-js-go-to-def…
sodic Nov 9, 2022
2c42e99
Merge branch 'filip-js-go-to-definition' into filip-update-docs-new-s…
sodic Nov 9, 2022
e9ebd26
Merge branch 'filip-update-docs-new-structure' into filip-update-exam…
sodic Nov 9, 2022
d4eaa5e
Merge remote-tracking branch 'origin/filip-update-docs-new-structure'…
sodic Nov 9, 2022
4f68e69
Remove env server file
sodic Nov 9, 2022
06f0b35
Apply suggestions from code review
sodic Nov 10, 2022
fe75413
Address code review comments
sodic Nov 10, 2022
da45f33
Merge branch 'filip-update-docs-new-structure' into filip-update-exam…
sodic Nov 10, 2022
a89df79
Fix incorrect path in docs
sodic Nov 10, 2022
5502285
Fix references to ext in docs
sodic Nov 10, 2022
676fc85
Edit changelog and add migration guide
sodic Nov 11, 2022
ccf96ff
Further update docs to new structure
sodic Nov 11, 2022
105b3d8
Merge branch 'filip-update-docs-new-structure' into filip-update-exam…
sodic Nov 11, 2022
a2e847e
Update blogs about example apps to new structure
sodic Nov 11, 2022
995d6ea
Fix typo in docs
sodic Nov 11, 2022
145fb46
Update typo on frontpage
sodic Nov 11, 2022
39411d5
Add missing src in docs
sodic Nov 11, 2022
2a592c0
Merge remote-tracking branch 'origin/main' into filip-update-docs-new…
sodic Nov 11, 2022
677e4b5
Merge remote-tracking branch 'origin/filip-update-docs-new-structure'…
sodic Nov 11, 2022
7c3cffa
Merge remote-tracking branch 'origin/filip-update-docs-new-structure'…
sodic Nov 11, 2022
fc91e2f
Merge remote-tracking branch 'origin/main' into filip-update-examples…
sodic Nov 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/realworld/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.wasp/
.env
/.env.server
/.env.client
2 changes: 1 addition & 1 deletion examples/realworld/.wasproot
Original file line number Diff line number Diff line change
@@ -1 +1 @@
File marking the root of Wasp project.
File marking the root of Wasp project.
46 changes: 23 additions & 23 deletions examples/realworld/main.wasp
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,39 @@ app Conduit {

route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import Main from "@ext/MainPage.js"
component: import Main from "@client/MainPage.js"
}

route LogInRoute { path: "/login", to: LogInPage }
page LogInPage {
component: import LogIn from "@ext/auth/LoginPage.js"
component: import LogIn from "@client/auth/LoginPage.js"
}

route RegisterRoute { path: "/register", to: SignUpPage }
page SignUpPage {
component: import SignUp from "@ext/auth/SignupPage.js"
component: import SignUp from "@client/auth/SignupPage.js"
}

route UserSettingsRoute { path: "/settings", to: UserSettingsPage }
page UserSettingsPage {
authRequired: true,
component: import UserSettings from "@ext/user/components/UserSettingsPage.js"
component: import UserSettings from "@client/user/components/UserSettingsPage.js"
}

route UserProfileRoute { path: "/@:username", to: UserProfilePage }
page UserProfilePage {
component: import UserProfile from "@ext/user/components/UserProfilePage.js"
component: import UserProfile from "@client/user/components/UserProfilePage.js"
}

route ArticleEditorRoute { path: "/editor/:articleSlug?", to: ArticleEditorPage }
page ArticleEditorPage {
authRequired: true,
component: import ArticleEditor from "@ext/article/components/ArticleEditorPage.js"
component: import ArticleEditor from "@client/article/components/ArticleEditorPage.js"
}

route ArticleViewRoute { path: "/article/:articleSlug", to: ArticleViewPage }
page ArticleViewPage {
component: import ArticleView from "@ext/article/components/ArticleViewPage.js"
component: import ArticleView from "@client/article/components/ArticleViewPage.js"
}

// ----------------- Entities ------------------ //
Expand Down Expand Up @@ -123,84 +123,84 @@ psl=}
// ----------------- User operations ------------------ //

query getUser {
fn: import { getUser } from "@ext/user/queries.js",
fn: import { getUser } from "@server/user/queries.js",
entities: [User]
}

action updateUser {
fn: import { updateUser } from "@ext/user/actions.js",
fn: import { updateUser } from "@server/user/actions.js",
entities: [User]
}

action followUser {
fn: import { followUser } from "@ext/user/actions.js",
fn: import { followUser } from "@server/user/actions.js",
entities: [User]
}

// ----------------- Article operations ------------------ //

query getArticlesByUser {
fn: import { getArticlesByUser } from "@ext/article/queries.js",
fn: import { getArticlesByUser } from "@server/article/queries.js",
entities: [Article]
}

query getFavoritedArticles {
fn: import { getFavoritedArticles } from "@ext/article/queries.js",
fn: import { getFavoritedArticles } from "@server/article/queries.js",
entities: [Article]
}

query getFollowedArticles {
fn: import { getFollowedArticles } from "@ext/article/queries.js",
fn: import { getFollowedArticles } from "@server/article/queries.js",
entities: [Article, User]
}

query getAllArticles {
fn: import { getAllArticles } from "@ext/article/queries.js",
fn: import { getAllArticles } from "@server/article/queries.js",
entities: [Article]
}

query getArticle {
fn: import { getArticle } from "@ext/article/queries.js",
fn: import { getArticle } from "@server/article/queries.js",
entities: [Article]
}

query getArticleComments {
fn: import { getArticleComments } from "@ext/article/queries.js",
fn: import { getArticleComments } from "@server/article/queries.js",
entities: [Comment]
}

action createArticle {
fn: import { createArticle } from "@ext/article/actions.js",
fn: import { createArticle } from "@server/article/actions.js",
entities: [Article]
}

action updateArticle {
fn: import { updateArticle } from "@ext/article/actions.js",
fn: import { updateArticle } from "@server/article/actions.js",
entities: [Article]
}

action deleteArticle {
fn: import { deleteArticle } from "@ext/article/actions.js",
fn: import { deleteArticle } from "@server/article/actions.js",
entities: [Article]
}

action setArticleFavorited {
fn: import { setArticleFavorited } from "@ext/article/actions.js",
fn: import { setArticleFavorited } from "@server/article/actions.js",
entities: [Article]
}

action createComment {
fn: import { createComment } from "@ext/article/actions.js",
fn: import { createComment } from "@server/article/actions.js",
entities: [Comment]
}

action deleteComment {
fn: import { deleteComment } from "@ext/article/actions.js",
fn: import { deleteComment } from "@server/article/actions.js",
entities: [Comment]
}

query getTags {
fn: import { getTags } from "@ext/article/queries.js",
fn: import { getTags } from "@server/article/queries.js",
entities: [ArticleTag, Article]
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const Tags = () => {
<Typography variant="subtitle1" className={classes.title}>Popular tags</Typography>
{ popularTags.map(tag => (
<Chip
key={tag.name}
className={classes.chip}
label={`${tag.name} (${tag.numArticles})`}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ const Article = (props) => {
<Button component={ Link } to={`/article/${article.slug}`} size="small" color="primary">
Read more
</Button>

<span className={classes.tags}>
{ article.tags.map(t => (
<Chip className={classes.chip} label={t.name}/>
{ article.tags.map(tag => (
<Chip key={tag.name} className={classes.chip} label={tag.name}/>
))}
</span>
</CardActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const ArticleViewPage = (props) => {
<Grid item xs={8}>
<div className={classes.tags}>
<span>Tags:</span>
{ article.tags.map(tag => <Chip label={tag.name} />) }
{ article.tags.map(tag => <Chip key={tag.name} label={tag.name} />) }
</div>

{ isMyArticle && (
Expand Down
27 changes: 27 additions & 0 deletions examples/realworld/src/client/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
// 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/web-app/",
"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/*"
]
}
}
}
File renamed without changes.
27 changes: 27 additions & 0 deletions examples/realworld/src/server/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
// 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 "@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/*"
]
}
}
}
23 changes: 23 additions & 0 deletions examples/realworld/src/shared/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
// 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/*"
]
}
}
}
1 change: 0 additions & 1 deletion examples/thoughts/.env

This file was deleted.

1 change: 1 addition & 0 deletions examples/thoughts/.env.server
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgresql://postgres:devpass1234@localhost:5432/thoughts-dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to remove this file entirely since it is .gitignore'd and the only env file we have committed for examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thought so too. I can remove it.

2 changes: 2 additions & 0 deletions examples/thoughts/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/.wasp/
/.env.server
/.env.client
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/thoughts/.wasproot
Original file line number Diff line number Diff line change
@@ -1 +1 @@
File marking the root of Wasp project.
File marking the root of Wasp project.
14 changes: 7 additions & 7 deletions examples/thoughts/main.wasp
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@ app Thoughts {

route MainRoute { path: "/", to: MainPage }
page MainPage {
component: import Main from "@ext/MainPage.js",
component: import Main from "@client/MainPage.js",
authRequired: true
}

route ThoughtsRoute { path: "/thoughts", to: ThoughtsPage }
page ThoughtsPage {
component: import Thoughts from "@ext/ThoughtsPage.js",
component: import Thoughts from "@client/ThoughtsPage.js",
authRequired: true
}

route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import Login from "@ext/LoginPage.js"
component: import Login from "@client/LoginPage.js"
}

route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
component: import Signup from "@ext/SignupPage"
component: import Signup from "@client/SignupPage"
}

action createThought {
fn: import { createThought } from "@ext/actions.js",
fn: import { createThought } from "@server/actions.js",
entities: [Thought, Tag]
}

query getThoughts {
fn: import { getThoughts } from "@ext/queries.js",
fn: import { getThoughts } from "@server/queries.js",
entities: [Thought]
}

query getTags {
fn: import { getTags } from "@ext/queries.js",
fn: import { getTags } from "@server/queries.js",
entities: [Tag]
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions examples/thoughts/src/client/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
// 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/web-app/",
"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/*"
]
}
}
}
27 changes: 27 additions & 0 deletions examples/thoughts/src/server/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
// 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 "@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/*"
]
}
}
}
Loading