You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+31-47Lines changed: 31 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,24 +47,22 @@ Also check out the README files in the root of each package directory for a brie
47
47
48
48
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
49
49
50
-
## Contribute to create-amplify package
51
-
52
-
### Set up your local development environment
50
+
## Set up your local development environment
53
51
54
52
```sh
55
53
# clone project repo
56
54
cd<project directory>
57
-
npm run install:local
55
+
npm run setup:local
58
56
npm run test
59
57
```
60
58
61
-
`npm run install:local` will run `npm install`, then build all packages in the projectand run `npm link`
59
+
`npm run setup:local` will run `npm install`, then build all packages in the project. It also links the amplify and create-amplify bin files into the project node_modules folder.
62
60
63
61
`npm run test` will run all the unit tests in the project
64
62
65
-
You should now be able to run the new `amplify` CLI.
63
+
You should now be ready to start contributing to the project!
66
64
67
-
####Other helpful scripts
65
+
### Other helpful scripts
68
66
69
67
`npm run watch` will start the tsc server and watch for changes in all packages
70
68
@@ -76,6 +74,30 @@ You should now be able to run the new `amplify` CLI.
76
74
77
75
`npm run e2e` will run the E2E test suite. Note: you must have valid AWS credentials configured locally to run this command successfully.
78
76
77
+
### Testing changes locally
78
+
79
+
For local testing we recommend writing unit tests that exercise the code you are modifying as you are making changes. Individual test files can be run using:
80
+
81
+
```sh
82
+
npm run test:dir packages/<package name>/lib/<file-name>.test.ts
83
+
```
84
+
85
+
> Note: You must rebuild using `npm run build` for tests to pick up your changes.
86
+
87
+
Sometimes it's nice to have a test project to use as a testing environment for local changes. You can create test projects in the `local-testing` directory using
88
+
89
+
```sh
90
+
npm run setup:test-project <name>
91
+
```
92
+
93
+
This allows you to make local changes and immediately try them out in a test project. All projects that you create in this directory are gitignored.
94
+
95
+
Depending on the scope of the change you are making, integration tests and/or E2E tests may be necessary.
96
+
97
+
Integration tests are located [here](./packages/integration-tests/src/test-in-memory/). These tests operate mostly like unit tests but they exercise many different components and packages together. However, these tests do NOT make service calls. Test assertions can be set up using the [CDK assertions library](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.assertions-readme.html).
98
+
99
+
E2E tests are located [here](./packages/integration-tests/src/test-e2e/). These tests exercise full end-to-end features with no mocking or stubbing. These tests do make service calls and therefore require valid AWS credentials to run. Tests should be added to this suite very sparingly as these tests are the most time consuming to run and maintain. If possible, additional features should be tested by adding on to existing tests rather than adding entirely new tests.
100
+
79
101
### Creating changesets
80
102
81
103
This repo uses [changesets](https://github.com/changesets/changesets) for versioning and releasing changes.
@@ -85,7 +107,7 @@ This will start a walkthrough to author the changeset file. This file should be
85
107
86
108
### Publishing packages locally
87
109
88
-
Publishing packages locally allows you to install local package changes as if they were published to NPM. This is useful for testing or demo scenarios.
110
+
Publishing packages locally allows you to install local package changes as if they were published to NPM. This can be useful for testing or demo scenarios.
89
111
90
112
To set up a local npm proxy and publish the current local state to the proxy, run `npm run vend`.
91
113
This will start a local npm proxy using [Verdaccio](https://verdaccio.org/) and run `changeset version` and `changeset publish`.
@@ -120,45 +142,7 @@ At a minimum, each package needs:
120
142
4. An `update:api` script in the `package.json` file
121
143
5. A `typedoc.json` file
122
144
6. An `.npmignore` file
123
-
124
-
### Dev
125
-
126
-
1. Publish to local
127
-
128
-
You have to publish to local every time after making a change
mkdir amplify-project-$(date +%Y-%m-%d)# create an empty folder. Alternatively, you can create a project by running e.g `npx create-next-app next-$(date +%Y-%m-%d)`.
144
-
cd amplify-project-$(date +%Y-%m-%d)# cd into the empty folder
145
-
```
146
-
147
-
3. Create Amplify Project
148
-
149
-
```sh
150
-
# In the folder created in the previous step
151
-
npm create amplify
152
-
```
153
-
154
-
### Test
155
-
156
-
```sh
157
-
# In amplify-backend repo
158
-
npm run build # Have to build every time after making a change before running test
159
-
npm run test:dir packages/create-amplify # Run all test in create-amplify
160
-
npm run test:dir packages/create-amplify/src/<file-name>.test.ts # Run all test in one file. e.g. npm run test:dir packages/create-amplify/src/get_project_root.test.ts
161
-
```
145
+
7. A `README.md` file that gives a brief description of the intent of the package
0 commit comments