Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/actions/node-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs:
${{ runner.os }}-build-artifacts-
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
# TODO We should be able to skip yarn / bootstrap if we cache enough things. Leaving because skipping causes issues.
# TODO We should be able to skip yarn install if we cache enough things. Leaving because skipping causes issues.
- name: Install
if: inputs.is-prebuild != 'true' || steps.cache-build-artifacts.outputs.cache-hit != 'true'
shell: bash
Expand All @@ -42,11 +42,6 @@ runs:
echo "Attempt $i failed."
sleep 5
done
- name: Bootstrap
if: inputs.is-prebuild != 'true' || steps.cache-build-artifacts.outputs.cache-hit != 'true'
run: yarn bootstrap
shell: bash
working-directory: ./amplify-js
- name: Build packages
if: steps.cache-build-artifacts.outputs.cache-hit != 'true'
run: yarn build
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/callable-canary-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ jobs:
run: yarn
shell: bash
working-directory: ./amplify-js
- name: Bootstrap
run: yarn bootstrap
shell: bash
working-directory: ./amplify-js
- name: Build packages
run: yarn build
shell: bash
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/callable-get-package-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ jobs:
- name: Dump Package List
if: steps.cache-package-list.outputs.cache-hit != 'true'
run: |
yarn lerna ll | egrep -v "lerna|Done|yarn" | jq -R -s -c 'split("\n")[:-1] | map({name: split(" ")[0], path: split(" ")[-1]})' > package-list.json
# Get all workspaces and filter out private packages (examples and scripts)
# This matches Lerna's behavior with "command.run.private: false"
yarn workspaces info --json 2>&1 | sed -n '/^{/,/^}/p' | jq -c '
to_entries |
map({name: .key, path: .value.location}) |
map(select(.path | (contains("/example") or startswith("scripts/")) | not))
' > package-list.json
- name: Get Package List
id: get_package_list
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/callable-native-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
env:
TEST_PACKAGE: ${{ matrix.package.name }}
run: |
npx lerna exec --scope $TEST_PACKAGE yarn prepare:ios
npx lerna exec --scope $TEST_PACKAGE yarn test:ios
yarn workspace $TEST_PACKAGE prepare:ios
yarn workspace $TEST_PACKAGE test:ios
- name: Run Android Tests
working-directory: ./amplify-js
env:
TEST_PACKAGE: ${{ matrix.package.name }}
run: |
npx lerna exec --scope $TEST_PACKAGE yarn prepare:android
npx lerna exec --scope $TEST_PACKAGE yarn test:android
yarn workspace $TEST_PACKAGE prepare:android
yarn workspace $TEST_PACKAGE test:android
2 changes: 1 addition & 1 deletion .github/workflows/callable-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
working-directory: ./amplify-js
env:
TEST_PACKAGE: ${{ matrix.package.name }}
run: npx lerna exec --scope $TEST_PACKAGE yarn test
run: yarn workspace $TEST_PACKAGE test
# disable temporarily
# - name: Check coverage report existence
# id: check-report
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
build
Config
lerna-debug.log
node_modules
packages/*/node_modules/**
packages/**/lib/
Expand Down Expand Up @@ -72,6 +71,9 @@ coverage-ts/
**/.rollup.cache
**/buildMeta

# Turborepo
.turbo

# ruby
vendor/
Gemfile.lock
3 changes: 3 additions & 0 deletions .turborc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"telemetry": false
}
14 changes: 5 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,13 @@ This section should get you running with **Amplify JS** and get you familiar wit

The recommended version of Node JS to work with this project is [`18.18.0`](https://nodejs.org/en/blog/release/v18.18.0/) with Yarn version [`1.22.x`](https://github.com/yarnpkg/yarn/blob/master/CHANGELOG.md).

> Note: newer versions of Yarn (2+) remove support for lerna's `--mutex` flag
> so be sure to use Yarn v1.22.x

Start by [forking](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) the main branch of [amplify-js](https://github.com/aws-amplify/amplify-js).

```
git clone [email protected]:[username]/amplify-js.git
cd amplify-js

yarn
yarn bootstrap
yarn build
```

Expand Down Expand Up @@ -139,7 +135,7 @@ Allowed patterns are stored in `.git/config` and apply only to your local reposi

## Architecture of the codebase

Amplify JS is a monorepo built with `Yarn` and `Lerna`. All the categories of Amplify live within the `packages` directory in the root. Each category inside packages has its own `src/` and `package.json`.
Amplify JS is a monorepo built with `Yarn` and `Turborepo`. All the categories of Amplify live within the `packages` directory in the root. Each category inside packages has its own `src/` and `package.json`.

[**Packages inside Amplify JS Monorepo**](https://github.com/aws-amplify/amplify-js/tree/main/packages)

Expand Down Expand Up @@ -170,15 +166,15 @@ yarn run test --scope @aws-amplify/auth
#### Test in a local sample app

**Yarn Linking**
The best way to develop locally and test is to link the individual package you’re working on and run lerna in watch mode.
The best way to develop locally and test is to link the individual package you’re working on and run it in watch mode.

Note: to test using the react-native framework you will need to use [Verdaccio](#verdaccio)

Run watch mode while editing (auth for example):

```
npx lerna exec --scope @aws-amplify/auth yarn link
npx lerna exec --scope @aws-amplify/auth yarn build:watch
yarn workspace @aws-amplify/auth link
yarn workspace @aws-amplify/auth build:watch
```

Or run the whole library in watch mode if you are working on multiple packages
Expand Down Expand Up @@ -280,7 +276,7 @@ _[Skip step 1 to 3 if you have already done this]_

1. Fork [`aws-amplify/amplify-js`](https://github.com/aws-amplify/amplify-js)
2. Clone your fork locally: `git clone [email protected]:YOUR_GITHUB_USERNAME/amplify-js.git`
3. Run `yarn && yarn bootstrap` in the repository root
3. Run `yarn` in the repository root
4. Within your fork, create a new branch based on the issue (e.g. Issue #123) you're addressing - `git checkout -b "group-token/short-token-[branch-name]"` or `git checkout -b "short-token/[branch-name]"`
- Use grouping tokens at the beginning of the branch names. For e.g, if you are working on changes specific to `amplify-ui-components`, then you could start the branch name as `ui-components/...`
- short token
Expand Down
11 changes: 0 additions & 11 deletions lerna.json

This file was deleted.

4 changes: 3 additions & 1 deletion license_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
"**/rollup.config.mjs",
"rollup",
".husky",
".turbo",
"eslint.config.mjs",
"packages/core/metadata"
"packages/core/metadata",
"packages/react-native/example/.bundle/config"
],
"ignoreFile": ".gitignore",
"license": "license_header.txt",
Expand Down
32 changes: 15 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,34 @@
"version": "0.1.30",
"description": "",
"scripts": {
"setup-dev": "yarn && yarn bootstrap && yarn link-all && yarn build",
"bootstrap": "lerna bootstrap",
"setup-dev": "yarn && yarn link-all && yarn build",
"test": "yarn test:no-datastore && yarn test:datastore && yarn test:license && yarn test:github-actions && yarn test:tsc-compliance",
"test:no-datastore": "lerna run test --stream --ignore @aws-amplify/datastore",
"test:datastore": "lerna run test --stream --scope @aws-amplify/datastore",
"test:size": "lerna run test:size --no-bail",
"test:no-datastore": "turbo run test --filter=!@aws-amplify/datastore",
"test:datastore": "turbo run test --filter=@aws-amplify/datastore",
"test:size": "turbo run test:size --continue",
"test:duplicates": "./scripts/duplicates-yarn.sh",
"test:license": "license-check-and-add check -f license_config.json",
"test:github-actions": "node ./scripts/test-github-actions.js",
"test:tsc-compliance": "yarn workspace tsc-compliance-test test:compliance",
"docs": "typedoc",
"docs:references": "typedoc --options typedoc.references.json",
"build": "lerna run build --stream && yarn test:duplicates",
"build:watch": "concurrently 'lerna run build:watch --parallel' --raw",
"build": "turbo run build && yarn test:duplicates",
"build:watch": "turbo run build:watch",
"build:client-types": "cd scripts/dts-bundler && yarn && yarn run build",
"clean": "lerna run clean --parallel",
"clean:size": "lerna run clean:size --parallel",
"format": "lerna run format",
"lint": "lerna run lint",
"lint:fix": "lerna run lint:fix",
"clean": "turbo run clean",
"clean:size": "turbo run clean:size",
"format": "turbo run format",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"lint:license": "license-check-and-add add -f license_config.json",
"link-all": "yarn unlink-all && lerna exec --no-bail --parallel yarn link",
"unlink-all": "lerna exec --no-bail --parallel -- yarn unlink; exit 0",
"link-all": "yarn unlink-all && yarn workspaces foreach --parallel --no-private run link",
"unlink-all": "yarn workspaces foreach --parallel --no-private run unlink || true",
"publish:latest": "changeset publish",
"publish:unstable": "cp .github/changeset-presets/bump-all-packages.md .changeset/ && changeset version --snapshot unstable-$(git rev-parse --short=7 HEAD) && changeset publish --tag unstable --no-git-tag",
"publish:preid": "./scripts/preid-env-vars-exist.sh && cp .github/changeset-presets/bump-all-packages.md .changeset/ && changeset version --snapshot ${PREID}-$(git rev-parse --short=7 HEAD) && changeset version && changeset publish --tag ${PREID} --no-git-tag",
"publish:verdaccio": "yarn publish:unstable",
"generate-metadata": "git rev-parse --short HEAD > packages/core/metadata && git commit -am 'chore(release): Set core metadata [skip release]'",
"ts-coverage": "lerna run ts-coverage",
"ts-coverage": "turbo run ts-coverage",
"prepare": "husky && ./scripts/setup-git-secrets.sh && ./scripts/set-preid-versions.sh"
},
"workspaces": {
Expand Down Expand Up @@ -84,7 +83,6 @@
"@changesets/changelog-github": "^0.5.2",
"@changesets/cli": "^2.27.1",
"@eslint/compat": "^1.2.0",
"@lerna/legacy-package-management": "^8.2.1",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-typescript": "^11.1.6",
"@size-limit/dual-publish": "^8.1.0",
Expand Down Expand Up @@ -115,7 +113,6 @@
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"json-loader": "^0.5.7",
"lerna": "^8.2.1",
"license-check-and-add": "^4.0.5",
"lint-staged": "^15.2.2",
"mkdirp": "^3.0.1",
Expand All @@ -126,6 +123,7 @@
"terser-webpack-plugin": "^5.3.6",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.3",
"turbo": "^2.3.3",
"typedoc": "0.25.8",
"typedoc-plugin-extras": "^3.0.0",
"typedoc-plugin-missing-exports": "^2.2.0",
Expand Down
55 changes: 55 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": [
"tsconfig.json",
"jest.config.js",
"jest.setup.js",
"eslint.config.mjs",
"prettier.config.js"
],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", "lib/**", "lib-esm/**"],
"inputs": ["src/**", "tsconfig.json", "tsconfig.build.json", "rollup.config.mjs", "webpack.config.js"]
},
"build:watch": {
"cache": false,
"persistent": true
},
"test": {
"dependsOn": ["^build"],
"outputs": ["coverage/**"],
"inputs": ["src/**", "__tests__/**", "jest.config.js"]
},
"test:size": {
"dependsOn": ["build"],
"cache": false
},
"lint": {
"outputs": [],
"inputs": ["src/**", "**/*.{ts,tsx}", "eslint.config.mjs"]
},
"lint:fix": {
"cache": false,
"outputs": []
},
"format": {
"cache": false,
"outputs": []
},
"clean": {
"cache": false
},
"clean:size": {
"cache": false
},
"ts-coverage": {
"outputs": [],
"inputs": ["src/**", "tsconfig.build.json"]
},
"generate-version": {
"cache": false
}
}
}
Loading
Loading