https://github.com/tablelandnetwork/js-template
A typescript template for internal @tableland projects.
https://github.com/tablelandnetwork/js-template
Last synced: about 1 year ago
JSON representation
A typescript template for internal @tableland projects.
- Host: GitHub
- URL: https://github.com/tablelandnetwork/js-template
- Owner: tablelandnetwork
- License: mit
- Created: 2022-11-16T01:31:14.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T01:22:48.000Z (over 2 years ago)
- Last Synced: 2025-03-25T17:03:25.568Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 386 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Tableland JavaScript Package Template
[](https://github.com/tablelandnetwork/js-template/actions/workflows/review.yml)
[](./LICENSE)
[](./package.json)
[](https://github.com/tablelandnetwork/js-template/releases/latest)
[](https://github.com/RichardLitt/standard-readme)
> A template for @tableland JavaScript projects
## Table of Contents
- [Table of Contents](#table-of-contents)
- [Background](#background)
- [Usage](#usage)
- [Development](#development)
- [Contributing](#contributing)
- [License](#license)
## Background
This repo contains starter code for building Tableland clients. It contains a basic example using the Tableland SDK ([`@tableland/js-tableland)`](https://github.com/tablelandnetwork/js-tableland)) for creating, writing to, and reading a table as well as Local Tableland ([@tableland/local](https://github.com/tablelandnetwork/local-tableland)) support during development. Both linting (with [`eslint`](https://eslint.org/)) and code formatting (with [`prettier`](https://prettier.io/)) are also included.
## Usage
First, clone this repo:
```sh
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`](https://mochajs.org/) 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`](https://github.com/bcoe/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](https://github.com/RichardLitt/standard-readme) specification.
## License
MIT AND Apache-2.0, © 2021-2023 Tableland Network Contributors