Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: move to monrepo #322

Merged
merged 15 commits into from
Jul 15, 2021
Merged

Conversation

TimoGlastra
Copy link
Contributor

@TimoGlastra TimoGlastra commented Jun 13, 2021

Basically ready to be merged.

Task list:

  • Split into @aries-framework/core, @aries-framework/node & @aries-framework/react-native
  • Tests working with new structure
  • Linting, prettier with monorepo
  • Automatic release script with lerna instead of release-it
  • update NPM token (to aries-framework org instead of hyperledger)

@TimoGlastra TimoGlastra changed the base branch from monorepo to main June 13, 2021 20:46
@TimoGlastra TimoGlastra force-pushed the monorepo branch 2 times, most recently from c0d4abb to 7d17038 Compare July 7, 2021 18:06
@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2021

Codecov Report

Merging #322 (5d1143e) into main (55e8697) will decrease coverage by 1.89%.
The diff coverage is 87.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #322      +/-   ##
==========================================
- Coverage   88.32%   86.42%   -1.90%     
==========================================
  Files         239      234       -5     
  Lines        4796     4803       +7     
  Branches      615      750     +135     
==========================================
- Hits         4236     4151      -85     
- Misses        560      652      +92     
Impacted Files Coverage Δ
packages/core/src/agent/AgentMessage.ts 86.66% <ø> (ø)
packages/core/src/agent/BaseMessage.ts 100.00% <ø> (ø)
packages/core/src/agent/Dispatcher.ts 96.42% <ø> (ø)
packages/core/src/agent/EnvelopeService.ts 100.00% <ø> (ø)
packages/core/src/agent/Events.ts 100.00% <ø> (ø)
packages/core/src/agent/MessageReceiver.ts 89.06% <ø> (ø)
packages/core/src/agent/MessageSender.ts 87.83% <ø> (ø)
packages/core/src/agent/TransportService.ts 92.30% <ø> (ø)
packages/core/src/agent/helpers.ts 100.00% <ø> (ø)
...ges/core/src/agent/models/InboundMessageContext.ts 93.33% <ø> (ø)
... and 267 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55e8697...5d1143e. Read the comment docs.

@TimoGlastra TimoGlastra marked this pull request as ready for review July 14, 2021 09:28
@TimoGlastra TimoGlastra requested a review from a team as a code owner July 14, 2021 09:28
@TimoGlastra
Copy link
Contributor Author

Ready for review! I've coordinated with Ry to get everything set up for automatic releases so if we merge it we should automatically release under the new branch.

This PR doesn't introduce a lot of changes in how things works, except for the extraction of platform specific dependencies. Those are now the second parameter to agent.

import { Agent } from '@aries-framework/core'
import { agentDependencies } from '@aries-framework/node'

const config = {}
const agent = new Agent(config, agentDependencies)

Copy link
Contributor

@JamesKEbert JamesKEbert left a comment

Choose a reason for hiding this comment

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

This looks good to me--there's a lot to look through on this, I left a couple of comments, but I may be missing some context behind the thoughts.
Thanks Timo for all of the effort here.

docs/setup-nodejs.md Show resolved Hide resolved
docs/setup-react-native.md Show resolved Hide resolved
packages/core/src/constants.ts Show resolved Hide resolved

"compilerOptions": {
"outDir": "./build",
// FIXME https://github.com/hyperledger/aries-framework-javascript/pull/327
Copy link
Contributor

Choose a reason for hiding this comment

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

Available for fixing?

Copy link
Contributor Author

@TimoGlastra TimoGlastra Jul 14, 2021

Choose a reason for hiding this comment

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

Yes and no. It's really a hassle to not depend on any global node/react-native/browser types. We want types for fetch and WebSocket. We can either do that by depending on types for a specific platform, or we should write them ourselves...

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm.. can we rely on global Node types, and then specify/override those in the respective environments? (my knowledge is a little light here so)

Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather avoid writing our own types, but I understand it's a tricky problem 🙁

tests/e2e.test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jakubkoci jakubkoci left a comment

Choose a reason for hiding this comment

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

That's Awesome 🎉 Great job Timo.

I added just a few insignificant notes :)

.eslintrc.js Show resolved Hide resolved
"@types/bn.js": "^5.1.0",
"@types/events": "^3.0.0",
"@types/indy-sdk": "^1.16.5",
"@types/node-fetch": "^2.5.10",
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we will eventually remove this from the core, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes once we resolve the typing issues as described above (declare them ourselves or use some trick to make it work)

// File system differs based on NodeJS / React Native
this.container.registerInstance(InjectionSymbols.FileSystem, this.agentConfig.fileSystem)
// Platform specific dependencies
this.container.registerInstance(InjectionSymbols.FileSystem, new dependencies.FileSystem())
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: What about creating an instance outside? Then you will have more flexibility to pass params into the constructor or set the instance as you need before passing it into the agent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look at that in a separate PR. That would mean extra steps to get started, even though you won't need in 99% of the cases

We can make it an optional config property?

Comment on lines +4 to +5
import type fetch from 'node-fetch'
import type WebSocket from 'ws'
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you already mention something about thsese two deps. Would it be possible to remove it later? In other words. Just mentioning it in case we forgot it here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. But we only depend on the @types packages. Not the actual packages themselves

this.logger.debug('Starting WS outbound transport')
this.WebSocket = agentConfig.agentDependencies.WebSocket
Copy link
Contributor

Choose a reason for hiding this comment

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

The this.WebSocket could be hard to understand what it means 🤔 like what's actually behind that property. Just saying, don't have any idea for improvement right now. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've renamed to WebSocketClass for now. Let me know if you want something else


"compilerOptions": {
"outDir": "./build",
// FIXME https://github.com/hyperledger/aries-framework-javascript/pull/327
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather avoid writing our own types, but I understand it's a tricky problem 🙁

@TimoGlastra TimoGlastra merged commit ffaa3c0 into openwallet-foundation:main Jul 15, 2021
@TimoGlastra TimoGlastra deleted the monorepo branch July 15, 2021 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove platform specific dependencies from the framework Moving to a monorepo
4 participants