Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 3.2 KB

README.md

File metadata and controls

56 lines (36 loc) · 3.2 KB

Tableland JavaScript Package Template

Review License Version Release standard-readme compliant

A template for @tableland JavaScript projects

Table of Contents

Background

This repo contains starter code for building Tableland clients. It contains a basic example using the Tableland SDK (@tableland/js-tableland)) for creating, writing to, and reading a table as well as Local Tableland (@tableland/local) support during development. Both linting (with eslint) and code formatting (with prettier) are also included.

Usage

First, clone this repo:

git clone https://github.com/tablelandnetwork/js-template

To get started, run npm install and then npm run build command; this will compile the package to the dist directory. In src/index.ts, there is a basic example of the aforementioned database functionality. A table is created, written to with a single value hello, and then exports this value after reading it from the table.

Development

Use the command npm run up, which runs npm install, the build command, and then spins up a Local Tableland node (the lt command). You can then use the output files in the dist directory against a local-only Tableland network.

This project also comes with mocha and tests already set up. Running npm test will spin up a local node (see: test/setup.ts), run the tests against the Local Tableland network, and then shut down the local node upon test completion. Coverage tests with c8 are also included, and can be run with npm run coverage command to output a coverage report to the coverage directory.

There are also a few other commands you can use:

  • npm run lint: Lint the codebase with eslint (along with the lint:fix option).
  • npm run prettier: Prettify the code format with prettier (along with the prettier:fix option).
  • npm run format: Both lint and format the codebase with eslint and prettier, also fixing any issues it can.
  • npm run clean: Remove the dist and coverage folders.

Contributing

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT AND Apache-2.0, © 2021-2023 Tableland Network Contributors