Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

Lerna and yarn workspace #66

Merged
merged 1 commit into from
Jun 5, 2019
Merged
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- checkout

- <<: *restore_dependencies
- run: yarn install
- run: yarn
- <<: *save_dependencies

- run: yarn lint
Expand Down
7 changes: 0 additions & 7 deletions @types/deoxysii.d.ts

This file was deleted.

41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,46 @@
[![Coverage Status](https://coveralls.io/repos/github/oasislabs/oasis-client/badge.svg?branch=master&t=yu91jw)](https://coveralls.io/github/oasislabs/oasis-client?branch=master)
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/Oasis-official/Lobby?source=orgpage)

## Packages

| Package | Version | Description |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| [`client`](/packages/client) | [![npm](https://img.shields.io/npm/v/client.svg)](https://www.npmjs.com) | Client for interacting with services on the Oasis cloud |
| [`developer-gateway-client`](/packages/developer-gateway-client) | [![npm](https://img.shields.io/npm/v/client.svg)](https://www.npmjs.com) | Lightweight client for interacting with developer-gateway services |
| [`@oasis/developer-gateway`](/packages/developer-gateway) | [![npm](https://img.shields.io/npm/v/client.svg)](https://www.npmjs.com) | Client backend for communicating with a developer-gateway |
| [`@oasis/service`](/packages/service) | [![npm](https://img.shields.io/npm/v/client.svg)](https://www.npmjs.com) | Implementations for deploying and interacting with services |
| [`@oasis/confidential`](/packages/confidential) | [![npm](https://img.shields.io/npm/v/client.svg)](https://www.npmjs.com) | Encryption tools for confidentiality on Oasis |
| [`@oasis/common`](/packages/common) | [![npm](https://img.shields.io/npm/v/client.svg)](https://www.npmjs.com) | Common utilities for Oasis packages |
| [`@oasis/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/client.svg)](https://www.npmjs.com) | Types for Oasis packages |
| [`@oasis/test`](/packages/test) | [![npm](https://img.shields.io/npm/v/client.svg)](https://www.npmjs.com) | Tools used in Oasis tests |


## Contributing

### Installing

To get started:
To get started first install the required build tools:

```
npm install -g lerna
armaniferrante marked this conversation as resolved.
Show resolved Hide resolved
npm install -g yarn
```

Then bootstrap the workspace:

```
yarn install
yarn
```

### Building

To build oasis.js:
To build the workspace:

```
yarn build
```

The built javascript and typescript definitions will be in `dist/`. For direct browser testing, simply include the rollup artifact directly in your script tag, e.g., `<script src=/dist/index.umd.js></script>`.
In each package, the built javascript and typescript definitions will be in `dist/`. For direct browser testing of a client, simply include the rollup artifact directly in your script tag, e.g., `<script src=/dist/index.umd.js></script>`. For example [here](https://github.com/oasislabs/oasis-client/blob/armani/wallet/packages/client/test/browser/service/index.html#L3).

### Testing

Expand All @@ -34,18 +55,6 @@ To run all tests:
yarn test
```

To run tests tests both in Jest and for the browser:

```
yarn test:unit
```

or

```
yarn test:browser
```

### Linting

To lint:
Expand Down
14 changes: 14 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

{
"lerna": "3.4.3",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
"packages/*"
],
"version": "independent",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
}
}
76 changes: 17 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,34 @@
{
"name": "oasis",
"version": "0.0.0",
"description": "",
"private": true,
"keywords": [],
"main": "dist/index.umd.js",
"module": "dist/index.es5.js",
"typings": "dist/types/index.d.ts",
"files": [
"dist",
"src",
"test"
],
"author": "Oasis Labs Inc. <info@oasislabs.com>",
"repository": {
"type": "git"
"workspaces": {
"packages": [
"packages/*"
]
},
"license": "",
"engines": {
"node": ">=6.0.0"
},
"scripts": {
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"lint:fix": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts' --fix",
"bootstrap": "lerna bootstrap",
"build": "lerna run build",
"lint": "lerna run lint --concurrency 1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't lint run concurrently? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can its just ugly and harder to debug errors if more than one lint error happens.

"lint:fix": "lerna run lint:fix --concurrency 1",
"prebuild": "rimraf dist",
"prepack": "yarn install && yarn build",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"serve": "yarn build && python3 -m http.server 8000",
"start": "rollup -c rollup.config.ts -w",
"test": "yarn test:jest && yarn test:browser",
"test:jest": "jest --coverage test/unit test/integration",
"test:unit": "jest test/unit",
"test:e2e": "jest test/e2e",
"test:integration": "jest test/integration",
"test:browser": "scripts/test-browser.sh",
"test:watch": "jest --coverage --watch",
"test": "lerna run test --concurrency 1 --stream",
"precommit": "lint-staged",
"coverage": "yarn test:jest && cat ./coverage/lcov.info | coveralls"
"coverage": "lerna run coverage --concurrency 1 -- stream && yarn istanbul",
"istanbul": "istanbul-combine -d coverage -r lcov -r html ./packages/**/coverage-final.json",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"lint-staged": {
"{src,test}/**/*.ts": [
"packages/*/{src,test}/**/*.ts": [
"prettier --write",
"git add"
]
},
"jest": {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testEnvironment": "node",
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"coveragePathIgnorePatterns": [
"src/confidential/ecdh-tweak/browser.ts",
"src/utils/eventemitter3.ts",
"src/utils/cbor.ts",
"src/utils/keccak256.ts",
"src/utils/tweetnacl.ts",
"test/"
]
},
"prettier": {
"semi": true,
"singleQuote": true
Expand All @@ -75,13 +41,14 @@
"devDependencies": {
"@commitlint/cli": "^7.1.2",
"@commitlint/config-conventional": "^7.1.2",
"@types/cbor": "^2.0.0",
"@types/eventemitter3": "^2.0.2",
"@oasis/test": "^0.0.0",
"@types/jest": "^23.3.2",
"coveralls": "^3.0.3",
"husky": "^1.0.1",
"istanbul-combine": "^0.3.0",
"jest": "^23.6.0",
"jest-config": "^23.6.0",
"lerna": "3.14.1",
"lint-staged": "^8.0.0",
"lodash.camelcase": "^4.3.0",
"prettier": "^1.14.3",
Expand All @@ -102,14 +69,5 @@
"tslint-config-standard": "^8.0.1",
"typedoc": "^0.12.0",
"typescript": "^3.0.3"
},
"dependencies": {
"ethers": "^4.0.27",
"axios": "^0.18.0",
"cbor-js": "^0.1.0",
"deoxysii": "^0.0.1",
"eventemitter3": "^3.1.2",
"js-sha3": "^0.8.0",
"node-localstorage": "^1.3.1"
}
}
44 changes: 44 additions & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "client",
"version": "0.0.0",
"description": "",
"keywords": [],
"main": "dist/index.umd.js",
"module": "dist/index.es5.js",
"typings": "dist/types/index.d.ts",
"files": [
"dist",
"src",
"test"
],
"author": "Oasis Labs Inc. <info@oasislabs.com>",
"scripts": {
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"lint:fix": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts' --fix",
"prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
"test": "yarn test:integration && yarn test:browser",
"test:e2e": "jest test/e2e",
"test:integration": "jest test/integration",
"test:browser": "scripts/test-browser.sh",
"coverage": "jest --coverage test/integration"
},
"jest": {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testEnvironment": "node",
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
},
"dependencies": {
"@oasis/common": "^0.0.0",
"@oasis/service": "^0.0.0",
"@oasis/developer-gateway": "^0.0.0",
"@oasis/ethereum": "^0.0.0"
}
}
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import DeveloperGateway from '@oasis/developer-gateway';
import { bytes } from '@oasis/common';
import {
Service,
deploy,
OasisCoder,
DeployHeaderReader,
DeployHeaderWriter,
setDefaultOasisGateway
} from '@oasis/service';
import { cbor, keccak256 } from '@oasis/types';
import { Deoxysii, encrypt, decrypt } from '@oasis/confidential';
import {
EthereumGateway,
EthereumCoder,
EthereumWallet as Wallet
} from '@oasis/ethereum';

setDefaultOasisGateway(DeveloperGateway.http('http://localhost:1234'));

let oasis = {
Service,
Wallet,
deploy,
utils: {
cbor,
bytes,
keccak256,
encrypt,
decrypt,
OasisCoder,
EthereumCoder,
EthereumGateway,
Deoxysii,
DeployHeaderReader,
DeployHeaderWriter
}
};

export default oasis;
Loading