Closed Chriscbr closed 2 months ago
Thanks for opening this pull request! :tada: Please consult the contributing guidelines for details on how to contribute to this project. If you need any assistance, don't hesitate to ping the relevant owner over Discord.
Topic | Owner |
---|---|
Wing SDK and standard library | @chriscbr |
Wing Console | @skyrpex |
Wing compiler and language design | @chriscbr |
VSCode extension and language server | @chriscbr |
Wing CLI | @chriscbr |
Documentation | @boyney123 |
Examples | @boyney123 |
Wing Playground | @skyrpex |
Console preview environment is available at https://wing-console-pr-7078.fly.dev :rocket:
Mmm... I thought this
wasn't necessary, but I found an example where it still seems like it's load-bearing. Basically, if you compile your Wing app to have multiple tests, this
will take on different values, so this is valid:
bring cloud;
bring "constructs" as constructs;
bring expect;
class BucketFactory {
pub static makeBucket(scope: constructs.IConstruct): cloud.Bucket {
let bucket = new cloud.Bucket() in scope;
// apply customizations to bucket...
return bucket;
}
}
let bucket = BucketFactory.makeBucket(this);
test "can use bucket" {
bucket.put("hello", "world");
expect.equal(bucket.list().length, 1);
}
test "can use other bucket" {
bucket.put("yo", "sup");
expect.equal(bucket.list().length, 1);
}
But if you were to change it to:
let bucket = BucketFactory.makeBucket(@app);
Then the test can't be run on AWS, because in preflight it tries creating two buckets with the same scope and name.
I'm not totally sure how to resolve this, so I'll revert a few of the changes and leave in this
for now.
@eladb missed that, thanks - I added it to the language ref
Congrats! :rocket: This was released in Wing 0.84.3.
Closes #6058
This PR introduces the
@app
and@filename
intrinsics to the language.@filename
is a complement to the existing@dirname
intrinsic, and@app
provides a way to access the globally accessible app.@app
exposes some meta information that can be useful, like whether the app is being compiled as a test or not, and the platform parameter system. In the CDK world, the app is also the "root" of the tree that all resources get added to.Checklist
pr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.