Skip to content

Commit

Permalink
feat(docs): update docs
Browse files Browse the repository at this point in the history
Updates the Wing docs. See details in [workflow run].

[Workflow Run]: https://github.com/winglang/docsite/actions/runs/5546499889

------

*Automatically created via the "update-docs" workflow*

Signed-off-by: monabot <[email protected]>
  • Loading branch information
monadabot committed Jul 13, 2023
1 parent fea1d3d commit dc474a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions versioned_docs/version-latest/01-start-here/05-aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ through the AWS Management Console.

## Cleanup

Terraform doesn't allow destroying a non-empty bucket by default. To prepare for
easy cleanup, you may delete the newly created file by marking the checkbox next
to `wing.txt`, clicking the `Delete` button, typing `permanently delete` in the
confirmation box and clicking the `Delete objects` button.

Once you're done, you can destroy all of the resources that were created on your AWS account by running:

```sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bucket.addObject("file1.txt", "Hello world!");
There are a few global functions with specific behaviors in preflight.
For example, adding a `log()` statement to your preflight code will result in Wing printing the string to the console after compilation.

```js playground
```js
// hello.w
log("7 * 6 = ${7 * 6}");
```
Expand Down Expand Up @@ -80,7 +80,7 @@ Let's walk through some examples.

Inflight code is always contained inside a block that starts with the word `inflight`.

```js playground
```js
let greeting = inflight () => {
log("Hello from the cloud!");
};
Expand Down Expand Up @@ -123,7 +123,7 @@ Today, inflights are typically compiled into JavaScript, but Wing may also be ab
Inflight code cannot be executed during preflight, because inflight APIs assume all resources have already been deployed.

```js
firstObject(); // error: method "firstObject" cannot be called in preflight phase
firstObject(); // error: Cannot call into inflight phase while preflight
```

Likewise, inflight code cannot call preflight code, because preflight code has the capability to modify your application's infrastructure configuration, which is disallowed after deployment.
Expand All @@ -135,7 +135,7 @@ bring cloud;
let bucket = new cloud.Bucket();

let saveCalculation = inflight () => {
bucket.addObject("file1", "${2 ** 10}"); // error: method "addObject" cannot be called in inflight phase
bucket.addObject("file1", "${2 ** 10}"); // error: Cannot call into preflight phase while inflight
};
```

Expand All @@ -147,7 +147,7 @@ Since a class's initializer is just a special kind of preflight function, it als
bring cloud;

inflight () => {
new cloud.Bucket(); // error: preflight class "Bucket" cannot be created in inflight
new cloud.Bucket(); // error: Cannot create preflight class "Bucket" in inflight phase
};
```

Expand All @@ -160,6 +160,8 @@ Here's a class that models a queue that can replay its messages.
A `cloud.Bucket` stores the history of messages, and a `cloud.Counter` helps with sequencing each new message as it's added to the queue.

```js playground
bring cloud;

class ReplayableQueue {
queue: cloud.Queue;
bucket: cloud.Bucket;
Expand All @@ -186,6 +188,8 @@ class ReplayableQueue {
}
}
}

let rq = new ReplayableQueue();
```

It's also possible to define inflight classes.
Expand All @@ -198,9 +202,9 @@ For example, this inflight class can be created in an inflight contexts, and its
inflight () => {
class Person {
name: str;
age: int;
age: num;

init(name: str, age: int) {
init(name: str, age: num) {
this.name = name;
this.age = age;
}
Expand Down Expand Up @@ -254,7 +258,7 @@ count = count + 1; // OK
names.push("Jack"); // OK

inflight () => {
count = count + 1; // error: variable "count" cannot be reassigned in inflight
count = count + 1; // error: Variable cannot be reassigned from inflight
names.push("Jill"); // error: variable "names" cannot be mutated in inflight
};
```
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-latest/09-analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You may not feel comfortable sharing this data with us, and that is ok. The gath

### Opting out

If you would like to opt out of the analytics gathering, then you can do so by simply setting the environment variable `WING_CLI_DISABLE_ANALYTICS=1`. You can also use the flag `--no-analytics` when running any command.
If you would like to opt out of the analytics gathering, then you can do so by simply setting the environment variable `WING_DISABLE_ANALYTICS=1`. You can also use the flag `--no-analytics` when running any command.

```sh
wing compile -t sim app.w --no-analytics
Expand Down

0 comments on commit dc474a9

Please sign in to comment.