0.0.2 • Published 6 months ago

@smartweaver/core v0.0.2

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
6 months ago

SmartWeaver

A collection of code intended to help you build your steezy SmartWeave tooling and workflows

Explore

View SmartWeaver projects at https://github.com/smartweaver.

Codebases

The SmartWeaver ecosystem is made up of the following codebases:

  • Core: All files/directories in the src directory (excluding src/standard)
  • Standard: All files/directories in the src/standard directory
  • Modules: All repositories at https://github.com/smartweaver excluding the core repository

These codebases are explained in further detail below.

Core

This part of the codebase provides types, interfaces, and classes (with minimal implementation). It contains the lowest level APIs and is intended to help build the Standard and Modules codebases.

To separate concerns, Core does not import code from Standard or Modules.

Standard

This part of the codebase is similar to Deno's Standard Library and Go's Standard Library, but smaller. Standard code is intended to be used as standalone code and code to help build modules in the Modules codebase (e.g., Slick Contract).

To separate concerns, Standard code only imports from Standard and Core. It does not import from Modules.

Modules

This part of the codebase is:

Modules import the most functionality for things like processing contract interactions, deploying contracts, bundling transactions, etc. Modules import from:

  • Core
  • Standard
  • Third-party code (e.g., smartweave, arweave)

Contributing

Prerequisites

  • Install Node (use the Node version in nvmrc)
  • Install Deno (use the latest v1.x version)

Tests

Tests are in the tests directory. The tests directory has a strict structure and naming convention as follows:

  • The tests directory structure mimics the src directory structure:

    ▾  src/
      ▾  standard/
        ▸  handlers/
    ▾  tests/
      ▸  core/
      ▾  standard/
        ▸  handlers/
  • Test file names mimic the file they test, include the type of tests they contain, and end of .test.ts:

    Format:    <file being tested>.<test type>.test.ts
    
    src file:  IsolatedHandlerChain.ts
    test file: IsolatedHandlerChain.unit.test.ts

Here is an example of the conventions mentioned above:

▾  src/
  ▸  core/
  ▾  standard/
    ▾  chains/
         IsolatedHandlerChain.ts
    ▸  handlers/
▾  tests/
  ▸  core/
  ▾  standard/
    ▾  chains/
         IsolatedHandlerChain.unit.test.ts
         IsolatedHandlerChain.integration.test.ts
    ▸  handlers/

Development Tips

  1. Use Node version in nvmrc.

  2. Do not add scripts to package.json. Add scripts to deno.json. This repo uses deno task <script>, not yarn <script>.

  3. Add tests if you can. If you do, follow the conventions mentioned above in the Tests section.

  4. Add a summary to your pull request and how to exercise your work. For example:

    ## Summary
    
    - Added this
    - Changed that
    
    ## How to test
    
    1. Run this script.
    
    1. Run the tests.
    
    1. Import this module and check the typings.
    
    ... etc.
  5. GitHub actions are in place to check pull requests for lint and formatting. Use deno lint and deno fmt to help you make fixes/changes.