Skip to content

Commit

Permalink
Merge pull request #3702 from BitGo/BTC-0.prettier-almost-all-the-things
Browse files Browse the repository at this point in the history
chore: apply prettier on many more files
  • Loading branch information
rushilbg committed Jul 4, 2023
2 parents b33c2ed + da718f7 commit 5ea79d7
Show file tree
Hide file tree
Showing 134 changed files with 1,783 additions and 1,655 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ coverage:
project: off
patch: off
comment:
layout: "diff, flags, files"
layout: 'diff, flags, files'
require_changes: true
flags:
bitgo:
Expand Down
17 changes: 11 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Bug Report
about: Report any bugs you find to help us improve the library.
labels: 'bug'

---

<!---
Expand All @@ -14,24 +13,30 @@ This will help us review, prioritize, and assign the issue to internal teams. Do
-->

## Environment Details
* **OS:** <!--- What is your operating system -->
* **Node Version:** <!--- What version of node are you running -->
* **Yarn Version:** <!--- What version of yarn are you running -->
* **BitGoJS Version:** <!--- What version of this library are you running -->
* **BitGo Environment:** <!--- Are you running against testnet or mainnet -->

- **OS:** <!--- What is your operating system -->
- **Node Version:** <!--- What version of node are you running -->
- **Yarn Version:** <!--- What version of yarn are you running -->
- **BitGoJS Version:** <!--- What version of this library are you running -->
- **BitGo Environment:** <!--- Are you running against testnet or mainnet -->

## Expected Behavior

<!--- Tell us what should happen -->

## Current Behavior

<!--- Tell us what happens instead of the expected behavior -->

## Possible Solution

<!--- Not obligatory, but suggest a fix/reason for the bug, -->

## Steps to Reproduce

<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->

1.
2.
3.
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Feature Request
about: Suggest an idea for this project.
labels: 'feature'

---

<!---
Expand All @@ -14,10 +13,13 @@ This will help us review, prioritize, and assign the issue to internal teams. Do
-->

## Feature Description

<!-- A concise description of the feature you would like. -->

## Motivation

<!-- Why should this feature be added. -->

## Context

<!--- Not obligatory; but provide any other context that would be helpful in terms of prioritization. -->
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] I have made corresponding changes to the documentation and on any new/updated functions and/or methods - [jsdoc](https://jsdoc.app/)
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
-->
-->
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
id: lerna-cache
uses: actions/cache@v3
with:
path: |
path: |
node_modules
modules/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('tsconfig.packages.json')}}
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
id: lerna-cache
uses: actions/cache@v3
with:
path: |
path: |
node_modules
modules/*/node_modules
/home/runner/.cache/Cypress
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
if: github.ref != 'refs/heads/master' # only publish changes if on feature branches
run: |
echo "preid=alpha" >> $GITHUB_ENV
- name: Set Environment Variable for Beta
if: github.ref == 'refs/heads/master' # only publish changes if on master branches
run: |
Expand All @@ -45,20 +45,20 @@ jobs:
echo "@bitgo-beta:registry=https://registry.npmjs.org" >> .npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.BETA_TOKEN }}" >> .npmrc
echo "//registry.npmjs.org/:always-auth=true" >> .npmrc
- name: Prepare Release
run: |
rm -rfd ./modules/web-demo
rm -rfd ./modules/express
npx ts-node ./scripts/prepare-release.ts ${{ env.preid }}
- name: Rebuild packages
run: yarn

- name: Commit Local Changes
run: git commit -am "Auto updated ${{ env.preid }} branch" --no-verify || echo "No changes to commit"

- name: Lerna Publish
- name: Lerna Publish
run: yarn lerna publish from-package --preid ${{ env.preid }} --dist-tag ${{ env.preid }} --force-publish --yes --loglevel silly

- name: Verify Publish
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test_package_updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ on:
branches:
- master
paths:
- "*/**/package.json"
- "!*/**/node_modules/package.json"
- "package.json"
- "!node_modules/package.json"
- '*/**/package.json'
- '!*/**/node_modules/package.json'
- 'package.json'
- '!node_modules/package.json'
pull_request:
branches:
- master
- rel/**
paths:
- "*/**/package.json"
- "!*/**/node_modules/package.json"
- "package.json"
- "!node_modules/package.json"
- '*/**/package.json'
- '!*/**/node_modules/package.json'
- 'package.json'
- '!node_modules/package.json'

jobs:
unit-test-all:
Expand Down
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.nyc_output/
dist/
scripts/sdk-coin-generator/template/
protobuf/
*.json
*.min.js
CHANGELOG.md
4 changes: 1 addition & 3 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
printWidth: 120
singleQuote: true
trailingComma: "es5"
requirePragma: true
insertPragma: true
trailingComma: 'es5'
61 changes: 34 additions & 27 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Requirements
* yarn version 1 (classic)
* node version >=14.18.0 and <17

- yarn version 1 (classic)
- node version >=14.18.0 and <17

# Installing

In the BitGoJS/ directory:
In the BitGoJS/ directory:

```bash
$ yarn install
Expand Down Expand Up @@ -51,6 +52,7 @@ Modules typically provide both unit and integration tests.
The rule of thumb for whether a test is a unit test or an integration test is whether or not the test makes a real network request to another system. If it does, it's probably an integration test, otherwise it's a unit test.

You can run unit tests for each individual module:

```bash
$ yarn run unit-test --scope bitgo
```
Expand All @@ -62,22 +64,25 @@ $ yarn run unit-test
```

Or just the modules which have changed since master:

```bash
$ yarn run unit-test-changed
```

Or the file that contains a specific string
- if you are a specific module:

- if you are a specific module:

```bash
$ yarn run unit-test --grep"keyword"
```

- if you are in the BitGoJs/ top-level directory

```bash
$ yarn run unit-test -- -- --grep "keyword"
```
```

**Note:** Each module's output will be prefixed with it's name, but it may be difficult to unmangle the test output.

To aid with evaluating test results, and especially test failures, a fancy test report is generated by the CI system and uploaded to S3.
Expand Down Expand Up @@ -127,19 +132,19 @@ Each module should have the following basic file structure:

### `package.json`

* #### `name`
For a binary application module named "fooapp", this should be set to `@bitgo/fooapp`.
- #### `name`
For a binary application module named "fooapp", this should be set to `@bitgo/fooapp`.

For a generic library module named "bar", this should be set to `@bitgo/sdk-lib-bar`.

For a coin library module which supports a coin with ticker "BAZ", this should be set to `@bitgo/sdk-coin-baz`.

* #### `scripts`
- #### `scripts`

These npm scripts may be run during lifecycle events and by lerna across all modules. If a script is not present in a module, that module will be skipped.

| Name | Description | Required? |
|----------------------|--------------------------------------------------------------------------------------------|-----------|
| -------------------- | ------------------------------------------------------------------------------------------ | --------- |
| `test` / `unit-test` | Run module unit tests | Yes |
| `integration-test` | Run module integration tests. These are run when a PR is targeted to merge against master. | No |
| `prepare` / `build` | Compile typescript sources | No |
Expand All @@ -151,9 +156,10 @@ These npm scripts may be run during lifecycle events and by lerna across all mod

Additional scripts which are too large for the package.json file should be placed in `scripts/` and should be plain javascript or bash.

* #### `repository`
- #### `repository`

This shall always be set for all modules to:

```json
{
"repository": {
Expand All @@ -163,13 +169,14 @@ This shall always be set for all modules to:
}
```

* #### `license`
- #### `license`

License shall be `Apache-2.0`.

* #### `engines`
- #### `engines`

Engines should be set to the following:

```json
{
"engines": {
Expand All @@ -182,24 +189,23 @@ Engines should be set to the following:
### `tsconfig.json`

There are a few things each module's `tsconfig.json` must do:
* Extend the root tsconfig.json
* Set the `outDir` and `rootDir` compiler options
* Set the `include` property to the correct module source directories (`package.json` should also be included if it is read at runtime)
* Include references to other packages within the repo already added to the `package.json`

- Extend the root tsconfig.json
- Set the `outDir` and `rootDir` compiler options
- Set the `include` property to the correct module source directories (`package.json` should also be included if it is read at runtime)
- Include references to other packages within the repo already added to the `package.json`

Here is a template to help get started:</br>
<b>Note: you only need to add references to other modules in the repo you actually use. </b>

```json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "."
},
"include": [
"src/**/*",
"package.json"
],
"include": ["src/**/*", "package.json"],
"references": [
{
"path": "../sdk-core"
Expand All @@ -212,7 +218,8 @@ Here is a template to help get started:</br>
```

### `tsconfig.packages.json`
Each package should also be listed in the root level `tsconfig.packages.json` as well.

Each package should also be listed in the root level `tsconfig.packages.json` as well.

## Package Installation

Expand Down Expand Up @@ -241,6 +248,7 @@ Make sure to run `yarn install` after adding a new dependency to a module. This
- Standalone packages that do not rely on direct SDK development but rather depend on SDK modules as installed from `npm` should keep all used dependencies within their module. They should not depend on any single dependency as defined at the root `package.json` or `node_modules`.

Examples of exceptions include:

- `express`
- `web-demo`

Expand All @@ -265,10 +273,10 @@ This will prompt you for both the coin's name (mainnet and testnet), symbol, and
Additional information about coin development can be found in the newly created coin's README.md file.

Due to supporting legacy versions of registering coins to `bitgo`, you will continue to add new coin definitions to:
| Module | Notes |
| Module | Notes |
|---------------|----------------------------------------------------------------------------------------------------------------------|
| `statics` | |
| `bitgo` | Coin registration in the `CoinFactory` class |
| `statics` | |
| `bitgo` | Coin registration in the `CoinFactory` class |
| `account-lib` | For account based coins that are converting from `account-lib`, the import/export at `account-lib`'s root `index.ts` |

### Coin Creation Options
Expand All @@ -278,8 +286,7 @@ Upon creating coins, you are given different options to choose from to create yo
> Do not install coin packages in the root of BitGoJS. They must be scoped to their respective package.
| Option | Description |
|---------|--------------------------------------------------------|
| ------- | ------------------------------------------------------ |
| Account | Used for account based coins. Eth based or "Eth like". |
| Utxo | Used for utxo based coins. Bitcoin, Litecoin, etc... |
| Simple | Base implementation extending BaseCoin. |

Loading

0 comments on commit 5ea79d7

Please sign in to comment.