Skip to content

Commit f1408db

Browse files
authored
release(required): Amplify JS release (aws-amplify#12539)
2 parents 6ac4649 + ff4e8d7 commit f1408db

File tree

389 files changed

+4749
-3267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

389 files changed

+4749
-3267
lines changed

.github/actions/setup-samples-staging/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ runs:
3434
env:
3535
BRANCH: ${{ github.ref_name }}
3636
run: |
37-
if git ls-remote --exit-code --heads origin $BRANCH >/dev/null 2>&1; then
37+
if git ls-remote origin $BRANCH | grep -q refs/heads/next/$BRANCH$; then
3838
# Branch exists, checkout and echo success message
3939
git fetch origin $BRANCH
4040
git checkout $BRANCH

.github/integ-config/integ-all.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -492,22 +492,22 @@ tests:
492492
sample_name: [delete-user]
493493
spec: delete-user
494494
browser: *minimal_browser_list
495-
# - test_name: integ_next_auth_authenticator_and_ssr_page
496-
# desc: 'Authenticator and SSR page'
497-
# framework: next
498-
# category: auth
499-
# sample_name: [auth-ssr]
500-
# spec: auth-ssr
501-
# browser: [chrome]
502-
# - test_name: integ_next_auth_authenticator_and_rsc_page
503-
# desc: 'Authenticator and RSC page'
504-
# framework: next
505-
# category: auth
506-
# sample_name: [auth-rsc]
507-
# spec: auth-rsc
508-
# browser: [chrome]
509-
# timeout_minutes: 45
510-
# retry_count: 10
495+
- test_name: integ_next_auth_authenticator_and_ssr_page
496+
desc: 'Authenticator and SSR page'
497+
framework: next
498+
category: auth
499+
sample_name: [auth-ssr]
500+
spec: auth-ssr
501+
browser: [chrome]
502+
- test_name: integ_next_auth_authenticator_and_rsc_page
503+
desc: 'Authenticator and RSC page'
504+
framework: next
505+
category: auth
506+
sample_name: [auth-rsc]
507+
spec: auth-rsc
508+
browser: [chrome]
509+
timeout_minutes: 45
510+
retry_count: 10
511511

512512
# DISABLED Angular/Vue tests:
513513
# TODO: delete tests or add custom ui logic to support them.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release LTS version to npm and update repository
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
target:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
deploy:
12+
name: Publish to Amplify Package
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
17+
with:
18+
path: amplify-js
19+
token: ${{ secrets.GH_TOKEN_AMPLIFY_JS_WRITE }}
20+
21+
- name: Setup node and build the repository
22+
uses: ./amplify-js/.github/actions/node-and-build
23+
24+
- name: Run npm publish
25+
uses: ./amplify-js/.github/actions/npm-publish
26+
with:
27+
target: ${{ inputs.target }}
28+
npm_token: ${{ secrets.NPM_TOKEN }}
29+
github_user: ${{ vars.GH_USER}}
30+
github_email: ${{ vars.GH_EMAIL}}
31+
32+
- name: Set github commit user
33+
env:
34+
GITHUB_EMAIL: ${{ vars.GH_EMAIL }}
35+
GITHUB_USER: ${{ vars.GH_USER }}
36+
run: |
37+
git config --global user.email $GITHUB_EMAIL
38+
git config --global user.name $GITHUB_USER
39+
40+
- name: Update API documentation
41+
working-directory: ./amplify-js
42+
run: |
43+
yarn run docs
44+
git add ./docs/api/
45+
git commit -m "chore(release): update API docs [ci skip]"
46+
47+
- name: Push post release changes
48+
working-directory: ./amplify-js
49+
env:
50+
TARGET_BRANCH: ${{ inputs.target }}
51+
run: |
52+
git push origin $TARGET_BRANCH

.github/workflows/callable-npm-publish-preid.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
ALLOW_PROTECTED_PREIDS: ${{ inputs.allow-protected-preid }}
2323
PREID: ${{ inputs.preid }}
2424
FORBIDDEN_PREIDS: latest
25-
PROTECTED_PREIDS: next unstable
25+
PROTECTED_PREIDS: next unstable stable-5 stable-4
2626
run: |
2727
echo "Testing to see if $PREID is in the forbidden list ($FORBIDDEN_PREIDS)"
2828
for e in $FORBIDDEN_PREIDS; do [[ $PREID == $e ]] && echo "$PREID is forbidden from preid release" && exit 1; done

.github/workflows/callable-release-verification.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ jobs:
77
uses: ./.github/workflows/callable-prebuild-amplify-js.yml
88
with:
99
runs_on: ubuntu-latest
10-
# prebuild-macos:
11-
# uses: ./.github/workflows/callable-prebuild-amplify-js.yml
12-
# with:
13-
# runs_on: macos-latest
10+
prebuild-macos:
11+
uses: ./.github/workflows/callable-prebuild-amplify-js.yml
12+
with:
13+
runs_on: macos-latest
1414
prebuild-samples-staging:
1515
secrets: inherit
1616
uses: ./.github/workflows/callable-prebuild-samples-staging.yml
1717
e2e:
1818
needs:
19-
# - prebuild-macos
19+
- prebuild-macos
2020
- prebuild-ubuntu
2121
- prebuild-samples-staging
2222
secrets: inherit
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Push - release from LTS branch to LTS dist tag
2+
3+
concurrency:
4+
# group name unique for push to push-latest-release
5+
group: push-lts-release-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
on:
9+
push:
10+
branches:
11+
- v5-stable
12+
13+
jobs:
14+
e2e:
15+
secrets: inherit
16+
uses: ./.github/workflows/callable-release-verification.yml
17+
release:
18+
needs:
19+
- e2e
20+
permissions:
21+
contents: write
22+
secrets: inherit
23+
uses: ./.github/workflows/callable-npm-publish-lts-release.yml
24+
with:
25+
target: v5-stable # TODO Update this to support other LTS branches in the future

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,7 @@ coverage-ts/
6363
**/example/ios/Podfile.lock
6464
**/example/.bundle
6565
**/example/yarn.lock
66+
67+
# rollup
68+
**/.rollup.cache
69+
**/buildMeta

license_config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"**/vendor",
3636
"**/__tests__",
3737
"**/__mocks__",
38-
"**/Gemfile"
38+
"**/Gemfile",
39+
"**/.rollup.cache",
40+
"**/rollup.config.mjs",
41+
"rollup"
3942
],
4043
"ignoreFile": ".gitignore",
4144
"license": "license_header.txt",

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"test:duplicates": "./scripts/duplicates-yarn.sh",
1313
"test:license": "license-check-and-add check -f license_config.json",
1414
"test:github-actions": "node ./scripts/test-github-actions.js",
15-
"test:tsc-compliance": "yarn workspace tsc-compliance-test test:compliance:ts4.2",
15+
"test:tsc-compliance": "yarn workspace tsc-compliance-test test:compliance",
1616
"coverage": "codecov || exit 0",
1717
"docs": "typedoc packages/**/src --name amplify-js --hideGenerator --excludePrivate --ignoreCompilerErrors --mode file --out docs/api --theme docs/amplify-theme/typedoc/ --readme README.md",
1818
"build": "lerna run build --stream && yarn test:duplicates",
@@ -30,6 +30,7 @@
3030
"publish:preid": "./scripts/preid-env-vars-exist.sh && lerna publish --canary --force-publish --dist-tag=${PREID_PREFIX} --preid=${PREID_PREFIX}${PREID_HASH_SUFFIX} --yes",
3131
"publish:main": "lerna publish --canary --force-publish --dist-tag=unstable --preid=unstable${PREID_HASH_SUFFIX} --yes",
3232
"publish:release": "lerna publish from-package --dist-tag=v6 --message 'chore(release): Publish [ci skip]' --yes",
33+
"publish:v5-stable": "lerna publish --conventional-commits --yes --dist-tag=stable-5 --message 'chore(release): Publish [ci skip]' --no-verify-access",
3334
"publish:verdaccio": "lerna publish --canary --force-publish --no-push --dist-tag=unstable --preid=unstable --yes",
3435
"ts-coverage": "lerna run ts-coverage",
3536
"prepare": "./scripts/set-preid-versions.sh"
@@ -94,6 +95,7 @@
9495
"babel-jest": "^24.9.0",
9596
"babel-loader": "^8.3.0",
9697
"codecov": "^3.6.5",
98+
"glob": "^10.3.10",
9799
"husky": "^3.0.5",
98100
"jest": "^24.x.x",
99101
"jest-config": "24.8.0",
@@ -129,7 +131,8 @@
129131
"@types/babel__traverse": "7.20.0",
130132
"path-scurry": "1.10.0",
131133
"**/glob/minipass": "6.0.2",
132-
"nx": "16.7.0"
134+
"nx": "16.7.0",
135+
"next": "13.5.6"
133136
},
134137
"jest": {
135138
"resetMocks": true,

packages/adapter-nextjs/__tests__/api/generateServerClient.test.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { ResourcesConfig } from '@aws-amplify/core';
22
import {
33
generateServerClientUsingCookies,
4-
generateServerClient,
4+
generateServerClientUsingReqRes,
55
} from '../../src/api';
6-
import { runWithAmplifyServerContext } from './../../src';
7-
import { getAmplifyConfig } from '../../src/utils';
6+
import {
7+
getAmplifyConfig,
8+
createRunWithAmplifyServerContext,
9+
} from '../../src/utils';
810
import { NextApiRequestMock, NextApiResponseMock } from '../mocks/headers';
11+
import { createServerRunnerForAPI } from '../../src/api/createServerRunnerForAPI';
912

10-
const headers = import('next/headers');
13+
const headers = import('next/headers.js');
1114
(global as any).Headers = jest.requireActual('node-fetch').Headers;
1215

1316
const mockAmplifyConfig: ResourcesConfig = {
@@ -29,13 +32,16 @@ const mockAmplifyConfig: ResourcesConfig = {
2932
};
3033

3134
jest.mock('../../src/utils', () => ({
35+
createRunWithAmplifyServerContext: jest.fn(() => jest.fn()),
3236
getAmplifyConfig: jest.fn(() => mockAmplifyConfig),
3337
createCookieStorageAdapterFromNextServerContext: jest.fn(),
3438
}));
3539

3640
jest.mock('aws-amplify/adapter-core');
3741

3842
const mockGetAmplifyConfig = getAmplifyConfig as jest.Mock;
43+
const mockCreateRunWithAmplifyServerContext =
44+
createRunWithAmplifyServerContext as jest.Mock;
3945

4046
describe('generateServerClientUsingCookies', () => {
4147
it('should throw error when used with req/res', async () => {
@@ -52,11 +58,13 @@ describe('generateServerClientUsingCookies', () => {
5258
}).toThrowError();
5359
});
5460

55-
it('should call getAmlifyConfig', async () => {
61+
it('should call createRunWithAmplifyServerContext to create runWithAmplifyServerContext function', async () => {
5662
const cookies = (await headers).cookies;
5763

58-
generateServerClientUsingCookies({ cookies });
59-
expect(mockGetAmplifyConfig).toHaveBeenCalled();
64+
generateServerClientUsingCookies({ config: mockAmplifyConfig, cookies });
65+
expect(mockCreateRunWithAmplifyServerContext).toHaveBeenCalledWith({
66+
config: mockAmplifyConfig,
67+
});
6068
});
6169
});
6270

@@ -67,12 +75,15 @@ describe('generateServerClient', () => {
6775
});
6876

6977
it('should call getAmlifyConfig', async () => {
70-
generateServerClient();
78+
generateServerClientUsingReqRes({ config: mockAmplifyConfig });
7179
expect(mockGetAmplifyConfig).toHaveBeenCalled();
7280
});
7381

7482
// TODO: figure out proper mocks and unskip
7583
it.skip('wrapped client.graphql should pass context through', async () => {
84+
const { runWithAmplifyServerContext } = createServerRunnerForAPI({
85+
config: mockAmplifyConfig,
86+
});
7687
const mockedReq = new NextApiRequestMock();
7788
const mockedRes = NextApiResponseMock;
7889

@@ -86,7 +97,9 @@ describe('generateServerClient', () => {
8697
getAmplifyServerContext: () => {},
8798
}));
8899

89-
const client = generateServerClient();
100+
const client = generateServerClientUsingReqRes({
101+
config: mockAmplifyConfig,
102+
});
90103

91104
await runWithAmplifyServerContext({
92105
nextServerContext: {

0 commit comments

Comments
 (0)