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

@constructor-io/constructorio-connect-cli

v1.5.1

Published

CLI tool to enable users to interface with the Constructor Connect Ecosystem

Downloads

412

Readme

Constructor.io Connect CLI

npm MIT licensed

Constructor.io is an e-commerce first product discovery service that optimizes results using artificial intelligence (including natural language processing, re-ranking to optimize for business metrics, and end user personalization).

This package is a CLI tool that helps you build, test and deploy your connector templates. By using templates, you can customize your catalog integration to shape your data the way you want it.

If you're looking for a package to consume our API, please use @constructor-io/constructorio-node instead. Alternatively, if you want a JavaScript client for client side (i.e. front end) integrations please use @constructor-io/constructorio-client-javascript.

1. Review the Requirements

Before you begin, note that this package is intended for use with partner connections. If you don't have a connector running yet, please take a look at our documentation to see how you can get started.

Finally, make sure you have your connect auth token available. If you don't have this yet, please get in touch with our team and we'll set this up.

2. Install

You can initialize a new working repo with the following command:

npx @constructor-io/constructorio-connect-cli init my-repo

Where my-repo is the name of the folder and repository you want to create.

With the new repository initialized, you can start developing your catalog integration. Please refer to our documentation for more information on how to build your templates.

3. Commands

constructorio-connect-cli deploy ENV

Deploys all templates defined on the connectrc.js file to the specified environment.

USAGE
  $ constructorio-connect-cli deploy ENV

ARGUMENTS
  ENV  (development|qa|production|demo) The target Constructor environment to deploy to.

DESCRIPTION

  Deploys all templates defined on the `connectrc.js` file to the specified environment.

  The script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.

EXAMPLES
  $ constructorio-connect-cli deploy development

  $ constructorio-connect-cli deploy qa

  $ constructorio-connect-cli deploy production

constructorio-connect-cli execute

Execute a template against a connection and fixture to see the resulting transformed data. Each value not provided as a flag will be prompted for when the command is executed.

USAGE
  $ constructorio-connect-cli execute [--template-path <value>] [--fixture-path <value>]
    [--external-data-path <value>] [--connection-id <value>]

FLAGS
  --connection-id=<value>       The ID of the connection to execute the template against.
  --external-data-path=<value>  The path to the external data to execute the template against. Must be in the
                                'src/fixtures/external_data' directory.
  --fixture-path=<value>        The path to the fixture to execute the template against. Must be in the 'src/fixtures'
                                directory.
  --template-path=<value>       The path to the template to execute. Must be in the 'src/templates' directory.

DESCRIPTION
  Execute a template against a connection and fixture to see the resulting transformed data. Each value not provided as
  a flag will be prompted for when the command is executed.

EXAMPLES
  $ constructorio-connect-cli execute

  $ constructorio-connect-cli execute --template-path=item/item.jsonata

  $ constructorio-connect-cli execute --template-path=variation/variation.jsonata

  $ constructorio-connect-cli execute --template-path=item_group/item_group.jsonata --fixture-path=item_group.json

  $ constructorio-connect-cli execute --template-path=grouping/grouping.jsonata --connection-id=example-connection-id

  $ constructorio-connect-cli execute --template-path=mapping/mapping.jsonata

constructorio-connect-cli generate-fixture

This command will fetch one fixture from the server and save it into a specified file. This fixture file will be an example of how the data would be passed to the connector when executing the templates.

USAGE
  $ constructorio-connect-cli generate-fixture

DESCRIPTION

  This command will fetch one fixture from the server and save it into a specified file. This fixture file will be an
  example of how the data would be passed to the connector when executing the templates.

  You are expected to customize this file to match the data you expect to cover in a template execution (e.g. an item
  with stock, a variation with missing data), etc. Note that you can have multiple fixtures of the same type to cover
  different scenarios.

  Finally, if the file already exists you'll be prompted to overwrite it.


EXAMPLES
  $ constructorio-connect-cli generate-fixture

constructorio-connect-cli help [COMMAND]

Display help for constructorio-connect-cli.

USAGE
  $ constructorio-connect-cli help [COMMAND...] [-n]

ARGUMENTS
  COMMAND...  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for constructorio-connect-cli.

constructorio-connect-cli init NAME

Bootstrap a new Constructor.io Connect CLI repository.

USAGE
  $ constructorio-connect-cli init NAME

ARGUMENTS
  NAME  name of the new folder

DESCRIPTION
  Bootstrap a new Constructor.io Connect CLI repository.

EXAMPLES
  $ constructorio-connect-cli init

  $ constructorio-connect-cli init new-repo-name

Development

Here's some useful npm scripts:

npm run lint            # run lint on source code and tests
npm run test            # run tests
npm run test:cov        # run tests with coverage report