Coinfer JS

The documentation is here.

Directory Structure

.
├── 📂assets
├── 📂build-scripts
├── 📂build-template
├── 📂document-generator
├── 📂output
│   ├── 📂coinferjs
│   ├── 📂coinferjs-node
│   └── 📂coinferjs-react
├── 📂src
│   ├── 📂react-tools
│   ├── 📄local_utils.js
│   ├── 📄proxy_server.js
│   ├── 📄coinfer.ts
│   └── ...
├── 📂tests
├── 📄CHANGELOG.md
├── 📄README.md
├── 📄bundle.browser.js
├── 📄bundle.react.js
├── 📄bundle.standalone.js
├── 📄package.json
├── 📄rollup.config.js
├── 📄tsconfig.json
└── 📄yarn.lock
  • 📂assets: Some resource files required by the project, such as pictures referenced in the document, etc.
  • 📂build-scripts: Some script codes required for building, such as clearing folders, copying static files, etc.
  • 📂build-template: Some static files required for building, such as package dependencies (package.json), README.md used to describe the built package, etc.
  • 📂document-generator: This folder is used to store the code for generating the project API documentation. It uses Docusaurus and Api Document, and uses typescript’s document comments and declaration files to generate HTML pages.
  • 📂output: The built code will be output to this directory. Its subdirectories coinferjs, coinferjs-node and coinferjs-react correspond to the three packages built by this project.
  • 📂src: Source code folder.
    • 📂react-tools: This folder provides some tools that are convenient for using the React framework, such as the WebSocket library that encapsulates permission verification and initialization, context tools, and some Hooks.
    • 📄local_utils.js: Store code that is only used in the local Node environment, such as reading and writing local files, etc.
    • 📄proxy_server.js: Used to provide proxy server functionality.
    • 📄coinfer.ts: The main file of the code library encapsulates most of the business functions, such as: operating the model list, operating the Experiment list, adding and deleting tokens, providing WebSocket to obtain Experiment information, etc.
  • 📂tests: The folder mainly stores the code used for testing.

How to build

  1. Run one of these commands:
  • yarn rollup, this command will monitor the project file for changes and compile it automatically.
  1. Wait a while until the code is built. The bundled files will be located in the output directory.
  2. In the output directory, you can see these directories:
    1. coinferjs: It just contains a coinfer.js, it provides entities CRUD.
    2. coinferjs-node: Provide a node-based program that can be called from the command line, such as “node index.js —help”, of course, this command depends on “Nodejs”.
    3. coinferjs-react: Provider some hooks and context of React.
    4. demo: This directory is for real-time development. output-description
  3. Build the docs. After successfully running yarn rollup, you can generate the documentation by running yarn build:docs. The final output directory is located at document-generator/website, and the generation process follows the sequence *.ts -> *.d.ts -> *.api.json -> *.md -> *.html..
yarn build:docs
  1. You can copy the dist files to your project. Of course, you can also publish these output files as npm packages.

Unit Test

  • yarn test

Export binary

Running yarn build, the binary file after building is in the output directory

Reference