From 2f4e039f7206207cd1bb3dd0a82179042ad7aa39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 13:33:38 -0700 Subject: [PATCH 01/48] test: init e2e flow test --- .github/workflows/poc-e2e-flow-test.yml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/poc-e2e-flow-test.yml diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml new file mode 100644 index 00000000000..82f6fa92758 --- /dev/null +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -0,0 +1,31 @@ +# Description: This workflow mimic the flow of behaviors when user using Amplify CLI; + +name: 'poc-e2e-flow-test' + +on: + push: + branches: + - poc/e2e-test + +jobs: + create-amplify-project: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + node-version: [18] + pkg-manager: [npm, yarn] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout aws-amplify/amplify-cli repo + uses: actions/checkout@b4ffde6 # v4.1.1. TODO: try only fetch .github/workflow + - name: Setup Node.js + uses: actions/setup-node@8f152de #4.0.0 + with: + node-version: ${{ matrix.node-version }} + cache: ${{ matrix.pkg-manager }} + - name: create-amplify-project + shell: bash + run: | + mkdir -p /tmp/amplify-project; cd /tmp/amplify-project + npm create amplify@alpha --yes From 04e6ee44eb1e7fcf0ff0fcd0ef178a415a919c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 13:36:06 -0700 Subject: [PATCH 02/48] fix GH hash --- .github/workflows/poc-e2e-flow-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 82f6fa92758..ce56bd0283f 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -18,9 +18,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout aws-amplify/amplify-cli repo - uses: actions/checkout@b4ffde6 # v4.1.1. TODO: try only fetch .github/workflow + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1. TODO: try only fetch .github/workflow - name: Setup Node.js - uses: actions/setup-node@8f152de #4.0.0 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 #4.0.0 with: node-version: ${{ matrix.node-version }} cache: ${{ matrix.pkg-manager }} From d88786b31ecefaa356faa0a4e48dc3cb87f841ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 13:51:07 -0700 Subject: [PATCH 03/48] use dynamic pkg manager --- .github/workflows/poc-e2e-flow-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index ce56bd0283f..458d4df7bbc 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -28,4 +28,4 @@ jobs: shell: bash run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - npm create amplify@alpha --yes + ${{matrix.pkg-manager}} create amplify@alpha --yes From c0eb0d4958663f36aa2ce3b81f255459cc2516dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 13:54:10 -0700 Subject: [PATCH 04/48] setup nodejs with npm --- .github/workflows/poc-e2e-flow-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 458d4df7bbc..4f1f977657f 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -23,7 +23,7 @@ jobs: uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 #4.0.0 with: node-version: ${{ matrix.node-version }} - cache: ${{ matrix.pkg-manager }} + cache: npm - name: create-amplify-project shell: bash run: | From 215acbf8f77252323ee866e86c85d8263054eff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 13:58:45 -0700 Subject: [PATCH 05/48] setup more pkg managers --- .github/workflows/poc-e2e-flow-test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 4f1f977657f..4c45c040035 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -14,7 +14,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] node-version: [18] - pkg-manager: [npm, yarn] + pkg-manager: [npm, yarn1, yarn3, pnpm, bun] runs-on: ${{ matrix.os }} steps: - name: Checkout aws-amplify/amplify-cli repo @@ -25,7 +25,14 @@ jobs: node-version: ${{ matrix.node-version }} cache: npm - name: create-amplify-project + if: matrix.pkg-manager != 'yarn1' && matrix.pkg-manager != 'yarn3' shell: bash run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project ${{matrix.pkg-manager}} create amplify@alpha --yes + - name: create-amplify-project + if: matrix.pkg-manager == 'yarn1' + shell: bash + run: | + mkdir -p /tmp/amplify-project; cd /tmp/amplify-project + ${{matrix.pkg-manager}} create amplify --yes From 95842bb4bff592a6c15aed9bd89ec6522becbf14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 14:03:12 -0700 Subject: [PATCH 06/48] install pkg managers --- .github/workflows/poc-e2e-flow-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 4c45c040035..8da55533d4d 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -29,10 +29,11 @@ jobs: shell: bash run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project + npm install -g ${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify@alpha --yes - name: create-amplify-project if: matrix.pkg-manager == 'yarn1' shell: bash run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - ${{matrix.pkg-manager}} create amplify --yes + yarn create amplify --yes From aaebae284a9c67a0d5590922e19b1646c54c4ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 14:10:22 -0700 Subject: [PATCH 07/48] fix yarn1 and change step name --- .github/workflows/poc-e2e-flow-test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 8da55533d4d..23fcea86bee 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -24,16 +24,17 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: npm - - name: create-amplify-project + - name: ${{matrix.pkg-manager}}-create-amplify-project if: matrix.pkg-manager != 'yarn1' && matrix.pkg-manager != 'yarn3' shell: bash run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project npm install -g ${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify@alpha --yes - - name: create-amplify-project + - name: yarn-1-create-amplify-project if: matrix.pkg-manager == 'yarn1' shell: bash - run: | + run: | # yarn1 create amplify doesn't work with @ahpha tag mkdir -p /tmp/amplify-project; cd /tmp/amplify-project yarn create amplify --yes + ~/.yarn/bin/create-amplify From 45d990c77dd3eabd56278ee565f885d650c87c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 14:16:10 -0700 Subject: [PATCH 08/48] fix yarn1 --- .github/workflows/poc-e2e-flow-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 23fcea86bee..4460f0c34c3 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -31,10 +31,11 @@ jobs: mkdir -p /tmp/amplify-project; cd /tmp/amplify-project npm install -g ${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify@alpha --yes - - name: yarn-1-create-amplify-project + - name: ${{matrix.pkg-manager}}-create-amplify-project if: matrix.pkg-manager == 'yarn1' shell: bash run: | # yarn1 create amplify doesn't work with @ahpha tag mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - yarn create amplify --yes + yarn -v + yarn add amplify@alpha ~/.yarn/bin/create-amplify From ee1c6c3f9acbeec50c96b5dda8687f0d9da75d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 14:19:17 -0700 Subject: [PATCH 09/48] fix yarn1 --- .github/workflows/poc-e2e-flow-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 4460f0c34c3..afb06556e85 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -36,6 +36,6 @@ jobs: shell: bash run: | # yarn1 create amplify doesn't work with @ahpha tag mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - yarn -v - yarn add amplify@alpha + echo "yarn version: $(yarn --version)" + yarn add amplify ~/.yarn/bin/create-amplify From f856bb8d4172c2741d7be362b4f0da0d6cd932de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 14:34:51 -0700 Subject: [PATCH 10/48] split yarn1 into 2 steps --- .github/workflows/poc-e2e-flow-test.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index afb06556e85..498aa37a71a 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -31,11 +31,16 @@ jobs: mkdir -p /tmp/amplify-project; cd /tmp/amplify-project npm install -g ${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify@alpha --yes - - name: ${{matrix.pkg-manager}}-create-amplify-project + - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install + continue-on-error: true if: matrix.pkg-manager == 'yarn1' shell: bash run: | # yarn1 create amplify doesn't work with @ahpha tag mkdir -p /tmp/amplify-project; cd /tmp/amplify-project echo "yarn version: $(yarn --version)" - yarn add amplify + yarn create amplify@alpha + - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup + if: matrix.pkg-manager == 'yarn1' + shell: bash + run: | ~/.yarn/bin/create-amplify From 1b11e6ecda5945050284fae9274c8beb1c3276da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 14:36:29 -0700 Subject: [PATCH 11/48] fix yarn1 --- .github/workflows/poc-e2e-flow-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 498aa37a71a..d9b4a6d61d6 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -43,4 +43,4 @@ jobs: if: matrix.pkg-manager == 'yarn1' shell: bash run: | - ~/.yarn/bin/create-amplify + /usr/local/bin/create-amplify From fd937e19f7d4e52b425b998cbfd35eae1d94f5a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 14:54:01 -0700 Subject: [PATCH 12/48] fix yarn1 win --- .github/workflows/poc-e2e-flow-test.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index d9b4a6d61d6..6e1f54f9223 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -39,8 +39,13 @@ jobs: mkdir -p /tmp/amplify-project; cd /tmp/amplify-project echo "yarn version: $(yarn --version)" yarn create amplify@alpha - - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup - if: matrix.pkg-manager == 'yarn1' + - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup-not-win + if: ${{matrix.pkg-manager == 'yarn1' && matrix.os != 'windows-latest'}} shell: bash run: | /usr/local/bin/create-amplify + - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup-win + if: ${{matrix.pkg-manager == 'yarn1' && matrix.os == 'windows-latest'}} + shell: bash + run: | + C:\npm\prefix\bin\create-amplify From 6e6d06f63bf64717a9217bd0213423fbdd9ef451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 14:58:28 -0700 Subject: [PATCH 13/48] exclude bun on windows --- .github/workflows/poc-e2e-flow-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 6e1f54f9223..c9a04d487f4 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -15,6 +15,9 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] node-version: [18] pkg-manager: [npm, yarn1, yarn3, pnpm, bun] + exclude: + - os: windows-latest + pkg-manager: bun # bun only have limit support on windows runs-on: ${{ matrix.os }} steps: - name: Checkout aws-amplify/amplify-cli repo From 41c89eac967c8dba04699a95214ba58d8b98359e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 15:01:06 -0700 Subject: [PATCH 14/48] yarn1 windows --- .github/workflows/poc-e2e-flow-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index c9a04d487f4..790436526dd 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -51,4 +51,4 @@ jobs: if: ${{matrix.pkg-manager == 'yarn1' && matrix.os == 'windows-latest'}} shell: bash run: | - C:\npm\prefix\bin\create-amplify + C:\\npm\\prefix\\bin\\create-amplify From c690620d8b1eed4546ceb10251532947cec580ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 15:09:17 -0700 Subject: [PATCH 15/48] setup yarn3 --- .github/workflows/poc-e2e-flow-test.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 790436526dd..28d0e7efb7c 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -40,8 +40,8 @@ jobs: shell: bash run: | # yarn1 create amplify doesn't work with @ahpha tag mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - echo "yarn version: $(yarn --version)" yarn create amplify@alpha + - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup-not-win if: ${{matrix.pkg-manager == 'yarn1' && matrix.os != 'windows-latest'}} shell: bash @@ -52,3 +52,12 @@ jobs: shell: bash run: | C:\\npm\\prefix\\bin\\create-amplify + + - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install + if: matrix.pkg-manager == 'yarn3' + shell: bash + run: | + corepack enable + yarn set version stable + mkdir -p /tmp/amplify-project; cd /tmp/amplify-project + yarn create amplify@alpha From fd2d0109eaccdb1a3ff30a8716e5aea2ea528dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 15:16:21 -0700 Subject: [PATCH 16/48] yarn3 --- .github/workflows/poc-e2e-flow-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 28d0e7efb7c..fdf58ee4265 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -58,6 +58,8 @@ jobs: shell: bash run: | corepack enable + echo "yarn set version stable" yarn set version stable + echo "yarn version $(yarn --version)" mkdir -p /tmp/amplify-project; cd /tmp/amplify-project yarn create amplify@alpha From f030ce099753be365139fad51235c5c29103e7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 15:40:09 -0700 Subject: [PATCH 17/48] yarn3 yarnPath --- .github/workflows/poc-e2e-flow-test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index fdf58ee4265..dbc7187c66b 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -57,9 +57,7 @@ jobs: if: matrix.pkg-manager == 'yarn3' shell: bash run: | - corepack enable - echo "yarn set version stable" - yarn set version stable - echo "yarn version $(yarn --version)" mkdir -p /tmp/amplify-project; cd /tmp/amplify-project + echo "yarnPath: .yarn/releases/yarn-3.5.0.cjs" >> .yarnrc.yml + echo "yarn version $(yarn --version)" yarn create amplify@alpha From 974bfa6e2038b6a83113d4a3b7e39456578d439e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Wed, 25 Oct 2023 15:55:08 -0700 Subject: [PATCH 18/48] yarn use 3rd party action --- .github/workflows/poc-e2e-flow-test.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index dbc7187c66b..f09ea9b7f8c 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -55,9 +55,6 @@ jobs: - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install if: matrix.pkg-manager == 'yarn3' - shell: bash - run: | - mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - echo "yarnPath: .yarn/releases/yarn-3.5.0.cjs" >> .yarnrc.yml - echo "yarn version $(yarn --version)" - yarn create amplify@alpha + uses: borales/actions-yarn@v4 + with: + cmd: create amplify@alpha From a938e15b4469de4dfba354d6854d47367024c47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 09:29:19 -0700 Subject: [PATCH 19/48] try yarn3 --- .github/workflows/poc-e2e-flow-test.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index f09ea9b7f8c..bc6a9bc8be6 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -55,6 +55,11 @@ jobs: - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install if: matrix.pkg-manager == 'yarn3' - uses: borales/actions-yarn@v4 - with: - cmd: create amplify@alpha + shell: bash + run: | + mkdir -p /tmp/amplify-project; cd /tmp/amplify-project + corepack enable + echo "yarn set version stable" + yarn set version stable + echo "yarn version $(yarn --version)" + yarn create amplify@alpha From c71302f81a37714d68ec5fe79ca69c1a5f305dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 09:32:35 -0700 Subject: [PATCH 20/48] set yarn 3.6.x --- .github/workflows/poc-e2e-flow-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index bc6a9bc8be6..9137268a0fc 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -60,6 +60,6 @@ jobs: mkdir -p /tmp/amplify-project; cd /tmp/amplify-project corepack enable echo "yarn set version stable" - yarn set version stable + yarn set version 3.6.x echo "yarn version $(yarn --version)" yarn create amplify@alpha From 71af9a834c652185be0d19ce1da1d1b207ab400d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 09:53:56 -0700 Subject: [PATCH 21/48] set yarn berry --- .github/workflows/poc-e2e-flow-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 9137268a0fc..27c6f5ab565 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -59,7 +59,7 @@ jobs: run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project corepack enable - echo "yarn set version stable" - yarn set version 3.6.x + echo "yarn set version berry" + yarn set version berry echo "yarn version $(yarn --version)" yarn create amplify@alpha From b28d8b99c98e2a96dbe6171be9ea351cbb73f4c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 10:09:55 -0700 Subject: [PATCH 22/48] set yarn stable and pass --yes --- .github/workflows/poc-e2e-flow-test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 27c6f5ab565..cece22d993f 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -40,7 +40,7 @@ jobs: shell: bash run: | # yarn1 create amplify doesn't work with @ahpha tag mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - yarn create amplify@alpha + yarn create amplify@alpha --yes - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup-not-win if: ${{matrix.pkg-manager == 'yarn1' && matrix.os != 'windows-latest'}} @@ -51,7 +51,7 @@ jobs: if: ${{matrix.pkg-manager == 'yarn1' && matrix.os == 'windows-latest'}} shell: bash run: | - C:\\npm\\prefix\\bin\\create-amplify + C:\\npm\\prefix\\bin\\create-amplify --yes - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install if: matrix.pkg-manager == 'yarn3' @@ -59,7 +59,7 @@ jobs: run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project corepack enable - echo "yarn set version berry" - yarn set version berry + echo "yarn set version stable" + yarn set version stable echo "yarn version $(yarn --version)" - yarn create amplify@alpha + yarn create amplify@alpha --yes From b41bb0571c4f6a6760bbb28b64a678a484cf5985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 11:56:30 -0700 Subject: [PATCH 23/48] feat: add env ci support --- .changeset/metal-tomatoes-check.md | 5 +++++ packages/create-amplify/src/get_project_root.ts | 3 ++- packages/create-amplify/src/logger.ts | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/metal-tomatoes-check.md diff --git a/.changeset/metal-tomatoes-check.md b/.changeset/metal-tomatoes-check.md new file mode 100644 index 00000000000..41a25346d74 --- /dev/null +++ b/.changeset/metal-tomatoes-check.md @@ -0,0 +1,5 @@ +--- +'create-amplify': patch +--- + +Create Amplify uses default options and log verbosely when it's CI env diff --git a/packages/create-amplify/src/get_project_root.ts b/packages/create-amplify/src/get_project_root.ts index bb9dc4f84be..c12f623a23a 100644 --- a/packages/create-amplify/src/get_project_root.ts +++ b/packages/create-amplify/src/get_project_root.ts @@ -7,7 +7,8 @@ import { logger } from './logger.js'; * Returns the project root directory. */ export const getProjectRoot = async () => { - const useDefault = process.env.npm_config_yes === 'true'; + const useDefault = + process.env.npm_config_yes === 'true' || process.env.CI === 'true'; const defaultProjectRoot = '.'; let projectRoot: string = useDefault ? defaultProjectRoot diff --git a/packages/create-amplify/src/logger.ts b/packages/create-amplify/src/logger.ts index 53832e04048..f30880665dc 100644 --- a/packages/create-amplify/src/logger.ts +++ b/packages/create-amplify/src/logger.ts @@ -77,7 +77,9 @@ export const argv = await yargs(process.argv.slice(2)).options({ }).argv; const minimumLogLevel = - argv.debug || argv.verbose ? LogLevel.DEBUG : LogLevel.INFO; + argv.debug || argv.verbose || process.env.CI === 'true' + ? LogLevel.DEBUG + : LogLevel.INFO; const logger = new Logger(global.console, minimumLogLevel); From e722f114ae4c340a0ff6b635e76fddae5b565541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 12:18:08 -0700 Subject: [PATCH 24/48] test: update unit tests --- .../src/get_project_root.test.ts | 14 +++++++++++ packages/create-amplify/src/logger.test.ts | 25 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/packages/create-amplify/src/get_project_root.test.ts b/packages/create-amplify/src/get_project_root.test.ts index 333c9974744..dce866b1f70 100644 --- a/packages/create-amplify/src/get_project_root.test.ts +++ b/packages/create-amplify/src/get_project_root.test.ts @@ -68,4 +68,18 @@ void describe('getProjectRoot', () => { ); assert.equal(projectRoot, path.resolve(userInput)); }); + + void it('use default options if in CI mode', async (ctx) => { + process.env.CI = 'true'; + const userInput = 'test'; + const fsMkDirSyncMock = ctx.mock.method(fsp, 'mkdir', () => undefined); + ctx.mock.method(fsp, 'stat', () => Promise.reject(new Error())); + ctx.mock.method(AmplifyPrompter, 'input', () => Promise.resolve(userInput)); + + const projectRoot = await getProjectRoot(); + + assert.equal(fsMkDirSyncMock.mock.callCount(), 1); + assert.equal(fsMkDirSyncMock.mock.calls[0].arguments[0], process.cwd()); + assert.equal(projectRoot, process.cwd()); + }); }); diff --git a/packages/create-amplify/src/logger.test.ts b/packages/create-amplify/src/logger.test.ts index 4e7f2132e0c..40267c3f9a6 100644 --- a/packages/create-amplify/src/logger.test.ts +++ b/packages/create-amplify/src/logger.test.ts @@ -59,4 +59,29 @@ void describe('Logger', () => { new RegExp(`\\[DEBUG\\].*: Test log message`) ); }); + + void it('logs a debug message in CI mode', async (ctx) => { + const mockConsole = { + log: ctx.mock.fn(() => undefined), + }; + + const mockArgs = { + debug: false, + verbose: false, + }; + + const mockProcessEnv = { CI: 'true' }; + + const mockMinimumLogLevel = + mockArgs.debug || mockArgs.verbose || mockProcessEnv.CI === 'true' + ? LogLevel.DEBUG + : LogLevel.INFO; + + const logger = new Logger(mockConsole as never, mockMinimumLogLevel); + await logger.debug('Test log message'); + assert.match( + [...mockConsole.log.mock.calls[0].arguments][0] ?? '', + new RegExp(`\\[DEBUG\\].*: Test log message`) + ); + }); }); From 7dca6dacdb451d327e66fa844c12d2b75e4f8aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 13:22:47 -0700 Subject: [PATCH 25/48] feat: create amplify --yes option --- packages/create-amplify/src/get_project_root.test.ts | 8 +++++--- packages/create-amplify/src/get_project_root.ts | 11 +++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/create-amplify/src/get_project_root.test.ts b/packages/create-amplify/src/get_project_root.test.ts index dce866b1f70..616ef9b2e5e 100644 --- a/packages/create-amplify/src/get_project_root.test.ts +++ b/packages/create-amplify/src/get_project_root.test.ts @@ -2,8 +2,9 @@ import { afterEach, describe, it } from 'node:test'; import assert from 'assert'; import fsp from 'fs/promises'; import path from 'path'; -import { getProjectRoot } from './get_project_root.js'; +import yargs from 'yargs'; import { AmplifyPrompter } from '@aws-amplify/cli-core'; +import { getProjectRoot } from './get_project_root.js'; const originalEnv = process.env; @@ -69,8 +70,9 @@ void describe('getProjectRoot', () => { assert.equal(projectRoot, path.resolve(userInput)); }); - void it('use default options if in CI mode', async (ctx) => { - process.env.CI = 'true'; + void it('use default options if `yes`', async (ctx) => { + process.env.npm_config_yes = 'false'; + process.argv = ['node', 'test.js', '--yes']; const userInput = 'test'; const fsMkDirSyncMock = ctx.mock.method(fsp, 'mkdir', () => undefined); ctx.mock.method(fsp, 'stat', () => Promise.reject(new Error())); diff --git a/packages/create-amplify/src/get_project_root.ts b/packages/create-amplify/src/get_project_root.ts index c12f623a23a..f88469c5ad8 100644 --- a/packages/create-amplify/src/get_project_root.ts +++ b/packages/create-amplify/src/get_project_root.ts @@ -1,5 +1,6 @@ import fsp from 'fs/promises'; import path from 'path'; +import yargs from 'yargs'; import { AmplifyPrompter } from '@aws-amplify/cli-core'; import { logger } from './logger.js'; @@ -7,8 +8,14 @@ import { logger } from './logger.js'; * Returns the project root directory. */ export const getProjectRoot = async () => { - const useDefault = - process.env.npm_config_yes === 'true' || process.env.CI === 'true'; + const argv = await yargs(process.argv.slice(2)).options({ + yes: { + type: 'boolean', + default: false, + }, + }).argv; + + const useDefault = process.env.npm_config_yes === 'true' || argv.yes === true; const defaultProjectRoot = '.'; let projectRoot: string = useDefault ? defaultProjectRoot From 70fad768a856da60a4f7dbe140ae6a888b845c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 13:27:28 -0700 Subject: [PATCH 26/48] chore: remove un-used code --- packages/create-amplify/src/get_project_root.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/create-amplify/src/get_project_root.test.ts b/packages/create-amplify/src/get_project_root.test.ts index 616ef9b2e5e..601cde9b71e 100644 --- a/packages/create-amplify/src/get_project_root.test.ts +++ b/packages/create-amplify/src/get_project_root.test.ts @@ -2,7 +2,6 @@ import { afterEach, describe, it } from 'node:test'; import assert from 'assert'; import fsp from 'fs/promises'; import path from 'path'; -import yargs from 'yargs'; import { AmplifyPrompter } from '@aws-amplify/cli-core'; import { getProjectRoot } from './get_project_root.js'; From dc2df4bf80669e39d37ebb1a909d75686609e065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 16:53:21 -0700 Subject: [PATCH 27/48] feat: support Panage Manager env var --- packages/create-amplify/src/get_project_root.ts | 1 - .../create-amplify/src/npm_package_manager_controller.ts | 8 +++++--- packages/create-amplify/src/tsconfig_initializer.ts | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/create-amplify/src/get_project_root.ts b/packages/create-amplify/src/get_project_root.ts index f88469c5ad8..cb693c3d25f 100644 --- a/packages/create-amplify/src/get_project_root.ts +++ b/packages/create-amplify/src/get_project_root.ts @@ -14,7 +14,6 @@ export const getProjectRoot = async () => { default: false, }, }).argv; - const useDefault = process.env.npm_config_yes === 'true' || argv.yes === true; const defaultProjectRoot = '.'; let projectRoot: string = useDefault diff --git a/packages/create-amplify/src/npm_package_manager_controller.ts b/packages/create-amplify/src/npm_package_manager_controller.ts index 39e6ee44068..a4bfbf044ef 100644 --- a/packages/create-amplify/src/npm_package_manager_controller.ts +++ b/packages/create-amplify/src/npm_package_manager_controller.ts @@ -15,7 +15,7 @@ export class NpmPackageManagerController implements PackageManagerController { private readonly projectRoot: string, private readonly execa = _execa ) {} - private readonly executableName = 'npm'; + private readonly executableName = process.env.PM || 'npm'; /** * Installs the given package names as devDependencies @@ -24,9 +24,11 @@ export class NpmPackageManagerController implements PackageManagerController { packageNames: string[], type: DependencyType ): Promise => { - const args = ['install'].concat(...packageNames); + const args = [this.executableName === 'yarn' ? 'add' : 'install'].concat( + ...packageNames + ); if (type === 'dev') { - args.push('--save-dev'); + args.push('-D'); } await this.execa(this.executableName, args, { stdio: 'inherit', diff --git a/packages/create-amplify/src/tsconfig_initializer.ts b/packages/create-amplify/src/tsconfig_initializer.ts index 114f1fdb031..2cecc99ed9e 100644 --- a/packages/create-amplify/src/tsconfig_initializer.ts +++ b/packages/create-amplify/src/tsconfig_initializer.ts @@ -17,6 +17,7 @@ export class TsConfigInitializer { private readonly existsSync = _existsSync, private readonly execa = _execa ) {} + private readonly executableName = process.env.PM || 'npx'; /** * If tsconfig.json already exists, this is a noop. Otherwise, `npx tsc --init` is executed to create a tsconfig.json file @@ -27,7 +28,7 @@ export class TsConfigInitializer { return; } this.logger.log( - 'No tsconfig.json file found in the current directory. Running `npx tsc --init`...' + `No tsconfig.json file found in the current directory. Running \`${this.executableName} tsc --init\`...` ); const packageJson = await this.packageJsonReader.readPackageJson(); @@ -53,20 +54,20 @@ export class TsConfigInitializer { } try { - await this.execa('npx', tscArgs, { + await this.execa(this.executableName, tscArgs, { stdio: 'inherit', cwd: this.projectRoot, }); } catch { throw new Error( - '`npx tsc --init` did not exit successfully. Initialize a valid TypeScript configuration before continuing.' + `\`${this.executableName} tsc --init\` did not exit successfully. Initialize a valid TypeScript configuration before continuing.` ); } if (!this.tsConfigJsonExists()) { // this should only happen if the customer exits out of npx tsc --init before finishing throw new Error( - 'tsconfig.json does not exist after running `npx tsc --init`. Initialize a valid TypeScript configuration before continuing.' + `tsconfig.json does not exist after running \`${this.executableName} tsc --init\`. Initialize a valid TypeScript configuration before continuing.` ); } }; From c4231705486955a30fcdb25207622488773df30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Thu, 26 Oct 2023 21:49:03 -0700 Subject: [PATCH 28/48] chore: add comments --- packages/create-amplify/src/npm_package_manager_controller.ts | 2 +- packages/create-amplify/src/tsconfig_initializer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/create-amplify/src/npm_package_manager_controller.ts b/packages/create-amplify/src/npm_package_manager_controller.ts index a4bfbf044ef..e6e5b4b6b10 100644 --- a/packages/create-amplify/src/npm_package_manager_controller.ts +++ b/packages/create-amplify/src/npm_package_manager_controller.ts @@ -15,7 +15,7 @@ export class NpmPackageManagerController implements PackageManagerController { private readonly projectRoot: string, private readonly execa = _execa ) {} - private readonly executableName = process.env.PM || 'npm'; + private readonly executableName = process.env.PM || 'npm'; // TODO: replace `process.env.PM` with `getPackageManagerName()` once the test infra is ready. /** * Installs the given package names as devDependencies diff --git a/packages/create-amplify/src/tsconfig_initializer.ts b/packages/create-amplify/src/tsconfig_initializer.ts index 2cecc99ed9e..1a471126c26 100644 --- a/packages/create-amplify/src/tsconfig_initializer.ts +++ b/packages/create-amplify/src/tsconfig_initializer.ts @@ -17,7 +17,7 @@ export class TsConfigInitializer { private readonly existsSync = _existsSync, private readonly execa = _execa ) {} - private readonly executableName = process.env.PM || 'npx'; + private readonly executableName = process.env.PM || 'npx'; // TODO: replace `process.env.PM` with `getPackageManagerName()` once the test infra is ready. /** * If tsconfig.json already exists, this is a noop. Otherwise, `npx tsc --init` is executed to create a tsconfig.json file From 7b887724a30c07a32d7f4eaef41e6568a6c9bea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Fri, 27 Oct 2023 13:35:31 -0700 Subject: [PATCH 29/48] chore: remove env.CI --- packages/create-amplify/src/logger.test.ts | 6 +----- packages/create-amplify/src/logger.ts | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/create-amplify/src/logger.test.ts b/packages/create-amplify/src/logger.test.ts index 40267c3f9a6..585dc0f736a 100644 --- a/packages/create-amplify/src/logger.test.ts +++ b/packages/create-amplify/src/logger.test.ts @@ -70,12 +70,8 @@ void describe('Logger', () => { verbose: false, }; - const mockProcessEnv = { CI: 'true' }; - const mockMinimumLogLevel = - mockArgs.debug || mockArgs.verbose || mockProcessEnv.CI === 'true' - ? LogLevel.DEBUG - : LogLevel.INFO; + mockArgs.debug || mockArgs.verbose ? LogLevel.DEBUG : LogLevel.INFO; const logger = new Logger(mockConsole as never, mockMinimumLogLevel); await logger.debug('Test log message'); diff --git a/packages/create-amplify/src/logger.ts b/packages/create-amplify/src/logger.ts index f30880665dc..53832e04048 100644 --- a/packages/create-amplify/src/logger.ts +++ b/packages/create-amplify/src/logger.ts @@ -77,9 +77,7 @@ export const argv = await yargs(process.argv.slice(2)).options({ }).argv; const minimumLogLevel = - argv.debug || argv.verbose || process.env.CI === 'true' - ? LogLevel.DEBUG - : LogLevel.INFO; + argv.debug || argv.verbose ? LogLevel.DEBUG : LogLevel.INFO; const logger = new Logger(global.console, minimumLogLevel); From a0851622e1135a8290d5dbf95971f085615a2b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Fri, 27 Oct 2023 13:38:34 -0700 Subject: [PATCH 30/48] chore: update changeset --- .changeset/metal-tomatoes-check.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.changeset/metal-tomatoes-check.md b/.changeset/metal-tomatoes-check.md index 41a25346d74..cb02e03b2b4 100644 --- a/.changeset/metal-tomatoes-check.md +++ b/.changeset/metal-tomatoes-check.md @@ -2,4 +2,5 @@ 'create-amplify': patch --- -Create Amplify uses default options and log verbosely when it's CI env +1. Create Amplify (temporarily) uses environment variable for Package Manager +2. Create Amplify uses `yes` option to choose the default value for prompts From 988637ebb865c1239a32fd2ca09f3bd973ff6140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Fri, 27 Oct 2023 13:38:50 -0700 Subject: [PATCH 31/48] chore: rename PACKAGE_MANAGER_EXECUTABLE --- packages/create-amplify/src/npm_package_manager_controller.ts | 3 ++- packages/create-amplify/src/tsconfig_initializer.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/create-amplify/src/npm_package_manager_controller.ts b/packages/create-amplify/src/npm_package_manager_controller.ts index e6e5b4b6b10..65c98f0ab7a 100644 --- a/packages/create-amplify/src/npm_package_manager_controller.ts +++ b/packages/create-amplify/src/npm_package_manager_controller.ts @@ -15,7 +15,8 @@ export class NpmPackageManagerController implements PackageManagerController { private readonly projectRoot: string, private readonly execa = _execa ) {} - private readonly executableName = process.env.PM || 'npm'; // TODO: replace `process.env.PM` with `getPackageManagerName()` once the test infra is ready. + private readonly executableName = + process.env.PACKAGE_MANAGER_EXECUTABLE || 'npm'; // TODO: replace `process.env.PACKAGE_MANAGER_EXECUTABLE` with `getPackageManagerName()` once the test infra is ready. /** * Installs the given package names as devDependencies diff --git a/packages/create-amplify/src/tsconfig_initializer.ts b/packages/create-amplify/src/tsconfig_initializer.ts index 1a471126c26..f17112e7396 100644 --- a/packages/create-amplify/src/tsconfig_initializer.ts +++ b/packages/create-amplify/src/tsconfig_initializer.ts @@ -17,7 +17,8 @@ export class TsConfigInitializer { private readonly existsSync = _existsSync, private readonly execa = _execa ) {} - private readonly executableName = process.env.PM || 'npx'; // TODO: replace `process.env.PM` with `getPackageManagerName()` once the test infra is ready. + private readonly executableName = + process.env.PACKAGE_MANAGER_EXECUTABLE || 'npx'; // TODO: replace `process.env.PACKAGE_MANAGER_EXECUTABLE` with `getPackageManagerName()` once the test infra is ready. /** * If tsconfig.json already exists, this is a noop. Otherwise, `npx tsc --init` is executed to create a tsconfig.json file From be3a456c11c88c32551da0f42015425f037de99c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Fri, 27 Oct 2023 13:56:55 -0700 Subject: [PATCH 32/48] fix: tests --- packages/create-amplify/src/logger.test.ts | 21 ------------------- .../npm_package_manager_controller.test.ts | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/packages/create-amplify/src/logger.test.ts b/packages/create-amplify/src/logger.test.ts index 585dc0f736a..4e7f2132e0c 100644 --- a/packages/create-amplify/src/logger.test.ts +++ b/packages/create-amplify/src/logger.test.ts @@ -59,25 +59,4 @@ void describe('Logger', () => { new RegExp(`\\[DEBUG\\].*: Test log message`) ); }); - - void it('logs a debug message in CI mode', async (ctx) => { - const mockConsole = { - log: ctx.mock.fn(() => undefined), - }; - - const mockArgs = { - debug: false, - verbose: false, - }; - - const mockMinimumLogLevel = - mockArgs.debug || mockArgs.verbose ? LogLevel.DEBUG : LogLevel.INFO; - - const logger = new Logger(mockConsole as never, mockMinimumLogLevel); - await logger.debug('Test log message'); - assert.match( - [...mockConsole.log.mock.calls[0].arguments][0] ?? '', - new RegExp(`\\[DEBUG\\].*: Test log message`) - ); - }); }); diff --git a/packages/create-amplify/src/npm_package_manager_controller.test.ts b/packages/create-amplify/src/npm_package_manager_controller.test.ts index 7504d2c3480..f555d3ba80f 100644 --- a/packages/create-amplify/src/npm_package_manager_controller.test.ts +++ b/packages/create-amplify/src/npm_package_manager_controller.test.ts @@ -12,7 +12,7 @@ void describe('NpmPackageManagerController', () => { await npmPackageManagerController.installDependencies(['testDep'], 'dev'); assert.deepStrictEqual(execaMock.mock.calls[0].arguments, [ 'npm', - ['install', 'testDep', '--save-dev'], + ['install', 'testDep', '-D'], { cwd: 'testPath', stdio: 'inherit' }, ]); }); From 3d6d301923a0c9671c358e92435abc63a9a3243b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Fri, 27 Oct 2023 14:43:31 -0700 Subject: [PATCH 33/48] use Env Var PACKAGE_MANAGER_EXECUTABLE --- .github/workflows/poc-e2e-flow-test.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index cece22d993f..2dc92f62c96 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -27,20 +27,29 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: npm + - name: Local Publish create-amplify + shell: bash + run: npm run install:local && npm run build && npm run vend - name: ${{matrix.pkg-manager}}-create-amplify-project if: matrix.pkg-manager != 'yarn1' && matrix.pkg-manager != 'yarn3' shell: bash run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project npm install -g ${{matrix.pkg-manager}} - ${{matrix.pkg-manager}} create amplify@alpha --yes + echo "$(${{matrix.pkg-manager}}) config set registry http://localhost:4873" + ${{matrix.pkg-manager}} config set registry http://localhost:4873 + echo "$(${{matrix.pkg-manager}}) config get registry" + ${{matrix.pkg-manager}} config get registry + PACKAGE_MANAGER_EXECUTABLE=${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify@alpha --yes - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install continue-on-error: true if: matrix.pkg-manager == 'yarn1' shell: bash run: | # yarn1 create amplify doesn't work with @ahpha tag mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - yarn create amplify@alpha --yes + echo "yarn config set registry http://localhost:4873" + yarn config set registry http://localhost:4873 + PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify@alpha --yes - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup-not-win if: ${{matrix.pkg-manager == 'yarn1' && matrix.os != 'windows-latest'}} @@ -51,7 +60,7 @@ jobs: if: ${{matrix.pkg-manager == 'yarn1' && matrix.os == 'windows-latest'}} shell: bash run: | - C:\\npm\\prefix\\bin\\create-amplify --yes + PACKAGE_MANAGER_EXECUTABLE=yarn C:\\npm\\prefix\\bin\\create-amplify --yes - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install if: matrix.pkg-manager == 'yarn3' @@ -62,4 +71,6 @@ jobs: echo "yarn set version stable" yarn set version stable echo "yarn version $(yarn --version)" - yarn create amplify@alpha --yes + yarn config set unsafeHttpWhitelist localhost + yarn config set npmRegistryServer http://localhost:4873 + PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify@alpha --yes From 4d3ebc3f8437e24a11aa1c27a161317e238f2819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Fri, 27 Oct 2023 15:43:23 -0700 Subject: [PATCH 34/48] fix npm -> npx, remove bun --- .github/workflows/poc-e2e-flow-test.yml | 2 +- packages/create-amplify/src/tsconfig_initializer.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 2dc92f62c96..bd4861b9c7f 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -14,7 +14,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] node-version: [18] - pkg-manager: [npm, yarn1, yarn3, pnpm, bun] + pkg-manager: [npm, yarn1, yarn3, pnpm] exclude: - os: windows-latest pkg-manager: bun # bun only have limit support on windows diff --git a/packages/create-amplify/src/tsconfig_initializer.ts b/packages/create-amplify/src/tsconfig_initializer.ts index f17112e7396..5c88dc8198e 100644 --- a/packages/create-amplify/src/tsconfig_initializer.ts +++ b/packages/create-amplify/src/tsconfig_initializer.ts @@ -29,7 +29,9 @@ export class TsConfigInitializer { return; } this.logger.log( - `No tsconfig.json file found in the current directory. Running \`${this.executableName} tsc --init\`...` + `No tsconfig.json file found in the current directory. Running \`${ + this.executableName === 'npm' ? 'npx' : this.executableName + } tsc --init\`...` ); const packageJson = await this.packageJsonReader.readPackageJson(); @@ -61,14 +63,18 @@ export class TsConfigInitializer { }); } catch { throw new Error( - `\`${this.executableName} tsc --init\` did not exit successfully. Initialize a valid TypeScript configuration before continuing.` + `\`${ + this.executableName === 'npm' ? 'npx' : this.executableName + } tsc --init\` did not exit successfully. Initialize a valid TypeScript configuration before continuing.` ); } if (!this.tsConfigJsonExists()) { // this should only happen if the customer exits out of npx tsc --init before finishing throw new Error( - `tsconfig.json does not exist after running \`${this.executableName} tsc --init\`. Initialize a valid TypeScript configuration before continuing.` + `tsconfig.json does not exist after running \`${ + this.executableName === 'npm' ? 'npx' : this.executableName + } tsc --init\`. Initialize a valid TypeScript configuration before continuing.` ); } }; From 7ca014417fe21cc711100eedcc53d70c92ea5c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 11:26:13 -0700 Subject: [PATCH 35/48] fix npm -> npx --- packages/create-amplify/src/tsconfig_initializer.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/create-amplify/src/tsconfig_initializer.ts b/packages/create-amplify/src/tsconfig_initializer.ts index 5c88dc8198e..0ad229653d0 100644 --- a/packages/create-amplify/src/tsconfig_initializer.ts +++ b/packages/create-amplify/src/tsconfig_initializer.ts @@ -57,10 +57,14 @@ export class TsConfigInitializer { } try { - await this.execa(this.executableName, tscArgs, { - stdio: 'inherit', - cwd: this.projectRoot, - }); + await this.execa( + this.executableName === 'npm' ? 'npx' : this.executableName, + tscArgs, + { + stdio: 'inherit', + cwd: this.projectRoot, + } + ); } catch { throw new Error( `\`${ From 347dae0d77ee1431f125f7f49e1e5ce0885e9b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 11:55:59 -0700 Subject: [PATCH 36/48] change -- --yes --- .github/workflows/poc-e2e-flow-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index bd4861b9c7f..71b70faf4a6 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -40,7 +40,7 @@ jobs: ${{matrix.pkg-manager}} config set registry http://localhost:4873 echo "$(${{matrix.pkg-manager}}) config get registry" ${{matrix.pkg-manager}} config get registry - PACKAGE_MANAGER_EXECUTABLE=${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify@alpha --yes + PACKAGE_MANAGER_EXECUTABLE=${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify@alpha -- --yes - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install continue-on-error: true if: matrix.pkg-manager == 'yarn1' @@ -51,18 +51,18 @@ jobs: yarn config set registry http://localhost:4873 PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify@alpha --yes - - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup-not-win + - name: yarn1-create-amplify-project-step2-setup-not-win if: ${{matrix.pkg-manager == 'yarn1' && matrix.os != 'windows-latest'}} shell: bash run: | /usr/local/bin/create-amplify - - name: ${{matrix.pkg-manager}}-create-amplify-project-step2-setup-win + - name: yarn1-create-amplify-project-step2-setup-win if: ${{matrix.pkg-manager == 'yarn1' && matrix.os == 'windows-latest'}} shell: bash run: | PACKAGE_MANAGER_EXECUTABLE=yarn C:\\npm\\prefix\\bin\\create-amplify --yes - - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install + - name: yarn3-create-amplify-project-step1-install if: matrix.pkg-manager == 'yarn3' shell: bash run: | From 16fdea355c69230521c7b30f5b32de6bcab1325a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 12:23:33 -0700 Subject: [PATCH 37/48] chore: update package.lock --- package-lock.json | 161 ++++++++++++++-------------------------------- 1 file changed, 47 insertions(+), 114 deletions(-) diff --git a/package-lock.json b/package-lock.json index 16af05de64e..046020cfbf5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9203,14 +9203,12 @@ "node_modules/aws-cdk-lib/node_modules/@balena/dockerignore": { "version": "1.0.2", "inBundle": true, - "license": "Apache-2.0", - "peer": true + "license": "Apache-2.0" }, "node_modules/aws-cdk-lib/node_modules/ajv": { "version": "8.12.0", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -9226,7 +9224,6 @@ "version": "5.0.1", "inBundle": true, "license": "MIT", - "peer": true, "engines": { "node": ">=8" } @@ -9235,7 +9232,6 @@ "version": "4.3.0", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -9250,7 +9246,6 @@ "version": "2.0.0", "inBundle": true, "license": "MIT", - "peer": true, "engines": { "node": ">=8" } @@ -9258,14 +9253,12 @@ "node_modules/aws-cdk-lib/node_modules/balanced-match": { "version": "1.0.2", "inBundle": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/aws-cdk-lib/node_modules/brace-expansion": { "version": "1.1.11", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -9275,7 +9268,6 @@ "version": "1.6.3", "inBundle": true, "license": "(MIT OR GPL-3.0-or-later)", - "peer": true, "engines": { "node": ">= 0.8.0" } @@ -9284,7 +9276,6 @@ "version": "2.0.1", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "color-name": "~1.1.4" }, @@ -9295,32 +9286,27 @@ "node_modules/aws-cdk-lib/node_modules/color-name": { "version": "1.1.4", "inBundle": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/aws-cdk-lib/node_modules/concat-map": { "version": "0.0.1", "inBundle": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/aws-cdk-lib/node_modules/emoji-regex": { "version": "8.0.0", "inBundle": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/aws-cdk-lib/node_modules/fast-deep-equal": { "version": "3.1.3", "inBundle": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/aws-cdk-lib/node_modules/fs-extra": { "version": "11.1.1", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -9333,14 +9319,12 @@ "node_modules/aws-cdk-lib/node_modules/graceful-fs": { "version": "4.2.11", "inBundle": true, - "license": "ISC", - "peer": true + "license": "ISC" }, "node_modules/aws-cdk-lib/node_modules/ignore": { "version": "5.2.4", "inBundle": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 4" } @@ -9349,7 +9333,6 @@ "version": "3.0.0", "inBundle": true, "license": "MIT", - "peer": true, "engines": { "node": ">=8" } @@ -9357,14 +9340,12 @@ "node_modules/aws-cdk-lib/node_modules/json-schema-traverse": { "version": "1.0.0", "inBundle": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/aws-cdk-lib/node_modules/jsonfile": { "version": "6.1.0", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "universalify": "^2.0.0" }, @@ -9376,7 +9357,6 @@ "version": "1.4.1", "inBundle": true, "license": "MIT", - "peer": true, "engines": { "node": "*" } @@ -9384,14 +9364,12 @@ "node_modules/aws-cdk-lib/node_modules/lodash.truncate": { "version": "4.4.2", "inBundle": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/aws-cdk-lib/node_modules/lru-cache": { "version": "6.0.0", "inBundle": true, "license": "ISC", - "peer": true, "dependencies": { "yallist": "^4.0.0" }, @@ -9403,7 +9381,6 @@ "version": "3.1.2", "inBundle": true, "license": "ISC", - "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -9415,7 +9392,6 @@ "version": "2.3.0", "inBundle": true, "license": "MIT", - "peer": true, "engines": { "node": ">=6" } @@ -9424,7 +9400,6 @@ "version": "2.0.2", "inBundle": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -9433,7 +9408,6 @@ "version": "7.5.4", "inBundle": true, "license": "ISC", - "peer": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -9448,7 +9422,6 @@ "version": "4.0.0", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -9465,7 +9438,6 @@ "version": "4.2.3", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -9479,7 +9451,6 @@ "version": "6.0.1", "inBundle": true, "license": "MIT", - "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -9491,7 +9462,6 @@ "version": "6.8.1", "inBundle": true, "license": "BSD-3-Clause", - "peer": true, "dependencies": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", @@ -9507,7 +9477,6 @@ "version": "2.0.0", "inBundle": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 10.0.0" } @@ -9516,7 +9485,6 @@ "version": "4.4.1", "inBundle": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "punycode": "^2.1.0" } @@ -9524,14 +9492,12 @@ "node_modules/aws-cdk-lib/node_modules/yallist": { "version": "4.0.0", "inBundle": true, - "license": "ISC", - "peer": true + "license": "ISC" }, "node_modules/aws-cdk-lib/node_modules/yaml": { "version": "1.10.2", "inBundle": true, "license": "ISC", - "peer": true, "engines": { "node": ">= 6" } @@ -19538,6 +19504,7 @@ } }, "packages/backend-platform-test-stubs": { + "name": "@aws-amplify/backend-platform-test-stubs", "version": "0.1.0", "license": "Apache-2.0", "dependencies": { @@ -19585,16 +19552,16 @@ }, "packages/cli": { "name": "@aws-amplify/backend-cli", - "version": "0.2.0-alpha.14", + "version": "0.2.0-alpha.15", "license": "Apache-2.0", "dependencies": { "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.7", "@aws-amplify/backend-secret": "^0.2.0-alpha.6", - "@aws-amplify/cli-core": "^0.1.0-alpha.3", + "@aws-amplify/cli-core": "^0.1.0-alpha.4", "@aws-amplify/client-config": "^0.2.0-alpha.12", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.9", + "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.11", "@aws-amplify/form-generator": "^0.2.0-alpha.4", - "@aws-amplify/model-generator": "^0.2.0-alpha.6", + "@aws-amplify/model-generator": "^0.2.0-alpha.7", "@aws-amplify/platform-core": "^0.1.1-alpha.3", "@aws-amplify/sandbox": "^0.2.0-alpha.18", "@aws-sdk/credential-provider-ini": "^3.360.0", @@ -19619,7 +19586,7 @@ }, "packages/cli-core": { "name": "@aws-amplify/cli-core", - "version": "0.1.0-alpha.3", + "version": "0.1.0-alpha.4", "license": "Apache-2.0", "dependencies": { "@inquirer/prompts": "^3.0.0" @@ -19754,10 +19721,10 @@ } }, "packages/create-amplify": { - "version": "0.2.0-alpha.14", + "version": "0.2.0-alpha.15", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/cli-core": "^0.1.0-alpha.3", + "@aws-amplify/cli-core": "^0.1.0-alpha.4", "execa": "^7.2.0", "yargs": "^17.7.2" }, @@ -19880,7 +19847,7 @@ }, "packages/deployed-backend-client": { "name": "@aws-amplify/deployed-backend-client", - "version": "0.2.0-alpha.10", + "version": "0.2.0-alpha.11", "license": "Apache-2.0", "dependencies": { "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", @@ -19925,7 +19892,7 @@ }, "packages/integration-tests": { "name": "@aws-amplify/integration-tests", - "version": "0.2.0-alpha.9", + "version": "0.2.0-alpha.10", "license": "Apache-2.0", "devDependencies": { "@aws-amplify/amplify-api-next-alpha": "^0.3.2", @@ -19994,11 +19961,11 @@ }, "packages/model-generator": { "name": "@aws-amplify/model-generator", - "version": "0.2.0-alpha.6", + "version": "0.2.0-alpha.7", "license": "Apache-2.0", "dependencies": { "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.5", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.2", + "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.11", "@aws-amplify/graphql-generator": "^0.1.3", "@aws-amplify/graphql-types-generator": "^3.4.4", "@aws-sdk/client-appsync": "^3.398.0", @@ -20651,11 +20618,11 @@ "requires": { "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.7", "@aws-amplify/backend-secret": "^0.2.0-alpha.6", - "@aws-amplify/cli-core": "^0.1.0-alpha.3", + "@aws-amplify/cli-core": "^0.1.0-alpha.4", "@aws-amplify/client-config": "^0.2.0-alpha.12", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.9", + "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.11", "@aws-amplify/form-generator": "^0.2.0-alpha.4", - "@aws-amplify/model-generator": "^0.2.0-alpha.6", + "@aws-amplify/model-generator": "^0.2.0-alpha.7", "@aws-amplify/platform-core": "^0.1.1-alpha.3", "@aws-amplify/sandbox": "^0.2.0-alpha.18", "@aws-sdk/credential-provider-ini": "^3.360.0", @@ -21669,7 +21636,7 @@ "version": "file:packages/model-generator", "requires": { "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.5", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.2", + "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.11", "@aws-amplify/graphql-generator": "^0.1.3", "@aws-amplify/graphql-types-generator": "^3.4.4", "@aws-sdk/client-appsync": "^3.398.0", @@ -27640,13 +27607,11 @@ "dependencies": { "@balena/dockerignore": { "version": "1.0.2", - "bundled": true, - "peer": true + "bundled": true }, "ajv": { "version": "8.12.0", "bundled": true, - "peer": true, "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -27656,31 +27621,26 @@ }, "ansi-regex": { "version": "5.0.1", - "bundled": true, - "peer": true + "bundled": true }, "ansi-styles": { "version": "4.3.0", "bundled": true, - "peer": true, "requires": { "color-convert": "^2.0.1" } }, "astral-regex": { "version": "2.0.0", - "bundled": true, - "peer": true + "bundled": true }, "balanced-match": { "version": "1.0.2", - "bundled": true, - "peer": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "peer": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -27688,41 +27648,34 @@ }, "case": { "version": "1.6.3", - "bundled": true, - "peer": true + "bundled": true }, "color-convert": { "version": "2.0.1", "bundled": true, - "peer": true, "requires": { "color-name": "~1.1.4" } }, "color-name": { "version": "1.1.4", - "bundled": true, - "peer": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "peer": true + "bundled": true }, "emoji-regex": { "version": "8.0.0", - "bundled": true, - "peer": true + "bundled": true }, "fast-deep-equal": { "version": "3.1.3", - "bundled": true, - "peer": true + "bundled": true }, "fs-extra": { "version": "11.1.1", "bundled": true, - "peer": true, "requires": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -27731,28 +27684,23 @@ }, "graceful-fs": { "version": "4.2.11", - "bundled": true, - "peer": true + "bundled": true }, "ignore": { "version": "5.2.4", - "bundled": true, - "peer": true + "bundled": true }, "is-fullwidth-code-point": { "version": "3.0.0", - "bundled": true, - "peer": true + "bundled": true }, "json-schema-traverse": { "version": "1.0.0", - "bundled": true, - "peer": true + "bundled": true }, "jsonfile": { "version": "6.1.0", "bundled": true, - "peer": true, "requires": { "graceful-fs": "^4.1.6", "universalify": "^2.0.0" @@ -27760,18 +27708,15 @@ }, "jsonschema": { "version": "1.4.1", - "bundled": true, - "peer": true + "bundled": true }, "lodash.truncate": { "version": "4.4.2", - "bundled": true, - "peer": true + "bundled": true }, "lru-cache": { "version": "6.0.0", "bundled": true, - "peer": true, "requires": { "yallist": "^4.0.0" } @@ -27779,25 +27724,21 @@ "minimatch": { "version": "3.1.2", "bundled": true, - "peer": true, "requires": { "brace-expansion": "^1.1.7" } }, "punycode": { "version": "2.3.0", - "bundled": true, - "peer": true + "bundled": true }, "require-from-string": { "version": "2.0.2", - "bundled": true, - "peer": true + "bundled": true }, "semver": { "version": "7.5.4", "bundled": true, - "peer": true, "requires": { "lru-cache": "^6.0.0" } @@ -27805,7 +27746,6 @@ "slice-ansi": { "version": "4.0.0", "bundled": true, - "peer": true, "requires": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -27815,7 +27755,6 @@ "string-width": { "version": "4.2.3", "bundled": true, - "peer": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -27825,7 +27764,6 @@ "strip-ansi": { "version": "6.0.1", "bundled": true, - "peer": true, "requires": { "ansi-regex": "^5.0.1" } @@ -27833,7 +27771,6 @@ "table": { "version": "6.8.1", "bundled": true, - "peer": true, "requires": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", @@ -27844,26 +27781,22 @@ }, "universalify": { "version": "2.0.0", - "bundled": true, - "peer": true + "bundled": true }, "uri-js": { "version": "4.4.1", "bundled": true, - "peer": true, "requires": { "punycode": "^2.1.0" } }, "yallist": { "version": "4.0.0", - "bundled": true, - "peer": true + "bundled": true }, "yaml": { "version": "1.10.2", - "bundled": true, - "peer": true + "bundled": true } } }, @@ -28805,7 +28738,7 @@ "create-amplify": { "version": "file:packages/create-amplify", "requires": { - "@aws-amplify/cli-core": "^0.1.0-alpha.3", + "@aws-amplify/cli-core": "^0.1.0-alpha.4", "execa": "^7.2.0", "yargs": "^17.7.2" }, From 3f0f5b285625787e9d88d2a2a0372b30a9a5946c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 13:35:01 -0700 Subject: [PATCH 38/48] chore: remove @alpha --- .github/workflows/poc-e2e-flow-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 71b70faf4a6..c7fc583506b 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -40,7 +40,7 @@ jobs: ${{matrix.pkg-manager}} config set registry http://localhost:4873 echo "$(${{matrix.pkg-manager}}) config get registry" ${{matrix.pkg-manager}} config get registry - PACKAGE_MANAGER_EXECUTABLE=${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify@alpha -- --yes + PACKAGE_MANAGER_EXECUTABLE=${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify --yes - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install continue-on-error: true if: matrix.pkg-manager == 'yarn1' @@ -49,7 +49,7 @@ jobs: mkdir -p /tmp/amplify-project; cd /tmp/amplify-project echo "yarn config set registry http://localhost:4873" yarn config set registry http://localhost:4873 - PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify@alpha --yes + PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify --yes - name: yarn1-create-amplify-project-step2-setup-not-win if: ${{matrix.pkg-manager == 'yarn1' && matrix.os != 'windows-latest'}} @@ -73,4 +73,4 @@ jobs: echo "yarn version $(yarn --version)" yarn config set unsafeHttpWhitelist localhost yarn config set npmRegistryServer http://localhost:4873 - PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify@alpha --yes + PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify --yes From c3b7998ebcd9a3bfdf2914f5eb15a504c25f746e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 13:47:53 -0700 Subject: [PATCH 39/48] fix: clean up yarn --- .github/workflows/poc-e2e-flow-test.yml | 28 ++++--------------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index c7fc583506b..c176209f59d 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -14,7 +14,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] node-version: [18] - pkg-manager: [npm, yarn1, yarn3, pnpm] + pkg-manager: [npm, yarn1, yarn-stable, pnpm] exclude: - os: windows-latest pkg-manager: bun # bun only have limit support on windows @@ -31,7 +31,7 @@ jobs: shell: bash run: npm run install:local && npm run build && npm run vend - name: ${{matrix.pkg-manager}}-create-amplify-project - if: matrix.pkg-manager != 'yarn1' && matrix.pkg-manager != 'yarn3' + if: matrix.pkg-manager != 'yarn-stable' shell: bash run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project @@ -41,29 +41,9 @@ jobs: echo "$(${{matrix.pkg-manager}}) config get registry" ${{matrix.pkg-manager}} config get registry PACKAGE_MANAGER_EXECUTABLE=${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify --yes - - name: ${{matrix.pkg-manager}}-create-amplify-project-step1-install - continue-on-error: true - if: matrix.pkg-manager == 'yarn1' - shell: bash - run: | # yarn1 create amplify doesn't work with @ahpha tag - mkdir -p /tmp/amplify-project; cd /tmp/amplify-project - echo "yarn config set registry http://localhost:4873" - yarn config set registry http://localhost:4873 - PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify --yes - - - name: yarn1-create-amplify-project-step2-setup-not-win - if: ${{matrix.pkg-manager == 'yarn1' && matrix.os != 'windows-latest'}} - shell: bash - run: | - /usr/local/bin/create-amplify - - name: yarn1-create-amplify-project-step2-setup-win - if: ${{matrix.pkg-manager == 'yarn1' && matrix.os == 'windows-latest'}} - shell: bash - run: | - PACKAGE_MANAGER_EXECUTABLE=yarn C:\\npm\\prefix\\bin\\create-amplify --yes - - name: yarn3-create-amplify-project-step1-install - if: matrix.pkg-manager == 'yarn3' + - name: yarn-stable-create-amplify-project-step1-install + if: matrix.pkg-manager == 'yarn-stable' shell: bash run: | mkdir -p /tmp/amplify-project; cd /tmp/amplify-project From a57454122b58d83555d0860ae07dcb7bb14d6773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 14:49:09 -0700 Subject: [PATCH 40/48] fix: change yarn1 to yarn --- .github/workflows/poc-e2e-flow-test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index c176209f59d..60874b33af6 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -14,10 +14,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] node-version: [18] - pkg-manager: [npm, yarn1, yarn-stable, pnpm] - exclude: - - os: windows-latest - pkg-manager: bun # bun only have limit support on windows + pkg-manager: [npm, yarn, yarn-stable, pnpm] runs-on: ${{ matrix.os }} steps: - name: Checkout aws-amplify/amplify-cli repo From 73ff6073b033d6b719e824389b5981af6ba5ce24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 15:12:46 -0700 Subject: [PATCH 41/48] chore: rename yarn step --- .github/workflows/poc-e2e-flow-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 60874b33af6..261acefc7be 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -39,7 +39,7 @@ jobs: ${{matrix.pkg-manager}} config get registry PACKAGE_MANAGER_EXECUTABLE=${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify --yes - - name: yarn-stable-create-amplify-project-step1-install + - name: yarn-stable-create-amplify-project if: matrix.pkg-manager == 'yarn-stable' shell: bash run: | From 00b9499beab2ba9e99967900858754e6cd523d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 15:17:47 -0700 Subject: [PATCH 42/48] chore: use env --- .github/workflows/poc-e2e-flow-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 261acefc7be..fdc4fd23de4 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -16,6 +16,8 @@ jobs: node-version: [18] pkg-manager: [npm, yarn, yarn-stable, pnpm] runs-on: ${{ matrix.os }} + env: + PACKAGE_MANAGER_EXECUTABLE: ${{ matrix.pkg-manager }} # TODO: remove PACKAGE_MANAGER_EXECUTABLE once CLI is able to getPackageManager(). steps: - name: Checkout aws-amplify/amplify-cli repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1. TODO: try only fetch .github/workflow @@ -37,7 +39,7 @@ jobs: ${{matrix.pkg-manager}} config set registry http://localhost:4873 echo "$(${{matrix.pkg-manager}}) config get registry" ${{matrix.pkg-manager}} config get registry - PACKAGE_MANAGER_EXECUTABLE=${{matrix.pkg-manager}} ${{matrix.pkg-manager}} create amplify --yes + ${{matrix.pkg-manager}} create amplify --yes - name: yarn-stable-create-amplify-project if: matrix.pkg-manager == 'yarn-stable' @@ -50,4 +52,4 @@ jobs: echo "yarn version $(yarn --version)" yarn config set unsafeHttpWhitelist localhost yarn config set npmRegistryServer http://localhost:4873 - PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify --yes + yarn create amplify --yes From fbf5b1a5b496d7b49607a3acdebd2fde673525bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 15:38:47 -0700 Subject: [PATCH 43/48] fix: yarn-stable env var --- .github/workflows/poc-e2e-flow-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index fdc4fd23de4..1cbeb3afa80 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -52,4 +52,4 @@ jobs: echo "yarn version $(yarn --version)" yarn config set unsafeHttpWhitelist localhost yarn config set npmRegistryServer http://localhost:4873 - yarn create amplify --yes + PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify --yes From 9c6d8a6d7d472583757dea67cef8d4e411f441e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Mon, 30 Oct 2023 15:48:12 -0700 Subject: [PATCH 44/48] add comments --- .github/workflows/poc-e2e-flow-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 1cbeb3afa80..29d331c92da 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -2,7 +2,7 @@ name: 'poc-e2e-flow-test' -on: +on: # TODO: need to change the trigger push: branches: - poc/e2e-test From 633ec61e87da9bf545fd1e4d540ef883b9f5c855 Mon Sep 17 00:00:00 2001 From: Amplifiyer <51211245+Amplifiyer@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:35:48 +0100 Subject: [PATCH 45/48] chore: update sample app with new imports (#541) --- .../simple_react/amplify/auth/resource.ts | 2 +- examples/simple_react/amplify/backend.ts | 4 +- .../simple_react/amplify/data/resource.ts | 2 +- package-lock.json | 320 +++++++++--------- 4 files changed, 164 insertions(+), 164 deletions(-) diff --git a/examples/simple_react/amplify/auth/resource.ts b/examples/simple_react/amplify/auth/resource.ts index e21daa45530..cd2d8595084 100644 --- a/examples/simple_react/amplify/auth/resource.ts +++ b/examples/simple_react/amplify/auth/resource.ts @@ -1,4 +1,4 @@ -import { defineAuth } from '@aws-amplify/backend-auth'; +import { defineAuth } from '@aws-amplify/backend'; export const auth = defineAuth({ loginWith: { diff --git a/examples/simple_react/amplify/backend.ts b/examples/simple_react/amplify/backend.ts index 7e5c96bfa5c..56375d22c40 100644 --- a/examples/simple_react/amplify/backend.ts +++ b/examples/simple_react/amplify/backend.ts @@ -1,8 +1,8 @@ -import { Backend } from '@aws-amplify/backend'; +import { defineBackend } from '@aws-amplify/backend'; import { auth } from './auth/resource.js'; import { data } from './data/resource.js'; -new Backend({ +defineBackend({ auth, data, }); diff --git a/examples/simple_react/amplify/data/resource.ts b/examples/simple_react/amplify/data/resource.ts index f45931f5cf4..031e65110a5 100644 --- a/examples/simple_react/amplify/data/resource.ts +++ b/examples/simple_react/amplify/data/resource.ts @@ -1,4 +1,4 @@ -import { defineData } from '@aws-amplify/backend-graphql'; +import { defineData } from '@aws-amplify/backend'; const schema = ` type Todo @model @auth(rules: [{ allow: private }]) { diff --git a/package-lock.json b/package-lock.json index 61715c90869..49af3918f6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19374,12 +19374,12 @@ }, "packages/auth-construct": { "name": "@aws-amplify/auth-construct-alpha", - "version": "0.2.0-alpha.18", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-output-storage": "^0.2.0", + "@aws-amplify/plugin-types": "^0.2.0" }, "peerDependencies": { "aws-cdk-lib": "^2.103.0", @@ -19388,19 +19388,19 @@ }, "packages/backend": { "name": "@aws-amplify/backend", - "version": "0.2.0-alpha.12", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { "@aws-amplify/amplify-api-next-alpha": "^0.6.2", - "@aws-amplify/backend-auth": "^0.2.0-alpha.15", - "@aws-amplify/backend-function": "^0.1.1-alpha.11", - "@aws-amplify/backend-graphql": "^0.2.0-alpha.13", - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6", - "@aws-amplify/backend-secret": "^0.2.0-alpha.5", - "@aws-amplify/backend-storage": "^0.2.0-alpha.10", - "@aws-amplify/platform-core": "^0.1.1-alpha.4", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/backend-auth": "^0.2.0", + "@aws-amplify/backend-function": "^0.1.1", + "@aws-amplify/backend-graphql": "^0.2.0", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-output-storage": "^0.2.0", + "@aws-amplify/backend-secret": "^0.2.0", + "@aws-amplify/backend-storage": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1", + "@aws-amplify/plugin-types": "^0.2.0" }, "devDependencies": { "@types/aws-lambda": "^8.10.119", @@ -19413,15 +19413,15 @@ }, "packages/backend-auth": { "name": "@aws-amplify/backend-auth", - "version": "0.2.0-alpha.15", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/auth-construct-alpha": "^0.2.0-alpha.18", - "@aws-amplify/backend-output-storage": "0.2.0-alpha.6", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/auth-construct-alpha": "^0.2.0", + "@aws-amplify/backend-output-storage": "0.2.0", + "@aws-amplify/plugin-types": "^0.2.0" }, "devDependencies": { - "@aws-amplify/backend-platform-test-stubs": "^0.1.0" + "@aws-amplify/backend-platform-test-stubs": "^0.1.1" }, "peerDependencies": { "aws-cdk-lib": "^2.103.0", @@ -19430,11 +19430,11 @@ }, "packages/backend-deployer": { "name": "@aws-amplify/backend-deployer", - "version": "0.2.0-alpha.11", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/platform-core": "^0.1.1-alpha.3", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11", + "@aws-amplify/platform-core": "^0.1.1", + "@aws-amplify/plugin-types": "^0.2.0", "execa": "^7.2.0", "tsx": "^3.12.6" }, @@ -19445,16 +19445,16 @@ }, "packages/backend-function": { "name": "@aws-amplify/backend-function", - "version": "0.1.1-alpha.11", + "version": "0.1.1", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-storage": "0.2.0-alpha.6", - "@aws-amplify/function-construct-alpha": "^0.2.0-alpha.7", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11", + "@aws-amplify/backend-output-storage": "0.2.0", + "@aws-amplify/function-construct-alpha": "^0.2.0", + "@aws-amplify/plugin-types": "^0.2.0", "execa": "^7.1.1" }, "devDependencies": { - "@aws-amplify/backend-platform-test-stubs": "^0.1.0" + "@aws-amplify/backend-platform-test-stubs": "^0.1.1" }, "peerDependencies": { "aws-cdk-lib": "^2.103.0", @@ -19463,17 +19463,17 @@ }, "packages/backend-graphql": { "name": "@aws-amplify/backend-graphql", - "version": "0.2.0-alpha.13", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { "@aws-amplify/amplify-api-next-types-alpha": "^0.0.4", - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/backend-output-storage": "0.2.0-alpha.6", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-output-storage": "0.2.0", "@aws-amplify/graphql-api-construct": "^1.1.4", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/plugin-types": "^0.2.0" }, "devDependencies": { - "@aws-amplify/backend-platform-test-stubs": "^0.1.0" + "@aws-amplify/backend-platform-test-stubs": "^0.1.1" }, "peerDependencies": { "aws-cdk-lib": "^2.103.0", @@ -19482,10 +19482,10 @@ }, "packages/backend-output-schemas": { "name": "@aws-amplify/backend-output-schemas", - "version": "0.2.0-alpha.8", + "version": "0.2.0", "license": "Apache-2.0", "devDependencies": { - "@aws-amplify/plugin-types": "0.2.0-alpha.11" + "@aws-amplify/plugin-types": "0.2.0" }, "peerDependencies": { "zod": "^3.21.4" @@ -19493,11 +19493,11 @@ }, "packages/backend-output-storage": { "name": "@aws-amplify/backend-output-storage", - "version": "0.2.0-alpha.6", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/platform-core": "^0.1.1-alpha.4" + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1" }, "peerDependencies": { "aws-cdk-lib": "^2.103.0" @@ -19505,7 +19505,7 @@ }, "packages/backend-platform-test-stubs": { "name": "@aws-amplify/backend-platform-test-stubs", - "version": "0.1.0", + "version": "0.1.1", "license": "Apache-2.0", "dependencies": { "aws-cdk-lib": "^2.100.0", @@ -19514,11 +19514,11 @@ }, "packages/backend-secret": { "name": "@aws-amplify/backend-secret", - "version": "0.2.0-alpha.6", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/platform-core": "^0.1.1-alpha.2", - "@aws-amplify/plugin-types": "^0.2.0-alpha.9", + "@aws-amplify/platform-core": "^0.1.1", + "@aws-amplify/plugin-types": "^0.2.0", "@aws-sdk/client-ssm": "^3.398.0" }, "devDependencies": { @@ -19527,15 +19527,15 @@ }, "packages/backend-storage": { "name": "@aws-amplify/backend-storage", - "version": "0.2.0-alpha.10", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11", - "@aws-amplify/storage-construct-alpha": "^0.2.0-alpha.11" + "@aws-amplify/backend-output-storage": "^0.2.0", + "@aws-amplify/plugin-types": "^0.2.0", + "@aws-amplify/storage-construct-alpha": "^0.2.0" }, "devDependencies": { - "@aws-amplify/backend-platform-test-stubs": "^0.1.0" + "@aws-amplify/backend-platform-test-stubs": "^0.1.1" }, "peerDependencies": { "aws-cdk-lib": "^2.103.0", @@ -19552,18 +19552,18 @@ }, "packages/cli": { "name": "@aws-amplify/backend-cli", - "version": "0.2.0-alpha.15", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.7", - "@aws-amplify/backend-secret": "^0.2.0-alpha.6", - "@aws-amplify/cli-core": "^0.1.0-alpha.4", - "@aws-amplify/client-config": "^0.2.0-alpha.12", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.11", - "@aws-amplify/form-generator": "^0.2.0-alpha.4", - "@aws-amplify/model-generator": "^0.2.0-alpha.7", - "@aws-amplify/platform-core": "^0.1.1-alpha.3", - "@aws-amplify/sandbox": "^0.2.0-alpha.18", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-secret": "^0.2.0", + "@aws-amplify/cli-core": "^0.1.0", + "@aws-amplify/client-config": "^0.2.0", + "@aws-amplify/deployed-backend-client": "^0.2.0", + "@aws-amplify/form-generator": "^0.2.0", + "@aws-amplify/model-generator": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1", + "@aws-amplify/sandbox": "^0.2.0", "@aws-sdk/credential-provider-ini": "^3.360.0", "@aws-sdk/credential-providers": "^3.360.0", "execa": "^7.2.0", @@ -19586,7 +19586,7 @@ }, "packages/cli-core": { "name": "@aws-amplify/cli-core", - "version": "0.1.0-alpha.4", + "version": "0.1.0", "license": "Apache-2.0", "dependencies": { "@inquirer/prompts": "^3.0.0" @@ -19694,12 +19694,12 @@ }, "packages/client-config": { "name": "@aws-amplify/client-config", - "version": "0.2.0-alpha.12", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.6", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.3", - "@aws-amplify/model-generator": "^0.2.0-alpha.5", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/deployed-backend-client": "^0.2.0", + "@aws-amplify/model-generator": "^0.2.0", "@aws-sdk/client-amplify": "^3.376.0", "@aws-sdk/client-cloudformation": "^3.376.0", "@aws-sdk/client-ssm": "^3.398.0", @@ -19721,10 +19721,10 @@ } }, "packages/create-amplify": { - "version": "0.2.0-alpha.15", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/cli-core": "^0.1.0-alpha.4", + "@aws-amplify/cli-core": "^0.1.0", "execa": "^7.2.0", "yargs": "^17.7.2" }, @@ -19847,11 +19847,11 @@ }, "packages/deployed-backend-client": { "name": "@aws-amplify/deployed-backend-client", - "version": "0.2.0-alpha.11", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/platform-core": "^0.1.1-alpha.4", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1", "@aws-sdk/client-amplify": "^3.414.0", "@aws-sdk/client-cloudformation": "^3.414.0", "@aws-sdk/client-s3": "^3.414.0", @@ -19861,7 +19861,7 @@ }, "packages/form-generator": { "name": "@aws-amplify/form-generator", - "version": "0.2.0-alpha.4", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { "@aws-amplify/appsync-modelgen-plugin": "^2.6.0", @@ -19880,10 +19880,10 @@ }, "packages/function-construct": { "name": "@aws-amplify/function-construct-alpha", - "version": "0.2.0-alpha.7", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6" + "@aws-amplify/backend-output-storage": "^0.2.0" }, "peerDependencies": { "aws-cdk-lib": "^2.103.0", @@ -19892,15 +19892,15 @@ }, "packages/integration-tests": { "name": "@aws-amplify/integration-tests", - "version": "0.2.0-alpha.10", + "version": "0.2.0", "license": "Apache-2.0", "devDependencies": { "@aws-amplify/amplify-api-next-alpha": "^0.3.2", - "@aws-amplify/backend": "0.2.0-alpha.12", - "@aws-amplify/backend-auth": "0.2.0-alpha.15", - "@aws-amplify/backend-secret": "^0.2.0-alpha.5", - "@aws-amplify/backend-storage": "0.2.0-alpha.10", - "@aws-amplify/platform-core": "^0.1.1-alpha.4", + "@aws-amplify/backend": "0.2.0", + "@aws-amplify/backend-auth": "0.2.0", + "@aws-amplify/backend-secret": "^0.2.0", + "@aws-amplify/backend-storage": "0.2.0", + "@aws-amplify/platform-core": "^0.1.1", "@aws-sdk/client-cloudformation": "^3.421.0", "execa": "^8.0.1", "fs-extra": "^11.1.1", @@ -19962,11 +19962,11 @@ }, "packages/model-generator": { "name": "@aws-amplify/model-generator", - "version": "0.2.0-alpha.7", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.5", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.11", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/deployed-backend-client": "^0.2.0", "@aws-amplify/graphql-generator": "^0.1.3", "@aws-amplify/graphql-types-generator": "^3.4.4", "@aws-sdk/client-appsync": "^3.398.0", @@ -20230,15 +20230,15 @@ }, "packages/platform-core": { "name": "@aws-amplify/platform-core", - "version": "0.1.1-alpha.4", + "version": "0.1.1", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/plugin-types": "^0.2.0-alpha.7" + "@aws-amplify/plugin-types": "^0.2.0" } }, "packages/plugin-types": { "name": "@aws-amplify/plugin-types", - "version": "0.2.0-alpha.11", + "version": "0.2.0", "license": "Apache-2.0", "peerDependencies": { "aws-cdk-lib": "^2.103.0", @@ -20247,15 +20247,15 @@ }, "packages/sandbox": { "name": "@aws-amplify/sandbox", - "version": "0.2.0-alpha.18", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-deployer": "0.2.0-alpha.11", - "@aws-amplify/backend-secret": "^0.2.0-alpha.4", - "@aws-amplify/cli-core": "^0.1.0-alpha.3", - "@aws-amplify/client-config": "0.2.0-alpha.12", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.9", - "@aws-amplify/platform-core": "^0.1.1-alpha.3", + "@aws-amplify/backend-deployer": "0.2.0", + "@aws-amplify/backend-secret": "^0.2.0", + "@aws-amplify/cli-core": "^0.1.0", + "@aws-amplify/client-config": "0.2.0", + "@aws-amplify/deployed-backend-client": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1", "@aws-sdk/client-cloudformation": "^3.421.0", "@aws-sdk/credential-providers": "^3.382.0", "@aws-sdk/types": "^3.378.0", @@ -20275,14 +20275,14 @@ }, "packages/storage-construct": { "name": "@aws-amplify/storage-construct-alpha", - "version": "0.2.0-alpha.11", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6" + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-output-storage": "^0.2.0" }, "devDependencies": { - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/plugin-types": "^0.2.0" }, "peerDependencies": { "aws-cdk-lib": "^2.103.0", @@ -20573,24 +20573,24 @@ "@aws-amplify/auth-construct-alpha": { "version": "file:packages/auth-construct", "requires": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-output-storage": "^0.2.0", + "@aws-amplify/plugin-types": "^0.2.0" } }, "@aws-amplify/backend": { "version": "file:packages/backend", "requires": { "@aws-amplify/amplify-api-next-alpha": "^0.6.2", - "@aws-amplify/backend-auth": "^0.2.0-alpha.15", - "@aws-amplify/backend-function": "^0.1.1-alpha.11", - "@aws-amplify/backend-graphql": "^0.2.0-alpha.13", - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6", - "@aws-amplify/backend-secret": "^0.2.0-alpha.5", - "@aws-amplify/backend-storage": "^0.2.0-alpha.10", - "@aws-amplify/platform-core": "^0.1.1-alpha.4", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11", + "@aws-amplify/backend-auth": "^0.2.0", + "@aws-amplify/backend-function": "^0.1.1", + "@aws-amplify/backend-graphql": "^0.2.0", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-output-storage": "^0.2.0", + "@aws-amplify/backend-secret": "^0.2.0", + "@aws-amplify/backend-storage": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1", + "@aws-amplify/plugin-types": "^0.2.0", "@types/aws-lambda": "^8.10.119", "aws-lambda": "^1.0.7" }, @@ -20608,24 +20608,24 @@ "@aws-amplify/backend-auth": { "version": "file:packages/backend-auth", "requires": { - "@aws-amplify/auth-construct-alpha": "^0.2.0-alpha.18", - "@aws-amplify/backend-output-storage": "0.2.0-alpha.6", - "@aws-amplify/backend-platform-test-stubs": "^0.1.0", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/auth-construct-alpha": "^0.2.0", + "@aws-amplify/backend-output-storage": "0.2.0", + "@aws-amplify/backend-platform-test-stubs": "^0.1.1", + "@aws-amplify/plugin-types": "^0.2.0" } }, "@aws-amplify/backend-cli": { "version": "file:packages/cli", "requires": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.7", - "@aws-amplify/backend-secret": "^0.2.0-alpha.6", - "@aws-amplify/cli-core": "^0.1.0-alpha.4", - "@aws-amplify/client-config": "^0.2.0-alpha.12", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.11", - "@aws-amplify/form-generator": "^0.2.0-alpha.4", - "@aws-amplify/model-generator": "^0.2.0-alpha.7", - "@aws-amplify/platform-core": "^0.1.1-alpha.3", - "@aws-amplify/sandbox": "^0.2.0-alpha.18", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-secret": "^0.2.0", + "@aws-amplify/cli-core": "^0.1.0", + "@aws-amplify/client-config": "^0.2.0", + "@aws-amplify/deployed-backend-client": "^0.2.0", + "@aws-amplify/form-generator": "^0.2.0", + "@aws-amplify/model-generator": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1", + "@aws-amplify/sandbox": "^0.2.0", "@aws-sdk/credential-provider-ini": "^3.360.0", "@aws-sdk/credential-providers": "^3.360.0", "@types/yargs": "^17.0.24", @@ -20700,8 +20700,8 @@ "@aws-amplify/backend-deployer": { "version": "file:packages/backend-deployer", "requires": { - "@aws-amplify/platform-core": "^0.1.1-alpha.3", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11", + "@aws-amplify/platform-core": "^0.1.1", + "@aws-amplify/plugin-types": "^0.2.0", "execa": "^7.2.0", "tsx": "^3.12.6" } @@ -20709,10 +20709,10 @@ "@aws-amplify/backend-function": { "version": "file:packages/backend-function", "requires": { - "@aws-amplify/backend-output-storage": "0.2.0-alpha.6", - "@aws-amplify/backend-platform-test-stubs": "^0.1.0", - "@aws-amplify/function-construct-alpha": "^0.2.0-alpha.7", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11", + "@aws-amplify/backend-output-storage": "0.2.0", + "@aws-amplify/backend-platform-test-stubs": "^0.1.1", + "@aws-amplify/function-construct-alpha": "^0.2.0", + "@aws-amplify/plugin-types": "^0.2.0", "execa": "^7.1.1" } }, @@ -20720,24 +20720,24 @@ "version": "file:packages/backend-graphql", "requires": { "@aws-amplify/amplify-api-next-types-alpha": "^0.0.4", - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/backend-output-storage": "0.2.0-alpha.6", - "@aws-amplify/backend-platform-test-stubs": "^0.1.0", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-output-storage": "0.2.0", + "@aws-amplify/backend-platform-test-stubs": "^0.1.1", "@aws-amplify/graphql-api-construct": "^1.1.4", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/plugin-types": "^0.2.0" } }, "@aws-amplify/backend-output-schemas": { "version": "file:packages/backend-output-schemas", "requires": { - "@aws-amplify/plugin-types": "0.2.0-alpha.11" + "@aws-amplify/plugin-types": "0.2.0" } }, "@aws-amplify/backend-output-storage": { "version": "file:packages/backend-output-storage", "requires": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/platform-core": "^0.1.1-alpha.4" + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1" } }, "@aws-amplify/backend-platform-test-stubs": { @@ -20750,8 +20750,8 @@ "@aws-amplify/backend-secret": { "version": "file:packages/backend-secret", "requires": { - "@aws-amplify/platform-core": "^0.1.1-alpha.2", - "@aws-amplify/plugin-types": "^0.2.0-alpha.9", + "@aws-amplify/platform-core": "^0.1.1", + "@aws-amplify/plugin-types": "^0.2.0", "@aws-sdk/client-ssm": "^3.398.0", "@aws-sdk/types": "^3.370.0" } @@ -20759,10 +20759,10 @@ "@aws-amplify/backend-storage": { "version": "file:packages/backend-storage", "requires": { - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6", - "@aws-amplify/backend-platform-test-stubs": "^0.1.0", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11", - "@aws-amplify/storage-construct-alpha": "^0.2.0-alpha.11" + "@aws-amplify/backend-output-storage": "^0.2.0", + "@aws-amplify/backend-platform-test-stubs": "^0.1.1", + "@aws-amplify/plugin-types": "^0.2.0", + "@aws-amplify/storage-construct-alpha": "^0.2.0" } }, "@aws-amplify/cli-core": { @@ -20774,9 +20774,9 @@ "@aws-amplify/client-config": { "version": "file:packages/client-config", "requires": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.6", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.3", - "@aws-amplify/model-generator": "^0.2.0-alpha.5", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/deployed-backend-client": "^0.2.0", + "@aws-amplify/model-generator": "^0.2.0", "@aws-sdk/client-amplify": "^3.376.0", "@aws-sdk/client-cloudformation": "^3.376.0", "@aws-sdk/client-ssm": "^3.398.0", @@ -20823,8 +20823,8 @@ "@aws-amplify/deployed-backend-client": { "version": "file:packages/deployed-backend-client", "requires": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/platform-core": "^0.1.1-alpha.4", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1", "@aws-sdk/client-amplify": "^3.414.0", "@aws-sdk/client-cloudformation": "^3.414.0", "@aws-sdk/client-s3": "^3.414.0", @@ -20852,7 +20852,7 @@ "@aws-amplify/function-construct-alpha": { "version": "file:packages/function-construct", "requires": { - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6" + "@aws-amplify/backend-output-storage": "^0.2.0" } }, "@aws-amplify/graphql-api-construct": { @@ -21592,11 +21592,11 @@ "version": "file:packages/integration-tests", "requires": { "@aws-amplify/amplify-api-next-alpha": "^0.3.2", - "@aws-amplify/backend": "0.2.0-alpha.12", - "@aws-amplify/backend-auth": "0.2.0-alpha.15", - "@aws-amplify/backend-secret": "^0.2.0-alpha.5", - "@aws-amplify/backend-storage": "0.2.0-alpha.10", - "@aws-amplify/platform-core": "^0.1.1-alpha.4", + "@aws-amplify/backend": "0.2.0", + "@aws-amplify/backend-auth": "0.2.0", + "@aws-amplify/backend-secret": "^0.2.0", + "@aws-amplify/backend-storage": "0.2.0", + "@aws-amplify/platform-core": "^0.1.1", "@aws-sdk/client-cloudformation": "^3.421.0", "execa": "^8.0.1", "fs-extra": "^11.1.1", @@ -21637,8 +21637,8 @@ "@aws-amplify/model-generator": { "version": "file:packages/model-generator", "requires": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.5", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.11", + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/deployed-backend-client": "^0.2.0", "@aws-amplify/graphql-generator": "^0.1.3", "@aws-amplify/graphql-types-generator": "^3.4.4", "@aws-sdk/client-appsync": "^3.398.0", @@ -21846,7 +21846,7 @@ "@aws-amplify/platform-core": { "version": "file:packages/platform-core", "requires": { - "@aws-amplify/plugin-types": "^0.2.0-alpha.7" + "@aws-amplify/plugin-types": "^0.2.0" } }, "@aws-amplify/plugin-types": { @@ -21856,12 +21856,12 @@ "@aws-amplify/sandbox": { "version": "file:packages/sandbox", "requires": { - "@aws-amplify/backend-deployer": "0.2.0-alpha.11", - "@aws-amplify/backend-secret": "^0.2.0-alpha.4", - "@aws-amplify/cli-core": "^0.1.0-alpha.3", - "@aws-amplify/client-config": "0.2.0-alpha.12", - "@aws-amplify/deployed-backend-client": "^0.2.0-alpha.9", - "@aws-amplify/platform-core": "^0.1.1-alpha.3", + "@aws-amplify/backend-deployer": "0.2.0", + "@aws-amplify/backend-secret": "^0.2.0", + "@aws-amplify/cli-core": "^0.1.0", + "@aws-amplify/client-config": "0.2.0", + "@aws-amplify/deployed-backend-client": "^0.2.0", + "@aws-amplify/platform-core": "^0.1.1", "@aws-sdk/client-cloudformation": "^3.421.0", "@aws-sdk/credential-providers": "^3.382.0", "@aws-sdk/types": "^3.378.0", @@ -21877,9 +21877,9 @@ "@aws-amplify/storage-construct-alpha": { "version": "file:packages/storage-construct", "requires": { - "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.8", - "@aws-amplify/backend-output-storage": "^0.2.0-alpha.6", - "@aws-amplify/plugin-types": "^0.2.0-alpha.11" + "@aws-amplify/backend-output-schemas": "^0.2.0", + "@aws-amplify/backend-output-storage": "^0.2.0", + "@aws-amplify/plugin-types": "^0.2.0" } }, "@aws-cdk/asset-awscli-v1": { @@ -28740,7 +28740,7 @@ "create-amplify": { "version": "file:packages/create-amplify", "requires": { - "@aws-amplify/cli-core": "^0.1.0-alpha.4", + "@aws-amplify/cli-core": "^0.1.0", "execa": "^7.2.0", "yargs": "^17.7.2" }, From 863dc2417e1e9fdddcd14b834308cf468f0c7a3d Mon Sep 17 00:00:00 2001 From: Spencer Stolworthy Date: Tue, 31 Oct 2023 10:50:02 -0700 Subject: [PATCH 46/48] feat: use "use client"; directive in generated react components (#540) --- .changeset/fuzzy-cooks-battle.md | 5 +++ package-lock.json | 32 +++++++++---------- packages/form-generator/package.json | 2 +- .../local_codegen_graphql_form_generator.ts | 1 + 4 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 .changeset/fuzzy-cooks-battle.md diff --git a/.changeset/fuzzy-cooks-battle.md b/.changeset/fuzzy-cooks-battle.md new file mode 100644 index 00000000000..896e97a49fa --- /dev/null +++ b/.changeset/fuzzy-cooks-battle.md @@ -0,0 +1,5 @@ +--- +'@aws-amplify/form-generator': minor +--- + +Use "use client"; directive in generated React components diff --git a/package-lock.json b/package-lock.json index 49af3918f6b..c6666945094 100644 --- a/package-lock.json +++ b/package-lock.json @@ -470,20 +470,20 @@ "link": true }, "node_modules/@aws-amplify/codegen-ui": { - "version": "2.19.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/codegen-ui/-/codegen-ui-2.19.1.tgz", - "integrity": "sha512-tmjJr3XXWpRSiqBbBrPg+PlYRafJL8Uk48e424scMsfmlmIIJbeb/FTcwi8aB7rihvgFwe/Z4pCS5OU9gnBciQ==", + "version": "2.19.3", + "resolved": "https://registry.npmjs.org/@aws-amplify/codegen-ui/-/codegen-ui-2.19.3.tgz", + "integrity": "sha512-Ny9y8QG8BrSDxRlwWoSxxaICyY0PZtvlvOKclDjz3yE6hy3AXA/hzInFA3O3zY1qJ6HQNUQ83+atzJuiBvfT+w==", "dependencies": { "change-case": "^4.1.2", "yup": "^0.32.11" } }, "node_modules/@aws-amplify/codegen-ui-react": { - "version": "2.19.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/codegen-ui-react/-/codegen-ui-react-2.19.1.tgz", - "integrity": "sha512-ufnwMF7p3Qi+LiLeCsqrM43LfHWZcuJ23SheXjI9Jmv07Kqeh82k+KNukV5M4pMGJupJdHGQj5ShpV2/91Mk5A==", + "version": "2.19.3", + "resolved": "https://registry.npmjs.org/@aws-amplify/codegen-ui-react/-/codegen-ui-react-2.19.3.tgz", + "integrity": "sha512-u/XlznCqD3oXTgmSO7amK+j6nvrypyzbWmQMXSIEqFHaPPipuU4i2fDmY2fSizRn+GZWa0/+8odBBJ1oGX9dag==", "dependencies": { - "@aws-amplify/codegen-ui": "2.19.1", + "@aws-amplify/codegen-ui": "2.19.3", "@typescript/vfs": "~1.3.5", "pluralize": "^8.0.0", "semver": "^7.5.4", @@ -19866,7 +19866,7 @@ "dependencies": { "@aws-amplify/appsync-modelgen-plugin": "^2.6.0", "@aws-amplify/codegen-ui": "^2.19.1", - "@aws-amplify/codegen-ui-react": "^2.19.1", + "@aws-amplify/codegen-ui-react": "^2.19.3", "@aws-amplify/graphql-docs-generator": "^4.1.0", "@aws-sdk/client-amplifyuibuilder": "^3.398.0", "@aws-sdk/client-appsync": "^3.398.0", @@ -20786,20 +20786,20 @@ } }, "@aws-amplify/codegen-ui": { - "version": "2.19.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/codegen-ui/-/codegen-ui-2.19.1.tgz", - "integrity": "sha512-tmjJr3XXWpRSiqBbBrPg+PlYRafJL8Uk48e424scMsfmlmIIJbeb/FTcwi8aB7rihvgFwe/Z4pCS5OU9gnBciQ==", + "version": "2.19.3", + "resolved": "https://registry.npmjs.org/@aws-amplify/codegen-ui/-/codegen-ui-2.19.3.tgz", + "integrity": "sha512-Ny9y8QG8BrSDxRlwWoSxxaICyY0PZtvlvOKclDjz3yE6hy3AXA/hzInFA3O3zY1qJ6HQNUQ83+atzJuiBvfT+w==", "requires": { "change-case": "^4.1.2", "yup": "^0.32.11" } }, "@aws-amplify/codegen-ui-react": { - "version": "2.19.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/codegen-ui-react/-/codegen-ui-react-2.19.1.tgz", - "integrity": "sha512-ufnwMF7p3Qi+LiLeCsqrM43LfHWZcuJ23SheXjI9Jmv07Kqeh82k+KNukV5M4pMGJupJdHGQj5ShpV2/91Mk5A==", + "version": "2.19.3", + "resolved": "https://registry.npmjs.org/@aws-amplify/codegen-ui-react/-/codegen-ui-react-2.19.3.tgz", + "integrity": "sha512-u/XlznCqD3oXTgmSO7amK+j6nvrypyzbWmQMXSIEqFHaPPipuU4i2fDmY2fSizRn+GZWa0/+8odBBJ1oGX9dag==", "requires": { - "@aws-amplify/codegen-ui": "2.19.1", + "@aws-amplify/codegen-ui": "2.19.3", "@typescript/vfs": "~1.3.5", "pluralize": "^8.0.0", "prettier": "2.3.2", @@ -20837,7 +20837,7 @@ "requires": { "@aws-amplify/appsync-modelgen-plugin": "^2.6.0", "@aws-amplify/codegen-ui": "^2.19.1", - "@aws-amplify/codegen-ui-react": "^2.19.1", + "@aws-amplify/codegen-ui-react": "^2.19.3", "@aws-amplify/graphql-docs-generator": "^4.1.0", "@aws-sdk/client-amplifyuibuilder": "^3.398.0", "@aws-sdk/client-appsync": "^3.398.0", diff --git a/packages/form-generator/package.json b/packages/form-generator/package.json index 4acb7f4adb4..a4d0f883ab7 100644 --- a/packages/form-generator/package.json +++ b/packages/form-generator/package.json @@ -20,7 +20,7 @@ "dependencies": { "@aws-amplify/appsync-modelgen-plugin": "^2.6.0", "@aws-amplify/codegen-ui": "^2.19.1", - "@aws-amplify/codegen-ui-react": "^2.19.1", + "@aws-amplify/codegen-ui-react": "^2.19.3", "@aws-amplify/graphql-docs-generator": "^4.1.0", "@aws-sdk/client-amplifyuibuilder": "^3.398.0", "@aws-sdk/client-appsync": "^3.398.0", diff --git a/packages/form-generator/src/local_codegen_graphql_form_generator.ts b/packages/form-generator/src/local_codegen_graphql_form_generator.ts index e5b5ebd6ba6..2a2d0be1b34 100644 --- a/packages/form-generator/src/local_codegen_graphql_form_generator.ts +++ b/packages/form-generator/src/local_codegen_graphql_form_generator.ts @@ -94,6 +94,7 @@ export class LocalGraphqlFormGenerator implements GraphqlFormGenerator { module: ModuleKind.ES2020, target: ScriptTarget.ES2020, script: ScriptKind.JSX, + includeUseClientDirective: true, renderTypeDeclarations: true, apiConfiguration: { dataApi: 'GraphQL', From d0119b25b63d6795faced80e226f45d81cb9d57a Mon Sep 17 00:00:00 2001 From: awsluja <110861985+awsluja@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:54:28 -0700 Subject: [PATCH 47/48] fix: flatten prop types auth (#534) * fix: flatten auth login with types * chore: update snapshots * chore: update api * chore: add changeset --- .changeset/good-suns-rescue.md | 7 +++ packages/auth-construct/API.md | 17 ++---- packages/auth-construct/src/index.ts | 2 - packages/auth-construct/src/types.ts | 55 ++++++++----------- packages/backend-auth/API.md | 11 +--- .../src/translate_auth_props.test.ts | 12 ++-- .../backend-auth/src/translate_auth_props.ts | 9 ++- packages/backend-auth/src/types.ts | 18 +++--- ...ify-testAppId-testBranchName.template.json | 2 +- ...ranchNameauth8722F3FC.nested.template.json | 12 ++-- 10 files changed, 59 insertions(+), 86 deletions(-) create mode 100644 .changeset/good-suns-rescue.md diff --git a/.changeset/good-suns-rescue.md b/.changeset/good-suns-rescue.md new file mode 100644 index 00000000000..8889bb037d4 --- /dev/null +++ b/.changeset/good-suns-rescue.md @@ -0,0 +1,7 @@ +--- +'@aws-amplify/integration-tests': patch +'@aws-amplify/auth-construct-alpha': patch +'@aws-amplify/backend-auth': patch +--- + +Flatten loginWith type to improve autocompletion. diff --git a/packages/auth-construct/API.md b/packages/auth-construct/API.md index 72540a748c4..afd6c6f0fdc 100644 --- a/packages/auth-construct/API.md +++ b/packages/auth-construct/API.md @@ -30,19 +30,17 @@ export type AppleProviderProps = Omit; }; -// @public -export type BasicLoginOptions = { - email?: EmailLogin; - phone?: PhoneNumberLogin; -}; - // @public export type EmailLogin = true | EmailLoginSettings; @@ -66,11 +64,6 @@ export type ExternalProviderOptions = { logoutUrls?: string[]; }; -// @public -export type ExternalProviderProps = { - externalProviders?: ExternalProviderOptions; -}; - // @public export type FacebookProviderProps = Omit; diff --git a/packages/auth-construct/src/index.ts b/packages/auth-construct/src/index.ts index 21efbd44eb4..f1416ee72da 100644 --- a/packages/auth-construct/src/index.ts +++ b/packages/auth-construct/src/index.ts @@ -1,6 +1,5 @@ export { AuthProps, - BasicLoginOptions, EmailLogin, EmailLoginSettings, GoogleProviderProps, @@ -10,7 +9,6 @@ export { OidcProviderProps, SamlProviderProps, ExternalProviderOptions, - ExternalProviderProps, MFA, MFASettings, PhoneNumberLogin, diff --git a/packages/auth-construct/src/types.ts b/packages/auth-construct/src/types.ts index 79809191d0c..892160d1798 100644 --- a/packages/auth-construct/src/types.ts +++ b/packages/auth-construct/src/types.ts @@ -52,26 +52,6 @@ export type PhoneNumberLogin = */ verificationMessage?: (code: string) => string; }; -/** - * Basic login options require at least email or phone number. - * Additional settings may be configured, such as email messages or sms verification messages. - */ -export type BasicLoginOptions = { - /** - * Email login options. - * - * If true, email login will be enabled with default settings. - * If settings are provided, email login will be enabled with the specified settings. - */ - email?: EmailLogin; - /** - * Phone number login options. - * - * If true, phone number login will be enabled with default settings. - * If settings are provided, phone number login will be enabled with the specified settings. - */ - phone?: PhoneNumberLogin; -}; /** * Configure the MFA types that users can use. Ignored if MFA mode is set to OFF. @@ -207,16 +187,6 @@ export type ExternalProviderOptions = { logoutUrls?: string[]; }; -/** - * External auth provider. - */ -export type ExternalProviderProps = { - /** - * Configure OAuth, OIDC, and SAML login providers - */ - externalProviders?: ExternalProviderOptions; -}; - /** * Union type of all supported auth trigger events */ @@ -227,9 +197,28 @@ export type TriggerEvent = (typeof triggerEvents)[number]; */ export type AuthProps = { /** - * Specify the allowed login mechanisms - */ - loginWith: BasicLoginOptions & ExternalProviderProps; + * Specify how you would like users to log in. You can choose from email, phone, and even external providers such as LoginWithAmazon. + */ + loginWith: { + /** + * Email login options. + * + * If true, email login will be enabled with default settings. + * If settings are provided, email login will be enabled with the specified settings. + */ + email?: EmailLogin; + /** + * Phone number login options. + * + * If true, phone number login will be enabled with default settings. + * If settings are provided, phone number login will be enabled with the specified settings. + */ + phone?: PhoneNumberLogin; + /** + * Configure OAuth, OIDC, and SAML login providers + */ + externalProviders?: ExternalProviderOptions; + }; /** * The set of attributes that are required for every user in the user pool. Read more on attributes here - https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html * @default - email/phone will be added as required user attributes if they are included as login methods diff --git a/packages/backend-auth/API.md b/packages/backend-auth/API.md index 8ff7244649b..ed3ca76abe3 100644 --- a/packages/backend-auth/API.md +++ b/packages/backend-auth/API.md @@ -10,10 +10,8 @@ import { AppleProviderProps } from '@aws-amplify/auth-construct-alpha'; import { AuthProps } from '@aws-amplify/auth-construct-alpha'; import { AuthResources } from '@aws-amplify/plugin-types'; import { BackendSecret } from '@aws-amplify/plugin-types'; -import { BasicLoginOptions } from '@aws-amplify/auth-construct-alpha'; import { ConstructFactory } from '@aws-amplify/plugin-types'; import { ExternalProviderOptions } from '@aws-amplify/auth-construct-alpha'; -import { ExternalProviderProps } from '@aws-amplify/auth-construct-alpha'; import { FacebookProviderProps } from '@aws-amplify/auth-construct-alpha'; import { FunctionResources } from '@aws-amplify/plugin-types'; import { GoogleProviderProps } from '@aws-amplify/auth-construct-alpha'; @@ -41,16 +39,13 @@ export type AppleProviderFactoryProps = Omit & { + externalProviders?: ExternalProviderSpecificFactoryProps; +}; // @public export const defineAuth: (props: AmplifyAuthFactoryProps) => ConstructFactory>; -// @public -export type ExternalProviderFactoryProps = Omit & { - externalProviders?: ExternalProviderSpecificFactoryProps; -}; - // @public export type ExternalProviderGeneralFactoryProps = Omit; diff --git a/packages/backend-auth/src/translate_auth_props.test.ts b/packages/backend-auth/src/translate_auth_props.test.ts index 1c0480e6ffe..c91f9c67ac1 100644 --- a/packages/backend-auth/src/translate_auth_props.test.ts +++ b/packages/backend-auth/src/translate_auth_props.test.ts @@ -6,11 +6,7 @@ import { import { describe, it } from 'node:test'; import { AuthLoginWithFactoryProps } from './types.js'; import { Construct } from 'constructs'; -import { - BasicLoginOptions, - ExternalProviderProps, - PhoneNumberLogin, -} from '@aws-amplify/auth-construct-alpha'; +import { AuthProps, PhoneNumberLogin } from '@aws-amplify/auth-construct-alpha'; import { SecretValue } from 'aws-cdk-lib'; import assert from 'node:assert'; import { translateToAuthConstructLoginWith } from './translate_auth_props.js'; @@ -91,7 +87,7 @@ void describe('translateToAuthConstructLoginWith', () => { backendResolver ); - const expected: BasicLoginOptions & ExternalProviderProps = { + const expected: AuthProps['loginWith'] = { phone, externalProviders: { google: { @@ -136,7 +132,7 @@ void describe('translateToAuthConstructLoginWith', () => { backendResolver ); - const expected: BasicLoginOptions & ExternalProviderProps = { + const expected: AuthProps['loginWith'] = { phone, externalProviders: { callbackUrls: callbackUrls, @@ -155,7 +151,7 @@ void describe('translateToAuthConstructLoginWith', () => { backendResolver ); - const expected: BasicLoginOptions & ExternalProviderProps = { + const expected: AuthProps['loginWith'] = { phone, }; assert.deepStrictEqual(translated, expected); diff --git a/packages/backend-auth/src/translate_auth_props.ts b/packages/backend-auth/src/translate_auth_props.ts index fa620f9f96d..60da0d466ba 100644 --- a/packages/backend-auth/src/translate_auth_props.ts +++ b/packages/backend-auth/src/translate_auth_props.ts @@ -1,8 +1,7 @@ import { AmazonProviderProps, AppleProviderProps, - BasicLoginOptions, - ExternalProviderProps, + AuthProps, FacebookProviderProps, GoogleProviderProps, OidcProviderProps, @@ -26,9 +25,9 @@ import { export const translateToAuthConstructLoginWith = ( authFactoryLoginWith: AuthLoginWithFactoryProps, backendSecretResolver: BackendSecretResolver -): BasicLoginOptions & ExternalProviderProps => { - const result: BasicLoginOptions & ExternalProviderProps = - authFactoryLoginWith as BasicLoginOptions; +): AuthProps['loginWith'] => { + const result: AuthProps['loginWith'] = + authFactoryLoginWith as AuthProps['loginWith']; if (!authFactoryLoginWith.externalProviders) { return result; } diff --git a/packages/backend-auth/src/types.ts b/packages/backend-auth/src/types.ts index 28d448a3385..a78497149f2 100644 --- a/packages/backend-auth/src/types.ts +++ b/packages/backend-auth/src/types.ts @@ -1,9 +1,8 @@ import { AmazonProviderProps, AppleProviderProps, - BasicLoginOptions, + AuthProps, ExternalProviderOptions, - ExternalProviderProps, FacebookProviderProps, GoogleProviderProps, OidcProviderProps, @@ -133,17 +132,14 @@ export type ExternalProviderSpecificFactoryProps = }; /** - * External provider properties. + * Auth factory loginWith attribute. */ -export type ExternalProviderFactoryProps = Omit< - ExternalProviderProps, +export type AuthLoginWithFactoryProps = Omit< + AuthProps['loginWith'], 'externalProviders' > & { + /** + * External provider properties. + */ externalProviders?: ExternalProviderSpecificFactoryProps; }; - -/** - * Auth factory loginWith attribute. - */ -export type AuthLoginWithFactoryProps = BasicLoginOptions & - ExternalProviderFactoryProps; diff --git a/packages/integration-tests/test-projects/data-storage-auth-with-triggers/expected-cdk-out/amplify-testAppId-testBranchName.template.json b/packages/integration-tests/test-projects/data-storage-auth-with-triggers/expected-cdk-out/amplify-testAppId-testBranchName.template.json index e83c06b4840..48586fd7b85 100644 --- a/packages/integration-tests/test-projects/data-storage-auth-with-triggers/expected-cdk-out/amplify-testAppId-testBranchName.template.json +++ b/packages/integration-tests/test-projects/data-storage-auth-with-triggers/expected-cdk-out/amplify-testAppId-testBranchName.template.json @@ -181,7 +181,7 @@ { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "/6ba9f860a2dc910090281e5a118e15a973a885091f83213d560125a18786aa31.json" + "/f0d3060f91da8f5b8062d42780fd3fba7c2b533136e30e7880ac9fc32efdf58c.json" ] ] } diff --git a/packages/integration-tests/test-projects/data-storage-auth-with-triggers/expected-cdk-out/amplifytestAppIdtestBranchNameauth8722F3FC.nested.template.json b/packages/integration-tests/test-projects/data-storage-auth-with-triggers/expected-cdk-out/amplifytestAppIdtestBranchNameauth8722F3FC.nested.template.json index 5610568f21e..177fee55592 100644 --- a/packages/integration-tests/test-projects/data-storage-auth-with-triggers/expected-cdk-out/amplifytestAppIdtestBranchNameauth8722F3FC.nested.template.json +++ b/packages/integration-tests/test-projects/data-storage-auth-with-triggers/expected-cdk-out/amplifytestAppIdtestBranchNameauth8722F3FC.nested.template.json @@ -205,7 +205,7 @@ "backendId": "testAppId", "branchName": "testBranchName", "secretName": "testAmazonId", - "secretLastUpdated": 1698693218594 + "secretLastUpdated": 1698712367508 }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -222,7 +222,7 @@ "backendId": "testAppId", "branchName": "testBranchName", "secretName": "testAmazonSecret", - "secretLastUpdated": 1698693218595 + "secretLastUpdated": 1698712367509 }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -239,7 +239,7 @@ "backendId": "testAppId", "branchName": "testBranchName", "secretName": "testFacebookId", - "secretLastUpdated": 1698693218595 + "secretLastUpdated": 1698712367509 }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -256,7 +256,7 @@ "backendId": "testAppId", "branchName": "testBranchName", "secretName": "testFacebookSecret", - "secretLastUpdated": 1698693218595 + "secretLastUpdated": 1698712367509 }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -273,7 +273,7 @@ "backendId": "testAppId", "branchName": "testBranchName", "secretName": "testGoogleId", - "secretLastUpdated": 1698693218595 + "secretLastUpdated": 1698712367509 }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -290,7 +290,7 @@ "backendId": "testAppId", "branchName": "testBranchName", "secretName": "testGoogleSecret", - "secretLastUpdated": 1698693218595 + "secretLastUpdated": 1698712367510 }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" From 3de87ade6b4e34423d7059e145895b6ec097932f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MJ=E2=98=94?= Date: Tue, 31 Oct 2023 13:49:05 -0700 Subject: [PATCH 48/48] chore: add TODO --- .github/workflows/poc-e2e-flow-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poc-e2e-flow-test.yml b/.github/workflows/poc-e2e-flow-test.yml index 29d331c92da..9f1870dc93d 100644 --- a/.github/workflows/poc-e2e-flow-test.yml +++ b/.github/workflows/poc-e2e-flow-test.yml @@ -32,7 +32,8 @@ jobs: - name: ${{matrix.pkg-manager}}-create-amplify-project if: matrix.pkg-manager != 'yarn-stable' shell: bash - run: | + run: + | # TODO: last step `create amplify` should be replaced by `run e2e` mkdir -p /tmp/amplify-project; cd /tmp/amplify-project npm install -g ${{matrix.pkg-manager}} echo "$(${{matrix.pkg-manager}}) config set registry http://localhost:4873" @@ -44,7 +45,8 @@ jobs: - name: yarn-stable-create-amplify-project if: matrix.pkg-manager == 'yarn-stable' shell: bash - run: | + run: + | # TODO: last step `create amplify` should be replaced by `run e2e` mkdir -p /tmp/amplify-project; cd /tmp/amplify-project corepack enable echo "yarn set version stable"