Skip to content

Commit

Permalink
build: npm workspaces (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
boweihan committed Sep 6, 2022
1 parent 3e9784d commit 8e200be
Show file tree
Hide file tree
Showing 28 changed files with 90,089 additions and 24,479 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:

- name: Install and Build
run: |
yarn install --frozen-lockfile
yarn build
npm ci
npm run build
- name: Publish
run: yarn run publishToNpm
run: npm run publishToNpm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 5 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ jobs:

- name: Install and Build
run: |
yarn install --frozen-lockfile
yarn build
./packages/components/node_modules/cypress/bin/cypress install
npm ci
npm run build
- name: Run unit tests
run: yarn test
run: npm test

- name: cypress run
- name: Run integration tests
uses: cypress-io/github-action@v2
with:
command: yarn test:cypress-ct
working-directory: packages/components
command: npm run test:integration
# after the test run completes
# store videos and any screenshots
- uses: actions/upload-artifact@v1
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CYPRESS_INSTALL_BINARY=0
puppeteer_skip_chromium_download=true
legacy-peer-deps=true
39 changes: 34 additions & 5 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,51 @@

### Environment setup

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.
Iot-App-Kit runs on node and uses npm for package management. Specific versions are required in order to keep builds working with the current monorepo tooling.

Ensure you have `node` version 16 and `npm` > 8.0.

- Node: any `v16` or higher
- Yarn: any `v1`, but not `v2` or higher
- Npm: `v8.0.0` or higher

### Building Iot-App-Kit

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.
With supported versions of node and npm 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.

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`.

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.
# Update to node version 16
sudo n 16
```
2. Build project
```bash
cd iot-app-kit/ (root)
npm install
npm run build
```

3. Running build commands for specific packages

```
npm run <command> -w @iot-app-kit/<package>
```

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

4. `yarn start` will run the project at `localhost:3333`. You should see example IoT App Kit components requesting data from SiteWise.
Run`npm run start` at the project root and then view `localhost:3333`. You should see example IoT App Kit components requesting data from SiteWise.

### Coding guidelines and requirements

Expand Down
13 changes: 0 additions & 13 deletions lerna.json

This file was deleted.

0 comments on commit 8e200be

Please sign in to comment.