Skip to content

fix: updated packages and switched to jest #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2023
Merged
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
58 changes: 0 additions & 58 deletions .circleci/config.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .commitlintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends:
- "@commitlint/config-conventional"
rules:
body-max-line-length: [1, "always", 100]
70 changes: 70 additions & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI/CD

on:
push:
pull_request:
workflow_dispatch:
branches:
- main

jobs:
lint-commits:
if: github.event_name == 'pull_request'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
- run: npm ci --ignore-scripts
- run: npx commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD

build:
runs-on: ubuntu-latest

strategy:
matrix:
# add/remove versions as we move support forward
node-version: [16, 18]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run lint
- run: npm run test:unit

release:
needs: build

# don't run on forks
if: ${{ github.repository_owner == 'SmartThingsCommunity' && github.ref == 'refs/heads/main' }}

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
- run: npm ci
- name: Release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PI_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: smartthingspi
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: smartthingspi
GIT_COMMITTER_EMAIL: [email protected]
run: npx semantic-release
41 changes: 0 additions & 41 deletions .github/workflows/codeql.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Close stale issues

on:
schedule:
- cron: "30 1 * * *"

permissions:
issues: write

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days."
exempt-issue-labels: "reviewed"
13 changes: 13 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/github"
- - "@semantic-release/changelog"
- changelogFile: docs/CHANGELOG.md
- "@semantic-release/npm"
- - "@semantic-release/git"
- assets: ["docs", "package.json"]
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
preset: conventionalcommits
branches:
- main
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Javascript DynamoDB Context Store

<p align="center">
<a href="https://circleci.com/gh/SmartThingsCommunity/dynamodb-context-store-nodejs/tree/main"><img src="https://circleci.com/gh/SmartThingsCommunity/dynamodb-context-store-nodejs.svg?style=svg"/></a>
<a href="https://www.npmjs.com/package/@smartthings/dynamodb-context-store"><img src="https://badgen.net/npm/v/@smartthings/dynamodb-context-store"/></a>
<a href="https://www.npmjs.com/package/@smartthings/dynamodb-context-store"><img src="https://badgen.net/npm/license/@smartthings/dynamodb-context-store"/></a>
<a href="https://codecov.io/gh/SmartThingsCommunity/dynamodb-context-store-nodejs"><img src="https://codecov.io/gh/SmartThingsCommunity/dynamodb-context-store-nodejs/branch/main/graph/badge.svg"/></a>
<a href="https://status.badgen.net/"><img src="https://badgen.net/xo/status/@smartthings/dynamodb-context-store"/></a>
</p>

Used by the [SmartApp SDK](https://github.com/SmartThingsCommunity/smartapp-sdk-nodejs) to store IDs and access tokens for an installed instance of a SmartApp and retrieves that information for use in asynchronous API calls. The use of a context store is only needed when SmartApps have to call the SmartThings API in response to external events. SmartApps that only response to lifecycle events from the SmartThings platform will automatically have the proper context without the app having to store it.

The context stored by this module consists of the following data elements:
Expand Down
5 changes: 5 additions & 0 deletions config/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint no-undef: 'off' */

process.on('unhandledRejection', error => {
fail(error)
})
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
// Currently unable to set coverage reporter watermarks in jest. See https://github.com/facebook/jest/issues/9734
//
// For our previous nyc watermark config, see
// https://github.com/SmartThingsCommunity/smartapp-sdk-nodejs/blob/79983de15646dd3be84d2b3e82d409f9bc632959/package.json#L72
collectCoverageFrom: ['lib/**/*.js'],
coverageReporters: ['json', 'text'],
testEnvironment: 'node',
testPathIgnorePatterns: ['test/data', 'test/utilities'],
testMatch: ['**/test/**/*.[jt]s?(x)'],
setupFiles: ['<rootDir>/config/jest.setup.js']
}
2 changes: 1 addition & 1 deletion lib/dynamodb-context-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = class DynamoDBContextStore {
*/

/**
* Create a context store instance instance
* Create a context store instance
* @param {DynamoDBContextStoreOptions|Object} [options] Optionally, pass in a configuration object
*/
constructor(options = {}) {
Expand Down
Loading