Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
13 changes: 11 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }],
"@typescript-eslint/no-unused-vars": [
"error",
{ "ignoreRestSiblings": true }
],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
Expand All @@ -52,7 +55,13 @@
"caseInsensitive": true
},
"newlines-between": "ignore",
"groups": [["builtin", "external"], "internal", "parent", "sibling", "index"]
"groups": [
["builtin", "external"],
"internal",
"parent",
"sibling",
"index"
]
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
## What?

A description about what this pull request implements and its purpose. Try to be detailed and describe any technical details to simplify the job of the reviewer and the individual on production support.

## Why?

...

## Testing / Proof

...

@bigcommerce/api-client-developers
33 changes: 16 additions & 17 deletions .github/workflows/validate-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,31 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: |
npm i -g npm@8.13.1
npm ci
- name: Install Dependencies
run: |
npm i -g npm@8.13.1
npm ci

- name: Run Build
run: npm run build
- name: Run Build
run: npm run build

- name: Lint Check
run: npm run lint --if-present
- name: Lint Check
run: npm run lint --if-present

- name: Validate tests
run: npm run test --if-present
- name: Validate tests
run: npm run test --if-present
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ typings/

# dotenv environment variables file
.env
.env.test
.env.*

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down Expand Up @@ -102,3 +102,7 @@ dist

# TernJS port file
.tern-port
blobfish.db
blobfish.db.bak

.DS_Store
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
min-release-age=2
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
graphql-env.d.ts
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"js/ts.tsdk.path": "node_modules/typescript/lib"
}
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down
35 changes: 19 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Contributing to Sample App NodeJS

Thanks for showing interest in contributing!

The following is a set of guidelines for contributing to the Sample App NodeJS. These are just guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
Expand All @@ -8,40 +9,42 @@ The following is a set of guidelines for contributing to the Sample App NodeJS.
[API Documentation](https://developer.bigcommerce.com/api)

How Can I Contribute?
* [Pull Requests](#pull-requests)
* [Issues / Bugs](#issues--bugs)
* [Other Ways to Contribute](#other-ways-to-contribute)

- [Pull Requests](#pull-requests)
- [Issues / Bugs](#issues--bugs)
- [Other Ways to Contribute](#other-ways-to-contribute)

Styleguides
* [Git Commit Messages](#git-commit-messages)

- [Git Commit Messages](#git-commit-messages)

## Pull Requests

First ensure that your feature isn't already being developed or considered (see open PRs and issues).
First ensure that your feature isn't already being developed or considered (see open PRs and issues).
If it is, please consider contributing to those initiatives.

All PRs require test coverage to be accepted when applicable.

## Issues / Bugs

* Please include a clear, specific title and replicable description.

* Please include your environment, OS, and any exceptions/backtraces that occur. The more
information that is given, the more likely we can debug and fix the issue.
- Please include a clear, specific title and replicable description.

- Please include your environment, OS, and any exceptions/backtraces that occur. The more
information that is given, the more likely we can debug and fix the issue.

**If you find a security bug, please do not post as an issue. Send directly to security@bigcommerce.com
**If you find a security bug, please do not post as an issue. Send directly to security@bigcommerce.com
instead.**

## Other Ways to Contribute

* Consider contributing to sample-app-nodejs documentation on the wiki, reporting bugs, contributing to test coverage,
or helping spread the word about sample-app-nodejs.
- Consider contributing to sample-app-nodejs documentation on the wiki, reporting bugs, contributing to test coverage,
or helping spread the word about sample-app-nodejs.

## Git Commit Messages

* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Reference pull requests and external links liberally
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference pull requests and external links liberally

Thank you again for your interest in contributing to sample-app-nodejs!
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ cp .env-sample .env
1. Creating a new project in Firebase
2. Adding a Cloud Firestore
3. And generating a new Private Key under Project Settings > Service Accounts
See the [Firebase quickstart (Google)](https://firebase.google.com/docs/firestore/quickstart) for more detailed information.
See the [Firebase quickstart (Google)](https://firebase.google.com/docs/firestore/quickstart) for more detailed information.

If using MySQL, supply the `MYSQL_` config keys listed in the `.env` file, then do the initial database migration by running the following npm script: `npm run db:setup`

Expand Down
8 changes: 4 additions & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
"CLIENT_ID": {
"description": "The client id of your app, provided by the BigCommerce developer portal."
},
"CLIENT_SECRET":{
"CLIENT_SECRET": {
"description": "The client secret of your app, provided by the BigCommerce developer portal."
},
"AUTH_CALLBACK":{
"AUTH_CALLBACK": {
"description": "The fully qualified authentication endpoint provided by this app. Replace the app name with the app name chosen above.",
"value": "https://<APP NAME>.herokuapp.com/api/auth"
},
"DB_TYPE":{
"DB_TYPE": {
"description": "Which type of database we are using. Options are 'mysql' or 'firebase'. Can safely leave unchanged.",
"value": "mysql"
},
"JWT_KEY":{
"JWT_KEY": {
"description": "Key the app will use for signing JWT. Can safely leave unchanged.",
"generator": "secret"
}
Expand Down
32 changes: 16 additions & 16 deletions components/error.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { H3, Panel } from '@bigcommerce/big-design';
import { ErrorMessageProps, ErrorProps } from '../types';
import { H3, Panel } from '@bigcommerce/big-design'
import { ErrorMessageProps, ErrorProps } from '../types'

const ErrorContent = ({ message }: Pick<ErrorProps, 'message'>) => (
<>
<H3>Failed to load</H3>
{message}
</>
<>
<H3>Failed to load</H3>
{message}
</>
)

const ErrorMessage = ({ error, renderPanel = true }: ErrorMessageProps) => {
if (renderPanel) {
return (
<Panel>
<ErrorContent message={error.message} />
</Panel>
)
}
if (renderPanel) {
return (
<Panel>
<ErrorContent message={error.message} />
</Panel>
)
}

return <ErrorContent message={error.message} />
};
return <ErrorContent message={error.message} />
}

export default ErrorMessage;
export default ErrorMessage
Loading
Loading