Giter VIP home page Giter VIP logo

chec / commercejs-nextjs-demo-store Goto Github PK

View Code? Open in Web Editor NEW
1.1K 16.0 203.0 28.71 MB

Commerce demo store built for the Jamstack. Built with Commerce.js, Next.js, and can be one-click deployed to Netlify. Includes product catalog, customer login, categories, variants, cart, checkout, payments (Stripe) order confirmation, and printable receipts.

Home Page: https://commercejs-demo-store.netlify.app/

License: BSD 3-Clause "New" or "Revised" License

JavaScript 80.25% Shell 0.28% SCSS 19.47%
headless nextjs netlify commercejs chec ecommerce open-source one-click-deploy serverless jamstack

commercejs-nextjs-demo-store's Introduction

Demo Store with Commerce.js and Next.js πŸ›οΈπŸ’³

Netlify Status Stars Forks

A high-fidelity fully-fledged eCommerce demo store built using the Commerce.js SDK and Next.js with live deployment to Netlify.

Chec see live demo button

Note

Table of Contents

Overview

This README will guide you in getting up and running with a fully-fledged eCommerce template. We have configured this template for you to one-click deploy directly to Netlify. Alternatively, you can manually deploy to your choice of hosting platform.

For a full detailed tutorial on building this JAMstack eCommerce application, please head on over here.

Prerequisites

  • IDE or code editor of your choice
  • Node (v8.2.0 or higher)
  • NPM or Yarn
  • Chec CLI yarn global add @chec/cli

Setup

Create a Chec account.

Now that you’ve installed Chec CLI globally, you will be able to access the list of chec [COMMANDS], one of which is registering for a Chec account. Let’s go ahead and get that set up!

# Open the Chec registration page in your browser
chec register

Follow the rest of the walk-through to set up your merchant details. Alternatively, you can go here to register for a Chec account.

One-click Deploy with Netlify (recommended)

The one-click deploy allows you to connect Netlify to your GitHub account to clone the commercejs-nextjs-demo-store repository and deploy it automatically. Be sure to go to Netlify and sign up for an account before clicking the deploy button.

Deploy to Netlify button

By clicking the above button, you will be navigated to the Netlify’s direct deploy page with the project’s repository passed as parameters in the url. Click the Connect to GitHub button, name your repository and enter in this public key in the Chec Public Key input. Please note that for the purpose of getting you up and running with a live deploy preview of the demo store, we provided you with the Public Key from our demo merchant account. Now, save & deploy your site.

Please note the initial build will fail if you enter in your public key instead of the provided demo merchant key. The one-click deploy is meant for presentation purposes to spin up a quick deploy. Using your merchant account would mean you would need to have the appropriate data such as multiple assets and categories associated with your products. If you would like to use your merchant account, please follow the manual setup steps below.

Manual setup and Netlify deployment

Manual setup involves cloning the repo into your local environment, seeding the provided sample data into your Chec account and deploying to Netlify.

STEP 1. Clone the repo and install dependencies

# Clone the repository locally, optionally rename the repo, change into the directory
git clone https://github.com/chec/commercejs-nextjs-demo-store.git chec-store 
# Change into the directory and install dependencies
cd chec-store && yarn

STEP 2. Set up your environment variables

Replace the sample .env.example dotenv file at the root of the project to store your Chec public_key as well as your secret_key.

# Copy from source file to destination file .env
cp .env.example .env

You can access your API key under in your Chec dashboard setup, then navigate to the Develop tab to copy your Public Key and Secret Key. Replace the provided NEXT_PUBLIC_CHEC_PUBLIC_KEY with your own and fill in your CHEC_SECRET_KEY in the .env file. The secret key is necessary for the seed script to have the proper permission to seed the sample data in /seeds into your Chec account. Remove the secret key once the data is seeded.

# .env

# Fill in your public key and secret key
NEXT_PUBLIC_CHEC_PUBLIC_KEY=
CHEC_API_URL=https://api.chec.io
# Secret key is used with chec/seeder to access your Chec account to seed it with sample data
CHEC_SECRET_KEY=
NODE_ENV=

This file is meant to not be committed to source control and also will be hidden in file browsers.

STEP 3. Seed the data necessary to power your Chec store and start your development environment (necessary for initial setup).

# Seed data in /seeds into your Chec account
yarn seed
# Run your development environment on http://localhost:3000
yarn dev

Now head on over to http://localhost:3000 after starting your development, your site should now be populated with the sample data!

If you are replacing the sample products or categories, you can customize your own categories images under `public/images/collection. See more info on data customization below.

STEP 5. Make any necessary changes you need and push the code to a repository on Github or your choice of platform.

STEP 6. Deploy your site

Be sure to sign up for a Netlify account and log in to it. Click the New site from Git button and give access to select your repo. Your build settings are automatically filled out for your from the netlify.toml in the template. To enter your environment variables, click Show advanced then New variable and fill in the key input as NEXT_PUBLIC_CHEC_PUBLIC_KEY and the value input with your Public Key. You can access your API key in your Chec dashboard under Setup, then navigate to the Developer tab to copy your Public Key

Now go ahead and click the "deploy site" to see your live site!

Setup using Chec CLI demo-store command

This command will download this example project from GitHub and initialise it on your machine. You will be free to edit the downloaded code and play around with Commerce.js afterwards.

STEP 1. Install the Chec CLI

npm install -g @chec/cli
# or
yarn add -g @chec/cli

STEP 2. Create a demo store

chec demo-store

When prompted to choose a demo store from the list, choose "commercejs-nextjs-demo-store". This command will also seed some sample data to your Chec account. For more information, see the Chec CLI documentation.

Caveats with data customization (IMPORTANT)

Because this project is a fully fledged storefront showcasing a custom design and user flow, there are certain caveats you will run into if you customize your data in the Chec Dashboard. One gotcha is with the categories data in the UI: The categories feature images are added in the Chec API as meta data. If you add new or edit the seeded sample categories data, you can customize the categories feature image by replacing your image assets under public/images/collection. The file names will need to remain the same. If you plan on changing the files names or add new categories, you'll need to add new meta data. The app will expect the below inventory setup in order to build and render the components, so if you'd like to customize with your inventory in the backend make sure you:

  • Create your categories in the dashboard
  • Replace categories feature images under public/images/collection with your own images
  • If you want multiple assets to your products similar to the demo stores, you can create assets and assign them to your products. This guide walks through how to achieve this.

πŸ₯ž Stack

Commerce.js features

This demo store uses a range of features provided by Commerce.js and powered by the Chec Dashboard.

Carts

The shopping cart uses the Commerce.js cart API. Carts are persisted for up to 30 days, and Commerce.js automatically remembers carts for visitors.

The checkout

Commerce.js provides many tools to streamline checkout implementations. The checkout in this demo store makes use of:

  • Commerce.js's country and region APIs,
  • the shipping methods API, and
  • the discounts API (for validating and applying discounts at the checkout).

Customers

Commerce.js provides inbuilt functionality for supporting customer logins without any server side code. This demo store features an existing customer login page, and provides detail about previous orders. The customer information is also used to pre-populate the checkout with known customer details.

Payment gateways

This demo store is configured with the Chec "test gateway" out of the box, which provides a handy payment option while testing your storefront. Additionally, Stripe Elements support is included if Stripe is configured on the Chec Dashboard.

Commerce.js <> Stripe integration documentation

Enabling Stripe

You must enable Stripe in the Chec Dashboard by following the instructions provided. You may add your sandbox keys for Stripe, and use a sandbox Chec public API key to test with Stripe. Both the Chec public API key, and the Stripe "publishable" key are configured in the .env file. See step two of "Manual setup and Netlify deployment"

Customization and Extendability

Fork this project to customize and extend the demo however you want. Here are some ideas of what you can do and directions you can take eCommerce.

  • Add shipping zones and enable shipping options in each product
  • Customizing the styling
    • All global styles are done using SASS and Bootstrap
  • A/B testing checkout designs and flows
  • Integrating other backend tools like Content Management Systems, Customer Support, Fulfillment services, and more
  • Fetching real client reviews from review APIs
  • Adding search functionality
  • Leveraging webhooks to automate post checkout actions

commercejs-nextjs-demo-store's People

Contributors

aman-zishan avatar botex98 avatar danimart1991 avatar dependabot[bot] avatar drobiu avatar eufandem avatar jaepass avatar jeffresc avatar john-raymon avatar kvisca avatar ltfschoen avatar ng29 avatar paitoanderson avatar robbieaverill avatar scopeynz avatar slavakurilyak avatar st46593 avatar trishitapingolia avatar yashs911 avatar zb2oby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commercejs-nextjs-demo-store's Issues

Bug/Adding second product triggers error

error:

{"error":{"type":"not_found","message":"This product doesn't have this variant option."},"status_code":404}

To reproduce:

  • go into a product detail page from the collection page, select a product and add a variant to cart (item is updated in cart)
  • go back to collection page and select another product to add to cart (item is updated in cart)
  • scroll down from current product detail page to a product card under suggested product and add that product to cart (item is not added to cart and triggers an error because previous initial state is not there)

Reason:

Reviews error

Clicking on View all Reviews --> Takes to a page "An expected error has occurred."

Better error handling when categories are deleted in the backend

Scenario:

Solutions:

  • Better error handling
  • Get rid of hardcoded collections data and somehow output dynamically or remove from UI where it is used in home page categories banner and sidebar in shop pages and pdp (added categories feature image and product count)

Show Shipping method validation error to customer

If a shipping method is not selected at the checkout the customer should be made aware of what they need to do to complete the checkout.

Proposed solutions:

  • Notification bar stating "Please select a shipping method to complete your order"
  • Highlight the Shipping Method field in red

yarn build failed on netlify

After verifying that the demo store functions fine on http://localhost:3000, I followed the instructions in the README to deploy to Netlify, but it failed. Here is the log:

5:07:16 PM: Build ready to start
5:07:18 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
5:07:18 PM: build-image tag: v3.4.1
5:07:18 PM: buildbot version: 19f1164460e8d8241255cf2a71abc5e0e454118e
5:07:18 PM: Fetching cached dependencies
5:07:18 PM: Failed to fetch cache, continuing with build
5:07:18 PM: Starting to prepare the repo for build
5:07:19 PM: No cached dependencies found. Cloning fresh repo
5:07:19 PM: git clone https://github.com/ocmyusa/store
5:07:20 PM: Preparing Git Reference refs/heads/main
5:07:21 PM: Starting build script
5:07:21 PM: Installing dependencies
5:07:21 PM: Python version set to 2.7
5:07:23 PM: v12.18.0 is already installed.
5:07:23 PM: Now using node v12.18.0 (npm v6.14.4)
5:07:23 PM: Started restoring cached build plugins
5:07:23 PM: Finished restoring cached build plugins
5:07:24 PM: Attempting ruby version 2.7.1, read from environment
5:07:25 PM: Using ruby version 2.7.1
5:07:26 PM: Using PHP version 5.6
5:07:26 PM: 5.2 is already installed.
5:07:26 PM: Using Swift version 5.2
5:07:26 PM: Started restoring cached node modules
5:07:26 PM: Finished restoring cached node modules
5:07:26 PM: Installing NPM modules using NPM version 6.14.4
5:07:30 PM: npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
5:07:34 PM: npm WARN deprecated [email protected]: this library is no longer supported
5:07:38 PM: npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
5:07:39 PM: npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
5:07:41 PM: npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
5:07:41 PM: npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
5:07:42 PM: npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
5:08:08 PM: > [email protected] install /opt/build/repo/node_modules/node-sass
5:08:08 PM: > node scripts/install.js
5:08:08 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
5:08:09 PM: Download complete
5:08:09 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
5:08:09 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.14.1/linux-x64-72_binding.node
5:08:09 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js
5:08:09 PM: > node -e "try{require('./postinstall')}catch(e){}"
5:08:09 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js-pure
5:08:09 PM: > node -e "try{require('./postinstall')}catch(e){}"
5:08:10 PM: > [email protected] postinstall /opt/build/repo/node_modules/node-sass
5:08:10 PM: > node scripts/build.js
5:08:10 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
5:08:10 PM: Testing binary
5:08:10 PM: Binary is fine
5:08:10 PM: > [email protected] postinstall /opt/build/repo/node_modules/swiper
5:08:10 PM: > echo "Love Swiper? Support Vladimir's work by donating or pledging on patreon: > https://patreon.com/vladimirkharlampidi
5:08:10 PM: "
5:08:10 PM: Love Swiper? Support Vladimir's work by donating or pledging on patreon: > https://patreon.com/vladimirkharlampidi
5:08:12 PM: npm notice created a lockfile as package-lock.json. You should commit this file.
5:08:12 PM: npm WARN notsup Unsupported engine for [email protected]: wanted: {"npm":"^3.0.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
5:08:12 PM: npm WARN notsup Not compatible with your version of node/npm: [email protected]
5:08:12 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
5:08:12 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:08:12 PM: npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"<8.10.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
5:08:12 PM: npm WARN notsup Not compatible with your version of node/npm: [email protected]
5:08:12 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
5:08:12 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:08:12 PM: npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
5:08:12 PM: npm WARN [email protected] No repository field.
5:08:12 PM: added 1533 packages from 536 contributors and audited 1536 packages in 44.814s
5:08:13 PM: 63 packages are looking for funding
5:08:13 PM:   run `npm fund` for details
5:08:13 PM: found 4 vulnerabilities (2 low, 2 high)
5:08:13 PM:   run `npm audit fix` to fix them, or `npm audit` for details
5:08:13 PM: NPM modules installed
5:08:13 PM: Started restoring cached go cache
5:08:13 PM: Finished restoring cached go cache
5:08:13 PM: go version go1.14.4 linux/amd64
5:08:13 PM: go version go1.14.4 linux/amd64
5:08:13 PM: Installing missing commands
5:08:13 PM: Verify run directory
5:08:15 PM: ​
5:08:15 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
5:08:15 PM: β”‚        Netlify Build        β”‚
5:08:15 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
5:08:15 PM: ​
5:08:15 PM: ❯ Version
5:08:15 PM:   @netlify/build 5.1.0
5:08:15 PM: ​
5:08:15 PM: ❯ Flags
5:08:15 PM:   deployId: 5f9caab436a6754286d1116f
5:08:15 PM:   mode: buildbot
5:08:15 PM: ​
5:08:15 PM: ❯ Current directory
5:08:15 PM:   /opt/build/repo
5:08:15 PM: ​
5:08:15 PM: ❯ Config file
5:08:15 PM:   /opt/build/repo/netlify.toml
5:08:15 PM: ​
5:08:15 PM: ❯ Context
5:08:15 PM:   production
5:08:15 PM: ​
5:08:15 PM: ❯ Loading plugins
5:08:15 PM:    - [email protected] from netlify.toml and package.json
5:08:15 PM: ​
5:08:15 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
5:08:15 PM: β”‚ 1. onPreBuild command from netlify-plugin-onboarding β”‚
5:08:15 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
5:08:15 PM: ​
5:08:15 PM: Cloning into '/opt/build/repo/node_modules/netlify-plugin-onboarding/template'...
5:08:26 PM: > [email protected] postinstall /opt/build/repo/node_modules/netlify-plugin-onboarding/template/node_modules/core-js
5:08:26 PM: > node -e "try{require('./postinstall')}catch(e){}"
5:08:27 PM: > [email protected] postinstall /opt/build/repo/node_modules/netlify-plugin-onboarding/template/node_modules/ejs
5:08:27 PM: > node ./postinstall.js
5:08:27 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
5:08:27 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:08:27 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
5:08:27 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:08:27 PM: added 528 packages from 405 contributors and audited 533 packages in 10.866s
5:08:27 PM: 6 packages are looking for funding
5:08:27 PM:   run `npm fund` for details
5:08:27 PM: found 9 vulnerabilities (7 low, 2 high)
5:08:27 PM:   run `npm audit fix` to fix them, or `npm audit` for details
5:08:28 PM: > [email protected] build /opt/build/repo/node_modules/netlify-plugin-onboarding/template
5:08:28 PM: > eleventy --input src --output dist
5:08:28 PM: Writing dist/index.html from ./src/index.md.
5:08:28 PM: Wrote 1 file in 0.11 seconds (v0.11.0)
5:08:28 PM: ​
5:08:28 PM: (netlify-plugin-onboarding onPreBuild completed in 13.1s)
5:08:28 PM: ​
5:08:28 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
5:08:28 PM: β”‚ 2. build.command from netlify.toml β”‚
5:08:28 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
5:08:28 PM: ​
5:08:28 PM: $ yarn deploy
5:08:28 PM: bash: yarn: command not found
5:08:28 PM: ​
5:08:28 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
5:08:28 PM: β”‚   "build.command" failed    β”‚
5:08:28 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
5:08:28 PM: ​
5:08:28 PM:   Error message
5:08:28 PM:   Command failed with exit code 127: yarn deploy
5:08:28 PM: ​
5:08:28 PM:   Error location
5:08:28 PM:   In build.command from netlify.toml:
5:08:28 PM:   yarn deploy
5:08:28 PM: ​
5:08:28 PM:   Resolved config
5:08:28 PM:   build:
5:08:28 PM:     command: yarn deploy
5:08:28 PM:     commandOrigin: config
5:08:28 PM:     publish: /opt/build/repo/out
5:08:28 PM:   plugins:
5:08:28 PM:     - inputs: {}
5:08:28 PM:       origin: config
5:08:28 PM:       package: netlify-plugin-onboarding
5:08:28 PM: Caching artifacts
5:08:28 PM: Started saving node modules
5:08:28 PM: Finished saving node modules
5:08:28 PM: Started saving build plugins
5:08:28 PM: Finished saving build plugins
5:08:28 PM: Started saving pip cache
5:08:29 PM: Finished saving pip cache
5:08:29 PM: Started saving emacs cask dependencies
5:08:29 PM: Finished saving emacs cask dependencies
5:08:29 PM: Started saving maven dependencies
5:08:29 PM: Finished saving maven dependencies
5:08:29 PM: Started saving boot dependencies
5:08:29 PM: Finished saving boot dependencies
5:08:29 PM: Started saving go dependencies
5:08:29 PM: Finished saving go dependencies
5:08:31 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:08:31 PM: Failing build: Failed to build site
5:08:31 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
5:08:31 PM: Finished processing build request in 1m13.431100281s

Could it be because the GitHub repo is private?

No option to NOT invert logo

This project is really nice to get started with next.js and commerce.js.
I would like to contribute all I can, but I'm a noob. Hopefully I can contribute as I learn, but seemingly not yet.
I have a proposal, and it might be a small and easy fix, but I can't do it.

It is indeed stylish that the header is transparent and inverts color of the fonts/logo/shopping cart when you're all the way up the page.
But, inverting the colors of the logo might not be suitable as I guess a brand would like their main logo consistent in colors.
Hence, this proposal to have an option to not invert the logo.

in components/common/Header.js you have your logo and logo-container:

      <div className="logo-container">
        <img
          src={`/icon/${showMobileMenu ? 'cross' : 'menu'}.svg`}
          onClick={this.toggleMobileMenu}
          className="w-32 mr-1 d-block d-sm-none"
          alt="Menu icon"
        />
        <Link href="/">
          <a>
            <img
              src="/images/commerce.svg"
              className="logo cursor-pointer"
              alt="Logo"
            />
          </a>
        </Link>
      </div>

In the same file, there is this code which I believe is responsible for the header invert:

    <div
      ref={this.header}
      className={`d-flex header align-items-center justify-content-between position-relative ${
        transparent ? '' : 'invert'
      }`}
    >

Anyone have suggestions on this fix?

Netlify onboarding plugin not working

  • Added onboarding plugin to Netlify config, tested and worked fine
  • Somehow regressed and now onboarding screen does not show extra template.environment property to input env var

Command failed with exit code 1: yarn deploy

Hello! Building with Netlify, I got error when website is deployed :

1:22:20 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:22:20 PM: β”‚        Netlify Build        β”‚
1:22:20 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:22:20 PM: ​
1:22:20 PM: ❯ Version
1:22:20 PM:   @netlify/build 3.1.10
1:22:20 PM: ​
1:22:20 PM: ❯ Flags
1:22:20 PM:   deployId: 5f2d3943799009008fb82918
1:22:20 PM:   mode: buildbot
1:22:20 PM:   timersFile: /tmp/substage_times.txt
1:22:20 PM: ​
1:22:20 PM: ❯ Current directory
1:22:20 PM:   /opt/build/repo
1:22:20 PM: ​
1:22:20 PM: ❯ Config file
1:22:20 PM:   /opt/build/repo/netlify.toml
1:22:20 PM: ​
1:22:20 PM: ❯ Context
1:22:20 PM:   production
1:22:20 PM: ​
1:22:20 PM: ❯ Loading plugins
1:22:20 PM:    - [email protected] from netlify.toml and package.json
1:22:20 PM: ​
1:22:20 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:22:20 PM: β”‚ 1. onPreBuild command from netlify-plugin-onboarding β”‚
1:22:20 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:22:20 PM: ​
1:22:20 PM: ​
1:22:20 PM: (netlify-plugin-onboarding onPreBuild completed in 5ms)
1:22:20 PM: ​
1:22:20 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:22:20 PM: β”‚ 2. build.command from netlify.toml β”‚
1:22:20 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:22:20 PM: ​
1:22:20 PM: $ yarn deploy
1:22:21 PM: yarn run v1.22.4
1:22:21 PM: $ next build && next export
1:22:21 PM: Browserslist: caniuse-lite is outdated. Please run the following command: `yarn upgrade`
1:22:21 PM: Warning: No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache
1:22:21 PM: Creating an optimized production build...
1:22:22 PM: Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.
1:22:22 PM: See here for more info: https://err.sh/next.js/built-in-css-disabled
1:22:48 PM: Compiled successfully.
1:22:48 PM: 
1:22:48 PM: Automatically optimizing pages...
1:22:48 PM: Warning: You have opted-out of Automatic Static Optimization due to `getInitialProps` in `pages/_app`.
1:22:48 PM: Read more: https://err.sh/next.js/opt-out-auto-static-optimization
1:22:50 PM: > Build error occurred
1:22:50 PM: TypeError: Cannot read property 'map' of undefined
1:22:50 PM:     at getStaticPaths (/opt/build/repo/.next/server/static/HEPUvl8hVstwABV3n7nTb/pages/product/[permalink].js:2546:26)
1:22:50 PM:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
1:22:50 PM:     at async buildStaticPaths (/opt/build/repo/node_modules/next/dist/build/utils.js:18:80)
1:22:50 PM:     at async Object.isPageStatic (/opt/build/repo/node_modules/next/dist/build/utils.js:25:542) {
1:22:50 PM:   type: 'TypeError'
1:22:50 PM: }
1:22:50 PM: error Command failed with exit code 1.
1:22:50 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
1:22:50 PM: ​
1:22:50 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:22:50 PM: β”‚   "build.command" failed    β”‚
1:22:50 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:22:50 PM: ​
1:22:50 PM:   Error message
1:22:50 PM:   Command failed with exit code 1: yarn deploy
1:22:50 PM: ​
1:22:50 PM:   Error location
1:22:50 PM:   In build.command from netlify.toml:
1:22:50 PM:   yarn deploy
1:22:50 PM: ​
1:22:50 PM:   Resolved config
1:22:50 PM:   build:
1:22:50 PM:     command: yarn deploy
1:22:50 PM:     commandOrigin: config
1:22:50 PM:     environment:
1:22:50 PM:       - CHEC_PUBLIC_KEY
1:22:50 PM:     publish: /opt/build/repo/out
1:22:50 PM:   plugins:
1:22:50 PM:     - inputs: {}
1:22:50 PM:       origin: config
1:22:50 PM:       package: netlify-plugin-onboarding
1:22:50 PM: Caching artifacts
1:22:50 PM: Started saving node modules
1:22:50 PM: Finished saving node modules
1:22:50 PM: Started saving build plugins
1:22:50 PM: Finished saving build plugins
1:22:50 PM: Started saving yarn cache
1:22:50 PM: Finished saving yarn cache
1:22:50 PM: Started saving pip cache
1:22:50 PM: Finished saving pip cache
1:22:50 PM: Started saving emacs cask dependencies
1:22:50 PM: Finished saving emacs cask dependencies
1:22:50 PM: Started saving maven dependencies
1:22:50 PM: Finished saving maven dependencies
1:22:50 PM: Started saving boot dependencies
1:22:50 PM: Finished saving boot dependencies
1:22:50 PM: Started saving go dependencies
1:22:50 PM: Finished saving go dependencies
1:22:52 PM: Error running command: Build script returned non-zero exit code: 1
1:22:52 PM: Failing build: Failed to build site
1:22:53 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
1:22:53 PM: Finished processing build request in 1m11.744157387s

My key is in the right place :

Screenshot_4

Add About page

Commerce.js example storefront

This is an open source storefront built using Chec’s headless architecture and the Commerce.js SDK. Commerce.js is a smarter, more efficient way to build eCommerce projects, and we hope you can see that as you explore the world custom eCommerce and build on top of, or pick apart this project. Everything in this project, from the storefront, to the cart, checkout and receipt, is 100% customizable. To build more custom eCommerce projects, using any frontend framework or platform, head over to commercejs.com.

Add GitHub action to run some automated checks

Example of some checks that we can run:

  • Linting (we'll need to add a linter and lint the project first)
  • yarn deploy - this is what Netlify/Vercel run to deploy the project

We often have pull requests merged that break the one-click deployment pipelines, but we don't discover this until that happens and somebody reports it (#136). This could be avoided by adding continuous integration checks for the deployment command, which is essentially the same locally as it is in the hosting provider.

Linting is a nice to have - the deployment command is the higher value addition for now.

Add category in dashboard messes up a Link in CategoryBanner.js

If I add a new category and refresh I get the error "Error: Failed prop type: The prop href expects a string or object in <Link>, but got undefined instead."

I traced it by luck to <Link href={item.link}> in components/homepage/CategoryBanner.js.

The error goes away if I remove the new category I created in the dashboard, or if I change the Link to <Link href="/">

Not Seeing Shipping Information

Hey πŸ‘‹.

When replicating the demo, I am having an issue seeing shipping information on the order page within Commerce.js

Here's a screenshot of what I see.

screen

Please advise.

Seeding is incomplete

Steps to reproduce:

  1. Set CHEC_PUBLIC_KEY and CHEC_SECRET_KEY to your own keys in .env
  2. Run yarn seed

It should run successfully and output something like this:

√ Completed seeding
Added:
  3 categories
  9 products
  27 assets
Done in 70.70s.
  1. Run yarn dev

Actual behavior: no products are visible in the store.
Expected behavior: 9 products should be visible in the store.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.