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

@lpgroup/import-cli

v1.9.1

Published

Cli command that imports data into rest api, RabbitMQ server and NATS.

Downloads

63

Readme

@lpgroup/import-cli

npm version Known Vulnerabilities Licence MIT tested with jest codecov

Cli command that imports data into rest-api, RabbitMQ and NATS.

Install

Installation of the npm

npm install @lpgroup/import-cli

Configuration

.import.json

{
  "environments": {
    "default": {
      "http": {
        "server": "https://api.thecatapi.com/v1/",
        "user": "",
        "password": "",
        "readyServer": "https://api.thecatapi.com/",
        "headers": { "x-api-key": "446825e1-284d-4d4d-8fc7-7556636211ad" }
      },
      "nats": {
        "uri": "nats://localhost:4222",
        "queue": "import-js",
        "messagePrefix": "int",
        "version": "v2"
      },
      "rabbitmq": {
        "uri": "amqps://user:[email protected]/user",
        "queue": "dev"
      }
    }
  },
  "requiredKeys": ["owner", "added", "changed", "url"],
  "ignoreKeyCompare": ["_id", "owner", "added", "changed", "url"]
}

Example

Add the following to import/10-votes.js.

import { axios } from "@lpgroup/import-cli";

export default async () => {
  return axios().then(async (ax) => {
    await ax.post(
      "/votes",
      {
        image_id: "good-cat",
        sub_id: "my-user-1234",
        value: 1,
      },
      {
        expected: {
          image_id: "good-cat",
          sub_id: "my-user-1234",
          value: 1,
        },
        noArraySort: true,
        ignoreError: false,
        ignoreKeyCompare: ["_id"],
        requiredKeys: ["changed"],
      },
    );
  });
};

Test Keys API:

| Keys | Type | Description | | ---------------- | ------------- | ----------------------------------------------------- | | noArraySort | boolean | | | ignoreError | boolean | | | ignoreKeyCompare | array | | | requiredKeys | array | | | expected | object | compares expected and actual response | | expectedFile | string | /expected/testFileName/{expectedFile}-method-expected | | writeRequest | boolean/false | expectedFile, will write the request if has diff | | writeDiff | boolean/false | expectedFile, will write if has diff | | writeOriginal | boolean/true | expectedFile, will write original, if has diff, |

Add the follwing script to package.json.

{
  "scripts": {
    "import": "import-cli -v -e default -w import/"
  }
}

Run script from command line.

npm run import -- -i 10-votes

Development

yarn jest -- import-cli
yarn workspace @lpgroup/import-cli lpimport

Contribute

See contribute

License

MIT - See licence