@commercelayer/vercel-builder

A Node JS library that lets you import predefines seed data into a Commerce Layer organization.

Usage no npm install needed!

<script type="module">
  import commercelayerVercelBuilder from 'https://cdn.skypack.dev/@commercelayer/vercel-builder';
</script>

README

Commerce Layer Vercel Builder

A Node JS library that lets you import predefines seed data into a Commerce Layer organization.

What is Commerce Layer?

Commerce Layer is a headless platform that lets you easily build enterprise-grade ecommerce into any website, by using the language, CMS, and tools you already master and love.

Table of contents

How it works

This builder is the easiest way to deploy our demo, made with NextJS in Server Side Rendering (SSR) mode.

This builder is built for Node.js and doesn't run in the browser.

Getting Started

To be ready to use the Commerce Vercel Builder, you need to install it and then get the credentials that will allow you to deploy the demo.

Installation

Commerce Layer Vercel Builder is available as an npm package:

// npm
npm install @commercelayer/vercel-builder

// yarn
yarn add @commercelayer/vercel-builder

Import

You can use the ES6 default import as follows:

import seeder from '@commercelayer/vercel-builder'

Usage

The seeder function

The vercelBuilder function returns a promise and you need to pass to it as a parameter an object containing:

{
  cms: {
    type: 'contentful' | 'dato'
    credentials: {
      contentfulDeliveryAccessToken?: string
      contentfulSpaceId?: string
      datoApiToken?: string
    }
  }
  searchEngine?: {
    type: 'algolia'
    credentials: {
      algoliaAdminApiKey?: string
      algoliaAppId?: string
    }
  }
  country?: 'US' | string
  languages?: ['en-US' | string]
  clClientId: string
  clEndpoint: string
  path?: string
  projectName: string
  vercelToken: string
}

  • cms: object — your CMS configuration (required)
  • searchEngine: object — your search engine configuration (optional)
  • country: string — country builds (optional / default: 'en-US')
  • languages: array — languages build (optional / default: [US])
  • clClientId: string — your Commerce Layer organization client id (required)
  • clEndpoint: string — your Commerce Layer organization endpoint (required)
  • path: string — where you want to save the demo in your local eviroment (optional / default: ./)
  • projectName: string — the project name (required)
  • vercelToken: string — your vercel token (required)
vercelBuilder({
  cms: {
    type: 'contentful',
    credentials: {
      contentfulDeliveryAccessToken:
        'your-contentful-delivery-access-token',
      contentfulSpaceId: 'your-contentful-space-id',
    },
  },
  clClientId: 'your-client-id',
  clEndpoint: 'https://yourdomain.commercelayer.io',
  projectName: 'your-project-name',
  vercelToken: 'your-vercel-token',
})

The returned object

The promise returned by the vercelBuilder function is an object, containing the information about your deploy.

License

This repository is published under the MIT license.