mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-09-11 15:26:19 +03:00
Migrated Wasp from Stack to Cabal (#471)
Co-authored-by: shayneczyzewski <shayne.czyzewski@gmail.com>
This commit is contained in:
parent
038ae0132f
commit
857912c2cc
90
.github/workflows/ci.yaml
vendored
90
.github/workflows/ci.yaml
vendored
@ -4,6 +4,10 @@ on:
|
|||||||
push: { branches: [main] }
|
push: { branches: [main] }
|
||||||
pull_request: { }
|
pull_request: { }
|
||||||
create: { tags: [v*] }
|
create: { tags: [v*] }
|
||||||
|
schedule:
|
||||||
|
# Additionally run once per week (At 00:00 on Sunday) to avoid loosing cache
|
||||||
|
# (GH deletes it after 7 days of not using it).
|
||||||
|
- cron: '0 0 * * 0'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
WASP_TELEMETRY_DISABLE: 1
|
WASP_TELEMETRY_DISABLE: 1
|
||||||
@ -23,19 +27,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
access_token: ${{ github.token }}
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
# Check that Haskell code is formatted.
|
|
||||||
code-formatter:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: mrkkrp/ormolu-action@v2
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build Wasp
|
name: Build Wasp
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs: code-formatter
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
ghc:
|
||||||
|
- "8.10.7"
|
||||||
|
cabal:
|
||||||
|
- "3.6.2.0"
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
@ -45,15 +45,22 @@ jobs:
|
|||||||
- name: Checkout the repo
|
- name: Checkout the repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Cache (Unix)
|
- name: Set up Haskell
|
||||||
uses: actions/cache@v2
|
id: setup-haskell-cabal
|
||||||
if: runner.os == 'Linux' || runner.os == 'macOS'
|
uses: haskell/actions/setup@v1
|
||||||
with:
|
with:
|
||||||
path: |
|
ghc-version: ${{ matrix.ghc }}
|
||||||
# TODO: To reduce the cache size significantly, we might want to look into ensuring that
|
cabal-version: ${{ matrix.cabal }}
|
||||||
# GHC is not cached, since it is big and can be installed in couple of minutes.
|
|
||||||
# To do that, we will probably want to cache only ~/.stack/snapshots.
|
- name: Verify Haskell setup
|
||||||
~/.stack
|
run: |
|
||||||
|
ghc --version
|
||||||
|
cabal --version
|
||||||
|
|
||||||
|
- name: Cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
|
||||||
# TODO: Right now, actions/cache updates cache only if cache was not fetched.
|
# TODO: Right now, actions/cache updates cache only if cache was not fetched.
|
||||||
# This is not ideal for us, because we would ideally update cache even if it
|
# This is not ideal for us, because we would ideally update cache even if it
|
||||||
# was fetched, because we want to cache any newly installed packages.
|
# was fetched, because we want to cache any newly installed packages.
|
||||||
@ -66,50 +73,19 @@ jobs:
|
|||||||
# ideal because caches keep getting evicted, so for example if Win job
|
# ideal because caches keep getting evicted, so for example if Win job
|
||||||
# fails multiple times while others don't, its cache will likely get evicted,
|
# fails multiple times while others don't, its cache will likely get evicted,
|
||||||
# making it even slower to test and fix (uffff).
|
# making it even slower to test and fix (uffff).
|
||||||
# When they fix this, we should remove ${{ github.run_id }} from the end of the key
|
# When they fix this, we should remove ${{ github.run_id }} from the end of the key.
|
||||||
# and also remove restore-keys.
|
key: wasp-build-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('waspc/cabal.project.freeze') }}-${{ github.run_id }}
|
||||||
key: wasp-build-{{ runner.os }}-${{ hashFiles('waspc/stack.yaml') }}-${{ github.run_id }}
|
restore-keys: wasp-build-${{ runner.os }}-${{ matrix.ghc }}-
|
||||||
restore-keys: |
|
|
||||||
wasp-build-{{ runner.os }}-${{ hashFiles('waspc/stack.yaml') }}-
|
|
||||||
|
|
||||||
- name: Cache (Windows)
|
- name: Check Haskell code formatting
|
||||||
uses: actions/cache@v2
|
if: matrix.os == 'ubuntu-latest'
|
||||||
if: runner.os == 'Windows'
|
run: ./run ormolu:check
|
||||||
with:
|
|
||||||
# C\:sr is where stack installs compiled dependencies.
|
|
||||||
# Caching this path reduces build time by 20 minutes while occupying only ~50mbs of cache space.
|
|
||||||
# To shave off 3 more minutes, we could add C:\Users\runneradmin\AppData\Local\Programs\stack
|
|
||||||
# to the cache -> this is where stack installs GHC. However, this adds ~900mb to the cache size!
|
|
||||||
path: |
|
|
||||||
C:\sr
|
|
||||||
# TODO: Check TODO in caching for Unix above.
|
|
||||||
key: wasp-build-{{ runner.os }}-${{ hashFiles('waspc/stack.yaml') }}-${{ github.run_id }}
|
|
||||||
restore-keys: |
|
|
||||||
wasp-build-{{ runner.os }}-${{ hashFiles('waspc/stack.yaml') }}-
|
|
||||||
|
|
||||||
# TODO: Remove this step once https://github.com/actions/cache/issues/445 is resolved.
|
- name: Build external dependencies
|
||||||
- name: Fix MacOS problem with corrupt cached executable
|
run: cabal build --enable-tests --enable-benchmarks --only-dependencies
|
||||||
if: runner.os == 'macOS'
|
|
||||||
run: rm -rf ~/.stack/setup-exe-cache
|
|
||||||
|
|
||||||
- name: Set up Haskell (Stack)
|
|
||||||
uses: haskell/actions/setup@v1
|
|
||||||
with:
|
|
||||||
ghc-version: latest
|
|
||||||
enable-stack: true
|
|
||||||
stack-version: latest
|
|
||||||
|
|
||||||
- name: Verify Haskell setup
|
|
||||||
run: |
|
|
||||||
stack --numeric-version
|
|
||||||
stack path --stack-root
|
|
||||||
ghc --version
|
|
||||||
|
|
||||||
- name: Build dependencies
|
|
||||||
run: stack --install-ghc test --only-dependencies
|
|
||||||
|
|
||||||
- name: Build Wasp & Run tests
|
- name: Build Wasp code & run tests
|
||||||
run: stack test
|
run: cabal test
|
||||||
|
|
||||||
- name: Create binary package (Unix)
|
- name: Create binary package (Unix)
|
||||||
if: startsWith(github.ref, 'refs/tags/v') && (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest')
|
if: startsWith(github.ref, 'refs/tags/v') && (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest')
|
||||||
|
6
waspc/.gitignore
vendored
6
waspc/.gitignore
vendored
@ -1,17 +1,11 @@
|
|||||||
.stack-work/
|
|
||||||
stack*.yaml.lock
|
|
||||||
dist-newstyle
|
dist-newstyle
|
||||||
waspc.cabal
|
|
||||||
|
|
||||||
|
|
||||||
/out
|
/out
|
||||||
|
|
||||||
|
|
||||||
.hie/
|
.hie/
|
||||||
.bin/
|
.bin/
|
||||||
stan.html
|
stan.html
|
||||||
|
|
||||||
|
|
||||||
# editor related
|
# editor related
|
||||||
*.orig
|
*.orig
|
||||||
*~
|
*~
|
||||||
|
135
waspc/README.md
135
waspc/README.md
@ -32,7 +32,12 @@ It can then also run that web app for you, deploy it (not yet but that is coming
|
|||||||
|
|
||||||
## Basics
|
## Basics
|
||||||
### Setup
|
### Setup
|
||||||
We use [Stack](https://docs.haskellstack.org/en/stable/README/) for building the project, so you will need to install `stack` on your machine.
|
We use [Cabal](https://cabal.readthedocs.io/) to build the project.
|
||||||
|
|
||||||
|
The best way to install it is via [ghcup](https://www.haskell.org/ghcup/).
|
||||||
|
|
||||||
|
Check [cabal.project](cabal.project) for exact version of GHC that we use to build Wasp.
|
||||||
|
Then, ensure via `ghcup` that you use that version of GHC and that you are using corresponding versions of `cabal` and `hls`.
|
||||||
|
|
||||||
### Repo
|
### Repo
|
||||||
Fork this repo and clone the fork to your machine (or clone this repo directly if you don't plan to contribute but just want to try it out).
|
Fork this repo and clone the fork to your machine (or clone this repo directly if you don't plan to contribute but just want to try it out).
|
||||||
@ -41,59 +46,40 @@ Position yourself in this directory (`waspc/`) and make sure that you are on the
|
|||||||
|
|
||||||
### Build
|
### Build
|
||||||
```
|
```
|
||||||
stack build
|
cabal build
|
||||||
```
|
```
|
||||||
to build the library and `wasp` executable.
|
to build the library and `wasp` executable.
|
||||||
|
|
||||||
This might take a longer time (10 mins) if you are doing it for the very first time, since `stack` will need to download the external dependencies.
|
This might take a while (10 mins) if you are doing it for the very first time, since `cabal` will need to download the external dependencies.
|
||||||
|
If that is the case, relax and feel free to get yourself a cup of coffee! When somebody asks what you are doing, you can finally rightfully say "compiling!" :D.
|
||||||
|
|
||||||
`NOTE:` For macOS Big Sur users there is a bug in older GHC versions (<= 8.10.3) causing system frameworks to load improperly and will fail when building the project. This can be fixed with the following steps:
|
NOTE: You may need to run `cabal update` before attempting to build if it has been some time since your last update.
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Show details</summary>
|
|
||||||
|
|
||||||
1. Clean up stack cache which could have been carried over from previous OS versions using below command.
|
|
||||||
|
|
||||||
```
|
|
||||||
rm -Rf ~/.stack/setup-exe-cache/x86_64-osx
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Run `stack build` until it fails with error `can't load framework: Cocoa (not found)`.
|
|
||||||
3. Checkout and build this [workaround](https://github.com/yairchu/macos11-haskell-workaround).
|
|
||||||
4. Re-run stack build with workaround using below command and it should build without errors.
|
|
||||||
|
|
||||||
```
|
|
||||||
DYLD_INSERT_LIBRARIES=~/macos11-haskell-workaround/macos11ghcwa.dylib stack build
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
### Test
|
### Test
|
||||||
```
|
```
|
||||||
stack test
|
cabal test
|
||||||
```
|
```
|
||||||
to ensure all the unit and end-to-end tests are passing (this will also build the project if needed).
|
to ensure all the unit and end-to-end tests are passing (this will also build the project if needed).
|
||||||
|
|
||||||
### Executable
|
### Executable
|
||||||
```
|
```
|
||||||
stack exec wasp-cli
|
cabal run wasp-cli
|
||||||
```
|
```
|
||||||
to run the `wasp-cli` executable that you just built!
|
to run the `wasp-cli` executable that you just built!
|
||||||
It should print "Usage" information.
|
It should print "Usage" information.
|
||||||
|
|
||||||
You can pass more arguments by just adding them to the command, e.g.: `stack exec wasp-cli new MyProject`.
|
You can pass more arguments by just adding them to the command, e.g.: `cabal run wasp-cli new MyProject`.
|
||||||
|
|
||||||
### Run example app
|
### Run example app
|
||||||
Position yourself in `waspc/examples/todoApp/` and run
|
Position yourself in `waspc/examples/todoApp/` and run
|
||||||
```
|
```
|
||||||
stack exec wasp-cli db migrate-dev
|
cabal run wasp-cli db migrate-dev
|
||||||
```
|
```
|
||||||
to update database schema (this is done only on schema changes).
|
to update database schema (this is done only on schema changes).
|
||||||
|
|
||||||
Then,
|
Then,
|
||||||
```
|
```
|
||||||
stack exec wasp-cli start
|
cabal run wasp-cli start
|
||||||
```
|
```
|
||||||
to run web app in development mode.
|
to run web app in development mode.
|
||||||
|
|
||||||
@ -105,23 +91,32 @@ NOTE: Reload page if blank.
|
|||||||
|
|
||||||
## Typical development workflow
|
## Typical development workflow
|
||||||
1. Create a new feature branch from `main`.
|
1. Create a new feature branch from `main`.
|
||||||
2. Run `./run ghcid` from the root of the project: this will run a process that watches the Haskell project and reports any Haskell compiler errors. Leave it running.
|
2. If you don't have a good/reliable working HLS (Haskell Language Server) in your IDE, you will want to instead run `./run ghcid` from the root of the project instead: this will run a process that watches the Haskell project and reports any Haskell compiler errors. Leave it running.
|
||||||
NOTE: You will need to install `ghcid` globally first, you can do it with `stack install ghcid`.
|
NOTE: You will need to install `ghcid` globally first. You can do it with `cabal install ghcid`.
|
||||||
3. Do a change in the codebase (most often in `lib/` or `cli/` or `data/`) (together with tests if that makes sense: see "Tests").
|
3. Do a change in the codebase (most often in `lib/` or `cli/` or `data/`) (together with tests if that makes sense: see "Tests").
|
||||||
Fix any errors shown by `ghcid`.
|
Fix any errors shown by HLS/`ghcid`.
|
||||||
Rinse and repeat.
|
Rinse and repeat.
|
||||||
4. Once close to done, run `stack test` to confirm that project is passing tests (new and old).
|
4. Once close to done, run `cabal test` to confirm that the project's tests are passing (both new and old).
|
||||||
5. If needed, confirm that `examples/todoApp/` is working correctly by running `stack build` first, to build the wasp executable, and then by running that executable with `stack exec wasp-cli start` from the `examples/todoApp/` dir -> this will run the web app in development mode with the current version of your Wasp code.
|
5. If needed, confirm that `examples/todoApp/` is working correctly by running `cabal build` first, to build the wasp executable, and then by running that executable with `cabal run wasp-cli start` from the `examples/todoApp/` dir -> this will run the web app in development mode with the current version of your Wasp code.
|
||||||
Manually inspect that app behaves ok: In the future we will add automatic integration tests, but for now testing is manual.
|
Manually inspect that app behaves ok: In the future we will add automatic integration tests, but for now testing is manual.
|
||||||
6. When all is ready, squash commits into one commit (or a few if that makes sense) and create a PR.
|
6. When all is ready, and if you modified any Haskell dependencies, regenerate the cabal freeze file.
|
||||||
|
You can do this by running `rm cabal.project.freeze && cabal freeze` (or `./run refreeze`).
|
||||||
|
7. Squash all the commits into a single commit (or a few in case it makes more sense) and create a PR.
|
||||||
Keep an eye on CI tests -> they should all be passing, if not, look into it.
|
Keep an eye on CI tests -> they should all be passing, if not, look into it.
|
||||||
7. If your PR changes how users(Waspers) use Wasp, make sure to also create a PR that will update the documentation, which is in a [separate repo](https://wasp-lang.dev/docs/tutorials/getting-started).
|
8. If your PR changes how users(Waspers) use Wasp, make sure to also create a PR that will update the documentation, which is in a [separate repo](https://wasp-lang.dev/docs/tutorials/getting-started).
|
||||||
8. Work with reviewer(s) to get the PR approved.
|
9. Work with reviewer(s) to get the PR approved.
|
||||||
Keep adding "fix" commits until PR is approved, then again squash them all into one commit.
|
Keep adding "fix" commits until PR is approved, then again squash them all into one commit.
|
||||||
9. Reviewer will merge the branch into `main`. Yay!
|
10. Reviewer will merge the branch into `main`. Yay!
|
||||||
|
|
||||||
|
NOTE: What is cabal freeze file, what is its purpose?
|
||||||
|
Freeze file (`cabal.project.freeze`) plays the same role as `package.lock.json` in `npm` -> it enables reproducible builds.
|
||||||
|
What `cabal freeze` does is, it captures exact versions of all the cabal dependencies (recursively) used at the moment and writes them down into `cabal.project.freeze` file. Then, in future, `cabal` uses those versions for any commands it runs, regardless of what is written in `.cabal` file.
|
||||||
|
This ensures consistent builds accross CI and different development machines -> a dependency won't suddenly get updated because the patch was released (potentially causing a bug).
|
||||||
|
The way to think about .cabal vs cabal.project.freeze is that dependency version bounds in .cabal specify what range of dependencies are we ok with, while freeze file specifies what (in that range) we know worked last and we tested with.
|
||||||
|
|
||||||
|
|
||||||
## Design docs (aka RFCs)
|
## Design docs (aka RFCs)
|
||||||
If the feature you are implementing is complex, be it regarding its design or technical implementation, we recommend creating a [design doc](https://www.industrialempathy.com/posts/design-docs-at-google/) (aka RFC).
|
If the feature you are implementing is complex, be it due to its design or technical implementation, we recommend creating a [design doc](https://www.industrialempathy.com/posts/design-docs-at-google/) (aka RFC).
|
||||||
It is a great way to share the idea you have with others while also getting help and feedback.
|
It is a great way to share the idea you have with others while also getting help and feedback.
|
||||||
|
|
||||||
To create one, make a PR that adds a markdown document under `wasp/docs/design-docs`, and in that markdown document explain the thinking behind and choice made when deciding how to implement a feature.
|
To create one, make a PR that adds a markdown document under `wasp/docs/design-docs`, and in that markdown document explain the thinking behind and choice made when deciding how to implement a feature.
|
||||||
@ -172,33 +167,34 @@ On any changes you do to the source code of Wasp, Wasp project gets recompiled,
|
|||||||
|
|
||||||
|
|
||||||
## Building / development (detailed)
|
## Building / development (detailed)
|
||||||
Some useful stack commands:
|
Some useful cabal commands:
|
||||||
- `stack build` to build the project, including `wasp` binary which is both CLI and compiler in one.
|
- `cabal update` to update your package information.
|
||||||
- `stack exec wasp-cli <arguments>` to run the `wasp` binary that you have built.
|
- `cabal build` to build the project, including `wasp` binary which is both CLI and compiler in one.
|
||||||
- `stack test` to build the whole project + tests and then also run tests.
|
- `cabal run wasp-cli <arguments>` to run the `wasp` binary that was previously built.
|
||||||
- `stack build --file-watch` -> live watch, reruns every time a file changes. But we prefer using `ghcid`, it is faster.
|
- `cabal test` to build the whole project + tests and then also run tests.
|
||||||
- `stack build --pedantic` -> sets -Wall and -Werror ghc options.
|
- `cabal install` -> builds the project and places the binary so it is in PATH (so you can call it directly, from anywhere, with just `wasp`).
|
||||||
- `stack build --profile`
|
|
||||||
- `stack build --trace`
|
|
||||||
- `stack install` -> builds the project and places the binary so it is in PATH (and you can call it directly with `wasp`).
|
|
||||||
- `stack ghci` -> opens ghci in the context of the project, allowing you to load and run local modules.
|
|
||||||
- `stack clear` -> clear all generated files/artifacts.
|
|
||||||
|
|
||||||
For live compilation and error checking of your code we recommend using `ghcid`.
|
For live compilation and error checking of your code we recommend using Haskell Language Server (hls) via your IDE, but if that is not working as it should, then safe fallback is always `ghcid`. You can install `ghcid` globally with `cabal install ghcid` and then just type `ghcid` when in the project -> it will watch for any file changes and report errors.
|
||||||
You can install it globally with `stack install ghcid` and then just type `ghcid --command=stack ghci` when in the project -> it will watch for any file changes and report errors.
|
|
||||||
|
|
||||||
### Run script
|
### Run script
|
||||||
For more convenient running of common build/dev commands, we created `run` script.
|
For more convenient running of common build/dev commands, we created `run` script.
|
||||||
It mostly runs stack commands described above, reducing the number of characters you have to type to run certain commands.
|
It mostly runs cabal commands described above, reducing the number of characters you have to type to run certain commands.
|
||||||
|
It also allows you to easily run some of the helper tools, for example tools for static analysis of our code.
|
||||||
|
|
||||||
The idea is that you normally use this for development, and you use `stack` directly when you need more control.
|
The idea is that you normally use this for development, and you use `cabal` directly when you need more control.
|
||||||
It is up to you, using `stack` directly is also perfectly fine and sometimes easier.
|
It is up to you, using `cabal` directly is also perfectly fine and sometimes easier.
|
||||||
|
|
||||||
You can run `./run help` to learn how to use it.
|
You can run `./run help` to learn how to use it.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
- `./run ghcid-test` will run ghcid that watches tests, while passing correct arguments to ghcid.
|
- `./run ghcid-test` will run ghcid that watches tests, while passing correct arguments to ghcid.
|
||||||
- `./run stan` will run static analysis of the codebase.
|
- `./run test:unit` will run only unit tests (skipping e2e tests, which is useful since they are relatively slow).
|
||||||
|
- `./run ormolu:format` will format the Haskell code for you.
|
||||||
|
|
||||||
|
Tip: to make it easy to run the `run` script from any place in your wasp codebase, you can create a bash alias that points to it:
|
||||||
|
```
|
||||||
|
alias wrun="/home/martin/git/wasp-lang/wasp/waspc/run"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
@ -231,14 +227,12 @@ All tests go into `test/` directory.
|
|||||||
This is convention for Haskell, opposite to mixing them with source code as in Javascript for example.
|
This is convention for Haskell, opposite to mixing them with source code as in Javascript for example.
|
||||||
Not only that, but Haskell build tools don't have a good support for mixing them with source files, so even if we wanted to do that it is just not worth the hassle.
|
Not only that, but Haskell build tools don't have a good support for mixing them with source files, so even if we wanted to do that it is just not worth the hassle.
|
||||||
|
|
||||||
Tests are run with `stack test`. They include both unit tests, and end-to-end tests of basic CLI commands.
|
Tests are run with `cabal test`. They include both unit tests, and end-to-end tests of basic CLI commands.
|
||||||
You can do `stack test --coverage` to see the coverage.
|
|
||||||
|
|
||||||
To run unit tests only, you can do `stack test :waspc-test`.
|
To run unit tests only, you can do `cabal test waspc-test` (or `./run test:unit`).
|
||||||
|
To run individual unit test, you can do `cabal test waspc-test --test-options "-p \"Some test description to match\""` (or just `./run test:unit "Some test description to match"`).
|
||||||
|
|
||||||
To run end-to-end tests only, you can do `stack test :e2e-test`.
|
To run end-to-end tests only, you can do `cabal test e2e-test` (or `/run test:e2e`).
|
||||||
|
|
||||||
To run individual test, you can do `stack test --test-arguments "-p \"Some test description to match\""`.
|
|
||||||
|
|
||||||
## Code analysis
|
## Code analysis
|
||||||
|
|
||||||
@ -250,6 +244,8 @@ To run the code analysis, run:
|
|||||||
This will check if code is correctly formatted, if it satisfies linter, and if it passes static analysis.
|
This will check if code is correctly formatted, if it satisfies linter, and if it passes static analysis.
|
||||||
|
|
||||||
These same checks are required to pass the CI, so make sure this is passing before making a PR.
|
These same checks are required to pass the CI, so make sure this is passing before making a PR.
|
||||||
|
TODO: For now we check only the code formatting during the CI. In the future, once we make sure all the warnings are passing,
|
||||||
|
we will also check linter and static analysis during the CI, but that is not happening yet.
|
||||||
|
|
||||||
### Formatting
|
### Formatting
|
||||||
For formatting Haskell code we use [Ormolu](https://github.com/tweag/ormolu).
|
For formatting Haskell code we use [Ormolu](https://github.com/tweag/ormolu).
|
||||||
@ -266,15 +262,21 @@ to see if there is any formatting that needs to be fixed, or with
|
|||||||
```
|
```
|
||||||
to have Ormolu actually format (in-place) all files that need formatting.
|
to have Ormolu actually format (in-place) all files that need formatting.
|
||||||
|
|
||||||
|
NOTE: When you run it for the first time it might take a while (~10 minutes) for all the dependencies to get installed.
|
||||||
|
The subsequent runs will be much faster.
|
||||||
|
|
||||||
### Linting
|
### Linting
|
||||||
We use [hlint](https://github.com/ndmitchell/hlint) for linting our Haskell code.
|
We use [hlint](https://github.com/ndmitchell/hlint) for linting our Haskell code.
|
||||||
|
|
||||||
You can use
|
You can use
|
||||||
```
|
```
|
||||||
./run hlint`
|
./run hlint
|
||||||
```
|
```
|
||||||
to run the hlint on Wasp codebase.
|
to run the hlint on Wasp codebase.
|
||||||
|
|
||||||
|
NOTE: When you run it for the first time it might take a while (~10 minutes) for all the dependencies to get installed.
|
||||||
|
The subsequent runs will be much faster.
|
||||||
|
|
||||||
### Static Analysis
|
### Static Analysis
|
||||||
We use [stan](https://github.com/kowainik/stan) to statically analyze our codebase.
|
We use [stan](https://github.com/kowainik/stan) to statically analyze our codebase.
|
||||||
|
|
||||||
@ -284,6 +286,9 @@ The easiest way to run it is to use
|
|||||||
```
|
```
|
||||||
This will build the codebase, run stan on it (while installing it first, if needed, with the correct version of GHC) and then write results to the CLI and also generate report in the `stan.html`.
|
This will build the codebase, run stan on it (while installing it first, if needed, with the correct version of GHC) and then write results to the CLI and also generate report in the `stan.html`.
|
||||||
|
|
||||||
|
NOTE: When you run it for the first time it might take a while (~10 minutes) for all the dependencies to get installed.
|
||||||
|
The subsequent runs will be much faster.
|
||||||
|
|
||||||
|
|
||||||
## Commit message conventions
|
## Commit message conventions
|
||||||
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) convention when creating commits.
|
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) convention when creating commits.
|
||||||
@ -299,7 +304,7 @@ If commit is tagged with tag starting with `v`, github draft release is created
|
|||||||
|
|
||||||
If you put `[skip ci]` in commit message, that commit will be ignored by Github Actions.
|
If you put `[skip ci]` in commit message, that commit will be ignored by Github Actions.
|
||||||
|
|
||||||
We also wrote a `new-release` script which you can use to help you with creating new release: you need to provide it with new version (`./new-release 0.3.0`) and it will update the version in package.yaml, commit it, push it, and will also create appropriate tag and push it, therefore triggering CI to create new release on Github.
|
We also wrote a `new-release` script which you can use to help you with creating new release: you need to provide it with new version (`./new-release 0.3.0`) and it will update the version in waspc.cabal, commit it, push it, and will also create appropriate tag and push it, therefore triggering CI to create new release on Github.
|
||||||
|
|
||||||
NOTE: If building of your commit is suddenly taking much longer time, it might be connected with cache on Github Actions.
|
NOTE: If building of your commit is suddenly taking much longer time, it might be connected with cache on Github Actions.
|
||||||
If it happens just once every so it is probably nothing to worry about. If it happens consistently, we should look into it.
|
If it happens just once every so it is probably nothing to worry about. If it happens consistently, we should look into it.
|
||||||
@ -308,7 +313,7 @@ If it happens just once every so it is probably nothing to worry about. If it ha
|
|||||||
- Update ChangeLog.md with release notes and open an PR for feedback.
|
- Update ChangeLog.md with release notes and open an PR for feedback.
|
||||||
- After approval, squash and merge PR for ChangeLog.md into `main`.
|
- After approval, squash and merge PR for ChangeLog.md into `main`.
|
||||||
- Make sure you are on `main` and up to date locally :D and then run `./new-release 0.x.y.z`.
|
- Make sure you are on `main` and up to date locally :D and then run `./new-release 0.x.y.z`.
|
||||||
- This will automatically create a new commit for updating the version in package.yaml, tag it, and push it all.
|
- This will automatically create a new commit for updating the version in waspc.cabal, tag it, and push it all.
|
||||||
- Wait for CI to finish & succeed for the new tag.
|
- Wait for CI to finish & succeed for the new tag.
|
||||||
- This will automatically create a new draft release.
|
- This will automatically create a new draft release.
|
||||||
- Find new draft release here: https://github.com/wasp-lang/wasp/releases and edit it with your release notes.
|
- Find new draft release here: https://github.com/wasp-lang/wasp/releases and edit it with your release notes.
|
||||||
|
16
waspc/cabal.project
Normal file
16
waspc/cabal.project
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
with-compiler: ghc-8.10.7
|
||||||
|
|
||||||
|
packages: .
|
||||||
|
|
||||||
|
package waspc
|
||||||
|
-- This causes cabal to build modules on all cores, instead of just one,
|
||||||
|
-- therefore reducing our build times.
|
||||||
|
ghc-options: -j
|
||||||
|
|
||||||
|
-- This causes cabal to build packages on all cores, instead of just one.
|
||||||
|
-- This doesn't help when developing a single local package, but instead helps when
|
||||||
|
-- building multiple packages at once, for example external dependencies.
|
||||||
|
jobs: $ncpus
|
||||||
|
|
||||||
|
-- Ensures that tests print their output to stdout as they execute.
|
||||||
|
test-show-details: direct
|
234
waspc/cabal.project.freeze
Normal file
234
waspc/cabal.project.freeze
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
active-repositories: hackage.haskell.org:merge
|
||||||
|
constraints: any.Cabal ==3.2.1.0,
|
||||||
|
any.Glob ==0.10.2,
|
||||||
|
any.HUnit ==1.6.2.0,
|
||||||
|
any.OneTuple ==0.3.1,
|
||||||
|
any.Only ==0.1,
|
||||||
|
any.QuickCheck ==2.14.2,
|
||||||
|
QuickCheck -old-random +templatehaskell,
|
||||||
|
any.abstract-deque ==0.3,
|
||||||
|
abstract-deque -usecas,
|
||||||
|
any.abstract-par ==0.3.3,
|
||||||
|
any.aeson ==1.5.6.0,
|
||||||
|
aeson -bytestring-builder -cffi -developer -fast,
|
||||||
|
any.aeson-pretty ==0.8.9,
|
||||||
|
aeson-pretty -lib-only,
|
||||||
|
any.alex ==3.2.7.1,
|
||||||
|
any.ansi-terminal ==0.11.1,
|
||||||
|
ansi-terminal -example,
|
||||||
|
any.ansi-wl-pprint ==0.6.9,
|
||||||
|
ansi-wl-pprint -example,
|
||||||
|
any.appar ==0.1.8,
|
||||||
|
any.array ==0.5.4.0,
|
||||||
|
any.asn1-encoding ==0.9.6,
|
||||||
|
any.asn1-parse ==0.9.5,
|
||||||
|
any.asn1-types ==0.3.4,
|
||||||
|
any.assoc ==1.0.2,
|
||||||
|
any.async ==2.2.4,
|
||||||
|
async -bench,
|
||||||
|
any.attoparsec ==0.14.4,
|
||||||
|
attoparsec -developer,
|
||||||
|
any.base ==4.14.3.0,
|
||||||
|
any.base-compat ==0.12.1,
|
||||||
|
any.base-compat-batteries ==0.12.1,
|
||||||
|
any.base-orphans ==0.8.6,
|
||||||
|
any.base64-bytestring ==1.2.1.0,
|
||||||
|
any.basement ==0.0.14,
|
||||||
|
any.bifunctors ==5.5.11,
|
||||||
|
bifunctors +semigroups +tagged,
|
||||||
|
any.binary ==0.8.8.0,
|
||||||
|
any.binary-orphans ==1.0.2,
|
||||||
|
any.blaze-builder ==0.4.2.2,
|
||||||
|
any.byteorder ==1.0.4,
|
||||||
|
any.bytestring ==0.10.12.0,
|
||||||
|
any.call-stack ==0.4.0,
|
||||||
|
any.case-insensitive ==1.2.1.0,
|
||||||
|
any.cassava ==0.5.2.0,
|
||||||
|
cassava -bytestring--lt-0_10_4,
|
||||||
|
any.cereal ==0.5.8.2,
|
||||||
|
cereal -bytestring-builder,
|
||||||
|
any.clock ==0.8.3,
|
||||||
|
clock -llvm,
|
||||||
|
any.cmdargs ==0.10.21,
|
||||||
|
cmdargs +quotation -testprog,
|
||||||
|
any.code-page ==0.2.1,
|
||||||
|
any.colour ==2.3.6,
|
||||||
|
any.comonad ==5.0.8,
|
||||||
|
comonad +containers +distributive +indexed-traversable,
|
||||||
|
any.conduit ==1.3.4.2,
|
||||||
|
any.conduit-extra ==1.3.5,
|
||||||
|
any.connection ==0.3.1,
|
||||||
|
any.constraints ==0.13.3,
|
||||||
|
any.containers ==0.6.5.1,
|
||||||
|
any.cookie ==0.4.5,
|
||||||
|
any.criterion ==1.5.13.0,
|
||||||
|
criterion -embed-data-files -fast,
|
||||||
|
any.criterion-measurement ==0.1.3.0,
|
||||||
|
criterion-measurement -fast,
|
||||||
|
any.cryptohash-md5 ==0.11.101.0,
|
||||||
|
any.cryptohash-sha1 ==0.11.101.0,
|
||||||
|
any.cryptohash-sha256 ==0.11.102.1,
|
||||||
|
cryptohash-sha256 -exe +use-cbits,
|
||||||
|
any.cryptonite ==0.29,
|
||||||
|
cryptonite -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq -support_pclmuldq +support_rdrand -support_sse +use_target_attributes,
|
||||||
|
any.data-default-class ==0.1.2.0,
|
||||||
|
any.data-fix ==0.3.2,
|
||||||
|
any.deepseq ==1.4.4.0,
|
||||||
|
any.dense-linear-algebra ==0.1.0.0,
|
||||||
|
any.dir-traverse ==0.2.3.0,
|
||||||
|
any.directory ==1.3.6.0,
|
||||||
|
any.distributive ==0.6.2.1,
|
||||||
|
distributive +semigroups +tagged,
|
||||||
|
any.dlist ==1.0,
|
||||||
|
dlist -werror,
|
||||||
|
any.enclosed-exceptions ==1.0.3,
|
||||||
|
any.entropy ==0.4.1.7,
|
||||||
|
entropy -halvm,
|
||||||
|
any.exceptions ==0.10.4,
|
||||||
|
any.filepath ==1.4.2.1,
|
||||||
|
any.fsnotify ==0.3.0.1,
|
||||||
|
any.ghc-boot-th ==8.10.7,
|
||||||
|
any.ghc-prim ==0.6.1,
|
||||||
|
any.happy ==1.20.0,
|
||||||
|
any.hashable ==1.3.5.0,
|
||||||
|
hashable +integer-gmp -random-initial-seed,
|
||||||
|
any.hinotify ==0.4.1,
|
||||||
|
any.hourglass ==0.2.12,
|
||||||
|
any.hsc2hs ==0.68.8,
|
||||||
|
hsc2hs -in-ghc-tree,
|
||||||
|
any.hspec ==2.7.10,
|
||||||
|
any.hspec-core ==2.7.10,
|
||||||
|
any.hspec-discover ==2.7.10,
|
||||||
|
any.hspec-expectations ==0.8.2,
|
||||||
|
any.http-client ==0.7.11,
|
||||||
|
http-client +network-uri,
|
||||||
|
any.http-client-tls ==0.3.6.1,
|
||||||
|
any.http-conduit ==2.3.8,
|
||||||
|
http-conduit +aeson,
|
||||||
|
any.http-types ==0.12.3,
|
||||||
|
any.indexed-traversable ==0.1.2,
|
||||||
|
any.integer-gmp ==1.0.3.0,
|
||||||
|
any.integer-logarithms ==1.0.3.1,
|
||||||
|
integer-logarithms -check-bounds +integer-gmp,
|
||||||
|
any.iproute ==1.7.12,
|
||||||
|
any.js-chart ==2.9.4.1,
|
||||||
|
any.libyaml ==0.1.2,
|
||||||
|
libyaml -no-unicode -system-libyaml,
|
||||||
|
any.lifted-async ==0.10.2.2,
|
||||||
|
any.lifted-base ==0.2.3.12,
|
||||||
|
any.logict ==0.7.0.3,
|
||||||
|
any.math-functions ==0.3.4.2,
|
||||||
|
math-functions +system-erf +system-expm1,
|
||||||
|
any.memory ==0.17.0,
|
||||||
|
memory +support_bytestring +support_deepseq,
|
||||||
|
any.microstache ==1.0.2,
|
||||||
|
any.mime-types ==0.1.0.9,
|
||||||
|
any.monad-control ==1.0.3.1,
|
||||||
|
any.monad-par ==0.3.5,
|
||||||
|
monad-par -chaselev -newgeneric,
|
||||||
|
any.monad-par-extras ==0.3.3,
|
||||||
|
any.mono-traversable ==1.0.15.3,
|
||||||
|
any.mtl ==2.2.2,
|
||||||
|
any.mustache ==2.3.2,
|
||||||
|
any.mwc-random ==0.15.0.2,
|
||||||
|
any.network ==3.1.2.7,
|
||||||
|
network -devel,
|
||||||
|
any.network-info ==0.2.1,
|
||||||
|
any.network-uri ==2.6.4.1,
|
||||||
|
any.optparse-applicative ==0.17.0.0,
|
||||||
|
optparse-applicative +process,
|
||||||
|
any.parallel ==3.2.2.0,
|
||||||
|
any.parsec ==3.1.14.0,
|
||||||
|
any.path ==0.9.2,
|
||||||
|
path -dev,
|
||||||
|
any.path-io ==1.6.3,
|
||||||
|
path-io -dev,
|
||||||
|
any.pem ==0.2.4,
|
||||||
|
any.pretty ==1.1.3.6,
|
||||||
|
any.primitive ==0.7.3.0,
|
||||||
|
any.process ==1.6.13.2,
|
||||||
|
any.quickcheck-io ==0.2.0,
|
||||||
|
any.random ==1.2.1,
|
||||||
|
any.regex-base ==0.94.0.2,
|
||||||
|
any.regex-tdfa ==1.3.1.2,
|
||||||
|
regex-tdfa -force-o2,
|
||||||
|
any.resourcet ==1.2.4.3,
|
||||||
|
any.rts ==1.0.1,
|
||||||
|
any.scientific ==0.3.7.0,
|
||||||
|
scientific -bytestring-builder -integer-simple,
|
||||||
|
any.setenv ==0.1.1.3,
|
||||||
|
any.shelly ==1.10.0,
|
||||||
|
shelly -build-examples -lifted,
|
||||||
|
any.smallcheck ==1.2.1,
|
||||||
|
any.socks ==0.6.1,
|
||||||
|
any.split ==0.2.3.4,
|
||||||
|
any.splitmix ==0.1.0.4,
|
||||||
|
splitmix -optimised-mixer,
|
||||||
|
any.statistics ==0.16.0.1,
|
||||||
|
any.stm ==2.5.0.1,
|
||||||
|
any.streaming-commons ==0.2.2.4,
|
||||||
|
streaming-commons -use-bytestring-builder,
|
||||||
|
any.strict ==0.4.0.1,
|
||||||
|
strict +assoc,
|
||||||
|
any.strong-path ==1.1.3.0,
|
||||||
|
any.tagged ==0.8.6.1,
|
||||||
|
tagged +deepseq +transformers,
|
||||||
|
any.tasty ==1.4.2.1,
|
||||||
|
tasty +clock +unix,
|
||||||
|
any.tasty-discover ==4.2.2,
|
||||||
|
any.tasty-golden ==2.3.5,
|
||||||
|
tasty-golden -build-example,
|
||||||
|
any.tasty-hspec ==1.1.6,
|
||||||
|
any.tasty-quickcheck ==0.10.2,
|
||||||
|
any.tasty-smallcheck ==0.8.2,
|
||||||
|
any.template-haskell ==2.16.0.0,
|
||||||
|
any.temporary ==1.3,
|
||||||
|
any.text ==1.2.4.1,
|
||||||
|
any.text-short ==0.1.5,
|
||||||
|
text-short -asserts,
|
||||||
|
any.tf-random ==0.5,
|
||||||
|
any.th-abstraction ==0.4.3.0,
|
||||||
|
any.th-compat ==0.1.3,
|
||||||
|
any.th-lift ==0.8.2,
|
||||||
|
any.these ==1.1.1.1,
|
||||||
|
these +assoc,
|
||||||
|
any.time ==1.9.3,
|
||||||
|
any.time-compat ==1.9.6.1,
|
||||||
|
time-compat -old-locale,
|
||||||
|
any.tls ==1.5.7,
|
||||||
|
tls +compat -hans +network,
|
||||||
|
any.transformers ==0.5.6.2,
|
||||||
|
any.transformers-base ==0.4.6,
|
||||||
|
transformers-base +orphaninstances,
|
||||||
|
any.transformers-compat ==0.7.1,
|
||||||
|
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
||||||
|
any.type-equality ==1,
|
||||||
|
any.typed-process ==0.2.8.0,
|
||||||
|
any.unbounded-delays ==0.1.1.1,
|
||||||
|
any.unix ==2.7.2.2,
|
||||||
|
any.unix-compat ==0.5.4,
|
||||||
|
unix-compat -old-time,
|
||||||
|
any.unliftio ==0.2.21.0,
|
||||||
|
any.unliftio-core ==0.2.0.1,
|
||||||
|
any.unordered-containers ==0.2.16.0,
|
||||||
|
unordered-containers -debug,
|
||||||
|
any.utf8-string ==1.0.2,
|
||||||
|
any.uuid ==1.3.15,
|
||||||
|
any.uuid-types ==1.0.5,
|
||||||
|
any.vector ==0.12.3.1,
|
||||||
|
vector +boundschecks -internalchecks -unsafechecks -wall,
|
||||||
|
any.vector-algorithms ==0.8.0.4,
|
||||||
|
vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks,
|
||||||
|
any.vector-binary-instances ==0.2.5.2,
|
||||||
|
any.vector-th-unbox ==0.2.2,
|
||||||
|
any.wcwidth ==0.0.2,
|
||||||
|
wcwidth -cli +split-base,
|
||||||
|
any.x509 ==1.7.6,
|
||||||
|
any.x509-store ==1.6.9,
|
||||||
|
any.x509-system ==1.6.7,
|
||||||
|
any.x509-validation ==1.6.12,
|
||||||
|
any.yaml ==0.11.8.0,
|
||||||
|
yaml +no-examples +no-exe,
|
||||||
|
any.zlib ==0.6.2.3,
|
||||||
|
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config
|
||||||
|
index-state: hackage.haskell.org 2022-03-14T08:54:09Z
|
@ -6,4 +6,4 @@ import Wasp.Cli.Message (cliSendMessage)
|
|||||||
import qualified Wasp.Message as Msg
|
import qualified Wasp.Message as Msg
|
||||||
|
|
||||||
cliSendMessageC :: Msg.Message -> Command ()
|
cliSendMessageC :: Msg.Message -> Command ()
|
||||||
cliSendMessageC = liftIO . cliSendMessage
|
cliSendMessageC = liftIO . cliSendMessage
|
||||||
|
@ -20,4 +20,4 @@ cliSendMessage (Msg.Success msg) =
|
|||||||
cliSendMessage (Msg.Failure title msg) =
|
cliSendMessage (Msg.Failure title msg) =
|
||||||
waspScreams $ asWaspFailureMessage (title ++ ":") ++ msg
|
waspScreams $ asWaspFailureMessage (title ++ ":") ++ msg
|
||||||
cliSendMessage (Msg.Warning title msg) =
|
cliSendMessage (Msg.Warning title msg) =
|
||||||
waspWarns $ asWaspWarningMessage (title ++ ":") ++ msg
|
waspWarns $ asWaspWarningMessage (title ++ ":") ++ msg
|
||||||
|
6
waspc/dev-tool.project
Normal file
6
waspc/dev-tool.project
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
with-compiler: ghc-8.10.7
|
||||||
|
|
||||||
|
packages: .
|
||||||
|
|
||||||
|
-- Speeds up builds by parallelizing them over the number of available CPUs.
|
||||||
|
jobs: $ncpus
|
@ -23,7 +23,7 @@ data GoldensDir
|
|||||||
|
|
||||||
getProjectRootPath :: IO (Path' Abs (Dir ProjectRoot))
|
getProjectRootPath :: IO (Path' Abs (Dir ProjectRoot))
|
||||||
getProjectRootPath = do
|
getProjectRootPath = do
|
||||||
-- NOTE: Stack/Cabal launches `stack test` from root of the project, so this should always be some absolute path to waspc.
|
-- NOTE: Cabal launches `cabal test` from root of the project, so this should always be some absolute path to waspc.
|
||||||
absCwd <- getCurrentDirectory
|
absCwd <- getCurrentDirectory
|
||||||
-- Just a little extra safeguard here since we are doing destructive file ops.
|
-- Just a little extra safeguard here since we are doing destructive file ops.
|
||||||
unless (takeFileName absCwd == "waspc") (error "Expecting test process to be invoked from waspc dir")
|
unless (takeFileName absCwd == "waspc") (error "Expecting test process to be invoked from waspc dir")
|
||||||
|
@ -18,4 +18,10 @@ main = do
|
|||||||
tests :: IO TestTree
|
tests :: IO TestTree
|
||||||
tests = do
|
tests = do
|
||||||
testGroup "All Golden Dir Tests"
|
testGroup "All Golden Dir Tests"
|
||||||
<$> mapM runGoldenTest [waspNew, waspCompile, waspMigrate, waspBuild]
|
<$> mapM
|
||||||
|
runGoldenTest
|
||||||
|
[ waspNew,
|
||||||
|
waspCompile,
|
||||||
|
waspMigrate,
|
||||||
|
waspBuild
|
||||||
|
]
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env stack
|
#!/usr/bin/env cabal
|
||||||
{-
|
{- cabal:
|
||||||
stack script
|
build-depends:
|
||||||
--resolver lts-16.14
|
base == 4.*
|
||||||
--package turtle
|
, turtle == 1.5.*
|
||||||
--package regex-tdfa
|
, regex-tdfa == 1.3.*
|
||||||
--package text
|
, text == 1.2.*
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
@ -28,16 +28,17 @@ makeNewRelease newVersion = do
|
|||||||
(ExitSuccess, branchName) <- shellStrict "git rev-parse --abbrev-ref HEAD" empty
|
(ExitSuccess, branchName) <- shellStrict "git rev-parse --abbrev-ref HEAD" empty
|
||||||
when (T.strip branchName /= "main") $ error "You must run this script from the main branch!"
|
when (T.strip branchName /= "main") $ error "You must run this script from the main branch!"
|
||||||
|
|
||||||
oldPackageYamlContents <- T.unpack <$> T.IO.readFile "package.yaml"
|
let cabalFileName = "waspc.cabal"
|
||||||
|
oldCabalFileContents <- T.unpack <$> T.IO.readFile cabalFileName
|
||||||
|
|
||||||
(newPackageYamlContents, oldVersion) <- updatePackageYaml oldPackageYamlContents newVersion
|
(newCabalFileContents, oldVersion) <- updateCabalFile oldCabalFileContents newVersion
|
||||||
let tag = "v" ++ newVersion
|
let tag = "v" ++ newVersion
|
||||||
|
|
||||||
when (newVersion == oldVersion) $ error "Version you provided is the current version!"
|
when (newVersion == oldVersion) $ error "Version you provided is the current version!"
|
||||||
|
|
||||||
putStrLn $ unlines
|
putStrLn $ unlines
|
||||||
[ "This will update wasp version from " ++ oldVersion ++ " to " ++ newVersion
|
[ "This will update wasp version from " ++ oldVersion ++ " to " ++ newVersion
|
||||||
, "package.yaml will be updated, and this change will be commited and pushed."
|
, cabalFileName ++ " will be updated, and this change will be commited and pushed."
|
||||||
, "Also, tag " ++ tag ++ " will be created and pushed, triggering CI to"
|
, "Also, tag " ++ tag ++ " will be created and pushed, triggering CI to"
|
||||||
++ " create new release on Github."
|
++ " create new release on Github."
|
||||||
, "Are you sure you want to proceed (y/n)?"
|
, "Are you sure you want to proceed (y/n)?"
|
||||||
@ -45,12 +46,12 @@ makeNewRelease newVersion = do
|
|||||||
confirmation <- getLine
|
confirmation <- getLine
|
||||||
when (confirmation /= "y") $ error "Aborting"
|
when (confirmation /= "y") $ error "Aborting"
|
||||||
|
|
||||||
T.IO.writeFile "package.yaml" $ T.pack newPackageYamlContents
|
T.IO.writeFile cabalFileName $ T.pack newCabalFileContents
|
||||||
|
|
||||||
-- TODO: Print what I am doing for each step.
|
-- TODO: Print what I am doing for each step.
|
||||||
|
|
||||||
putStrLn "\nCreating new commit with updated package.yaml and pushing it.\n"
|
putStrLn $ "\nCreating new commit with updated " ++ cabalFileName ++ " and pushing it.\n"
|
||||||
ExitSuccess <- shell "git add package.yaml" empty
|
ExitSuccess <- shell (T.pack $ "git add " ++ cabalFileName) empty
|
||||||
ExitSuccess <- shell (T.pack $ "git commit -m \"Updated wasp version to " ++ newVersion ++ ".\"") empty
|
ExitSuccess <- shell (T.pack $ "git commit -m \"Updated wasp version to " ++ newVersion ++ ".\"") empty
|
||||||
gitPushExitCode <- shell "git push" empty
|
gitPushExitCode <- shell "git push" empty
|
||||||
case gitPushExitCode of
|
case gitPushExitCode of
|
||||||
@ -65,13 +66,11 @@ makeNewRelease newVersion = do
|
|||||||
|
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
updatePackageYaml :: String -> String -> IO (String, String) -- Returns (update package yaml contents, old version)
|
updateCabalFile :: String -> String -> IO (String, String) -- Returns (updated cabal file contents, old version)
|
||||||
updatePackageYaml packageYamlContents newVersion = do
|
updateCabalFile cabalFileContents newVersion = do
|
||||||
let (beforeMatch, match, afterMatch, submatches) =
|
let (beforeMatch, match, afterMatch, submatches) =
|
||||||
packageYamlContents TR.=~ ("(version: *)([^ #]+)( *# *%WASP_VERSION%)" :: String) :: (String, String, String, [String])
|
cabalFileContents TR.=~ ("^(version: *)([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)" :: String) :: (String, String, String, [String])
|
||||||
when (null match) $
|
when (null match) $ error "Couldn't locate version in cabal file!?"
|
||||||
error ("Couldn't locate version in package.yaml, make sure it is annotated"
|
let [matchBeforeVersion, oldVersion] = submatches
|
||||||
++ " with line comment starting with %WASP_VERSION% (in the same line).")
|
let newContents = beforeMatch ++ matchBeforeVersion ++ newVersion ++ afterMatch
|
||||||
let [matchBeforeVersion, oldVersion, matchAfterVersion] = submatches
|
|
||||||
let newContents = beforeMatch ++ matchBeforeVersion ++ newVersion ++ matchAfterVersion ++ afterMatch
|
|
||||||
return (newContents, oldVersion)
|
return (newContents, oldVersion)
|
||||||
|
70
waspc/run
70
waspc/run
@ -3,10 +3,12 @@
|
|||||||
# This script defines common commands used during building / developing
|
# This script defines common commands used during building / developing
|
||||||
# and makes it easy to run them.
|
# and makes it easy to run them.
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
|
||||||
|
PROJECT_ROOT=$SCRIPT_DIR
|
||||||
THIS=$0
|
THIS=$0
|
||||||
COMMAND=${1:-watch}
|
COMMAND=${1:-watch}
|
||||||
shift
|
shift
|
||||||
ARGS="$@"
|
ARGS=("$@") # NOTE: This is a bash array!
|
||||||
|
|
||||||
BOLD="\033[1m"
|
BOLD="\033[1m"
|
||||||
UNDERLINED="\033[4m"
|
UNDERLINED="\033[4m"
|
||||||
@ -16,17 +18,27 @@ GREEN="\033[32m"
|
|||||||
RED="\033[31m"
|
RED="\033[31m"
|
||||||
DEFAULT_COLOR="\033[39m"
|
DEFAULT_COLOR="\033[39m"
|
||||||
|
|
||||||
BUILD_CMD="stack build"
|
BUILD_CMD="cabal build all"
|
||||||
BUILD_ALL_CMD="stack build --bench --no-run-benchmarks --test --no-run-tests"
|
BUILD_ALL_CMD="cabal build all --enable-tests --enable-benchmarks"
|
||||||
STAN_CMD="$BUILD_ALL_CMD && stack install stan --stack-yaml=stack-stan.yaml && .bin/stan report $ARGS"
|
TEST_CMD="cabal test"
|
||||||
HLINT_CMD="stack install hlint --stack-yaml=stack-hlint.yaml && .bin/hlint . $ARGS"
|
TEST_UNIT_CMD="cabal test waspc-test"
|
||||||
ORMOLU_INSTALL_CMD="stack install ormolu --stack-yaml=stack-ormolu.yaml"
|
TEST_E2E_CMD="cabal test e2e-test"
|
||||||
ORMOLU_BASE_CMD="$ORMOLU_INSTALL_CMD && .bin/ormolu --color always --check-idempotence"
|
RUN_CMD="cabal run wasp-cli ${ARGS[@]}"
|
||||||
|
GHCID_CMD="ghcid --command=cabal repl"
|
||||||
|
GHCID_TEST_CMD="ghcid --command=cabal repl"
|
||||||
|
|
||||||
|
DEV_TOOLS_BIN="$PROJECT_ROOT/.bin"
|
||||||
|
function install_dev_tool () {
|
||||||
|
echo "cabal --project-file=$PROJECT_ROOT/dev-tool.project install $1 --installdir=$DEV_TOOLS_BIN --install-method=copy --overwrite-policy=always"
|
||||||
|
}
|
||||||
|
function dev_tool_path () {
|
||||||
|
echo "$DEV_TOOLS_BIN/$1"
|
||||||
|
}
|
||||||
|
STAN_CMD="$BUILD_ALL_CMD && $(install_dev_tool stan) && $(dev_tool_path stan) report ${ARGS[@]}"
|
||||||
|
HLINT_CMD="$(install_dev_tool hlint) && $(dev_tool_path hlint) . ${ARGS[@]}"
|
||||||
|
ORMOLU_BASE_CMD="$(install_dev_tool ormolu) && $(dev_tool_path ormolu) --color always --check-idempotence"
|
||||||
ORMOLU_CHECK_CMD="$ORMOLU_BASE_CMD --mode check "'$'"(git ls-files '*.hs' '*.hs-boot')"
|
ORMOLU_CHECK_CMD="$ORMOLU_BASE_CMD --mode check "'$'"(git ls-files '*.hs' '*.hs-boot')"
|
||||||
ORMOLU_FORMAT_CMD="$ORMOLU_BASE_CMD --mode inplace "'$'"(git ls-files '*.hs' '*.hs-boot')"
|
ORMOLU_FORMAT_CMD="$ORMOLU_BASE_CMD --mode inplace "'$'"(git ls-files '*.hs' '*.hs-boot')"
|
||||||
TEST_CMD="$BUILD_CMD --test"
|
|
||||||
EXEC_CMD="stack exec wasp-cli $ARGS"
|
|
||||||
GHCID_CMD="ghcid --command=stack ghci"
|
|
||||||
|
|
||||||
echo_and_eval () {
|
echo_and_eval () {
|
||||||
echo -e $"${LIGHT_CYAN}Running:${DEFAULT_COLOR}" $1 "\n"
|
echo -e $"${LIGHT_CYAN}Running:${DEFAULT_COLOR}" $1 "\n"
|
||||||
@ -38,17 +50,21 @@ echo_bold () { echo -e $"${BOLD}${1}${RESET}"; }
|
|||||||
print_usage () {
|
print_usage () {
|
||||||
print_usage_cmd () {
|
print_usage_cmd () {
|
||||||
echo -e $" ${UNDERLINED}${1}${RESET}"
|
echo -e $" ${UNDERLINED}${1}${RESET}"
|
||||||
echo " $2";
|
echo -e " $2";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo_bold "Usage: ${THIS} <command>"
|
echo_bold "Usage: run <command>"
|
||||||
echo "Commands:"
|
echo "Commands:"
|
||||||
print_usage_cmd "build" \
|
print_usage_cmd "build" \
|
||||||
"Builds the project."
|
"Builds the project."
|
||||||
print_usage_cmd "test" \
|
print_usage_cmd "test" \
|
||||||
"Builds the project and executes tests."
|
"Executes all tests (unit + e2e). Builds the project first if needed."
|
||||||
|
print_usage_cmd "test:unit [pattern]" \
|
||||||
|
"Executes only unit tests. Builds the project first if needed. If pattern is provided, it will run only tests whose description/name matches the pattern. Check https://github.com/UnkindPartition/tasty#patterns to learn more about valid patterns."
|
||||||
|
print_usage_cmd "test:e2e" \
|
||||||
|
"Executes only e2e tests. Builds the project first if needed."
|
||||||
print_usage_cmd "wasp-cli <args>" \
|
print_usage_cmd "wasp-cli <args>" \
|
||||||
"Builds the project once and runs the wasp executable while forwarding arguments."
|
"Runs the wasp executable while forwarding arguments. Builds the project first if needed."
|
||||||
print_usage_cmd "ghcid" \
|
print_usage_cmd "ghcid" \
|
||||||
"Runs ghcid, which watches source file changes and reports errors. Does not watch tests."
|
"Runs ghcid, which watches source file changes and reports errors. Does not watch tests."
|
||||||
print_usage_cmd "ghcid-test" \
|
print_usage_cmd "ghcid-test" \
|
||||||
@ -56,13 +72,15 @@ print_usage () {
|
|||||||
print_usage_cmd "code-check" \
|
print_usage_cmd "code-check" \
|
||||||
"Checks code by running it through formatter, linter and static analysis."
|
"Checks code by running it through formatter, linter and static analysis."
|
||||||
print_usage_cmd "stan <args>" \
|
print_usage_cmd "stan <args>" \
|
||||||
"Builds the project and runs static code analysis on it, generating stan.html."
|
"Runs static code analysis on the code, generating stan.html. Builds the project first if needed."
|
||||||
print_usage_cmd "hlint <args>" \
|
print_usage_cmd "hlint <args>" \
|
||||||
"Runs linter on the codebase."
|
"Runs linter on the codebase."
|
||||||
print_usage_cmd "ormolu:check" \
|
print_usage_cmd "ormolu:check" \
|
||||||
"Runs the code formatter and reports if code is correctly formatted or not."
|
"Runs the code formatter and reports if code is correctly formatted or not."
|
||||||
print_usage_cmd "ormolu:format" \
|
print_usage_cmd "ormolu:format" \
|
||||||
"Runs the code formatter and formats the code in place."
|
"Runs the code formatter and formats the code in place."
|
||||||
|
print_usage_cmd "refreeze" \
|
||||||
|
"Regenerates the cabal.project.freeze file. Run this if you changed any cabal dependencies."
|
||||||
}
|
}
|
||||||
|
|
||||||
exitStatusToString () {
|
exitStatusToString () {
|
||||||
@ -80,15 +98,26 @@ case $COMMAND in
|
|||||||
# --color always is needed for Tasty to turn on the coloring.
|
# --color always is needed for Tasty to turn on the coloring.
|
||||||
# NOTE: I did not put this into variable because I was not able to put single quotes
|
# NOTE: I did not put this into variable because I was not able to put single quotes
|
||||||
# around :main --color always that way and it was not working.
|
# around :main --color always that way and it was not working.
|
||||||
ghcid -T=':main --color always' --command=stack ghci test/TastyDiscoverDriver.hs
|
ghcid -T=':main --color always' --command=cabal repl test/TastyDiscoverDriver.hs
|
||||||
;;
|
;;
|
||||||
test)
|
test)
|
||||||
echo_and_eval "$TEST_CMD"
|
echo_and_eval "$TEST_CMD"
|
||||||
;;
|
;;
|
||||||
|
test:unit)
|
||||||
|
TEST_PATTERN="${ARGS[0]}"
|
||||||
|
if [[ -z "$TEST_PATTERN" ]]
|
||||||
|
then
|
||||||
|
echo_and_eval "$TEST_UNIT_CMD"
|
||||||
|
else
|
||||||
|
echo_and_eval "$TEST_UNIT_CMD --test-options \"-p \\\"$TEST_PATTERN\\\"\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
;;
|
||||||
|
test:e2e)
|
||||||
|
echo_and_eval "$TEST_E2E_CMD"
|
||||||
|
;;
|
||||||
wasp-cli)
|
wasp-cli)
|
||||||
echo_and_eval "$BUILD_CMD"
|
echo_and_eval "$RUN_CMD"
|
||||||
echo
|
|
||||||
echo_and_eval "$EXEC_CMD"
|
|
||||||
;;
|
;;
|
||||||
stan)
|
stan)
|
||||||
echo_and_eval "$STAN_CMD"
|
echo_and_eval "$STAN_CMD"
|
||||||
@ -128,6 +157,9 @@ case $COMMAND in
|
|||||||
|
|
||||||
exit $TOTAL_RESULT
|
exit $TOTAL_RESULT
|
||||||
;;
|
;;
|
||||||
|
refreeze)
|
||||||
|
echo_and_eval "rm $PROJECT_ROOT/cabal.project.freeze && cabal freeze"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
print_usage
|
print_usage
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -15,8 +15,8 @@ reversePosixPath :: FilePath -> FilePath
|
|||||||
reversePosixPath path
|
reversePosixPath path
|
||||||
| null parts = "."
|
| null parts = "."
|
||||||
| otherwise =
|
| otherwise =
|
||||||
assert (".." `notElem` parts) $
|
assert (".." `notElem` parts) $
|
||||||
FPP.joinPath $ map (const "..") parts
|
FPP.joinPath $ map (const "..") parts
|
||||||
where
|
where
|
||||||
parts :: [String]
|
parts :: [String]
|
||||||
parts = filter (/= ".") $ FPP.splitDirectories path
|
parts = filter (/= ".") $ FPP.splitDirectories path
|
||||||
|
@ -30,4 +30,4 @@ fromList :: [(String, String)] -> [Dependency]
|
|||||||
fromList = map make
|
fromList = map make
|
||||||
|
|
||||||
make :: (String, String) -> Dependency
|
make :: (String, String) -> Dependency
|
||||||
make (n, v) = Dependency {name = n, version = v}
|
make (n, v) = Dependency {name = n, version = v}
|
||||||
|
@ -24,9 +24,9 @@ generateFile :: C.ExternalCodeGeneratorStrategy -> EC.File -> Generator FD.FileD
|
|||||||
generateFile strategy file
|
generateFile strategy file
|
||||||
| extension `elem` [".js", ".jsx"] = generateJsFile strategy file
|
| extension `elem` [".js", ".jsx"] = generateJsFile strategy file
|
||||||
| otherwise =
|
| otherwise =
|
||||||
let relDstPath = C._extCodeDirInProjectRootDir strategy </> dstPathInGenExtCodeDir
|
let relDstPath = C._extCodeDirInProjectRootDir strategy </> dstPathInGenExtCodeDir
|
||||||
absSrcPath = EC.fileAbsPath file
|
absSrcPath = EC.fileAbsPath file
|
||||||
in return $ FD.createCopyFileDraft relDstPath absSrcPath
|
in return $ FD.createCopyFileDraft relDstPath absSrcPath
|
||||||
where
|
where
|
||||||
dstPathInGenExtCodeDir :: Path' (Rel C.GeneratedExternalCodeDir) File'
|
dstPathInGenExtCodeDir :: Path' (Rel C.GeneratedExternalCodeDir) File'
|
||||||
dstPathInGenExtCodeDir = C.castRelPathFromSrcToGenExtCodeDir $ EC.filePathInExtCodeDir file
|
dstPathInGenExtCodeDir = C.castRelPathFromSrcToGenExtCodeDir $ EC.filePathInExtCodeDir file
|
||||||
|
@ -203,4 +203,4 @@ dependenciesToPackageJsonEntryWithKey key deps =
|
|||||||
++ key
|
++ key
|
||||||
++ "\": {"
|
++ "\": {"
|
||||||
++ intercalate ",\n " (map (\dep -> "\"" ++ D.name dep ++ "\": \"" ++ D.version dep ++ "\"") deps)
|
++ intercalate ",\n " (map (\dep -> "\"" ++ D.name dep ++ "\": \"" ++ D.version dep ++ "\"") deps)
|
||||||
++ "\n}"
|
++ "\n}"
|
||||||
|
@ -59,10 +59,10 @@ genDotEnv spec = return $
|
|||||||
case AS.dotEnvFile spec of
|
case AS.dotEnvFile spec of
|
||||||
Just srcFilePath
|
Just srcFilePath
|
||||||
| not $ AS.isBuild spec ->
|
| not $ AS.isBuild spec ->
|
||||||
[ createCopyFileDraft
|
[ createCopyFileDraft
|
||||||
(C.serverRootDirInProjectRootDir </> dotEnvInServerRootDir)
|
(C.serverRootDirInProjectRootDir </> dotEnvInServerRootDir)
|
||||||
srcFilePath
|
srcFilePath
|
||||||
]
|
]
|
||||||
_ -> []
|
_ -> []
|
||||||
|
|
||||||
dotEnvInServerRootDir :: Path' (Rel C.ServerRootDir) File'
|
dotEnvInServerRootDir :: Path' (Rel C.ServerRootDir) File'
|
||||||
|
@ -122,12 +122,12 @@ readChecksumFile dstDir = do
|
|||||||
| label == fileFsEntityLabel = Left <$> SP.parseRelFile fp
|
| label == fileFsEntityLabel = Left <$> SP.parseRelFile fp
|
||||||
| label == dirFsEntityLabel = Right <$> SP.parseRelDir fp
|
| label == dirFsEntityLabel = Right <$> SP.parseRelDir fp
|
||||||
| otherwise =
|
| otherwise =
|
||||||
error $
|
error $
|
||||||
"Found different file path type! Expected one of: ["
|
"Found different file path type! Expected one of: ["
|
||||||
++ fileFsEntityLabel
|
++ fileFsEntityLabel
|
||||||
++ ","
|
++ ","
|
||||||
++ dirFsEntityLabel
|
++ dirFsEntityLabel
|
||||||
++ "]. This should never happen!"
|
++ "]. This should never happen!"
|
||||||
|
|
||||||
writeChecksumFile :: Path' Abs (Dir ProjectRootDir) -> RelPathsToChecksums -> IO ()
|
writeChecksumFile :: Path' Abs (Dir ProjectRootDir) -> RelPathsToChecksums -> IO ()
|
||||||
writeChecksumFile dstDir relativePathsToChecksums = do
|
writeChecksumFile dstDir relativePathsToChecksums = do
|
||||||
|
@ -11,4 +11,4 @@ module Wasp.Message (Message (..), SendMessage) where
|
|||||||
|
|
||||||
data Message = Info String | Start String | Success String | Failure String String | Warning String String
|
data Message = Info String | Start String | Success String | Failure String String | Warning String String
|
||||||
|
|
||||||
type SendMessage = Message -> IO ()
|
type SendMessage = Message -> IO ()
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
resolver: ./stack-snapshot.yaml
|
|
||||||
local-bin-path: .bin
|
|
@ -1,2 +0,0 @@
|
|||||||
resolver: ./stack-snapshot.yaml
|
|
||||||
local-bin-path: .bin
|
|
@ -1 +0,0 @@
|
|||||||
resolver: lts-18.21
|
|
@ -1,15 +0,0 @@
|
|||||||
resolver: ./stack-snapshot.yaml
|
|
||||||
local-bin-path: .bin
|
|
||||||
extra-deps:
|
|
||||||
- stan-0.0.1.0
|
|
||||||
- colourista-0.1.0.1@sha256:98353ee0e2f5d97d2148513f084c1cd37dfda03e48aa9dd7a017c9d9c0ba710e,3307
|
|
||||||
- dir-traverse-0.2.3.0@sha256:adcc128f201ff95131b15ffe41365dc99c50dc3fa3a910f021521dc734013bfa,2137
|
|
||||||
- extensions-0.0.0.1@sha256:16517ab9df3dd6c7a20da746c8ed02cfd59c8cb40ae5719aef8b5dd4edceadc0,3993
|
|
||||||
- microaeson-0.1.0.0@sha256:ddb1bfa843b3de5e105485b4ecd362ca7d0ccabb19901dd7786846caccf42d67,3456
|
|
||||||
- optparse-applicative-0.15.1.0@sha256:29ff6146aabf54d46c4c8788e8d1eadaea27c94f6d360c690c5f6c93dac4b07e,4810
|
|
||||||
- pretty-simple-3.2.3.0@sha256:7d054c500d2918e6c7723f29b9d212d27359dbd231d7eeca1900d60042e9a16f,4137
|
|
||||||
- slist-0.1.1.0@sha256:4896d54f16493697facb4b2a23395d95de5eefe2a0e9acdb62d8bb034846070d,2537
|
|
||||||
- trial-0.0.0.0@sha256:834d3be439dc9b52a759a45a4d3944e5e55c3d50fd5874003147cc1f6231d4aa,4301
|
|
||||||
- trial-optparse-applicative-0.0.0.0@sha256:ba05edfc327a281766df5e0f44d91229e6a98afaf59abe1894b293453f076192,2449
|
|
||||||
- trial-tomland-0.0.0.0@sha256:743a9baaa36891ed3a44618fdfd5bc4ed9afc39cf9b9fa23ea1b96f3787f5ec0,2526
|
|
||||||
- dlist-0.8.0.8@sha256:90ca348bffdc62d7070bcf0e97c728f8d01b24fbc7ea08d2909157d0da76534c,2066
|
|
@ -1,13 +0,0 @@
|
|||||||
resolver: ./stack-snapshot.yaml
|
|
||||||
packages:
|
|
||||||
- .
|
|
||||||
extra-deps:
|
|
||||||
- strong-path-1.1.2.0
|
|
||||||
- path-0.9.2
|
|
||||||
- path-io-1.6.3
|
|
||||||
- dir-traverse-0.2.3.0
|
|
||||||
# (Martin): I added this per instructions from haskell-language-server, in order to
|
|
||||||
# enable type information and documentation on hover for dependencies.
|
|
||||||
# This will cause compilation errors if a dependency contains invalid Haddock markup for older versions of GHC.
|
|
||||||
ghc-options:
|
|
||||||
"$everything": -haddock
|
|
1
waspc/tools/.gitignore
vendored
Normal file
1
waspc/tools/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.tar.gz
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
# Takes last binary built by stack and packages it together with data
|
# Takes last wasp binary built by cabal and packages it together with data
|
||||||
# into .tar.gz package.
|
# into .tar.gz package.
|
||||||
|
|
||||||
# First and only argument is the filename of the package to be generated.
|
# First and only argument is the filename of the package to be generated.
|
||||||
@ -10,8 +10,11 @@ DST=$PWD/${1:-wasp.tar.gz}
|
|||||||
|
|
||||||
TMP_DIR="$(mktemp -d 2>/dev/null || mktemp -d -t wasp-bin-package)"
|
TMP_DIR="$(mktemp -d 2>/dev/null || mktemp -d -t wasp-bin-package)"
|
||||||
|
|
||||||
cp "$(stack path --local-install-root)"/bin/wasp-cli "$TMP_DIR/wasp-bin"
|
WASP_BINARY_PATH="$(cabal list-bin wasp-cli)"
|
||||||
cp -R "$(stack path --project-root)/data" "$TMP_DIR/data"
|
cp "$WASP_BINARY_PATH" "$TMP_DIR/wasp-bin"
|
||||||
|
|
||||||
|
CABAL_PROJECT_ROOT_PATH="$(cabal list-bin wasp-cli | sed s/\\/dist-newstyle.*//)"
|
||||||
|
cp -R "$CABAL_PROJECT_ROOT_PATH/data" "$TMP_DIR/data"
|
||||||
|
|
||||||
cd "$TMP_DIR"
|
cd "$TMP_DIR"
|
||||||
tar -czf "$DST" *
|
tar -czf "$DST" *
|
||||||
|
382
waspc/waspc.cabal
Normal file
382
waspc/waspc.cabal
Normal file
@ -0,0 +1,382 @@
|
|||||||
|
cabal-version: 2.4
|
||||||
|
|
||||||
|
-- TODO:
|
||||||
|
-- - Rename wasp-cli back to just wasp.
|
||||||
|
-- - Manually updating exposed-modules, other-modules and data-files is tedious.
|
||||||
|
-- Consider using hpack, or maybe even hpack-dhall.
|
||||||
|
|
||||||
|
name: waspc
|
||||||
|
version: 0.4.0.0
|
||||||
|
description: Please see the README on GitHub at <https://github.com/wasp-lang/wasp/waspc#readme>
|
||||||
|
homepage: https://github.com/wasp-lang/wasp/waspc#readme
|
||||||
|
bug-reports: https://github.com/wasp-lang/wasp/issues
|
||||||
|
author: Wasp Team
|
||||||
|
maintainer: team@wasp-lang.dev
|
||||||
|
copyright: Wasp, Inc.
|
||||||
|
license: MIT
|
||||||
|
license-file: LICENSE
|
||||||
|
build-type: Simple
|
||||||
|
extra-source-files:
|
||||||
|
README.md
|
||||||
|
ChangeLog.md
|
||||||
|
data-files:
|
||||||
|
-- NOTE: cabal has this weird rule that * doesn't capture file extension, nor can you provide just *,
|
||||||
|
-- it has to be followed by extension, which is why we have to manually list all of the extensions,
|
||||||
|
-- and also files with no extension.
|
||||||
|
-- Check https://github.com/haskell/cabal/issues/5883 for more details.
|
||||||
|
Generator/templates/Dockerfile
|
||||||
|
Generator/templates/dockerignore
|
||||||
|
Generator/templates/react-app/gitignore
|
||||||
|
Generator/templates/server/gitignore
|
||||||
|
Generator/templates/server/npmrc
|
||||||
|
Generator/templates/server/nvmrc
|
||||||
|
Generator/templates/**/*.prisma
|
||||||
|
Generator/templates/**/*.toml
|
||||||
|
Generator/templates/**/*.json
|
||||||
|
Generator/templates/**/*.ico
|
||||||
|
Generator/templates/**/*.html
|
||||||
|
Generator/templates/**/*.md
|
||||||
|
Generator/templates/**/*.js
|
||||||
|
Generator/templates/**/*.css
|
||||||
|
Generator/templates/**/*.png
|
||||||
|
Cli/bash-completion
|
||||||
|
Cli/templates/**/*.css
|
||||||
|
Cli/templates/**/*.js
|
||||||
|
Cli/templates/**/*.png
|
||||||
|
data-dir: data/
|
||||||
|
|
||||||
|
source-repository head
|
||||||
|
type: git
|
||||||
|
location: https://github.com/wasp-lang/wasp
|
||||||
|
|
||||||
|
common common-all
|
||||||
|
default-language: Haskell2010
|
||||||
|
ghc-options:
|
||||||
|
-Wall
|
||||||
|
-- -optP-Wno-nonportable-include-path avoids warning caused by .../autogen/cabal_macros.h. on OSX.
|
||||||
|
-optP-Wno-nonportable-include-path
|
||||||
|
-- -fwrite-ide-info and -hiedir=.hie tell GHC to write compile-time information about the code
|
||||||
|
-- to .hie directory. This information can then be used by other tools, e.g. stan (static analyzer).
|
||||||
|
-fwrite-ide-info -hiedir=.hie
|
||||||
|
default-extensions:
|
||||||
|
OverloadedStrings
|
||||||
|
TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
ScopedTypeVariables
|
||||||
|
|
||||||
|
common common-exe
|
||||||
|
ghc-options:
|
||||||
|
-threaded -rtsopts -with-rtsopts=-N
|
||||||
|
|
||||||
|
library
|
||||||
|
import: common-all
|
||||||
|
hs-source-dirs: src
|
||||||
|
build-tool-depends:
|
||||||
|
alex:alex
|
||||||
|
, happy:happy
|
||||||
|
build-depends:
|
||||||
|
, base >= 4.7 && < 5
|
||||||
|
, Glob ^>= 0.10.2
|
||||||
|
, containers ^>= 0.6.5
|
||||||
|
, directory ^>= 1.3.6 && < 1.4
|
||||||
|
, dir-traverse ^>= 0.2.3
|
||||||
|
, filepath ^>= 1.4.2
|
||||||
|
, time ^>= 1.9.3
|
||||||
|
, bytestring ^>= 0.10.12
|
||||||
|
, aeson ^>= 1.5.6
|
||||||
|
, aeson-pretty ^>= 0.8
|
||||||
|
, text ^>= 1.2.4
|
||||||
|
, template-haskell ^>= 2.16.0
|
||||||
|
, unordered-containers ^>= 0.2.16
|
||||||
|
, mtl ^>= 2.2.2
|
||||||
|
, async ^>= 2.2.4
|
||||||
|
, conduit ^>= 1.3.4
|
||||||
|
, exceptions ^>= 0.10.4
|
||||||
|
, split ^>= 0.2.3
|
||||||
|
, conduit-extra ^>= 1.3.5
|
||||||
|
, process ^>= 1.6.13
|
||||||
|
, cryptohash-sha256 ^>= 0.11.102
|
||||||
|
, mustache ^>= 2.3.2
|
||||||
|
, parsec ^>= 3.1.14
|
||||||
|
, path ^>= 0.9.2
|
||||||
|
, path-io ^>= 1.6.3
|
||||||
|
, regex-tdfa ^>= 1.3.1
|
||||||
|
, strong-path ^>= 1.1.2
|
||||||
|
, unliftio ^>= 0.2.20
|
||||||
|
, utf8-string ^>= 1.0.2
|
||||||
|
, cryptonite ^>= 0.29
|
||||||
|
, fsnotify ^>= 0.3.0
|
||||||
|
, http-conduit ^>= 2.3.8
|
||||||
|
, uuid ^>= 1.3.15
|
||||||
|
-- 'array' is used by code generated by Alex for src/Analyzer/Parser/Lexer.x
|
||||||
|
, array ^>= 0.5.4
|
||||||
|
other-modules: Paths_waspc
|
||||||
|
exposed-modules:
|
||||||
|
FilePath.Extra
|
||||||
|
Wasp.Analyzer
|
||||||
|
Wasp.Analyzer.AnalyzeError
|
||||||
|
Wasp.Analyzer.Evaluator
|
||||||
|
Wasp.Analyzer.Evaluator.Bindings
|
||||||
|
Wasp.Analyzer.Evaluator.Evaluation
|
||||||
|
Wasp.Analyzer.Evaluator.Evaluation.Combinators
|
||||||
|
Wasp.Analyzer.Evaluator.Evaluation.Internal
|
||||||
|
Wasp.Analyzer.Evaluator.Evaluation.TypedDictExpr
|
||||||
|
Wasp.Analyzer.Evaluator.Evaluation.TypedDictExpr.Combinators
|
||||||
|
Wasp.Analyzer.Evaluator.Evaluation.TypedExpr
|
||||||
|
Wasp.Analyzer.Evaluator.Evaluation.TypedExpr.Combinators
|
||||||
|
Wasp.Analyzer.Evaluator.EvaluationError
|
||||||
|
Wasp.Analyzer.Parser
|
||||||
|
Wasp.Analyzer.Parser.AST
|
||||||
|
Wasp.Analyzer.Parser.Ctx
|
||||||
|
Wasp.Analyzer.Parser.Lexer
|
||||||
|
Wasp.Analyzer.Parser.Monad
|
||||||
|
Wasp.Analyzer.Parser.ParseError
|
||||||
|
Wasp.Analyzer.Parser.Parser
|
||||||
|
Wasp.Analyzer.Parser.SourcePosition
|
||||||
|
Wasp.Analyzer.Parser.SourceRegion
|
||||||
|
Wasp.Analyzer.Parser.Token
|
||||||
|
Wasp.Analyzer.StdTypeDefinitions
|
||||||
|
Wasp.Analyzer.StdTypeDefinitions.App.Dependency
|
||||||
|
Wasp.Analyzer.StdTypeDefinitions.Entity
|
||||||
|
Wasp.Analyzer.Type
|
||||||
|
Wasp.Analyzer.TypeChecker
|
||||||
|
Wasp.Analyzer.TypeChecker.AST
|
||||||
|
Wasp.Analyzer.TypeChecker.Internal
|
||||||
|
Wasp.Analyzer.TypeChecker.Monad
|
||||||
|
Wasp.Analyzer.TypeChecker.TypeError
|
||||||
|
Wasp.Analyzer.TypeDefinitions
|
||||||
|
Wasp.Analyzer.TypeDefinitions.Class.HasCustomEvaluation
|
||||||
|
Wasp.Analyzer.TypeDefinitions.Class.IsDeclType
|
||||||
|
Wasp.Analyzer.TypeDefinitions.Class.IsEnumType
|
||||||
|
Wasp.Analyzer.TypeDefinitions.Internal
|
||||||
|
Wasp.Analyzer.TypeDefinitions.TH
|
||||||
|
Wasp.Analyzer.TypeDefinitions.TH.Common
|
||||||
|
Wasp.Analyzer.TypeDefinitions.TH.Decl
|
||||||
|
Wasp.Analyzer.TypeDefinitions.TH.Enum
|
||||||
|
Wasp.AppSpec
|
||||||
|
Wasp.AppSpec.Action
|
||||||
|
Wasp.AppSpec.App
|
||||||
|
Wasp.AppSpec.App.Auth
|
||||||
|
Wasp.AppSpec.App.Db
|
||||||
|
Wasp.AppSpec.App.Dependency
|
||||||
|
Wasp.AppSpec.App.Server
|
||||||
|
Wasp.AppSpec.Core.Decl
|
||||||
|
Wasp.AppSpec.Core.Ref
|
||||||
|
Wasp.AppSpec.Entity
|
||||||
|
Wasp.AppSpec.Entity.Field
|
||||||
|
Wasp.AppSpec.ExternalCode
|
||||||
|
Wasp.AppSpec.ExtImport
|
||||||
|
Wasp.AppSpec.JSON
|
||||||
|
Wasp.AppSpec.Operation
|
||||||
|
Wasp.AppSpec.Page
|
||||||
|
Wasp.AppSpec.Query
|
||||||
|
Wasp.AppSpec.Route
|
||||||
|
Wasp.Common
|
||||||
|
Wasp.CompileOptions
|
||||||
|
Wasp.Data
|
||||||
|
Wasp.Error
|
||||||
|
Wasp.ExternalCode
|
||||||
|
Wasp.Generator
|
||||||
|
Wasp.Generator.Common
|
||||||
|
Wasp.Generator.DbGenerator
|
||||||
|
Wasp.Generator.DbGenerator.Common
|
||||||
|
Wasp.Generator.DbGenerator.Jobs
|
||||||
|
Wasp.Generator.DbGenerator.Operations
|
||||||
|
Wasp.Generator.DockerGenerator
|
||||||
|
Wasp.Generator.ExternalCodeGenerator
|
||||||
|
Wasp.Generator.ExternalCodeGenerator.Common
|
||||||
|
Wasp.Generator.ExternalCodeGenerator.Js
|
||||||
|
Wasp.Generator.FileDraft
|
||||||
|
Wasp.Generator.FileDraft.CopyDirFileDraft
|
||||||
|
Wasp.Generator.FileDraft.CopyFileDraft
|
||||||
|
Wasp.Generator.FileDraft.TemplateFileDraft
|
||||||
|
Wasp.Generator.FileDraft.TextFileDraft
|
||||||
|
Wasp.Generator.FileDraft.Writeable
|
||||||
|
Wasp.Generator.FileDraft.WriteableMonad
|
||||||
|
Wasp.Generator.Job
|
||||||
|
Wasp.Generator.Job.IO
|
||||||
|
Wasp.Generator.Job.Process
|
||||||
|
Wasp.Generator.JsImport
|
||||||
|
Wasp.Generator.Monad
|
||||||
|
Wasp.Generator.ServerGenerator
|
||||||
|
Wasp.Generator.ServerGenerator.AuthG
|
||||||
|
Wasp.Generator.ServerGenerator.Common
|
||||||
|
Wasp.Generator.ServerGenerator.ConfigG
|
||||||
|
Wasp.Generator.ServerGenerator.ExternalCodeGenerator
|
||||||
|
Wasp.Generator.ServerGenerator.OperationsG
|
||||||
|
Wasp.Generator.ServerGenerator.OperationsRoutesG
|
||||||
|
Wasp.Generator.ServerGenerator.Setup
|
||||||
|
Wasp.Generator.ServerGenerator.Start
|
||||||
|
Wasp.Generator.Setup
|
||||||
|
Wasp.Generator.Start
|
||||||
|
Wasp.Generator.Templates
|
||||||
|
Wasp.Generator.WebAppGenerator
|
||||||
|
Wasp.Generator.WebAppGenerator.AuthG
|
||||||
|
Wasp.Generator.WebAppGenerator.Common
|
||||||
|
Wasp.Generator.WebAppGenerator.ExternalCodeGenerator
|
||||||
|
Wasp.Generator.WebAppGenerator.OperationsGenerator
|
||||||
|
Wasp.Generator.WebAppGenerator.OperationsGenerator.ResourcesG
|
||||||
|
Wasp.Generator.WebAppGenerator.RouterGenerator
|
||||||
|
Wasp.Generator.WebAppGenerator.Setup
|
||||||
|
Wasp.Generator.WebAppGenerator.Start
|
||||||
|
Wasp.Generator.WriteFileDrafts
|
||||||
|
Wasp.Lexer
|
||||||
|
Wasp.Lib
|
||||||
|
Wasp.NpmDependency
|
||||||
|
Wasp.Psl.Ast.Model
|
||||||
|
Wasp.Psl.Generator.Model
|
||||||
|
Wasp.Psl.Parser.Model
|
||||||
|
Wasp.Util
|
||||||
|
Wasp.Util.Control.Monad
|
||||||
|
Wasp.Util.Fib
|
||||||
|
Wasp.Util.IO
|
||||||
|
Wasp.Util.Terminal
|
||||||
|
Wasp.WaspignoreFile
|
||||||
|
Wasp.Generator.NpmDependencies
|
||||||
|
Wasp.Generator.NpmInstall
|
||||||
|
Wasp.Message
|
||||||
|
|
||||||
|
|
||||||
|
executable wasp-cli
|
||||||
|
import: common-all, common-exe
|
||||||
|
hs-source-dirs: cli
|
||||||
|
main-is: Main.hs
|
||||||
|
build-depends:
|
||||||
|
directory
|
||||||
|
, base
|
||||||
|
, filepath
|
||||||
|
, time
|
||||||
|
, aeson
|
||||||
|
, mtl
|
||||||
|
, async
|
||||||
|
, exceptions
|
||||||
|
, cryptonite
|
||||||
|
, fsnotify
|
||||||
|
, http-conduit
|
||||||
|
, path
|
||||||
|
, path-io
|
||||||
|
, strong-path
|
||||||
|
, utf8-string
|
||||||
|
, uuid
|
||||||
|
, waspc
|
||||||
|
other-modules:
|
||||||
|
Wasp.Cli.Command
|
||||||
|
Wasp.Cli.Command.BashCompletion
|
||||||
|
Wasp.Cli.Command.Build
|
||||||
|
Wasp.Cli.Command.Call
|
||||||
|
Wasp.Cli.Command.Clean
|
||||||
|
Wasp.Cli.Command.Common
|
||||||
|
Wasp.Cli.Command.Compile
|
||||||
|
Wasp.Cli.Command.CreateNewProject
|
||||||
|
Wasp.Cli.Command.Db
|
||||||
|
Wasp.Cli.Command.Db.Migrate
|
||||||
|
Wasp.Cli.Command.Deps
|
||||||
|
Wasp.Cli.Command.Info
|
||||||
|
Wasp.Cli.Command.Start
|
||||||
|
Wasp.Cli.Command.Telemetry
|
||||||
|
Wasp.Cli.Command.Telemetry.Common
|
||||||
|
Wasp.Cli.Command.Telemetry.Project
|
||||||
|
Wasp.Cli.Command.Telemetry.User
|
||||||
|
Wasp.Cli.Command.Watch
|
||||||
|
Wasp.Cli.Common
|
||||||
|
Wasp.Cli.Terminal
|
||||||
|
Wasp.Cli.Command.Message
|
||||||
|
Wasp.Cli.Message
|
||||||
|
Paths_waspc
|
||||||
|
|
||||||
|
test-suite waspc-test
|
||||||
|
import: common-all, common-exe
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
hs-source-dirs: test
|
||||||
|
main-is: TastyDiscoverDriver.hs
|
||||||
|
build-tool-depends:
|
||||||
|
tasty-discover:tasty-discover
|
||||||
|
build-depends:
|
||||||
|
, aeson
|
||||||
|
, base
|
||||||
|
, deepseq
|
||||||
|
, filepath
|
||||||
|
, mtl
|
||||||
|
, parsec
|
||||||
|
, path
|
||||||
|
, split
|
||||||
|
, strong-path
|
||||||
|
, text
|
||||||
|
, unordered-containers
|
||||||
|
, waspc
|
||||||
|
, QuickCheck ^>= 2.14
|
||||||
|
, tasty ^>= 1.4.2
|
||||||
|
-- tasty-hspec 1.1.7 introduces breaking changes, which is why we have < 1.1.7 .
|
||||||
|
, tasty-hspec >= 1.1 && < 1.1.7
|
||||||
|
, tasty-quickcheck ^>= 0.10
|
||||||
|
other-modules:
|
||||||
|
Analyzer.Evaluation.EvaluationErrorTest
|
||||||
|
Analyzer.EvaluatorTest
|
||||||
|
Analyzer.Parser.ParseErrorTest
|
||||||
|
Analyzer.Parser.SourcePositionTest
|
||||||
|
Analyzer.Parser.TokenTest
|
||||||
|
Analyzer.ParserTest
|
||||||
|
Analyzer.TestUtil
|
||||||
|
Analyzer.TypeChecker.InternalTest
|
||||||
|
Analyzer.TypeCheckerTest
|
||||||
|
AnalyzerTest
|
||||||
|
ErrorTest
|
||||||
|
FilePath.ExtraTest
|
||||||
|
Fixtures
|
||||||
|
Generator.ExternalCodeGenerator.JsTest
|
||||||
|
Generator.FileDraft.CopyFileDraftTest
|
||||||
|
Generator.FileDraft.TemplateFileDraftTest
|
||||||
|
Generator.MockWriteableMonad
|
||||||
|
Generator.WebAppGeneratorTest
|
||||||
|
Generator.WriteFileDraftsTest
|
||||||
|
Psl.Common.ModelTest
|
||||||
|
Psl.Generator.ModelTest
|
||||||
|
Psl.Parser.ModelTest
|
||||||
|
Test.Util
|
||||||
|
Util.FibTest
|
||||||
|
UtilTest
|
||||||
|
WaspignoreFileTest
|
||||||
|
Paths_waspc
|
||||||
|
Generator.NpmDependenciesTest
|
||||||
|
|
||||||
|
test-suite e2e-test
|
||||||
|
import: common-all, common-exe
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
hs-source-dirs: e2e-test
|
||||||
|
main-is: Main.hs
|
||||||
|
build-tool-depends: waspc:wasp-cli
|
||||||
|
build-depends:
|
||||||
|
, aeson
|
||||||
|
, directory
|
||||||
|
, base
|
||||||
|
, filepath
|
||||||
|
, strong-path
|
||||||
|
, text
|
||||||
|
, mtl
|
||||||
|
, bytestring
|
||||||
|
, dir-traverse
|
||||||
|
, aeson-pretty
|
||||||
|
, process
|
||||||
|
, tasty ^>= 1.4.2
|
||||||
|
-- tasty-hspec 1.1.7 introduces breaking changes, which is why we have < 1.1.7 .
|
||||||
|
, tasty-hspec >= 1.1 && < 1.1.7
|
||||||
|
, tasty-golden ^>= 2.3.5
|
||||||
|
other-modules:
|
||||||
|
Common
|
||||||
|
GoldenTest
|
||||||
|
ShellCommands
|
||||||
|
Tests.WaspBuildTest
|
||||||
|
Tests.WaspCompileTest
|
||||||
|
Tests.WaspMigrateTest
|
||||||
|
Tests.WaspNewTest
|
||||||
|
|
||||||
|
benchmark waspc-benchmarks
|
||||||
|
import: common-all, common-exe
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
hs-source-dirs: benchmark
|
||||||
|
main-is: Main.hs
|
||||||
|
other-modules: Paths_waspc
|
||||||
|
build-depends:
|
||||||
|
base
|
||||||
|
, criterion ^>= 1.5
|
||||||
|
, waspc
|
@ -87,9 +87,9 @@ In the meantime, the best way to start using Wasp on Windows is by using [WSL](h
|
|||||||
|
|
||||||
If installer is not working for you or your OS is not supported, you can try building Wasp from source.
|
If installer is not working for you or your OS is not supported, you can try building Wasp from source.
|
||||||
|
|
||||||
To install from source, you need to clone the [wasp repo](https://github.com/wasp-lang/wasp), install [stack](https://docs.haskellstack.org) on your machine and then run `stack install` from the `waspc/` dir.
|
To install from source, you need to clone the [wasp repo](https://github.com/wasp-lang/wasp), install [cabal](https://cabal.readthedocs.io/en/stable/getting-started.html) on your machine and then run `cabal install` from the `waspc/` dir.
|
||||||
|
|
||||||
If you have never built Wasp before, this might take some time due to `stack` downloading dependencies for the first time.
|
If you have never built Wasp before, this might take some time due to `cabal` downloading dependencies for the first time.
|
||||||
|
|
||||||
Check [waspc/](https://github.com/wasp-lang/wasp/tree/main/waspc) for more details on building.
|
Check [waspc/](https://github.com/wasp-lang/wasp/tree/main/waspc) for more details on building.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user