-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa22107
commit c3e683e
Showing
8 changed files
with
162 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
/dist/ | ||
/coverage/ | ||
.vscode | ||
.DS_Store | ||
.DS_Store | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,56 @@ | ||
# @tableland/template | ||
# Tableland TypeScript Package Template | ||
|
||
[![Review](https://github.com/tablelandnetwork/js-template/actions/workflows/review.yml/badge.svg)](https://github.com/tablelandnetwork/js-template/actions/workflows/review.yml) | ||
[![License](https://img.shields.io/github/license/tablelandnetwork/js-template.svg)](./LICENSE) | ||
[![Version](https://img.shields.io/github/package-json/v/tablelandnetwork/js-template.svg)](./package.json) | ||
[![Release](https://img.shields.io/github/release/tablelandnetwork/js-template.svg)](https://github.com/tablelandnetwork/js-template/releases/latest) | ||
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme) | ||
|
||
> A template for @tableland typescript projects | ||
> A template for @tableland TypeScript projects | ||
# Table of Contents | ||
## Table of Contents | ||
|
||
- [@tableland/template](#tablelandtemplate) | ||
- [Table of Contents](#table-of-contents) | ||
- [Background](#background) | ||
- [Usage](#usage) | ||
- [Install](#install) | ||
- [Development](#development) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
|
||
# Background | ||
## Background | ||
|
||
A really nice library for working with @tableland. | ||
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 | ||
## Usage | ||
|
||
```ts | ||
import { hello } from "@tableland/template"; | ||
First, clone this repo: | ||
|
||
console.log(await hello()); | ||
// "world" | ||
```sh | ||
git clone https://github.com/tablelandnetwork/ts-template | ||
``` | ||
|
||
# Install | ||
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. | ||
|
||
You can install via npm. | ||
## Development | ||
|
||
``` | ||
npm i @tableland/template | ||
``` | ||
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. | ||
|
||
# Development | ||
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. | ||
|
||
Get started with installing, building, and testing the project: | ||
There are also a few other commands you can use: | ||
|
||
```shell | ||
npm install | ||
npm run build | ||
npm test | ||
``` | ||
- `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 | ||
## Contributing | ||
|
||
PRs accepted. | ||
|
||
Small note: If editing the README, please conform to the | ||
[standard-readme](https://github.com/RichardLitt/standard-readme) specification. | ||
|
||
# License | ||
## License | ||
|
||
MIT AND Apache-2.0, © 2021-2022 Tableland Network Contributors | ||
MIT AND Apache-2.0, © 2021-2023 Tableland Network Contributors |
Oops, something went wrong.