Updated READMEs.

This commit is contained in:
Martin Sosic 2020-09-22 13:52:16 +02:00 committed by Martin Šošić
parent 934fe697b8
commit 616ca79461
3 changed files with 58 additions and 128 deletions

View File

@ -9,19 +9,9 @@
[![Build Status](https://travis-ci.com/wasp-lang/wasp.svg?branch=master)](https://travis-ci.com/wasp-lang/wasp)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/wasp-lang/wasp?branch=master&svg=true)](https://ci.appveyor.com/project/Martinsos/wasp/branch/master)
- **Project page**: [https://wasp-lang.dev]
- **Demo**: [https://wasp-lang.dev/#demo]
<br>
```
_ _
__ ____ _ ___ _ __ | )/ )
\ \ /\ / / _` / __| '_ \ \\ |//,' __
\ V V / (_| \__ \ |_) | (")(_)-"()))=-
\_/\_/ \__,_|___/ .__/ (\\
|_|
```
- [**Project page**](https://wasp-lang.dev)
- [**Demo**](https://wasp-lang.dev/#demo)
- [**Docs**](https://wasp-lang.github.io/web/docs)
<br>
@ -29,6 +19,8 @@ Wasp (**W**eb **A**pplication **Sp**ecification Language) is an extensible [DSL]
Concepts such as *app*, *page*, *user*, *login*, *frontend*, *production*, etc. are baked into the language, bringing a new level of expressiveness and allowing you to get more work done with fewer lines of code.
NOTE: Wasp is still in alpha, meaning it has bugs and many critical featuers are still missing and it is stil changing a lot!
```js
// todoApp.wasp:
@ -37,25 +29,20 @@ app TodoApp {
favicon: "./todo-logo.png"
}
entity Task {
description :: string,
isDone :: boolean
}
entity-list<Task> TaskList {
editable: true
}
route "/" -> page Main
page Main {
route: "/",
content: {=jsx
<h1>Todos</h1>
<TaskList/>
jsx=},
style: "./main.css"
component: import Main from "@ext/pages/Main"
}
...
query getTasks {
fn: import { getTasks } from "@ext/queries.js"
}
entityPSL Task {=psl
id Int @id @default(autoincrement())
description String
isDone Boolean @default(false)
psl=}
```
Source files (`.wasp`, `.js(x)`, `.css`, ...) are compiled (transpiled) by `waspc` (Wasp compiler) into the web technology stack of your choice (e.g. React + Redux + ExpressJS + ...).
@ -65,44 +52,28 @@ Source files (`.wasp`, `.js(x)`, `.css`, ...) are compiled (transpiled) by `wasp
Why is Wasp awesome:
- **Quick start**: Due to its expressiveness, you can create and deploy a production-ready web app from scratch with very few lines of concise, consistent, declarative code.
- **Flexible**: When you need more control than Wasp offers, you can write code in existing technologies such as js/html/css/... and combine it with Wasp code!
- **No lock-in**: If Wasp becomes too limiting for you, simply eject and continue with the generated source code (in web tech stack of your choice) that follows industry best-practices, as if it was handwritten by a senior engineer.
- **No lock-in**: If Wasp becomes too limiting for you, simply eject and continue with the generated source code, which is human-readable.
For more of general information about Wasp, check:
- **The main webpage**: [https://wasp-lang.dev].
- [**Blog**](https://blog.wasp-lang.dev/): [Why are we building Wasp?](https://blog.wasp-lang.dev/posts/2019-09-01-hello-wasp.html)
For more information about Wasp, check [**docs**](https://wasp-lang.github.io/web/docs).
# Get started
In `waspc` directory is Wasp compiler which you can run and build if you want, however it is still under heavy development and will not give great experience of trying out Wasp: check [Project status](#project-status) for more info.
If you want to be notified when we release the version which will be nice and easy to try, either watch the repo or subscribe to our [email list](https://wasp-lang.dev#signup).
If you want to get involved more or just chat with us, check [Contributing](#contributing)!
Check out [the docs](https://wasp-lang.github.io/web/docs/language/getting-started).
# This repository
This is the main repo of the Wasp universe, containing core code (mostly `waspc` - Wasp compiler) and the supporting materials.
# Documentation
We don't have proper documentation yet due to how fast everything is changing in this early stage of Wasp development.
In the meantime, the best way to learn more is by taking a look at our [TodoApp example](examples/todoApp), or you can ask us questions directly!
# Project status
We are still very early (pre-alpha). Specifically, we are developing `waspc` (Wasp compiler) and also designing language as we go.
Currently, `waspc` is in a state where the main parts are there (code analysis and generation) and we are successfully generating code as can be seen at [TodoApp example](examples/todoApp).
Currently, `waspc` is in a state where the main parts are there (code analysis and generation) and we are successfully generating code.
The language itself supports a narrow set of features for now, not enough for serious web app development, but we believe it is a good basis to build upon.
The next step is to expand the language (and compiler) so it can serve the role of a smart code generator - it will still not have enough features to keep you from ejecting for a very long time, but it will be enough to give you a quick start.
Finally, as it grows further, it should allow the development of web apps of increasing complexity without the need to eject!
While the idea is to support multiple web tech stacks in the future, right now we are focusing on the specific stack: React + Redux, NodeJS + ExpressJS, Mongo. We might yet change that as time goes, taking trends into account, but for now, this is serving us well for the purpose of developing compiler and language.
While the idea is to support multiple web tech stacks in the future, right now we are focusing on the specific stack: React + react-query, NodeJS + ExpressJS, Prisma. We might yet change that as time goes, taking trends into account, but for now, this is serving us well for the purpose of developing compiler and language.
# Contributing
@ -117,11 +88,8 @@ You can also:
- :star: Star this repo to show your interest/support.
- :mailbox: Stay updated by subscribing to our [email list](https://wasp-lang.dev#signup).
For more technical details on building and contributing to `waspc` check [waspc/README.md](waspc/README.md).
# FAQ
Check out https://wasp-lang.dev/#faq.
# Other
Wasp ASCII art used in the title is from https://www.asciiart.eu/animals/insects/bees, author: Stef00.

View File

@ -5,82 +5,56 @@
<br>
```
_ _
__ ____ _ ___ _ __ ___ | )/ )
\ \ /\ / / _` / __| '_ \ / __| \\ |//,' __
\ V V / (_| \__ \ |_) | (__ (")(_)-"()))=-
\_/\_/ \__,_|___/ .__/ \___| (\\
|_|
_ _
__ ____ _ ___ _ __ ___ | )/ )
\ \ /\ / / _` / __| '_ \ / __| \\ |//,' __
\ V V / (_| \__ \ |_) | (__ (")(_)-"()))=-
\_/\_/ \__,_|___/ .__/ \___| (\\
|_|
```
## Install
### From binary
To install latest release, run `curl -sSL https://raw.githubusercontent.com/wasp-lang/wasp/master/waspc/tools/install.sh | sh`!
This directory contains source code of Wasp compiler (waspc), and this README is aimed for contributors to the project. If you are a Wasp user and not contributor (yet :)), you might want to look into following resources instead:
This will work for linux/osx and will install a prebuilt binary. Since the binary is dynamically built (for now), it might not work if you are missing some packages/libraries on your OS or if your OS distro is very different from the one it was built on.
### From source
Install `stack`.
Run `stack setup` in the project root to do initial setup.
Run `stack build` to build the project, including wasp binary.
Run `stack exec wasp <args>` to run wasp binary.
- [**Project page**](https://wasp-lang.dev)
- [**Docs**](https://wasp-lang.github.io/web/docs)
## Project configuration overview
This is a [Stack](https://docs.haskellstack.org/en/stable/README/) project.
### Adding a package as a dependency
This is just so you don't have to search Stack docs.
Just put it in package.yaml like this:
```
dependencies:
...
- <package_name>
...
```
If package you need is not in the Stack snapshot defined by `resolver`, add it to `extra-deps` instead of `dependencies`.
## Setup
This is a [Stack](https://docs.haskellstack.org/en/stable/README/) project, so you will need to install `stack` on your machine.
Then run `stack setup` in the project root to do initial setup.
## Building / development
You build the project with `stack build`. It uses `package.yaml`, `waspc.yaml` (and possibly some other files in the future) and source files to generate files and build the project.
It is recommended using `stack build --pedantic` to turn on pedantic code checking (-Wall, -Werror).
`stack build` to build the project, including `wasp` binary which is both CLI and compiler in one.
`stack exec <my-executable>` will run executable in the context of stack project.
In our case, `stack exec waspc-cli` will run waspc (build it first with `stack build`!).
`stack exec wasp <arguments>` to run the `wasp` binary that you have built.
Some useful command options when building:
- `stack build --test` -> same as `stack test`.
`stack test` to build the whole project + tests and then also run tests.
Some other useful `stack` commands:
- `stack build --file-watch` -> live watch, reruns every time a file changes.
- `stack build --pedantic` -> sets -Wall and -Werror ghc options.
- `stack build --ghc-options="-Wall -Werror"` -> sets ghc options.
- `stack build --bench`
- `stack build --profile`
- `stack build --trace`
- `stack install` -> builds the project and then copies it to the local path.
- `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.
There is also `stack install` which builds the project and then copies it to the local bin path.
Running `stack ghci` will open ghci in the context of the project, allowing you to load and run local modules, which can be useful for development.
You can use `stack clear` to clear all the generated files/artifacts from the project.
When developing, if you don't have full support for Haskell in your editor, consider using `stack build --file-watch` for live error checking, or `ghcid` as a faster alternative (install it globally with `stack install ghcid` and then just type `ghcid` when in the project.
For live compilation and error checking of your code we recommend using `ghcid`.
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 anyfile changes and report errors.
### Run script
For more convenient running of common build/dev commands, we created `run` script.
It mostly runs stack commands described above.
It mostly runs stack commands described above, reducing the number of characters you have to type to run certain commands.
The idea is that you normally use this for development, and you use `stack` directly when you need more control.
It is up to you, using `stack` directly is also perfectly fine.
You can run `./run help` to learn how to use it.
Examples:
- `./run exec examples/todoMVC.wasp out/todoMVC` will run waspc on todoMVC example.
- `./run ghcid-test` will run ghcid that watches tests, while passing correct arguments to ghcid.
## Tests
@ -122,7 +96,7 @@ Hlint already adds a lot of extensions on its own so this is not a very often pr
Every commit is built and tested on Travis (linux, osx) and AppVeyor (win).
Tagged commits are also deployed as github releases.
If commit is tagged, github draft release is created from it containing binary packages.
If you put `[skip ci]` in commit message, that commit will be ignored by both Travis and AppVeyor.

View File

@ -8,16 +8,14 @@ COMMAND=${1:-watch}
shift
ARGS="$@"
BOLD="\e[1m"
UNDERLINED="\e[4m"
RESET="\e[0m"
LIGHT_CYAN="\e[96m"
DEFAULT_COLOR="\e[39m"
BOLD="\033[1m"
UNDERLINED="\033[4m"
RESET="\033[0m"
LIGHT_CYAN="\033[96m"
DEFAULT_COLOR="\033[39m"
BUILD_CMD="stack build"
WATCH_CMD="$BUILD_CMD --file-watch"
TEST_CMD="$BUILD_CMD --test"
TEST_WATCH_CMD="$TEST_CMD --file-watch"
EXEC_CMD="stack exec wasp $ARGS"
GHCID_CMD="ghcid --command=stack ghci"
@ -38,27 +36,20 @@ print_usage () {
echo "Commands:"
print_usage_cmd "build" \
"Builds the project."
print_usage_cmd "watch" \
"Builds the project on any file change. (DEFAULT)"
print_usage_cmd "test" \
"Builds the project and executes tests."
print_usage_cmd "test-watch" \
"Builds the project and executes tests on any file change."
print_usage_cmd "exec" \
"Builds the project once and runs the executable while forwarding arguments."
print_usage_cmd "exec <args>" \
"Builds the project once and runs the wasp executable while forwarding arguments."
print_usage_cmd "ghcid" \
"Runs ghcid, which is much faster alternative to 'watch'."
"Runs ghcid, which watches source file changes and reports errors. Does not watch tests."
print_usage_cmd "ghcid-test" \
"Runs ghcid on tests, which is much faster alternative to 'test-watch'."
"Runs ghcid on both source and tests."
}
case $COMMAND in
build)
echo_and_eval "$BUILD_CMD"
;;
watch)
echo_and_eval "$WATCH_CMD"
;;
ghcid)
echo_and_eval "$GHCID_CMD"
;;
@ -71,9 +62,6 @@ case $COMMAND in
test)
echo_and_eval "$TEST_CMD"
;;
test-watch)
echo_and_eval "$TEST_WATCH_CMD"
;;
exec)
echo_and_eval "$BUILD_CMD"
echo