diff --git a/docs/docs/08-guides/02-ci-cd.md b/docs/docs/08-guides/02-ci-cd.md index b2d7b02ff3d..be26426cf35 100644 --- a/docs/docs/08-guides/02-ci-cd.md +++ b/docs/docs/08-guides/02-ci-cd.md @@ -73,7 +73,7 @@ jobs: role-session-name: gh-actions-winglang # makes it easy to identify, e.g. in AWS Cloudtrail aws-region: ${{ env.AWS_REGION }} - name: Deploy Winglang App - uses: winglang/wing-github-action/actions/deploy@v0.1.0 + uses: winglang/wing-github-action/actions/deploy@main with: entry: main.w target: 'tf-aws' @@ -109,7 +109,7 @@ jobs: role-session-name: gh-actions-winglang aws-region: ${{ env.AWS_REGION }} - name: Terraform Plan - uses: winglang/wing-github-action/actions/pull-request-diff@v0.1.0 + uses: winglang/wing-github-action/actions/pull-request-diff@main with: entry: main.w target: 'tf-aws' @@ -123,24 +123,26 @@ Most users will find using the Wing GitHub Action within GitHub Actions as the s Refer to the following Github Action workflow as a template to define your customized workflow. For detailed instructions, please refer to the Github Actions [documentation](https://docs.github.com/en/actions). -#### Backend Plugin +#### Backend Platform -Add the following file to your application root directory as `plugin.s3-backend.js`. This will be used in the Github Action workflow during the `wing compile` step. Learn more about this in the [Terraform Backend guide](./01-terraform-backend.md) +Add the following file to your application root directory as `platform.s3-backend.js`. This will be used in the Github Action workflow during the `wing compile` step. Learn more about this in the [Terraform Backend guide](./01-terraform-backend.md) ``` -// plugin.s3-backend.js -exports.postSynth = function(config) { - if (!process.env.TF_BACKEND_BUCKET) {throw new Error("env var TF_BACKEND_BUCKET not set")} - if (!process.env.TF_BACKEND_BUCKET_REGION) {throw new Error("env var TF_BACKEND_BUCKET_REGION not set")} - if (!process.env.TF_BACKEND_STATE_FILE) {throw new Error("env var TF_BACKEND_STATE_FILE not set")} - config.terraform.backend = { - s3: { - bucket: process.env.TF_BACKEND_BUCKET, - region: process.env.TF_BACKEND_BUCKET_REGION, - key: process.env.TF_BACKEND_STATE_FILE +// platform.s3-backend.js +exports.Platform = class TFBackend { + postSynth(config) { + if (!process.env.TF_BACKEND_BUCKET) {throw new Error("env var TF_BACKEND_BUCKET not set")} + if (!process.env.TF_BACKEND_BUCKET_REGION) {throw new Error("env var TF_BACKEND_BUCKET_REGION not set")} + if (!process.env.TF_BACKEND_STATE_FILE) {throw new Error("env var TF_BACKEND_STATE_FILE not set")} + config.terraform.backend = { + s3: { + bucket: process.env.TF_BACKEND_BUCKET, + region: process.env.TF_BACKEND_BUCKET_REGION, + key: process.env.TF_BACKEND_STATE_FILE + } } + return config; } - return config; } ``` @@ -181,7 +183,7 @@ permissions: env: AWS_REGION: "us-east-1" - # The following values are used in the backend plugin which + # The following values are used in the backend platform which # is used in the `wing compile` step TF_BACKEND_BUCKET: "my-terraform-state-bucket-with-a-globally-unique-name" TF_BACKEND_BUCKET_REGION: "us-east-1" @@ -202,7 +204,7 @@ jobs: - name: Install Dependencies run: npm ci - name: Compile - run: wing compile -t tf-aws --plugins=plugin.s3-backend.js main.w + run: wing compile -t tf-aws -t platform.s3-backend.js main.w - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -228,7 +230,7 @@ Consider adding Winglang simulator tests as an intermediate step in your workflo - name: Run Tests run: wing test main.w - name: Compile - run: wing compile -t tf-aws --plugins=plugin.s3-backend.js main.w + run: wing compile -t tf-aws -t platform.s3-backend.js main.w # ... ``` @@ -241,7 +243,7 @@ Consider integrating third-party Terraform analysis tools for more comprehensive - name: Install Dependencies run: npm ci - name: Compile - run: wing compile -t tf-aws --plugins=plugin.s3-backend.js main.w + run: wing compile -t tf-aws -t platform.s3-backend.js main.w - name: Check Terraform Config run: cd ./target/main.tfaws && your-tf-tool # ... diff --git a/package.json b/package.json index 672fe38a505..d36e9aa8d11 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "wing": "turbo compile -F winglang --output-logs=new-only && ./packages/winglang/bin/wing" }, "volta": { - "node": "20.11.1", + "node": "20.17.0", "pnpm": "8.15.1" }, "packageManager": "pnpm@8.15.1", diff --git a/packages/@winglang/wingc/src/lib.rs b/packages/@winglang/wingc/src/lib.rs index 0044a110178..cebfc6a1fa3 100644 --- a/packages/@winglang/wingc/src/lib.rs +++ b/packages/@winglang/wingc/src/lib.rs @@ -84,21 +84,19 @@ const WINGSDK_HTTP_MODULE: &'static str = "http"; const WINGSDK_MATH_MODULE: &'static str = "math"; const WINGSDK_AWS_MODULE: &'static str = "aws"; const WINGSDK_EXPECT_MODULE: &'static str = "expect"; -const WINGSDK_REGEX_MODULE: &'static str = "regex"; const WINGSDK_FS_MODULE: &'static str = "fs"; const WINGSDK_SIM_MODULE: &'static str = "sim"; const WINGSDK_UI_MODULE: &'static str = "ui"; pub const UTIL_CLASS_NAME: &'static str = "Util"; -const WINGSDK_BRINGABLE_MODULES: [&'static str; 10] = [ +const WINGSDK_BRINGABLE_MODULES: [&'static str; 9] = [ WINGSDK_CLOUD_MODULE, WINGSDK_UTIL_MODULE, WINGSDK_HTTP_MODULE, WINGSDK_MATH_MODULE, WINGSDK_AWS_MODULE, WINGSDK_EXPECT_MODULE, - WINGSDK_REGEX_MODULE, WINGSDK_FS_MODULE, WINGSDK_SIM_MODULE, WINGSDK_UI_MODULE, diff --git a/packages/@winglang/wingc/src/lsp/snapshots/completions/bring_suggestions.snap b/packages/@winglang/wingc/src/lsp/snapshots/completions/bring_suggestions.snap index 872f845d882..3b0ebabb871 100644 --- a/packages/@winglang/wingc/src/lsp/snapshots/completions/bring_suggestions.snap +++ b/packages/@winglang/wingc/src/lsp/snapshots/completions/bring_suggestions.snap @@ -1,5 +1,5 @@ --- -source: libs/wingc/src/lsp/completions.rs +source: packages/@winglang/wingc/src/lsp/completions.rs --- - label: aws kind: 9 @@ -19,9 +19,6 @@ source: libs/wingc/src/lsp/completions.rs - label: math kind: 9 sortText: kk|math -- label: regex - kind: 9 - sortText: kk|regex - label: sim kind: 9 sortText: kk|sim diff --git a/packages/@winglang/wingc/src/lsp/snapshots/completions/bring_suggestions_partial.snap b/packages/@winglang/wingc/src/lsp/snapshots/completions/bring_suggestions_partial.snap index 872f845d882..3b0ebabb871 100644 --- a/packages/@winglang/wingc/src/lsp/snapshots/completions/bring_suggestions_partial.snap +++ b/packages/@winglang/wingc/src/lsp/snapshots/completions/bring_suggestions_partial.snap @@ -1,5 +1,5 @@ --- -source: libs/wingc/src/lsp/completions.rs +source: packages/@winglang/wingc/src/lsp/completions.rs --- - label: aws kind: 9 @@ -19,9 +19,6 @@ source: libs/wingc/src/lsp/completions.rs - label: math kind: 9 sortText: kk|math -- label: regex - kind: 9 - sortText: kk|regex - label: sim kind: 9 sortText: kk|sim diff --git a/tests/invalid/bring.test.w b/tests/invalid/bring.test.w index d37d18299f4..831a0568b66 100644 --- a/tests/invalid/bring.test.w +++ b/tests/invalid/bring.test.w @@ -7,3 +7,9 @@ bring ; //^^^^^ Expected module specification (see https://www.winglang.io/docs/libraries) bring c; //^^^^^^ "c" is not a built-in module + +bring regex; +//^ "Could not find a trusted library "@winglibs/regex" installed" + +bring num; +//^ Could not find a trusted library "@winglibs/num" installed diff --git a/tools/hangar/__snapshots__/invalid.ts.snap b/tools/hangar/__snapshots__/invalid.ts.snap index ce0c40a4885..6a8a5ddb043 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -433,6 +433,20 @@ error: Could not find a trusted library "@winglibs/c" installed. Did you mean to | ^^^^^^^^ +error: Could not find a trusted library "@winglibs/regex" installed. Did you mean to run \`npm i @winglibs/regex\`? + --> ../../../tests/invalid/bring.test.w:11:1 + | +11 | bring regex; + | ^^^^^^^^^^^^ + + +error: Could not find a trusted library "@winglibs/num" installed. Did you mean to run \`npm i @winglibs/num\`? + --> ../../../tests/invalid/bring.test.w:14:1 + | +14 | bring num; + | ^^^^^^^^^^ + + error: Redundant bring of "std" --> ../../../tests/invalid/bring.test.w:1:1 |