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

@ordercloud/seeding

v1.1.0

Published

Download and upload seeding files from the OrderCloud platform.

Downloads

803

Readme

@ordercloud/seeding

A CLI to download and upload serialized representations of full ordercloud marketplaces.

npm package

Ways to get started

  • For node.js users, install with npm i @ordercloud/seeding -g and then run seeding --help.

    • Alternatively, node.js users can run without install npx @ordercloud/seeding --help.
  • For docker users docker run --mount type=bind,source=<local directory>,target=/app oliverheywood/ordercloud-seeding --help.

    • Subsitute <local directory> for an absolute path in order for local file reading and writing to be mounted on the container.
  • Download an executable. Run like ./seeding-win.exe --help.

| Operating System | Executable | | --- | --- |
| Windows | seeding-win.exe | | Mac | seeding-macos | | Linux | seeding-linux |

CLI Usage

Create a marketplace from a "Simple-B2C" template.

npx @ordercloud/seeding seed Simple-B2C -u={username} -p={password}

Create a marketplace based on data in a local file. Looks for files based on the directory the command is run from.

npx @ordercloud/seeding seed seed-data-file.yml -u={username} -p={password}

Create a marketplace based on a public url.

npx @ordercloud/seeding seed https://raw.githubusercontent.com/ordercloud-api/ordercloud-seed/main/seeds/Simple-B2C.yml -u={username} -p={password}

Download the data from an existing marketplace to a seed file.

npx @ordercloud/seeding download new-file-to-create.yml -i={existing-marketplace-id} -u={username} -p={password}

Validate that a local file would seed successfully.

npx @ordercloud/seeding validate my-file.yml

Javascript API Usage

import { download, seed, validate, SerializedMarketplace } from "@ordercloud/seeding";


var myData: SerializedMarketplace = { ... };

await seed({
   portalJWT: "xxxxxx", 
   rawData: myData,
   logger: (message:string, type: MessageType) => {
        console.log(message)
   }
}); 

Marketplace Templates

These are seeding files maintained as part of this repo that represent templates for common ordercloud use cases.

| Command Alias | Raw URL | | --- | --- |
| seed Simple-B2C | https://raw.githubusercontent.com/ordercloud-api/ordercloud-seed/main/seeds/Simple-B2C.yml |

Development

  • Run npm install
  • Run npm run build everytime you change source files.
  • Run node ./dist/cli.js [command] to debug a command.
  • Run npm run test to run unit tests.

Nice to Have features

  • JSON as an option
  • Reference other files
  • Template variables in YAML for imports. Including allowing OC to define an ID and then applying it later.

Steps to release new version

Note: You must have node version 16 to build the package, you will get errors on node v17 and higher

  1. Make your code changes
  2. Run npm run build to build the code
  3. Run npm run test to run the unit tests against your built code
  4. Run npm run pkg to generate the executables (The following warning can be safely ignored: Warning Cannot resolve 'config.)
  5. Update "version" field in package.json (use semver)
  6. Commit all changes and push to master
  7. Create a git release/tag
  8. Run npm publish