Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/auto-accept-p…
Browse files Browse the repository at this point in the history
…roof

Signed-off-by: Berend Sliedrecht <berend@animo.id>
  • Loading branch information
berendsliedrecht committed Jul 16, 2021
2 parents 23f1d86 + 3331a3c commit 7f39d2a
Show file tree
Hide file tree
Showing 360 changed files with 7,159 additions and 3,025 deletions.
6 changes: 0 additions & 6 deletions .env

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

42 changes: 31 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,31 @@ module.exports = {
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
project: ['./tsconfig.eslint.json'],
},
settings: {
'import/extensions': ['.js', '.ts'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
project: 'packages/*/tsconfig.json',
alwaysTryTypes: true,
},
},
},
plugins: ['@typescript-eslint'],
rules: {
// Type is enforced by callers. Not entirely, but it's good enough.
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
'@typescript-eslint/explicit-member-accessibility': 'error',
'no-console': 'error',
// Because of early development, we only warn on ts-ignore. In future we want to move to error
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
'import/no-cycle': 'error',
Expand All @@ -36,19 +42,33 @@ module.exports = {
'newlines-between': 'always',
},
],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: false,
},
],
},
overrides: [
{
files: ['*.test.*'],
rules: {
'no-console': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
files: ['jest.config.ts', '.eslintrc.js'],
env: {
node: true,
},
},
{
files: ['jest.config.js', '.eslintrc.js'],
files: ['*.test.ts', '**/__tests__/**', '**/tests/**', 'jest.*.ts', 'samples/**'],
env: {
node: true,
jest: true,
node: false,
},
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
},
},
],
Expand Down
59 changes: 13 additions & 46 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ on:
branches: [main]
push:
branches: [main]
workflow_dispatch:
inputs:
releaseType:
description: The type of release. Should be one of "major", "minor", "patch"
required: true
default: 'patch'

env:
TEST_AGENT_PUBLIC_DID_SEED: 000000000000000000000000Trustee9
Expand Down Expand Up @@ -111,26 +105,27 @@ jobs:
- uses: codecov/codecov-action@v1
if: always()

release:
release-canary:
runs-on: ubuntu-20.04
name: Release
name: Release Canary
needs: [integration-test, validate]
# Only run on push or workflow dispatch to main branch
if: (github.ref == 'refs/heads/main' && github.repository == 'hyperledger/aries-framework-javascript') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
if: github.ref == 'refs/heads/main' && github.repository == 'hyperledger/aries-framework-javascript' && github.event_name == 'push'
steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2
with:
# pulls all commits (needed for lerna to correctly version)
fetch-depth: 0

# setup dependencies
- name: Setup Libindy
uses: ./.github/actions/setup-libindy

- name: git config
run: |
git config user.name "@github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Setup node v16
uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org/'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -144,40 +139,12 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup node v16
uses: actions/setup-node@v2
with:
node-version: 16

- name: Install dependencies
run: yarn install

# https://github.com/yarnpkg/yarn/issues/6617#issuecomment-436222106
- name: Prepend Node path
run: npm config set scripts-prepend-node-path true

- name: Set Verbose Logging
run: npm config set loglevel verbose --global

- name: Set NPM config
run: |
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "always-auth=true" >> .npmrc
- name: Install dependencies
run: yarn install --frozen-lockfile

# On push to master, release unstable version
# On push to main, release unstable version
- name: Release Unstable
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release patch --preRelease=unstable -VV

# On manual workflow dispatch release stable version
- name: Release Stable
if: github.event_name == 'workflow_dispatch'
run: yarn lerna publish --loglevel=verbose --canary minor --exact --force-publish --yes --no-verify-access --dist-tag latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release ${{ github.event.inputs.releaseType }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ build
yarn-error.log
.idea
aries-framework-*.tgz
src/lib/__tests__/genesis-von.txn
coverage
.DS_Store
logs.txt
logs/
logs/
packages/core/src/__tests__/genesis-von.txn
lerna-debug.log
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .node-dev.json

This file was deleted.

1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,8 @@ FROM base as final
WORKDIR /www
ENV RUN_MODE="docker"

COPY package.json package.json
COPY yarn.lock yarn.lock

# Run install after copying only depdendency file
# to make use of docker layer caching
RUN yarn install

# Copy other depdencies
# Copy dependencies
COPY . .

RUN yarn compile
RUN yarn install
RUN yarn build
28 changes: 12 additions & 16 deletions docs/setup-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,29 @@ To start using Aries Framework JavaScript in NodeJS some platform specific depen
- [macOS](../docs/libindy/macos.md)
- [Linux](../docs/libindy/linux.md)
- [Windows](../docs/libindy/windows.md)
3. Add `indy-sdk` and `aries-framework` to your project.
3. Add `@aries-framework/core` and `@aries-framework/node` to your project.

```bash
yarn add aries-framework indy-sdk # npm install aries-framework indy-sdk
yarn add @aries-framework/core @aries-framework/node
```

> ⚠️ If making use of NodeJS > 12, make sure you're also using indy-sdk >= 1.16.0-dev-1633
## Agent Setup

Initializing the Agent also requires some NodeJS specific setup, mainly for the Indy SDK and File System. Below is a sample config, see the [README](../README.md#getting-started) for an overview of getting started guides. If you want to jump right in, check the [Getting Started: Agent](./getting-started/0-agent.md) guide.

```ts
import { Agent } from 'aries-framework'

// Import indy-sdk and File System for NodeJS
import indy from 'indy-sdk'
import { NodeFileSystem } from 'aries-framework/build/storage/fs/NodeFileSystem'
import { Agent } from '@aries-framework/core'
import { agentDependencies } from '@aries-framework/node'

// This creates an agent with all the specified configuration data
const agent = new Agent({
label: 'my-agent',
walletConfig: { id: 'walletId' },
walletCredentials: { key: 'testkey0000000000000000000000000' },
indy,
fileSystem: new NodeFileSystem(),
})
const agent = new Agent(
{
label: 'my-agent',
walletConfig: { id: 'walletId' },
walletCredentials: { key: 'testkey0000000000000000000000000' },
},
agentDependencies
)

// Make sure to initialize the agent before using it.
try {
Expand Down
45 changes: 12 additions & 33 deletions docs/setup-react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
To start using Aries Framework JavaScript in React Native some platform specific dependencies are required.

1. Follow the [React Native Setup](https://reactnative.dev/docs/environment-setup) guide to set up your environment.
2. Add `rn-indy-sdk` and `aries-framework` to your project.
2. Add `@aries-framework/core` and `@aries-framework/react-native` to your project.

```bash
yarn add aries-framework rn-indy-sdk
yarn add @aries-framework/core @aries-framework/react-native
```

3. Install [Libindy](https://github.com/hyperledger/indy-sdk) for iOS and Android:
Expand All @@ -20,25 +20,6 @@ yarn add aries-framework rn-indy-sdk

- Indy SDK [issue](https://github.com/hyperledger/indy-sdk/issues/2346#issuecomment-841000640)

5. Install React Native polyfills and import them in the `index.js` file:

```bash
yarn add react-native-get-random-values @azure/core-asynciterator-polyfill
```

```js
import 'react-native-get-random-values'
import '@azure/core-asynciterator-polyfill'
```

## TypeScript

If you're using TypeScript in your React Native project you need to install `indy-sdk` types both with and without alias. This is to make sure you have types when importing `rn-indy-sdk`, but also for `indy-sdk` types used by the framework.

```
yarn add -D @types/rn-indy-sdk@npm:@types/indy-sdk @types/indy-sdk
```

### Using decorators

If you intend to extend the core framework capabilities good change you will need to use decorators. In this case you need to enable support for decorators in both TypeScript and Babel.
Expand Down Expand Up @@ -77,20 +58,18 @@ module.exports = {
Initializing the Agent also requires some React Native specific setup, mainly for the Indy SDK and File System. Below is a sample config, see the [README](../README.md#getting-started) for an overview of getting started guides. If you want to jump right in, check the [Getting Started: Agent](./getting-started/0-agent.md) guide.

```ts
import { Agent } from 'aries-framework'

// Import rn-indy-sdk and File System for React Native
import indy from 'rn-indy-sdk'
import { ReactNativeFileSystem } from 'aries-framework/build/storage/fs/ReactNativeFileSystem'
import { Agent } from 'aries-framework/core'
import { agentDependencies } from '@aries-framework/react-native'

// This creates an agent with all the specified configuration data
const agent = new Agent({
label: 'my-agent',
walletConfig: { id: 'walletId' },
walletCredentials: { key: 'testkey0000000000000000000000000' },
indy,
fileSystem: new ReactNativeFileSystem(),
})
const agent = new Agent(
{
label: 'my-agent',
walletConfig: { id: 'walletId' },
walletCredentials: { key: 'testkey0000000000000000000000000' },
},
agentDependencies
)

// Make sure to initialize the agent before using it.
try {
Expand Down
24 changes: 24 additions & 0 deletions jest.config.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Config } from '@jest/types'

const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
coveragePathIgnorePatterns: ['/build/', '/node_modules/', '/__tests__/', 'tests'],
coverageDirectory: '<rootDir>/coverage/',
verbose: true,
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
moduleNameMapper: {
'@aries-framework/(.+)': [
'<rootDir>/../../packages/$1/src',
'<rootDir>/../packages/$1/src',
'<rootDir>/packages/$1/src',
],
},
globals: {
'ts-jest': {
isolatedModules: true,
},
},
}

export default config
17 changes: 0 additions & 17 deletions jest.config.js

This file was deleted.

11 changes: 11 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Config } from '@jest/types'

import base from './jest.config.base'

const config: Config.InitialOptions = {
...base,
roots: ['<rootDir>'],
projects: ['<rootDir>/packages/*', '<rootDir>/tests/jest.config.ts'],
}

export default config
Loading

0 comments on commit 7f39d2a

Please sign in to comment.