Giter Site home page Giter Site logo

jzxchiang1 / agent-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dfinity/agent-js

0.0 0.0 0.0 7.51 MB

A collection of libraries and tools for building software around the Internet Computer, in JavaScript.

License: Apache License 2.0

TypeScript 98.84% Modelica 0.16% Shell 0.17% HTML 0.32% JavaScript 0.52%

agent-js's Introduction

agent-js

Use an Agent to interact with the Internet Computer from your JavaScript program.

This source code repository contains multiple npm packages, each under ./packages/.

Development

Getting Started

  1. Clone the git repository.
  2. Run npm i -g npm
  3. Run npm install

After that, you probably want to dive into a specific package in ./packages.

Workspaces

We use npm to manage this repo and its packages. A few useful commands to keep in mind;

  • To run the unit tests locally, you can use npm run test.
  • To run e2e tests, you can use npm run e2e. WARNING: You need to have a running replica locally. In our CI runs, we use the ic-ref which is not (at this time) available publicly. Normally you can use a replica distributed with dfx (ie. dfx start in a project), but there is no guarantee that the next branch will work with the latest published dfx. Once you have a replica running locally, you must pass the port to the e2e tests using the IC_REF_PORT environment vairable. If that variable is not set, the tests will fail.

Contributing

If you are interested in contributing to this project, please read the contributing guidelines.

Publishing

To publish to NPM, create a branch and run the following commands;

  • git clean -dfx. Removes all non-tracked files and directories.
  • npm install. Makes sure everything is installed and up to date locally;
  • npm run build --workspaces. Builds all the applications and packages.
  • npm run version [patch|major|minor|version]. Update the version in each of the packages.
  • Manually update the version in the root package.json file.
  • npm install. Updates the versions of the packages in the package-lock.json file.
  • git checkout -b release/v<#.#.#>. Check out release branch
  • git add .. Check out release branch
  • git commit -m 'chore: release v<#.#.#>'. Commit changes
  • Open a pull request from your fork of the repository

Once the change is merged, you can publish to NPM. To publish to NPM, run the following commands;

  • npm run build --workspaces. This is just for safety
  • npm publish --workspaces. Publishes the packages to NPM.
    • You will need to have authorization to publish the npm packages in our NPM organization. Reach out to IT if you neeed access.
    • You can add the --dry-run flag to see what would have been published and make sure that all the versions and packages look correct.

Then, when you have merged the new versions and published to npm, open https://github.com/dfinity/agent-js/releases/new, click the "Draft a new release" button, enter the new tag version in form v#.#.#, and click "Publish release".

Publishing Docs

Until we have an internal process and centrally owned canister, docs can be released manually for @dfinity/agent and @dfinity/authentication.

  • Start from a fresh clone (or git clean -dfx .)
  • npm install
  • npm run make:docs/reference
  • dfx deploy

Note - you may need to ask to be added as a controller for the wallet that owns the docs until this job is moved to CI

GitHub Actions

GitHub Actions for this repo are configured in ./.github/workflows.

Master Branch Conventions and Mergify

All commits in the master branch should come from squashed GitHub Pull Requests, and those commit messages should follow the conventionalcommits.org syntax.

Mergify can take care of enforcing all of this. Just add the automerge-squash label to each Pull Request that Mergify should merge. This policy is configured via ./.mergify.yml.

bin/* scripts

The following scripts can be found in ./bin:

Monorepo-related scripts run in this order, but are usually invoked by npm install:

  • npm-postinstall - Run with npm run postinstall in this monorepo package.
    • It copies devtools dependencies from ./packages/agent-js-devtools/node_modules -> ./node_modules
  • build - Build (npm run build) each subpackage in ./packages/
  • test - Run npm test in each subpackage

Formatting

To save time on formatting, we use automated formatting for this repo using prettier. You can either use git pre-commit hooks or run the command npm exec prettier:format before submitting your PR to have your changes pass. We check formatting on CI.

agent-js's People

Contributors

3cl1p5e7 avatar andrewwylde avatar chenyan-dfinity avatar daniel-bloom-dfinity avatar dependabot[bot] avatar dfinity-bjoern avatar ericswanson-dfinity avatar floorlamp avatar gobengo avatar hansl avatar hpeebles avatar ielashi avatar kritzcreek avatar krpeacock avatar lwshang avatar msecret avatar ninegua avatar nmattia avatar nomeata avatar p-shahi avatar roman-kashitsyn avatar taylorham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.