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

export-mouser-orders

v1.0.3

Published

Small script which can export your order details easily into a selected format

Downloads

2

Readme

ExportMouserOrders

Description

This small script helps you to export your mouser orders into a csv file.

How to use

You need an installed node version on your computer and a terminal to run the script. In your terminal (Windows: cmd, Linux/Mac OS: terminal) you need to enter the following commands:

Before your first run, you have to initialise your workspace by installing the depemdencies:

npm i

Then with the following command, (the given options are optional) you can fetch and save your order details into a csv file:

node export-orders [ --orderApiKey={YOUR_API_KEY} --output={OUTPUT_PATH} ... ]

You can always read the help for this command by typing the following:

node export-orders --help

API keys

You need a working order API key from mouser, which can be requested on this page. It should be a 36 character long random string. You also have to enable both the Order and Order history API access for your key.

Other API key is required when you want to request extended product informations from mouser

Available options

  • orderApiKey: Required, you need to provide your API key here as a string. How to generate my own API key?
  • searchApiKey: Only required when you enable the extended search option. You have to request, just like the orderApiKey. How to generate my own API key?
  • extendedSearch: Requesting extended product informations, which can be saved in the export. This option is a boolean value, default is false
  • output: Required, this string will determine the output file's path, without it, the script is unable to save the fetched details. The ./output/*.csv wildcard is added to the gitignore file, so your exports won't be visible in your local git history. IMPORTANT: You have to create the folder for the output, otherwise the export script will fail! (node won't create the path for you by default)
  • columns: Optional, default will put all available columns in your export. This is a comma separated string, which contains the column names for the export process. If the column doesn't exists, then it will fill up with empty values. (might be usefull for post process tasks to have those already generated). Example string: "OrderNumber, Manufacturer, MfrPartNumber, Description, Quantity, ExtendedPrice"

Options file

You can provide an external option file if you don't want to type them into the command line every time you are running this script. You should put your options in the options.json file in the project's root folder. (don't worry, it's added to the gitignore file, so it won't be visible in your git if you cloned this repo) The options file's content should look like this:

{
	"orderApiKey": "YOUR_ORDER_API_KEY",
	"searchApiKey": "YOUR_SEARCH_API_KEY",
	"extendedSearch": true,
	"output": "./output/exported-orders.csv",
	"columns: "OrderNumber, Manufacturer, MfrPartNumber, Description, Quantity, ExtendedPrice"
}

Using as node module

You can also use this project as a module in your application. The following functions are available if you import the project:

  • fetchOrders: It will fetch every orders and return the items as an array. The input parameter is your apiKey
  • exportOrders: Same as the command line behaviour, the input parameter is an object, which expects the options parameters