Skip to content

Commit

Permalink
refactor: change repo to monorepo
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Jul 7, 2021
1 parent ee81d01 commit c0d4abb
Show file tree
Hide file tree
Showing 330 changed files with 5,877 additions and 2,531 deletions.
6 changes: 0 additions & 6 deletions .env

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

45 changes: 32 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@ 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: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.
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
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',
// Aries protocol defines attributes with snake case.
'@typescript-eslint/camelcase': '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 @@ -38,19 +43,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'],
env: {
node: true,
jest: true,
node: false,
},
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
},
},
],
Expand Down
62 changes: 13 additions & 49 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 @@ -62,7 +56,7 @@ jobs:
run: yarn check-format

- name: Compile
run: yarn compile
run: yarn check-types

integration-test:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -129,26 +123,24 @@ 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:
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 @@ -162,40 +154,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/src/storage/fs/NodeFileSystem'
import { Agent } from '@aries-framework/core'
import * as dependencies 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' },
},
dependencies
)

// Make sure to initialize the agent before using it.
try {
Expand Down
26 changes: 12 additions & 14 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 Down Expand Up @@ -77,20 +77,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/src/storage/fs/ReactNativeFileSystem'
import { Agent } from 'aries-framework/core'
import * as dependencies 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' },
},
dependencies
)

// Make sure to initialize the agent before using it.
try {
Expand Down
19 changes: 19 additions & 0 deletions jest.config.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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',
],
},
}

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
11 changes: 11 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"packages": ["packages/*"],
"version": "0.0.0",
"useWorkspaces": true,
"npmClient": "yarn",
"command": {
"version": {
"allowBranch": "main"
}
}
}
Loading

0 comments on commit c0d4abb

Please sign in to comment.