ordercloud-api / ordercloud-seed

CLI and library to Import and export serialized representations of full marketplaces
MIT License
9 stars 9 forks source link

@ordercloud/seeding

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

npm package

Ways to get started

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

Nice to Have features

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