A template for @tableland JavaScript projects
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.
First, clone this repo:
git clone https://github.com/tablelandnetwork/js-templateTo 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.
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 witheslint(along with thelint:fixoption).npm run prettier: Prettify the code format withprettier(along with theprettier:fixoption).npm run format: Both lint and format the codebase witheslintandprettier, also fixing any issues it can.npm run clean: Remove thedistandcoveragefolders.
PRs accepted.
Small note: If editing the README, please conform to the standard-readme specification.
MIT AND Apache-2.0, © 2021-2023 Tableland Network Contributors