Commit Graph

184 Commits

Author SHA1 Message Date
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
Martin Šošić
d9fc27bcde
Improved how Wasp prints output of underlying processes. (#794) 2022-11-04 19:57:34 +01:00
Martin Šošić
7c45475601
Detect when jobs quiet down and print compiler warnings/errors. (#781)
Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>

Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com>
2022-11-01 22:43:39 +01: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
Hari Sankar
76e43b3685
Add information of completion command in wasp help (#256) (#766)
* Add information of completion command in `wasp help` (fix #256)

* Fix syntax error

* Move completion command under GENERAL
2022-10-19 09:46:15 +02:00
Steven Garcia
c018d284a9
Update Wasp CLI bash completion list (#765)
* Update Wasp CLI bash completion list

* Add completion and completion:generate to commands

Co-authored-by: sgarcia <sgarcia@pop-os.localdomain>
2022-10-19 09:44:00 +02:00
Shayne Czyzewski
8fc6fd1836
Adds support for Dockerfile customization (#732) 2022-10-13 12:46:07 -04:00
Shayne Czyzewski
4cdc06dd13
Warn if .env file found (#746) 2022-10-06 13:23:40 +02:00
Peter Reshetin
3f63340fc1
feat: separate env vars for server and client (#683) 2022-10-06 12:51:28 +02:00
Filip Sodić
31391ee2dc Fix unused variable warning (#736) 2022-09-29 16:04:08 +02:00
Martin Šošić
99487ff2f7
waspls is now part of waspc (#716) 2022-09-08 13:56:37 +02: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ć
25a1b991ef
Now waspc assumes all files to be UTF8 regardless of OS'es default locale. (#653) 2022-06-28 19:48:02 +02:00
Shayne Czyzewski
a264d2ee29
Make warnings filterable to avoid redundant messages (#610) 2022-06-02 14:04:57 -04: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
Martin Šošić
4ee7cebc36
Context and user id can now be passed to our telemetry. (#564)
* Added 'context' field to our telemetry, specifically to recognize when Wasp is running on Gitpod.

* Telemetry user id can now be specified via ENV var.

* Improved user signature obtaining code a bit.

* Added fromMaybeM.
2022-04-15 18:46:47 +02: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
1995ccdb9d
Make CLI code testable (#510) 2022-03-23 08:04:09 -04:00
Martin Šošić
2a16bfd3cf
App spec validation (#459) 2022-03-17 12:36:36 +01:00
Martin Šošić
857912c2cc
Migrated Wasp from Stack to Cabal (#471)
Co-authored-by: shayneczyzewski <shayne.czyzewski@gmail.com>
2022-03-16 16:00:18 +01:00
Martijn Faassen
b6f738416a
Use send message protocol in cli (#493)
Use cliSendMessage everywhere in CLI

Instead of using waspSays and friends, we use the new cliSendMessage protocol everywhere to
send messages. For convenience we introduce a cliSendMessageC that's lifted to commands.

We handle CommandErrors specially now, and have a special way to display errors (failures) and warnings
with a heading.
2022-03-09 15:43:41 +01:00
Shayne Czyzewski
84821005f4
Adds E2E CLI testing support via Golden Tests (Part 1) (#470) 2022-03-01 15:00:51 -05:00
Martijn Faassen
f944f0beb3
Send messages from the setup phase (#472)
We introduce a SendMessage protocol. 

We implement it in the CLI as that knows how to send messages. We also pass it into the generator so that it can reach the setup phase. There we use it to emit messages on the CLI.
2022-02-24 12:20:37 +01: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
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
91a40a6105 Revert to the previous behavior for now.
Leave comments in place on what to do once we can skip `npm install`.
2022-02-08 11:00:24 +01:00
Martijn Faassen
55d9bd1ef1 We now run compile and install each time the wasp file changes 2022-02-07 12:56:46 +01:00
Martijn Faassen
988929fbdc Factor out this function into its own module
We also need to reuse it during watch
2022-02-07 12:56:41 +01:00
Martijn Faassen
ae5f498b65 Rename to compileAndSetup
Until (and if) we ever rename setup, we should use this simpler name.

And it involves npm install of two projects, not one one anyway.
2022-02-07 12:55:24 +01:00
Martijn Faassen
4f1088ddf5 Remove commented out code 2022-02-07 12:55:24 +01:00
Martijn Faassen
901a9b9f0e Factor out a compileAndInstall 2022-02-07 12:55:24 +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
Shayne Czyzewski
cdee0ff0d3
feature: Makes CLI output easier to see success and failure (#418)
Closes #212
2022-01-05 09:15:38 -05:00
Shayne Czyzewski
081f3c149a
feature: Delays recompilation until no file changes in last 1s (#403)
Closes #191
2021-12-17 08:39:59 -05:00
Shayne Czyzewski
4156cebb20
fix: Propagates deletion of DB migrations dir from Wasp src to the generated project (#383)
Fixes #211
2021-12-13 12:06:42 -05:00
Phil de Joux
89c9d6a1db
ref: Fixed most of the hlint suggestions. (#366) 2021-11-17 00:36:46 +01:00
Phil de Joux
41077ea2bd fix: flag when new project name is a reserved word.
fixes #354.
2021-11-11 19:45:14 +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
(´⌣`ʃƪ)
2ce24cdfa0
refactor: convert functions in Util.IO to use StrongPath instead of Path (#346)
* refactor: convert functions in Util.IO to use StrongPath instead of Path

* Clean up import in IO

* Updated version of strong-path to the newest one, that doesn't cause version conflicts.

* Tightened types a bit in Util/IO.hs

Co-authored-by: Martin Sosic <sosic.martin@gmail.com>
2021-10-28 14:07:26 +02:00
Saatvik Shah
347cca6d9b
Move bash completion logic to Haskell (#305)
This patch moves majority of the bash completion logic from Bash to
Haskell taking advantage of the environment variables exposed by the
`complete` builtin to infer and suggest possible outputs.

Co-authored-by: sshah1 <saatvik.shah@imc.com>
2021-09-06 13:09:03 +02:00
zant
76acbfd52a
feat: Implement wasp info command (#295) 2021-08-23 18:13:04 +02:00
Martin Sosic
7c7eaa5409 Updated StrongPath to 1.0.0.0, from Hackage. 2021-07-05 17:47:28 +02:00
Trieu Huy Vu
a18be1ab27
feat(cli): CLI now supports bash completion (#224)
Co-authored-by: Trieu Vu <trieuv@strategicdata.com.au>
2021-06-16 13:40:31 +02:00
tolarianwiz
f363ed1c24 feat(cli): add 'wasp deps' command that lists dependencies used in the project by wasp (#238) 2021-05-20 14:15:36 +02:00
Sameer Kolhar
092bb70db2
cli: clean up /build before wasp build (#230)
fix: build/ dir is now cleaned before creating new build (#230)
2021-05-17 16:10:08 +02:00
Martin Sosic
1219a57bc9 Formatted whole codebase with ormolu. 2021-04-28 17:44:00 +02:00
Sameer Kolhar
6844313144 feat(cli): Enriched wasp telemetry CLI command to show more telemetry info. 2021-04-28 17:07:25 +02:00
Martin Sosic
21dcdb2e6b Small fixes in Haskell code, mostly haddock fixes. 2021-04-28 14:38:24 +02:00
Manikandan Sundararajan
bf6299c0dd fix(cli): Check if project name is valid when creating new project. 2021-04-27 18:12:30 +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 Sosic
300b4caafe Switched from Control.Exception to UnliftIO.Exception, that handles async exceptions by default. 2021-03-30 23:41:20 +02:00
Martin Šošić
779cff3745
Enabled input in proxied CLI commands + fixed encoding of proxied output. (#202)
Co-authored-by: Matija Sosic <matija.sosic@gmail.com>
2021-03-15 17:11:04 +01:00
Craig McIlwrath
82ea947981
Add ext/.waspignore file (#196) 2021-03-03 09:35:27 +01:00
Sameer Kolhar
486ea76d19
cli: add telemetry command (#186) 2021-02-22 18:32:04 +01:00
Martin Sosic
9c23b17b99 Added 'Wasp is in Alpha' note to CLI. 2021-02-09 17:29:08 +01:00
Matija Sosic
0207276a01
Added welcome page to the newly created app. (#178) 2021-02-09 13:13:51 +01:00
Martin Sosic
e32bca9007 Prettified CLI usage output. 2021-02-09 11:19:29 +01:00
Martin Sosic
e1aa7723b5 Cleaned up output on success from 'wasp new'. 2021-02-08 15:28:37 +01:00
Martin Sosic
0e98099028 Added tracking of 'build' command in telemetry. 2021-02-05 14:40:46 +01:00
Martin Sosic
332fe32c4c compileIOWithOptions now has nicer code. 2021-02-05 12:18:12 +01:00
Martin Sosic
6abcf496c4 Fixed migrations not being copied on 'wasp build'. 2021-02-04 17:45:38 +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
Martin Sosic
57d847d6e3 Implemented CLI telemetry. 2021-01-25 22:00:10 +01:00
Matija Sosic
46a1cbab32
Added wasp db studio command. (#120) 2020-11-04 15:26:35 +01:00
Martin Sosic
bf363c0791 Fixed some old docs links and created init version of realworld app. 2020-10-30 16:28:50 +01:00
Martin Sosic
4889fefd0f Added 'version' command to cli. 2020-10-29 13:15:13 +01:00
Matija Sosic
61d028d32a
Fixed a bug with Prisma migrations. (#104) 2020-10-28 15:28:58 +01:00
Matija Sosic
a55aba643c
Db commands now make sure their prerequisites are set. (#86) 2020-10-20 11:02:00 +02:00
Martin Sosic
71273805db Enriched 'wasp new' message and refactored terminal coloring. 2020-10-19 14:56:43 +02:00
Matija Sosic
c1f2d6dab3
TodoApp example now uses db. (#45) 2020-09-19 16:11:09 +02:00
Matija Sosic
338c3c909e Removed unused imports. 2020-09-18 16:45:20 +02:00
Matija Sosic
08f224d03d
Implemented migrate-save and migrate-up cli db commands. (#41) 2020-09-18 16:14:14 +02:00
Martin Sosic
1f02809b3d Fixed compile error from previous commit. 2020-09-15 17:39:56 +02:00
Martin Sosic
32bb439c53 'wasp start' now reloads on file change. 2020-09-15 17:00:48 +02:00
Matija Sosic
e95fae7f06
Implemented wasp db migrate cli cmd - runs only prisma migrate save for now. (#39) 2020-09-15 16:39:56 +02:00
Martin Sosic
f06c933182 wasp start now does setup and start while forwarding output.
fix
2020-09-11 17:33:10 +02:00
Martin Sosic
a70effa6db Implemented first version of CLI, with clean, new and start commands.
Start does not yet work properly.
2020-09-10 09:47:41 +02:00