Commit Graph

178 Commits

Author SHA1 Message Date
Filip Sodić
2327a8f9d9
Stop weakening the AST (#628) 2023-02-14 10:09:21 +01:00
Mihovil Ilakovac
07b03fec5d
Generate all JS import statements in Haskell (#956) 2023-02-13 16:57:31 +01:00
Shayne Czyzewski
2182b9088d
Adds GitHub login and refactors Passport.js (#872) 2022-12-20 09:12:08 -05:00
Shayne Czyzewski
a16aa73753
Add support for --create-only migrations (#862) 2022-12-13 13:55:01 -05:00
Filip Sodić
86e0893d6f
Separate user code into client, server, shared (#753)
* Separate ext code to client and server

* Use skeleton in createNewProject and refactor

* Refactor Lib.hs to use ExceptT

* Fix formatting

* Pop up returns

* Extract liftIO and add a do block

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

* Address some review comments

* Add skeleton comment

* Extract common CommandError message

* Separate skeleton comment into two rows

* Move server and client dirs into src

* Simplify maybeToEither

* Further refactor Lib.hs

* Further simplify skeleton comment

* Add shared code directory to project structure

* Update e2e test inputs

* Update e2e test outputs

* Fix formatting

* Fix bug in compile function

Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>

* Change map to fmap in compile function

* Fix formatting

* Force git to include empty directories

* Remove extra empty line from .gitkeep files

* Watch shared directory for changes

* Fix regular and e2e tests

* Fix cli template packaging and update todoApp

* Add a shared function demo to todoApp

* Update waspc and e2e tests

* Fix compiler warnings and rename function

* Rename mkError to mkParserError

* Remove redundant empty line

* Fix test warnings

* Fix formatting

* Fix directory tree watching on wasp start

* Implement review feedback

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>
Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
2022-11-11 17:20:49 +01:00
Shayne Czyzewski
e0fd8975a9
Fix warnings in tests (#801) 2022-11-06 08:26:53 -05:00
Martin Šošić
26f45942f8
If wrong wasp version, message gives instructions how to install correct one. (#799)
* If wrong wasp version, message gives instructions how to install correct one.

* fix
2022-11-04 19:24:51 +01:00
Shayne Czyzewski
fa9f487e2a
Adds opt-in support for Tailwind (#777) 2022-11-04 09:39:13 -04:00
Anthony Suárez
0cde880f24
Feat: Validate wasp version from spec (#786)
* Add wasp field to AppSpec.App

* Validate app.wasp.version in AppSpec.Valid

* Add app.wasp.version field on .wasp file generated by CreateNewProject

* Add app.wasp.version to .wasp files of e2e tests

* Add app.wasp.version to examples' .wasp files

* Add app.wasp.version to docs

* Change waspc version from 0.6.0.0 to 0.6.0

* Change app.wasp.version validation to use regular semver

* Format code

* Refactor app.wasp.version validation

* Refactor app.wasp.version validation

* Update supported app.wasp.version format in docs

* Add TODO to validateWaspVersion

* Refactor app.wasp.version using toEnum

* Create Wasp.Version module with waspVersion constant

* Fix parseWaspVersionRange regex

Fixed:
  - The regex wasn't checking the string *starts* with ^.
  - The . symbols were not escaped.
  - The $ token is not specified as supported in the regex-tdfa docs.
    \' is used instead.

* Add comment explaining wasp version validation restrictions

* Use Wasp.Version.waspVersion instead of Paths_wasp.version
2022-10-31 23:00:03 +01:00
InfiniteVerma
c6b61ce573
Checks for duplicate FileDraft _dstPath during generation (#733) 2022-10-17 10:59:24 -04:00
Steven Garcia
e2fe5b2402
Fix compiler warnings in tests (#764)
Co-authored-by: sgarcia <sgarcia@pop-os.localdomain>
2022-10-17 01:32:44 +02:00
Peter Reshetin
3f63340fc1
feat: separate env vars for server and client (#683) 2022-10-06 12:51:28 +02:00
Filip Sodić
b470d50be8
Generalize WriteableMonad (#742)
* Fix unused variable warning (#736)

* Generalize WriteableMonad functions

* Format code and remove redundant imports

* Improve MockWriteableMonad with RankNTypes
2022-10-04 11:05:52 +02:00
Shayne Czyzewski
6cd38b0f94
Adds Google as an authentication method (#669) 2022-09-06 14:35:59 -04:00
Martin Šošić
eb69deb348
Removed duplication between waspls and waspc, made them two packages in the same cabal project (#712) 2022-09-06 14:10:42 +02:00
Prat
51d7f30b97
Add support for kebab-case in project name (#590) (#700)
* Add support for kebab-case in project name (#590)

* clean up kebab case naming (#590)

* clean up code for create new project (#590)

* clean up code for kebab-name project (#590)

Co-authored-by: Prat T <pt2121@users.noreply.github.com>
2022-09-02 11:54:25 +02:00
Martin Šošić
8cc63a85a5
Make SemanticVersion module more expressive
* First try.

* first version that compiles.

* Added range function.

* fixed tests.

* Fixed order of funcions in the code.

* fix

* Simplify semantic version module

* Change qualified import name for SV

Co-authored-by: Filip Sodić <filip.sodic@fer.hr>
2022-08-26 16:46:55 +02:00
Shayne Czyzewski
bc92b024e1
Renames auth method EmailAndPassword to UsernameAndPassword (#696) 2022-08-24 10:32:46 -04:00
Martin Šošić
75ce7db663
Fix incorrect parsing of escaped strings in Wasp (#699)
* Fixed incorrect handling of escaped strings in parser.

* Refactored Parser golden tests a bit.

* Moved PrettyPrinter for Parser AST to Parser.

* fix
2022-08-23 14:01:00 +02:00
Shayne Czyzewski
d827d05d96
Jobs callback function updates (#676) 2022-08-17 13:53:05 -04:00
Craig McIlwrath
0de0855787
Integrate new error resilient parser into waspc (#684)
* Add CST parsing code into waspc

* Implement CST -> AST conversion

* Implement parseExpression & isValidWaspIdentifier

* Implement golden tests for Parser

* Configure CI git checkout to always use LF line endings
2022-08-11 12:26:12 -04:00
Martin Šošić
62f0a76937
Limited Wasp version to ^16.0.0 && <=16.15.0 (#634)
* Limited Wasp node version to ^16.0.0 && <=16.15.0.

In the process, I removed .nvmrc files from generated code and
refactored SemanticVersion to follow npm spec.
I also updated CI to use node 16.15.0, and not any 16.
I also updated docs.
2022-06-17 17:02:54 +02:00
Filip Sodić
0b78f658be
Implement support for query client configuration (#612)
* Implement support for query client configuration

* Make sure query client is always initialized

* Fix formatting

* Fix formatting

* Add missing await in index.js

* Separate query client setup into two functions

* Introduce default query client config

* Fix missing export in docs

* Fix missing field warnings

* Add query client setup docs

* Update e2e tests for query client config
2022-06-09 10:37:19 +02:00
Filip Sodić
59c714111e
Support for the client setup function (#595)
* Add clientSetup support to analyzer and tidy up generator

* Add clientSetup support to generator

* Add tests for client setup function and tidy up

* Address PR comments for client setup function

* Clean up server and web app generators

* Document react query invalidation on logout

* Update e2e tests after query client cache clean

* Fix syntax error in exmaple app

* Remove leftover todos

* Fix formatting

* Fix formatting

* Fix tests for client setup function

* Update e2e test

* Fix todos in templates

* Add docs for client setup

* Fix docs typo

* Fix docs typo

* Fix docs typo

* Fix docs typo

* Update e2e test
2022-05-20 14:49:26 +02:00
Shayne Czyzewski
4de7d16331
Adds cron support to pg-boss Jobs and documentation (#586) 2022-05-13 12:30:55 -04:00
Shayne Czyzewski
f14be11fc3
Add pg-boss as a Job executor (#582)
Note: This does not provide cron support, that is coming in the next PR.
2022-05-03 14:34:25 -04:00
Shayne Czyzewski
302fcc11d8
Adds support for basic Wasp job DSL parsing (#540) 2022-04-06 10:07:45 -04:00
Filip Sodić
b3d9014e37
Allow Wasp identifiers for project names (#520)
* Allow Wasp identifiers for project names

* Rename initialState to makeInitialState

* Fix formatting

* Use parser to parse Wasp identifiers

* Add newline at the end of Wasp.Analyzer.Parser

* Fix newline at the end of Wasp.Analyzer.Parser

* Clean up and rename parsing

* Fix newline at the end of Wasp.Analyzer.Parser

* Add tests for new parser functions

* Fix formatting

* Fix formatting

* Reformat where statement

* Address PR comments and remove redundant module

* Remove keywords from error message

* Fix formatting in CreateNewProject.hs

* Remove redundant note on duplication
2022-03-30 01:25:56 +02:00
Shayne Czyzewski
52ec8d7232
Improve performance of writing FileDrafts (#506)
Closes #503 

Co-authored-by: Martijn Faassen <martijn@wasp-lang.dev>
2022-03-29 08:53:28 -04:00
Filip Sodić
52badd651e
[Analyzer] Reverse the order of Wasp error messages (#500)
* Reverse the order for TypeError messages

* Remove redundant import and unused pragma

* Remove redundant import and unused pragma

* Reverse additional type error messages

* Remove redundant import

* Format util test file

* Address PR comments

* Add empty line to TypeError.hs

* Address PR comments

* Format TypeError.hs

* Reverse message order in evaluation errors

* Extract common error message functions

* Add tests for EvaluationErrors

* Improve naming in Wasp.ErrorMessage

* Fix formatting

* Fix formatting

* Format code

* Change naming and syntax in ErrorMessage

* hange names in EvaluationError tests

* Add full stops to documentation

* Fix formatting in tests
2022-03-23 13:18:43 +01:00
Filip Sodić
8a3fba8831
Require LTS version of Node for Wasp (#504)
* Require LTS node and npm on client and server

* Update node and npm versions in the docs

* Add npmrc and nvmrc to WebAppGenerator

* Change function name in test

* Add newline to nvmrc

* Add newline to Common.hs

* Remove extra empty line in nvmrc

* Remove extra empty line in Common.hs

* Update end to end tests for node LTS

* Add newline at the end of server/nvmrc

* Ensure Node version 16 in CI

* Fix broken ci file

* Change how Wasp specifies required versions

* Fix formatting

* Use type alias for semantic versions

* Remove incorrect comment on Prisma LTS

* Update e2e checksums

* Fix typo in gitignore

Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>

* Sort e2e checksums

* Extract semantic version to its module

* Fix formatting

* Fix formatting again

* Add comment explaining nvmrc

* Add tests and change semver naming

* Add natural numbers and formatting to semver

* Add newline at the end of semver module

* Add missing space to node mismatch message

Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
2022-03-21 15:00:19 +01:00
Phil de Joux
08704f4117
Follow hlint suggestions. (#513) 2022-03-18 12:33:37 +01:00
Martin Šošić
2a16bfd3cf
App spec validation (#459) 2022-03-17 12:36:36 +01:00
Shayne Czyzewski
8bc004ef29
Makes Wasp smarter when writing over existing generated files (#486)
Closes #209
2022-03-15 07:43:52 -04:00
Martijn Faassen
540a4d0ded
Do npm install as part of generation process, only when needed (#464)
Create a seperate runSetup function

This does the `npm install` (if required) and the database setup.

Since this is now happening in the generation phase, this means we don't need
`compileAndSetup` anymore.

Since compile now sets up the dependencies, we only need to compile in any db command

Reworked the naming and types of combining the various dependencies.
2022-02-18 17:23:14 +01:00
Martijn Faassen
830bb43be1 We can compare PackageJsonDependencies independent of dependency order
Use an explicit Ord to enforce dependencies are compared by name.
2022-02-11 11:05:02 +01:00
Martijn Faassen
27b3c83f7a Introduce combinePackageDependencies
This is the base operation used now to combine package dependencies. It
knows about dev dependencies too. I've adjusted the code for
both web app and server to use this.

I've factored out commonalities in error handling into PackageJsonGenerator

We now support devDependencies for web app and in the deps command

We also have nicer functions to generate the package json entries
directly from the PackageJsonDependencies structure
2022-02-11 11:05:02 +01:00
Martijn Faassen
55d9e1bbd8
Resolve dependencies refactor (#449)
Create a new resolveDependencies

Use Map to do differences between Wasp and user package.json dependencies.

This is now used internally in resolveNpmDeps.

Also fixes a bug in the conflict error message, where the wasp and user dependency
were previously not properly distinguished.

Add .vscode and move everything that appears text editor related to a section
2022-02-09 14:02:19 +01:00
Shayne Czyzewski
c516113f11
feat: Warns user if Prisma needs to be migrated because of schema.prisma changes (#424)
Closes #214
2022-01-27 15:14:29 -05:00
Shayne Czyzewski
82cb481c96
feat: Adds Generator monad for more flexible error and warning handling (#433)
Closes #123
2022-01-23 09:21:31 -05:00
Martin Šošić
8d2c33ab28
Replace Wasp with AppSpec and Parser with Analyzer. (#423) 2022-01-20 11:45:14 +01:00
Shayne Czyzewski
b74eb88ff0
Makes DbGenerator responsible for movement of migrations dir (#420)
Closes #105
2022-01-12 11:28:21 -05:00
Martin Šošić
fe915158d9
Polished AppSpec: added missing fields + deps are not tuples. (#417) 2022-01-11 13:59:13 +01:00
Martin Šošić
5f534f7bcf
Added concept of SourceRegion to Ctx. (#409) 2022-01-08 23:55:52 +01:00
Martin Šošić
424def31d6
TypeError now uses WithCtx internally. (#408) 2022-01-08 23:54:32 +01:00
Martin Šošić
7a0f75b539
Enriched Evaluation errors with parse context + made them showable. (#407) 2022-01-08 23:52:26 +01:00
Martin Šošić
82bec83769
Better type error messages (and context). (#400)
- Enriched Parser.AST, TypeChecker.AST and TypeError with Ctx.
2022-01-08 23:50:48 +01:00
Martin Sosic
c7ce883b5a Improved parse errors (added expected tokens, nicer error messages).
- Added expected tokens.
- Nice error messages + source position.
2021-12-21 16:36:49 +01:00
Martin Sosic
6756fa4d88 Added tuple to Wasp language. 2021-12-07 15:05:41 +01:00
Martin Šošić
880cd39226
Added support for custom evaluation to Analyzer. (#375) 2021-12-07 14:44:01 +01:00
Martin Šošić
bb3964ae6f
Made Dependencies and Entity full-featured (in AppSpec and Analyzer) (#374) 2021-11-26 15:26:03 +01:00
Martin Sosic
4eb5fac817 Added Server and Database to AppSpec / Analyzer. 2021-11-25 14:09:46 +01:00
Martin Sosic
c86ecdf62c Added Dependencies to AppSpec and Analyzer. 2021-11-25 14:09:46 +01:00
Martin Sosic
032e57a46b Added Action to AppSpec and Analyzer. 2021-11-25 14:09:46 +01:00
Martin Sosic
637e2e20aa Added Query to AppSpec and Analyzer. 2021-11-25 14:09:46 +01:00
Martin Šošić
18c5165df8
Added Route to AppSpec. (#372) 2021-11-25 12:02:02 +01:00
Martin Šošić
ee30923f7a
Added support for Page in Analyzer. (#371) 2021-11-25 10:47:50 +01:00
Martin Šošić
8d946b9ed7
Added support in Analyzer for AppSpec to have record as dict field. (#369) 2021-11-24 23:18:25 +01:00
Giovanni Garufi
dcd1549211
auth: Add onAuthSucceededRedirectTo option (#350)
Allows a user to specify a redirect target in case of successful authentication.
This used to be hardcoded to /, and the current implementation will fallback to that if the property is not specified.

Change-type: minor
Signed-off-by: Giovanni Garufi <nazrhom@gmail.com>
2021-11-22 14:23:19 +01:00
Martin Sosic
ff2543b42f Reviewed remaining hlint rules. 2021-11-17 12:24:39 +01:00
Phil de Joux
89c9d6a1db
ref: Fixed most of the hlint suggestions. (#366) 2021-11-17 00:36:46 +01:00
Martin Šošić
3feeed555f
Moved all src/ modules into Wasp module, and all cli/ modules into Wasp.Cli module. 2021-11-11 13:26:20 +01:00
Martin Šošić
4773ae36e3
Wrote initial version of new Wasp AST: AppSpec (#353)
* Introduced AppSpec, replacement for previous Wasp.hs as a core IR in Wasp.

* Organized AppSpec into Core and Domain.

* Removed Domain from AppSpec.

* Moved ExternalCode.File to AppSpec.

* Added some TODOs.

* Added IsDecl to AppSpec.

* Removed ExternalCode File reexports.

* Added comments.
2021-11-10 16:27:27 +01:00
Martin Šošić
a7a69ff207
[Analyzer] Instead of directly embedding Declarations into AST, now they are referenced via Ref (#343) 2021-10-22 11:59:51 +02:00
Martin Sosic
074529d79c Made TypeDefinitions implementation Internal. 2021-09-18 00:08:42 +02:00
Martin Sosic
cb50008b98 fix 2021-09-14 17:08:53 +02:00
craigmc08
9686eaf4dc Add test for Analyzer module 2021-08-22 13:33:44 -04:00
craigmc08
2507a71abe Add evaluation for import, json, psl 2021-08-05 15:22:21 -04:00
craigmc08
4120bc53dc Add TH generation for IsDeclType, IsEnumType instances 2021-08-05 13:25:13 -04:00
craigmc08
d043548ecc Get evaluation working a bit
Code is probably not great, but passing tests for generating haskell
data structures exist!

Still have to hand write IsDeclType and IsEnumType instances, but it's cool
2021-08-05 13:25:13 -04:00
craigmc08
96450aa31d Suggestions from code review 2021-08-05 13:17:49 -04:00
craigmc08
6f178115dc Suggestions from code review 2021-08-05 13:17:49 -04:00
craigmc08
d335562263 Suggestions from code review 2021-08-05 13:17:49 -04:00
craigmc08
31a4ebaee3 Refactor typechecker tests 2021-08-05 13:17:49 -04:00
craigmc08
e1e062479e Suggestions from code review 2021-08-05 13:17:49 -04:00
Craig McIlwrath
46206c3fb3 Apply suggestions from code review
Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
2021-08-05 13:17:49 -04:00
craigmc08
c456ca8d2e Reorganize typechecker tests
Now matches typechecker module structure, and a couple more tests were added to
test more behavior.
2021-08-05 13:17:49 -04:00
craigmc08
f25f206b91 Remove some useless comments 2021-08-05 13:17:49 -04:00
craigmc08
cf55594eda Refactor typechecker module
Move code into Analyzer.TypeChecker.Internal to clean up interface, change lots of
names to be more readable, add comments to explain the complex parts of typechecker
code.
2021-08-05 13:17:49 -04:00
craigmc08
5ab608b8f1 Refactor TypeError
Instead of just a string, now the possible errors are enumerated. Recursive
error structures are used for dictionary/list type errors. Tests are updated
to check behavior of the new type errors.
2021-08-05 13:17:49 -04:00
craigmc08
51b6cda07a Implement Decl, Enum type checking 2021-08-05 13:17:49 -04:00
craigmc08
0357921162 Implement type checking for lists and dictionaries
Currently fails to type check empty lists, because the requisite type
inference has not been added yet.
2021-08-05 13:17:49 -04:00
craigmc08
ce7ee253bd Implement type checking of literal expressions
Type checks literal expressions + variables. Tests are included for all of
these cases as well.
2021-08-05 13:17:49 -04:00
Martin Šošić
d86b53cb24
Merge pull request #279 from saatvikshah/auth_opt_out
Allow operations to opt out of auth middleware
2021-07-21 16:28:18 +02:00
Martin Sosic
748dfb5725 feat: Wasp can now run custom setup code on server start (#199). 2021-07-21 16:14:38 +02:00
Martin Sosic
0b02e45354 Formatted tests with ormolu. 2021-07-21 16:13:21 +02:00
Saatvik Shah
3791b0ee7c Merge remote-tracking branch 'upstream/master' into auth_opt_out 2021-07-18 18:46:18 +02:00
Craig McIlwrath
be03c2a153
feat(analyzer): add new Analyzer module and implement parser
Implements the parser for the new wasp Analyzer. Additionally fixes some ambiguities/inconsistencies in the wasplang document.

Closes #274
2021-07-16 09:34:12 -04:00
Saatvik Shah
d0c5114a52 Address review comments 2021-07-09 08:04:29 +02:00
Saatvik Shah
c71eb58ea9 Merge remote-tracking branch 'upstream/master' into auth_opt_out 2021-07-05 21:26:47 +02:00
Saatvik Shah
a85b408b60 Allow operations to opt out of auth middleware
This patch allows operations to individually specify whether they want
to use or opt out of auth middleware, via an additional `auth` argument
under the actions/queries sections. If left unspecified it is assumed to
be true.

This is addressed by removing the current global auth middleware
registration, and adding it instead to individual operation route
specification.
2021-07-05 21:20:56 +02:00
Martin Sosic
eae7b20938 Replaced couple of last usages of Path with StrongPath. 2021-07-05 17:47:28 +02:00
Martin Sosic
7c7eaa5409 Updated StrongPath to 1.0.0.0, from Hackage. 2021-07-05 17:47:28 +02:00
Martin Sosic
1219a57bc9 Formatted whole codebase with ormolu. 2021-04-28 17:44:00 +02:00
Martin Šošić
f9e8f88b66
Upgraded to Prisma 2.21 (stable migrations) + postgre can be used in local dev.
- `wasp db migrate-save` and `wasp db migrate-up` got replaced with `wasp db migrate-dev`.
- Wasp now has a declarative way to express which db is used, postgresql or sqlite: `db { system: PostgreSQL }`.
- Prisma is now at the latest version, 2.21. PSL parser was upgraded to work with this.
- PostgreSQL can now be used for local development.
- We migrated examples/realworld to work with this new version of Wasp.
2021-04-21 14:06:25 +02:00
Martin Šošić
92937b5e65
Implemented support for dotenv file. (#208) 2021-04-16 12:43:57 +02:00
Martin Šošić
ad3bdd32ae
Implemented PSL model parser, used it for Entity. (#201) 2021-03-15 17:10:01 +01:00
Craig McIlwrath
82ea947981
Add ext/.waspignore file (#196) 2021-03-03 09:35:27 +01:00
Matija Sosic
316c727a8c
Implemented app.head property. (#170) 2021-02-04 11:42:01 +01:00
Matija Sosic
647814e920
Implemented "wasp build" cmd - generates different schema.prisma. (#166)
* Implemented "wasp build" cmd - generates different schema.prisma.

* PR fixes.
2021-02-01 17:37:42 +01:00