🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@rapyuta-robotics/api-clients

Package Overview
Dependencies
Maintainers
5
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rapyuta-robotics/api-clients

Mock API server

0.1.21
latest
Source
npm
Version published
Weekly downloads
57
-38.04%
Maintainers
5
Weekly downloads
 
Created
Source

@rapyuta-robotics/api-clients

Mock API server

You can use this package to intercept your network requests and mock the response.

This package also exports few types which can be used in your project.

How to add this package to your project

In your project's directory,

run yarn add @rapyuta-robotics/api-clients

To start the mock server/requests interception:

import { mockServer } from '@rapyuta-robotics/api-clients/test';

run mockServer.listen()

To stop the mock server/requests interception:

run mockServer.close()

Testing example

import { Factories } from '@rapyuta-robotics/api-clients'; import { mockApi, MockRoutes, expectApiCall } from '@rapyuta-robotics/api-clients/test';

// Configure the API. const map = Factories.MAPS({ id: 0 }); mockApi({ route: MockRoutes.MAPS, payload: [map] });

// Test the API. expectApiCall({ method: 'GET', route: MockRoutes.MAPS });

To add types to your project

import { ContainerState } from '@rapyuta-robotics/api-clients';

Reference

You can refer src/factories/types.ts for all the exported types

You can refer src/factories/index.ts for all the exported factory methods

How to develop this package locally

Start development:

  • First, make sure that you have added this package to your project (see: How to add this package to your project)
  • In this package's 📦 directory, run yarn link to create the symlink
  • In this package's 📦 directory, run yarn start to watch this package's file changes and rebuild automatically
  • In your project's 📝 directory, run yarn link @rapyuta-robotics/api-clients to establish the symlink
  • Your project is now referencing to the local copy of this package everytime you import such as import { helloWorld } from '@rapyuta-robotics/api-clients'
  • When you edit the code of this package, your project will hot-reload and reflect the new changes

Stop development:

  • In your project's 📝 directory, run yarn unlink @rapyuta-robotics/api-clients to disband the symlink (NOTE: you need to do this before step (3), otherwise the unlink will fail. In the case that you mistakenly run (3) before (1), run yarn link in this package's 📦 directory and restart from (1))
  • In your project's 📝 directory, run yarn install --force to ensure that it's using the correct remote version of @rapyuta-robotics/api-clients
  • In this package's 📦 directory, run yarn unlink to cancel the symlink

How to publish a new version

A new version will be published to NPM everytime a new release is created

The workflow shall be:

  • Create a new release targeting devel. No release branch should be created as we are using trunk-based development approach.
  • Tag of the new release should follow semantic versioning with [breaking change (compatibility issue)].[feature update].[bugfix patches] -> (x.y.z)
  • Once release is created, github action will automatically publish it to npmjs.

FAQs

  • If CI fails when trying to publish npm package, there is a chance that the project does not have access to RR_NPM_TOKEN in organization's secrets. Contact michael.orr@rapyuta-robotics.com when such case occurs.

References

FAQs

Package last updated on 07 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts