Defines data structure for ABT Node backend API, and maintains schema for GQL endpoint.
npm install @abtnode/schemaDefines data structure for ABT Node backend API, and maintains schema for GQL endpoint.
You can choose one of the following two ways to build schema.
It is recommended to build with Docker.
Requirements:
- Docker
``bash`
docker pull arcblock/blocklet-server-proto
docker run --rm -v {absolute path of core/schema}:/home/root/schema arcblock/blocklet-server-proto
Requirements:
- go 1.8+
#### Install go
- Mac: brew install go
- Other platform: https://go.dev/doc/install
`shellgo envyou can use
to check the go environment
go env
`
#### Install gnu-sed(MacOS)
`bashsedInstall(Mac OS), other platform: https://www.gnu.org/software/sed/
brew install gnu-sedMake
command work, only for homebrew:`
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
#### Install protobuf
- Mac: brew install protobuf
- Other platform: https://developers.google.com/protocol-buffers/docs/downloads
#### Add to ~/.profile
`shell
vim ~/.profile
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
source ~/.profile
`
#### Install other dependencies
Run make init
> If there is a network problem, try to change golang registry by https://goproxy.cn/
#### Build Schema
Make sure you're in the core/schema directory, run make build
Ensure that core/schema has been built, please see here.
> If you are using mac, you may need replace the sed command with gsed
just run:
`shell`
npm run open:gql
> should make sure the DB Proxy is running, if not, run yarn start in a new terminal
just run:
`shell`
npm run upgrade
In the root directory of the project, run:
`shell``
npm run update:schema
The execution steps of this command are as follows:
- Step 1: Execute 'make build' in the 'core/schema' directory
- Step 2: Execute 'npm run open:gql' in the 'core/webapp' directory
- Step 3: Execute 'npm run upgrade' in the 'core/client' directory
- Step 4: Terminate the process started in Step 2