From 70c60fe7dd55b669410b32d25cf3096f31e27f52 Mon Sep 17 00:00:00 2001 From: Jim Blanchard Date: Fri, 27 Oct 2023 15:16:12 -0500 Subject: [PATCH 1/2] chore: Setup v5 LTS CI infrastructure (#12455) --- .../callable-npm-publish-lts-release.yml | 52 +++++++++++++++++++ .../workflows/callable-npm-publish-preid.yml | 2 +- .github/workflows/push-lts-release.yml | 25 +++++++++ package.json | 1 + 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/callable-npm-publish-lts-release.yml create mode 100644 .github/workflows/push-lts-release.yml diff --git a/.github/workflows/callable-npm-publish-lts-release.yml b/.github/workflows/callable-npm-publish-lts-release.yml new file mode 100644 index 00000000000..b4db35ab829 --- /dev/null +++ b/.github/workflows/callable-npm-publish-lts-release.yml @@ -0,0 +1,52 @@ +name: Release LTS version to npm and update repository + +on: + workflow_call: + inputs: + target: + required: true + type: string + +jobs: + deploy: + name: Publish to Amplify Package + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f + with: + path: amplify-js + token: ${{ secrets.GH_TOKEN_AMPLIFY_JS_WRITE }} + + - name: Setup node and build the repository + uses: ./amplify-js/.github/actions/node-and-build + + - name: Run npm publish + uses: ./amplify-js/.github/actions/npm-publish + with: + target: ${{ inputs.target }} + npm_token: ${{ secrets.NPM_TOKEN }} + github_user: ${{ vars.GH_USER}} + github_email: ${{ vars.GH_EMAIL}} + + - name: Set github commit user + env: + GITHUB_EMAIL: ${{ vars.GH_EMAIL }} + GITHUB_USER: ${{ vars.GH_USER }} + run: | + git config --global user.email $GITHUB_EMAIL + git config --global user.name $GITHUB_USER + + - name: Update API documentation + working-directory: ./amplify-js + run: | + yarn run docs + git add ./docs/api/ + git commit -m "chore(release): update API docs [ci skip]" + + - name: Push post release changes + working-directory: ./amplify-js + env: + TARGET_BRANCH: ${{ inputs.target }} + run: | + git push origin $TARGET_BRANCH diff --git a/.github/workflows/callable-npm-publish-preid.yml b/.github/workflows/callable-npm-publish-preid.yml index 8d3af4fbc7c..6152f46f331 100644 --- a/.github/workflows/callable-npm-publish-preid.yml +++ b/.github/workflows/callable-npm-publish-preid.yml @@ -22,7 +22,7 @@ jobs: ALLOW_PROTECTED_PREIDS: ${{ inputs.allow-protected-preid }} PREID: ${{ inputs.preid }} FORBIDDEN_PREIDS: latest - PROTECTED_PREIDS: next unstable + PROTECTED_PREIDS: next unstable stable-5 stable-4 run: | echo "Testing to see if $PREID is in the forbidden list ($FORBIDDEN_PREIDS)" for e in $FORBIDDEN_PREIDS; do [[ $PREID == $e ]] && echo "$PREID is forbidden from preid release" && exit 1; done diff --git a/.github/workflows/push-lts-release.yml b/.github/workflows/push-lts-release.yml new file mode 100644 index 00000000000..00704ba053a --- /dev/null +++ b/.github/workflows/push-lts-release.yml @@ -0,0 +1,25 @@ +name: Push - release from LTS branch to LTS dist tag + +concurrency: + # group name unique for push to push-latest-release + group: push-lts-release-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - v5-stable + +jobs: + e2e: + secrets: inherit + uses: ./.github/workflows/callable-release-verification.yml + release: + needs: + - e2e + permissions: + contents: write + secrets: inherit + uses: ./.github/workflows/callable-npm-publish-lts-release.yml + with: + target: v5-stable # TODO Update this to support other LTS branches in the future diff --git a/package.json b/package.json index c4644806578..4b6630f6291 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "publish:main": "lerna publish --canary --force-publish \"*\" --yes --dist-tag=unstable --preid=unstable${PREID_HASH_SUFFIX} --exact --no-verify-access", "publish:next": "lerna publish --canary --force-publish \"*\" --yes --dist-tag=next --preid=next${PREID_HASH_SUFFIX} --exact --no-verify-access", "publish:release": "lerna publish --conventional-commits --yes --message 'chore(release): Publish [ci skip]' --no-verify-access", + "publish:v5-stable": "lerna publish --conventional-commits --yes --dist-tag=stable-5 --message 'chore(release): Publish [ci skip]' --no-verify-access", "publish:verdaccio": "lerna publish --no-push --canary minor --dist-tag=unstable --preid=unstable --exact --force-publish --yes --no-verify-access", "ts-coverage": "lerna run ts-coverage" }, From 51e97ea499cf2c74bcc398ba6573bd4ae63dbc3e Mon Sep 17 00:00:00 2001 From: Francisco Rodriguez Date: Mon, 6 Nov 2023 13:16:47 -0800 Subject: [PATCH 2/2] chore(deps): upgrade axios to 1.6.0 (#12489) --- .../actions/setup-samples-staging/action.yml | 2 +- packages/api-graphql/package.json | 32 +++---- packages/api-graphql/tsconfig.json | 8 ++ packages/api-rest/package.json | 96 +++++++++---------- packages/api-rest/tsconfig.json | 8 ++ packages/api/package.json | 37 ++++--- packages/api/tsconfig.json | 8 ++ packages/aws-amplify/package.json | 3 + .../datastore-storage-adapter/package.json | 3 + packages/datastore/package.json | 5 +- packages/pushnotification/package.json | 3 + yarn.lock | 14 +-- 12 files changed, 127 insertions(+), 92 deletions(-) create mode 100644 packages/api-graphql/tsconfig.json create mode 100644 packages/api-rest/tsconfig.json create mode 100644 packages/api/tsconfig.json diff --git a/.github/actions/setup-samples-staging/action.yml b/.github/actions/setup-samples-staging/action.yml index 508e36b4ed7..9a2902614cd 100644 --- a/.github/actions/setup-samples-staging/action.yml +++ b/.github/actions/setup-samples-staging/action.yml @@ -34,7 +34,7 @@ runs: env: BRANCH: ${{ github.ref_name }} run: | - if git ls-remote origin $BRANCH | grep -q refs/heads/next/$BRANCH$; then + if git ls-remote origin $BRANCH | grep -q refs/heads/$BRANCH$; then # Branch exists, checkout and echo success message git fetch origin $BRANCH git checkout $BRANCH diff --git a/packages/api-graphql/package.json b/packages/api-graphql/package.json index 976352a7689..130bdf595fb 100644 --- a/packages/api-graphql/package.json +++ b/packages/api-graphql/package.json @@ -19,10 +19,10 @@ "test": "npm run lint && jest --coverage", "test:size": "size-limit", "build-with-test": "npm test && npm run build", - "build:cjs": "node ./build es5 && webpack && webpack --config ./webpack.config.dev.js", - "build:esm": "node ./build es6", - "build:cjs:watch": "node ./build es5 --watch", - "build:esm:watch": "node ./build es6 --watch", + "build:cjs": "rimraf lib && tsc -m commonjs --outDir lib && webpack && webpack --config ./webpack.config.dev.js", + "build:esm": "rimraf lib-esm && tsc -m esnext --outDir lib-esm", + "build:cjs:watch": "rimraf lib && tsc -m commonjs --outDir lib --watch", + "build:esm:watch": "rimraf lib-esm && tsc -m esnext --outDir lib-esm --watch", "build": "npm run clean && npm run build:esm && npm run build:cjs", "clean": "npm run clean:size && rimraf lib-esm lib dist", "clean:size": "rimraf dual-publish-tmp tmp*", @@ -41,7 +41,8 @@ }, "homepage": "https://aws-amplify.github.io/", "devDependencies": { - "@types/zen-observable": "^0.8.0" + "@types/zen-observable": "^0.8.0", + "typescript": "5.0.2" }, "files": [ "lib", @@ -65,29 +66,26 @@ "name": "API (GraphQL client)", "path": "./lib-esm/index.js", "import": "{ Amplify, GraphQLAPI }", - "limit": "89.52 kB" + "limit": "95273 B" } ], "jest": { + "moduleNameMapper": { + "axios": "axios/dist/node/axios.cjs" + }, "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": { - "lib": [ - "es5", - "es2015", - "dom", - "esnext.asynciterable", - "es2017.object" - ], - "allowJs": true - } + "tsConfig": false } }, "transform": { "^.+\\.(js|jsx|ts|tsx)$": "ts-jest" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$", + "testPathIgnorePatterns": [ + "/testUtils/" + ], "moduleFileExtensions": [ "ts", "tsx", @@ -96,7 +94,6 @@ "jsx" ], "testEnvironment": "jsdom", - "testURL": "http://localhost/", "coverageThreshold": { "global": { "branches": 0, @@ -105,6 +102,7 @@ "statements": 0 } }, + "testURL": "http://localhost/", "coveragePathIgnorePatterns": [ "/node_modules/", "dist", diff --git a/packages/api-graphql/tsconfig.json b/packages/api-graphql/tsconfig.json new file mode 100644 index 00000000000..e750401b7ee --- /dev/null +++ b/packages/api-graphql/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": {}, + "include": ["./src"], + "watchOptions": { + "excludeDirectories": ["lib*"] + } +} diff --git a/packages/api-rest/package.json b/packages/api-rest/package.json index 6ecd110f0c7..f6e4cafdc09 100644 --- a/packages/api-rest/package.json +++ b/packages/api-rest/package.json @@ -19,10 +19,10 @@ "test": "npm run lint && jest --coverage", "test:size": "size-limit", "build-with-test": "npm test && npm run build", - "build:cjs": "node ./build es5 && webpack && webpack --config ./webpack.config.dev.js", - "build:esm": "node ./build es6", - "build:cjs:watch": "node ./build es5 --watch", - "build:esm:watch": "node ./build es6 --watch", + "build:cjs": "rimraf lib && tsc -m commonjs --outDir lib && webpack && webpack --config ./webpack.config.dev.js", + "build:esm": "rimraf lib-esm && tsc -m esnext --outDir lib-esm", + "build:cjs:watch": "rimraf lib && tsc -m commonjs --outDir lib --watch", + "build:esm:watch": "rimraf lib-esm && tsc -m esnext --outDir lib-esm --watch", "build": "npm run clean && npm run build:esm && npm run build:cjs", "clean": "npm run clean:size && rimraf lib-esm lib dist", "clean:size": "rimraf dual-publish-tmp tmp*", @@ -47,60 +47,60 @@ ], "dependencies": { "@aws-amplify/core": "5.8.5", - "axios": "0.26.0", + "axios": "1.6.0", "tslib": "^1.8.0", "url": "0.11.0" }, + "devDependencies": { + "typescript": "5.0.2" + }, "size-limit": [ { "name": "API (rest client)", "path": "./lib-esm/index.js", "import": "{ Amplify, RestAPI }", - "limit": "31 kB" + "limit": "36665 B" } ], "jest": { - "globals": { - "ts-jest": { - "diagnostics": false, - "tsConfig": { - "lib": [ - "es5", - "es2015", - "dom", - "esnext.asynciterable", - "es2017.object" - ], - "allowJs": true - } - } - }, - "transform": { - "^.+\\.(js|jsx|ts|tsx)$": "ts-jest" + "moduleNameMapper": { + "axios": "axios/dist/node/axios.cjs" }, - "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json", - "jsx" - ], - "testEnvironment": "jsdom", - "testURL": "http://localhost/", - "coverageThreshold": { - "global": { - "branches": 0, - "functions": 0, - "lines": 0, - "statements": 0 - } - }, - "coveragePathIgnorePatterns": [ - "/node_modules/", - "dist", - "lib", - "lib-esm" - ] - } + "globals": { + "ts-jest": { + "diagnostics": false, + "tsConfig": false + } + }, + "transform": { + "^.+\\.(js|jsx|ts|tsx)$": "ts-jest" + }, + "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$", + "testPathIgnorePatterns": [ + "/testUtils/" + ], + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "json", + "jsx" + ], + "testEnvironment": "jsdom", + "coverageThreshold": { + "global": { + "branches": 0, + "functions": 0, + "lines": 0, + "statements": 0 + } + }, + "testURL": "http://localhost/", + "coveragePathIgnorePatterns": [ + "/node_modules/", + "dist", + "lib", + "lib-esm" + ] + } } diff --git a/packages/api-rest/tsconfig.json b/packages/api-rest/tsconfig.json new file mode 100644 index 00000000000..e750401b7ee --- /dev/null +++ b/packages/api-rest/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": {}, + "include": ["./src"], + "watchOptions": { + "excludeDirectories": ["lib*"] + } +} diff --git a/packages/api/package.json b/packages/api/package.json index 9a640350850..f02c113f33d 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -26,10 +26,10 @@ "test": "npm run lint && jest -w 1 --coverage", "test:size": "size-limit", "build-with-test": "npm test && npm run build", - "build:cjs": "node ./build es5 && webpack && webpack --config ./webpack.config.dev.js", - "build:esm": "node ./build es6", - "build:cjs:watch": "node ./build es5 --watch", - "build:esm:watch": "node ./build es6 --watch", + "build:cjs": "rimraf lib && tsc -m commonjs --outDir lib && webpack && webpack --config ./webpack.config.dev.js", + "build:esm": "rimraf lib-esm && tsc -m esnext --outDir lib-esm", + "build:cjs:watch": "rimraf lib && tsc -m commonjs --outDir lib --watch", + "build:esm:watch": "rimraf lib-esm && tsc -m esnext --outDir lib-esm --watch", "build": "npm run clean && npm run build:esm && npm run build:cjs", "clean": "npm run clean:size && rimraf lib-esm lib dist", "clean:size": "rimraf dual-publish-tmp tmp*", @@ -48,7 +48,8 @@ }, "homepage": "https://aws-amplify.github.io/", "devDependencies": { - "@types/zen-observable": "^0.8.0" + "@types/zen-observable": "^0.8.0", + "typescript": "5.0.2" }, "files": [ "lib", @@ -67,29 +68,26 @@ "name": "API (top-level class)", "path": "./lib-esm/index.js", "import": "{ Amplify, API }", - "limit": "90.28 kB" + "limit": "96.05 kB" } ], "jest": { + "moduleNameMapper": { + "axios": "axios/dist/node/axios.cjs" + }, "globals": { - "ts-jest": { - "diagnostics": false, - "tsConfig": { - "lib": [ - "es5", - "es2015", - "dom", - "esnext.asynciterable", - "es2017.object" - ], - "allowJs": true + "ts-jest": { + "diagnostics": false, + "tsConfig": false } - } }, "transform": { "^.+\\.(js|jsx|ts|tsx)$": "ts-jest" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$", + "testPathIgnorePatterns": [ + "/testUtils/" + ], "moduleFileExtensions": [ "ts", "tsx", @@ -98,7 +96,6 @@ "jsx" ], "testEnvironment": "jsdom", - "testURL": "http://localhost/", "coverageThreshold": { "global": { "branches": 0, @@ -107,6 +104,7 @@ "statements": 0 } }, + "testURL": "http://localhost/", "coveragePathIgnorePatterns": [ "/node_modules/", "dist", @@ -114,4 +112,5 @@ "lib-esm" ] } + } diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json new file mode 100644 index 00000000000..e750401b7ee --- /dev/null +++ b/packages/api/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": {}, + "include": ["./src"], + "watchOptions": { + "excludeDirectories": ["lib*"] + } +} diff --git a/packages/aws-amplify/package.json b/packages/aws-amplify/package.json index 9993e8c8479..75cc26b4447 100644 --- a/packages/aws-amplify/package.json +++ b/packages/aws-amplify/package.json @@ -55,6 +55,9 @@ "tslib": "^2.0.0" }, "jest": { + "moduleNameMapper": { + "axios": "axios/dist/node/axios.cjs" + }, "globals": { "ts-jest": { "diagnostics": false, diff --git a/packages/datastore-storage-adapter/package.json b/packages/datastore-storage-adapter/package.json index b92454749f3..cc07c95dea7 100644 --- a/packages/datastore-storage-adapter/package.json +++ b/packages/datastore-storage-adapter/package.json @@ -44,6 +44,9 @@ "sqlite3": "^5.0.2" }, "jest": { + "moduleNameMapper": { + "axios": "axios/dist/node/axios.cjs" + }, "globals": { "ts-jest": { "diagnostics": true, diff --git a/packages/datastore/package.json b/packages/datastore/package.json index fb534f05849..889d9019351 100644 --- a/packages/datastore/package.json +++ b/packages/datastore/package.json @@ -73,10 +73,13 @@ "name": "DataStore (top-level class)", "path": "./lib-esm/index.js", "import": "{ Amplify, DataStore }", - "limit": "137 kB" + "limit": "144.06 kB" } ], "jest": { + "moduleNameMapper": { + "axios": "axios/dist/node/axios.cjs" + }, "globals": { "ts-jest": { "diagnostics": true, diff --git a/packages/pushnotification/package.json b/packages/pushnotification/package.json index ef9273a027b..c362397de9d 100644 --- a/packages/pushnotification/package.json +++ b/packages/pushnotification/package.json @@ -46,6 +46,9 @@ "@react-native-community/push-notification-ios": "1.0.3" }, "jest": { + "moduleNameMapper": { + "axios": "axios/dist/node/axios.cjs" + }, "globals": { "ts-jest": { "diagnostics": false, diff --git a/yarn.lock b/yarn.lock index 9b2dc662428..192b5b26f8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5751,12 +5751,14 @@ axe-core@^4.6.2: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.2.tgz#040a7342b20765cb18bb50b628394c21bccc17a0" integrity sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g== -axios@0.26.0: - version "0.26.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.0.tgz#9a318f1c69ec108f8cd5f3c3d390366635e13928" - integrity sha512-lKoGLMYtHvFrPVt3r+RBMp9nh34N0M8zEfCWqdWZx6phynIEhQqAdydpyBAAG211zlhX9Rgu08cOamy6XjE5Og== +axios@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.0.tgz#f1e5292f26b2fd5c2e66876adc5b06cdbd7d2102" + integrity sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg== dependencies: - follow-redirects "^1.14.8" + follow-redirects "^1.15.0" + form-data "^4.0.0" + proxy-from-env "^1.1.0" axios@^1.0.0: version "1.4.0" @@ -8391,7 +8393,7 @@ fn.name@1.x.x: resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== -follow-redirects@^1.14.8, follow-redirects@^1.15.0: +follow-redirects@^1.15.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==