npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rapyuta-robotics/api-clients

v0.1.21

Published

Mock API server

Downloads

1,059

Readme

@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:

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

Stop development:

  1. 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))
  2. In your project's 📝 directory, run yarn install --force to ensure that it's using the correct remote version of @rapyuta-robotics/api-clients
  3. 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:

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

FAQs

  1. 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 [email protected] when such case occurs.

References

  1. This project uses tsup for bundling and hot-bundling on code changes (see: https://github.com/egoist/tsup)
  2. Yarn link & unlink workflow reference: https://gist.github.com/alanbsmith/6c581e5042b8e5e558b0b4454192eb69
  3. Trunk-based development: https://www.atlassian.com/continuous-delivery/continuous-integration/trunk-based-development