Skip to content

Commit

Permalink
Fix: Development Quick Start Docs/Scripts (#148)
Browse files Browse the repository at this point in the history
* add yarn bootstrap script to replace lerna bootstrap

* specify supported node and yarn engines

* simplify development docs and update build steps

Co-authored-by: Thomas Juranek <thjurane@amazon.com>
  • Loading branch information
tjuranek and Thomas Juranek committed Jul 7, 2022
1 parent 04aab6b commit aa9dba6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 36 deletions.
47 changes: 11 additions & 36 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,20 @@
## Quick start for development
## Development Quick Start

1. Environment setup
### Environment setup

Ensure you have node version 16 and the latest version of yarn installed.
Iot-App-Kit runs on node and uses yarn for package management. Specific versions are required in order to keep builds working with the current monorepo tooling.

- Node: any `v16` or higher
- Yarn: any `v1`, but not `v2` or higher

To do this, execute the following commands:
```
# Install `n`, a node package manager, globally to help switch between node versions.
npm i n -g
### Building Iot-App-Kit

# Update to node version 16
sudo n 16
With supported versions of node and yarn installed, you're ready to connect to SiteWise and start building for Iot-App-Kit. You'll need to pull in credentials, specify the SiteWise assets you'd like to connect to, build the project, and then run locally.

# Install the latest version of yarn
npm i yarn@latest -g
1. Copy a set of AWS JSON formatted credentials to the account with the access to the SiteWise resources you are requesting, at `<rootDir>/packages/components/creds.json`.

# Optionally, install lerna
npm i lerna -g
```

2. Build project

```
# Without installing lerna locally...
npx lerna bootstrap
# With lerna installed locally
lerna bootstrap
```

4. Provide credentials
Copy a set of AWS JSON formatted credentials to the account with the access to the SiteWise resources you are requesting, at `<rootDir>/packages/components/creds.json`.

These credentials should not be uploaded to the repository.

5. Point to valid SiteWise resources

Alter the file `siteWiseQueries` within `@iot-app-kit/components` to point to valid SiteWise asset properties for the accounts credentials from the prior step.

6. Test locally
run `yarn run start` at the project root, and then view `localhost:3333`. Here you should see example IoT App Kit components requesting data from SiteWise.
2. Alter the file `siteWiseQueries` within `@iot-app-kit/components` to point to valid SiteWise asset properties for the account credentials from the prior step.

3. `yarn bootstrap` installs dependencies and builds the Iot-App-Kit packages. Note: this is different than using `lerna bootstrap`, which installs dependencies but doesn't build the packages.

4. `yarn start` will run the project at `localhost:3333`. You should see example IoT App Kit components requesting data from SiteWise.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
"main": "index.js",
"license": "Apache-2.0",
"repository": "git@github.com:awslabs/iot-app-kit.git",
"engines": {
"node": ">=16.0.0",
"yarn": ">=1.0.0 <2.0.0"
},
"workspaces": {
"packages": [
"packages/*"
]
},
"scripts": {
"start": "cd packages/components && yarn run start",
"bootstrap": "yarn install && yarn build",
"build": "lerna run build --stream",
"clean": "git clean -dxf -e /.idea -e /.vscode -e creds.json",
"fix": "npm-run-all -p fix:eslint fix:stylelint",
Expand Down

0 comments on commit aa9dba6

Please sign in to comment.