-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(*): create signing manager generator
add contribution guidelines, basic docs, improve commit config
- Loading branch information
Showing
14 changed files
with
312 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Contributing | ||
|
||
_DISCLAIMER: These guidelines (as well as all documentation) are in constant development. Any feedback is greatly appreciated. Just open a github issue and we will do our best to incorporate your suggestions within reason._ | ||
|
||
Thanks for your efforts in helping the Polymesh ecosystem grow! | ||
|
||
We accept PRs with all kinds of contributions, including the creation of custom signing managers to support currently unsupported use cases. | ||
|
||
## Custom Signing Managers | ||
|
||
To create a new signing manager, run `yarn generate:signing-manager <name>`. This will create a `packages/<name>` directory with all the necessary configuration to build/test/release an npm package called `@polymathnetwork/<name>`. Unit tests must be written using the [jest](https://jestjs.io/) testing framework. | ||
|
||
### Naming | ||
|
||
The package should be called `<something>-signing-manager` (i.e. `hashicorp-vault-signing-manager`). Use existing packages as an example. | ||
|
||
## Commits | ||
|
||
This repo uses [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). For automated release versions to work properly, commits must have the affected package name as a scope. For example, if adding a new feature to the `local-signing-manager` package, the commit message should be `feat(local-signing-manager): sign raw messages`. Commits that affect more than one package can use `*` as a scope. | ||
|
||
In order to ensure commits are properly formatted, we use husky to hijack the `git commit` command, so that it launches the commitizen CLI. Additionally, commit messages are validated with commitlint. | ||
|
||
## PR Requirements | ||
|
||
In order for a PR to be merged, it must: | ||
|
||
- Produce no linting errors | ||
- Have the proper type, scope and description in all commits | ||
- Be reasonably type safe (avoid type assertions, non-null assertions and use of `any` and `unknown` within reason) | ||
- Pass all unit tests | ||
- Pass the sonarcloud quality gate (no code smells and 100% unit test coverage) | ||
- Be properly documented with JSDoc comments | ||
- Be added to the table in the project README | ||
- Have an installation and usage example in its own README | ||
|
||
On top of that, all PRs will be subject to review by the Polymesh association. The association reserves the right to reject submissions on any basis. That said, we certainly welcome and encourage external contributions. | ||
|
||
As soon as your PR is merged, our CI pipeline will handle releasing new versions of all affected packages to npm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,19 @@ | ||
|
||
|
||
# SigningManagers | ||
|
||
This project was generated using [Nx](https://nx.dev). | ||
|
||
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="450"></p> | ||
|
||
🔎 **Smart, Fast and Extensible Build System** | ||
|
||
## Adding capabilities to your workspace | ||
|
||
Nx supports many plugins which add capabilities for developing different types of applications and different tools. | ||
|
||
These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well. | ||
|
||
Below are our core plugins: | ||
|
||
- [React](https://reactjs.org) | ||
- `npm install --save-dev @nrwl/react` | ||
- Web (no framework frontends) | ||
- `npm install --save-dev @nrwl/web` | ||
- [Angular](https://angular.io) | ||
- `npm install --save-dev @nrwl/angular` | ||
- [Nest](https://nestjs.com) | ||
- `npm install --save-dev @nrwl/nest` | ||
- [Express](https://expressjs.com) | ||
- `npm install --save-dev @nrwl/express` | ||
- [Node](https://nodejs.org) | ||
- `npm install --save-dev @nrwl/node` | ||
|
||
There are also many [community plugins](https://nx.dev/community) you could add. | ||
|
||
## Generate an application | ||
|
||
Run `nx g @nrwl/react:app my-app` to generate an application. | ||
|
||
> You can use any of the plugins above to generate applications as well. | ||
When using Nx, you can create multiple applications and libraries in the same workspace. | ||
|
||
## Generate a library | ||
|
||
Run `nx g @nrwl/react:lib my-lib` to generate a library. | ||
|
||
> You can also use any of the plugins above to generate libraries as well. | ||
Libraries are shareable across libraries and applications. They can be imported from `@signing-managers/mylib`. | ||
Monorepo for Polymesh SDK compatible Signing Managers. | ||
|
||
## Development server | ||
|
||
Run `nx serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. | ||
|
||
## Code scaffolding | ||
|
||
Run `nx g @nrwl/react:component my-component --project=my-app` to generate a new component. | ||
|
||
## Build | ||
|
||
Run `nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. | ||
|
||
## Running unit tests | ||
|
||
Run `nx test my-app` to execute the unit tests via [Jest](https://jestjs.io). | ||
|
||
Run `nx affected:test` to execute the unit tests affected by a change. | ||
|
||
## Running end-to-end tests | ||
|
||
Run `nx e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io). | ||
|
||
Run `nx affected:e2e` to execute the end-to-end tests affected by a change. | ||
|
||
## Understand your workspace | ||
|
||
Run `nx graph` to see a diagram of the dependencies of your projects. | ||
|
||
## Further help | ||
|
||
Visit the [Nx Documentation](https://nx.dev) to learn more. | ||
|
||
|
||
|
||
## ☁ Nx Cloud | ||
This project was generated using [Nx](https://nx.dev). | ||
|
||
### Distributed Computation Caching & Distributed Task Execution | ||
## Projects | ||
|
||
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-cloud-card.png"></p> | ||
| Project | Package | Version | Links | | ||
| ------------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **Local Signing Manager** | [`@polymathnetwork/local-signing-manager`](https://npmjs.com/package/@ng-easy/builders) | [![npm latest version](https://img.shields.io/npm/v/@polymathnetwork/local-signing-manager/latest.svg)](https://www.npmjs.com/package/@polymathnetwork/local-signing-manager) | [![README](https://img.shields.io/badge/README--green.svg)](/packages/local-signing-manager/README.md) [![CHANGELOG](https://img.shields.io/badge/CHANGELOG--orange.svg)](/packages/local-signing-manager/CHANGELOG.md) | | ||
|
||
Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly. | ||
## Scripts | ||
|
||
Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers. | ||
- Linting: `yarn lint <packageName>` | ||
- Testing: `yarn test <packageName>` | ||
- Building: `yarn build <packageName>` | ||
|
||
Visit [Nx Cloud](https://nx.app/) to learn more. | ||
You can also use nx commands directly with `yarn nx` (i.e. `yarn nx affected --targets=lint,test`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional', '@commitlint/config-nx-scopes'], | ||
extends: ['@commitlint/config-conventional', 'cz'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
# local-signing-manager | ||
|
||
Polymesh SDK (v13+) compatible signing manager that stores private keys in memory. | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
## Usage | ||
|
||
```typescript | ||
import { LocalSigningManager } from '@polymathnetwork/local-signing-manager'; | ||
import { Polymesh } from '@polymathnetwork/polymesh-sdk'; | ||
|
||
// setup | ||
const signingManager = await LocalSigningManager.create({ | ||
accounts: [ | ||
{ | ||
mnemonic: 'secret words will not be shared', | ||
}, | ||
], | ||
}); | ||
|
||
Run `nx test local-signing-manager` to execute the unit tests via [Jest](https://jestjs.io). | ||
const sdk = await Polymesh.connect({ | ||
nodeUrl, | ||
signingManager, | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# types | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
Base types for Signing Managers | ||
|
||
Run `nx test types` to execute the unit tests via [Jest](https://jestjs.io). | ||
This library was generated with [Nx](https://nx.dev). |
Oops, something went wrong.