Skip to content

Commit 00443da

Browse files
AllanZhengYPtrivikr
authored andcommitted
chore: optimize building repository (#326)
1 parent f8794b4 commit 00443da

File tree

10 files changed

+9178
-38
lines changed

10 files changed

+9178
-38
lines changed

Diff for: .travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
language: node_js
22
node_js:
33
- "10.9.0"
4+
before_install:
5+
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.17.3
6+
- export PATH="$HOME/.yarn/bin:$PATH"
47
install:
5-
- npm install
6-
- travis_wait 180 npm run bootstrap
8+
- yarn
79
script:
8-
- travis_wait 180 npm run test
10+
- yarn test
911
after_success:
1012
- ./node_modules/.bin/codecov -f coverage/*.json

Diff for: .yarnrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
workspaces-experimental true

Diff for: CONTRIBUTING.md

+16-17
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ and pull requests. Please read through this document before submitting any
77
issues or pull requests to ensure we have all the necessary information to
88
effectively respond to your bug report or contribution.
99

10-
1110
## Filing Bug Reports
1211

1312
You can file bug reports against the SDK on the [GitHub issues][issues] page.
@@ -41,7 +40,6 @@ guidelines prior to filing a bug report.
4140
as well, like whether this is a persistent issue, or if it only occurs
4241
some of the time.
4342

44-
4543
## Submitting Pull Requests
4644

4745
We are always happy to receive code and documentation contributions to the SDK.
@@ -57,7 +55,7 @@ Please be aware of the following notes prior to opening a pull request:
5755

5856
3. Wherever possible, pull requests should contain tests as appropriate.
5957
Bugfixes should contain tests that exercise the corrected behavior (i.e., the
60-
test should fail without the bugfix and pass with it), and new features
58+
test should fail without the bugfix and pass with it), and new features
6159
should be accompanied by tests exercising the feature. Pull requests that
6260
contain failing tests will not be merged until the test failures are addressed.
6361
Pull requests that cause a significant drop in the SDK's test coverage
@@ -67,10 +65,9 @@ Please be aware of the following notes prior to opening a pull request:
6765
[conventional commits][conventional commits]. Title must begin with `feat(module): title`,
6866
`fix(module): title`, `docs(module): title`, `test(module): title`, `chore(module): title`.
6967
Title should be lowercase and not period at the end of it. If the commit includes
70-
a breaking change, the commit message must end with a single paragraph: `BREAKING
71-
CHANGE: a description of what broke`
68+
a breaking change, the commit message must end with a single paragraph: `BREAKING CHANGE: a description of what broke`
7269

73-
5. After getting ready to open a pull request, make sure to run the `npm run update-clients`
70+
5. After getting ready to open a pull request, make sure to run the `yarn update-clients`
7471
to re-generate all the service clients, and commit the change(if any) to a
7572
standalone commit following the guide above.
7673

@@ -79,32 +76,34 @@ Please be aware of the following notes prior to opening a pull request:
7976
This project uses a monorepo to manage all of the packages.
8077
This allows us to easily test the effects of changes in one package to others.
8178

82-
To run the tests locally, install the dependencies for the root project. This includes Lerna, the tool
83-
we use to manage the monorepo.
79+
Make sure you have [`yarn`](https://yarnpkg.com/en/) installed by:
8480

8581
```
86-
npm install
82+
yarn --version
8783
```
8884

89-
Then, run the following command to tell Lerna to install and link any dependencies in the `packages` directory:
85+
If not, please refer to [yarn installation](https://yarnpkg.com/en/docs/install#mac-stable) to install `yarn`.
86+
87+
To install the dependencies and link the library, run the following command:
9088

9189
```
92-
npm run bootstrap
90+
yarn
9391
```
9492

95-
To run all of the tests in the repository, still from the root package, run the following:
93+
To run all of the tests in the repository, still from the root package, run the following command:
9694

9795
```
98-
npm test
96+
yarn test-all
9997
```
98+
10099
The above command will use Lerna to run the `test` script in every package in the `packages` directory.
101100

102-
To run the tests for a specific package, you can run `npm test` from within the specified package folder, assuming the above steps have been run.
101+
To run the tests for a specific package, you can run `yarn test` from within the specified package folder, assuming the above steps have been run.
103102

104103
### Generating Service Clients
105104

106-
You can generate service client by yourself from either [AWS service models][] or customized models. The SDK provides
107-
a command line interface for generating packages. In order to use the CLI, first complete the test and setup steps (above) to
105+
You can generate service client by yourself from either [AWS service models][] or customized models. The SDK provides
106+
a command line interface for generating packages. In order to use the CLI, first complete the test and setup steps (above) to
108107
build the package-generator and its dependencies.
109108

110109
```
@@ -138,5 +137,5 @@ node ./packages/package-generator/build/cli.js client --model models/dynamodb/20
138137
[pr]: https://github.com/aws/aws-sdk-js-v3/pulls
139138
[license]: http://aws.amazon.com/apache2.0/
140139
[cla]: http://en.wikipedia.org/wiki/Contributor_License_Agreement
141-
[AWS service models]: https://github.com/aws/aws-sdk-js-v3/tree/master/models
140+
[aws service models]: https://github.com/aws/aws-sdk-js-v3/tree/master/models
142141
[conventional commits]: https://www.conventionalcommits.org/

Diff for: buildspec.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ phases:
44
install:
55
runtime-versions:
66
nodejs: 10
7-
pre_build:
87
commands:
9-
- echo Installing dependencies
10-
- npm install && npm run bootstrap
8+
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.17.3
9+
- export PATH="$HOME/.yarn/bin:$PATH"
10+
- yarn
1111
build:
1212
commands:
1313
- echo Executing unit tests
14-
- npm test
14+
- yarn test

Diff for: jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ module.exports = {
55
projects: ["<rootDir>/packages/*/jest.config.js"],
66
testPathIgnorePatterns: [
77
"<rootDir>/packages/add-glacier-checksum-headers-browser",
8-
"<rootDir>/packages/client-.*"
8+
"<rootDir>/clients/.*/client-.*"
99
],
1010
coveragePathIgnorePatterns: [
1111
"/node_modules/",
1212
"<rootDir>/packages/add-glacier-checksum-headers-browser",
1313
"<rootDir>/packages/crypto-sjcl-*",
1414
"<rootDir>/packages/xml-body-parser/vendor/",
15-
"<rootDir>/packages/client-.*",
15+
"<rootDir>/clients/.*/client-.*",
1616
"/__fixtures__/"
1717
]
1818
};

Diff for: lerna.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44
"packages/*",
55
"clients/browser/*",
66
"clients/node/*",
7-
"client/universal/*"
7+
"clients/universal/*"
88
],
99
"version": "independent",
10+
"npmClient": "yarn",
11+
"useWorkspaces": true,
1012
"command": {
1113
"bootstrap": {
1214
"nohoist": ["@types/*", "typedoc", "karma*"]
15+
},
16+
"run": {
17+
"npmClient": "yarn"
1318
}
1419
},
15-
"hoist": true,
1620
"nohoist": ["@types/*", "typedoc", "karma*"]
1721
}

Diff for: package.json

+14-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
"description": "AWS SDK for JavaScript from the future",
66
"main": "index.js",
77
"scripts": {
8-
"bootstrap": "lerna bootstrap",
9-
"clean": "npm run clear-build-cache && lerna clean",
8+
"bootstrap": "yarn",
9+
"clean": "yarn clear-build-cache && yarn clear-build-info && lerna clean",
1010
"clear-build-cache": "rimraf ./packages/*/build/* ./clients/*/*/build/*",
11+
"clear-build-info": "rimraf ./packages/*/*.tsbuildinfo ./clients/*/*/*.tsbuildinfo",
1112
"copy-models": "node ./scripts/copyModels.js",
12-
"update-clients": "node ./scripts/rebuildClients.js",
13-
"pretest": "lerna run pretest",
14-
"test": "jest --coverage"
13+
"update-clients": "node ./packages/package-generator/build/cli.js import-all --matching './models/*/*/service-2.json'",
14+
"pretest": "lerna run pretest --since --include-filtered-dependents --include-filtered-dependencies",
15+
"test": "jest --coverage",
16+
"pretest-all": "lerna run pretest",
17+
"test-all": "jest --coverage"
1518
},
1619
"repository": {
1720
"type": "git",
@@ -38,10 +41,14 @@
3841
"lerna": "3.16.2",
3942
"lint-staged": "^9.0.0",
4043
"prettier": "1.18.2",
41-
"typescript": "~3.4.0"
44+
"typescript": "~3.4.0",
45+
"yarn": "1.17.3"
4246
},
4347
"workspaces": [
44-
"packages/*"
48+
"packages/*",
49+
"clients/browser/*",
50+
"clients/node/*",
51+
"clients/universal/*"
4552
],
4653
"husky": {
4754
"hooks": {

Diff for: packages/package-generator/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@types/prettier": "1.16.4",
4141
"@types/rimraf": "^2.0.2",
4242
"@types/semver": "^6.0.0",
43-
"@types/yargs": "^8.0",
43+
"@types/yargs": "~8.0",
4444
"jest": "^24.7.1",
4545
"typescript": "~3.4.0"
4646
}

Diff for: packages/util-create-request/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
},
2121
"devDependencies": {
2222
"@aws-sdk/middleware-stack": "^0.1.0-preview.5",
23-
"@types/jest": "^20.0.2",
23+
"@types/jest": "^24.0.12",
2424
"@types/node": "^10.0.3",
25-
"jest": "^20.0.4",
25+
"jest": "^24.7.1",
2626
"typescript": "~3.4.0"
2727
}
2828
}

0 commit comments

Comments
 (0)