Skip to content

Conversation

@yknl
Copy link
Contributor

@yknl yknl commented Jul 27, 2020

This PR splits blockstack.js into multiple NPM packages hosted from a single GitHub monorepo. See original proposal on the forum: https://forum.blockstack.org/t/stacks-mono-repo-rfc/11017

The following functionality have been removed and will be superceded by Stacks 2.0 compatible libraries/packages in this repo.

  • BTC & Stacks 1.0 transaction building including BNS operations
  • Stacks 1.0 wallet class
  • Stacks 1.0 network class

New packages

Auth - @stacks/auth

A package that contains all functions relating to authentication. The API has been updated to support new implementations of authenticators and Connect. Functions depending on a legacy Blockstack browser have been dropped in favour of Connect.

Storage - @stacks/storage

Storage functions have been separated from auth and the UserSession class. In order to use storage, you should import the Storage class from the package and create an instance of it using a valid UserSession object.

import { UserSession } from '@stacks/auth'
import { Storage } from '@stacks/storage'

const userSession = new UserSession()
// perform authentication

const storage = new Storage(userSession)

Common - @stacks/common

Utility functionality shared by packages in this monorepo have been moved to a new common package. Developers shouldn't need to include this package directly.

Profile - @stacks/profile

API used by authenticators to manipulate user profiles on BNS have been moved to this package. Social proofs are fully deprecated.

Encryption - @stacks/encryption

Common encryption functions used across the platform.

Keychain - @stacks/keychain

This package exposes the identity, key management functions. Moved from https://github.com/blockstack/ux/tree/master/packages/keychain

Transaction - @stacks/transaction

This package contains methods used to construct all types of transactions for Stacks 2.0. Migrated from https://github.com/blockstack/stacks-transactions-js

Network - @stacks/network

This package contains network functions for Stacks 2.0.

CLI - @stacks/cli

The Stacks 2.0 CLI tool. Used to create/broadcast Stacks 2.0 transactions from the command line. Moved from: stacks-archive/cli-blockstack#40

Additional Review Notes

Build instructions

lerna bootstrap
lerna run build

Tests

All tests have been migrated to jest for consistency. Many of the tests were updated to use jest mock and jest-fetch-mock.

@yknl yknl linked an issue Jul 28, 2020 that may be closed by this pull request
@zone117x
Copy link
Contributor

zone117x commented Oct 16, 2020

Code code reports are failing to upload. See report only showing files from old repo structure: https://codecov.io/gh/blockstack/blockstack.js/tree/ce733d62f720db6d59247453bf3bb2942bcb7446/src

The codecov upload script failure can be seen here: https://app.circleci.com/pipelines/github/blockstack/blockstack.js/125/workflows/f82b3bcb-d12c-4203-a9bd-ecf505ea9237/jobs/2087

==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
    Failed to run gcov command.
==> Scanning for reports
    X Failed to read file at 
==> Uploading reports
    Success!

It looks like coverage reports are found and uploaded for an initial set of repos, but last step fails and seems to upload an empty report? Not sure.

"module": "dist/index.esm.js",
"typings": "dist/auth/src/index.d.ts",
"umd:main": "dist/auth.umd.production.js",
"unpkg": "dist/auth.cjs.production.min.js"
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't unpkg point to umd builds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like publishing from lerna updates this value automatically. Not sure where this is configured, we might have to update manually.

"@stacks/transactions": ["../../transactions/src"]
}
},
"include": ["src/**/*", "tests/**/*"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this tsconfig would result in test files being output in the /dist directory and being published within the npm package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That doesn't seem to be the case, I wasn't able to find test files in the published packages.

@zone117x
Copy link
Contributor

@yknl are we still generating reference docs with typedoc (or any other tool)?

@yknl
Copy link
Contributor Author

yknl commented Oct 27, 2020

@yknl are we still generating reference docs with typedoc (or any other tool)?

Yes, still using typedoc. See the latest pushed commit.

Copy link
Contributor

@zone117x zone117x left a comment

Choose a reason for hiding this comment

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

Haven't had a chance to test out the new dev setup myself yet, but project structure and code looks good to me. Great work @yknl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants