Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 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
1 change: 0 additions & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
env: {
node: true,
es2021: true,
jest: true,
},
extends: ['eslint:recommended'],
parserOptions: {
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci

- name: Lint
run: |
npm run lint
npm run format -- --check
15 changes: 5 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
node-version: [20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -25,11 +25,6 @@ jobs:
sudo apt-get install -y libgbm-dev jq xvfb
npm ci

- name: Lint
run: |
npm run lint
npm run format -- --check

- name: Install Chrome
uses: browser-actions/setup-chrome@latest
with:
Expand All @@ -38,7 +33,7 @@ jobs:
- name: Run tests with mocks
run: |
# Run tests with coverage and capture results in JSON format
npm test -- --coverage-reporters=lcov --coverage-reporters=json-summary --json --outputFile=test-results.json
npm test -- --coverage.reporter=lcov --coverage.reporter=json-summary --reporter=json --outputFile.json=test-results.json

# Extract coverage and test results
{
Expand Down Expand Up @@ -70,13 +65,13 @@ jobs:
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
name: coverage-report-${{ matrix.node-version }}
path: coverage/

- name: Run visual tests
run: |
mkdir -p __image_snapshots__
CHROME_PATH="$(which chrome)" xvfb-run --auto-servernum --server-args="-screen 0 1280x800x24" npm run test:visual:ci -- -u --json --outputFile=visual-test-results.json
CHROME_PATH="$(which chrome)" xvfb-run --auto-servernum --server-args="-screen 0 1280x800x24" npm run test:visual:ci -- --update --reporter=json --outputFile.json=visual-test-results.json

# Show test results and screenshots
{
Expand Down Expand Up @@ -111,5 +106,5 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots
name: screenshots-${{ matrix.node-version }}
path: artifacts/
2 changes: 1 addition & 1 deletion .github/workflows/zapier-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
- name: Deploy to Zapier
env:
ZAPIER_DEPLOY_KEY: ${{ secrets.ZAPIER_DEPLOY_KEY }}
run: zapier push
run: npm run build && zapier push
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Dependencies
node_modules/

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/

# Zapier build files
.zapierapprc
build/
Expand Down
1 change: 0 additions & 1 deletion babel.config.json

This file was deleted.

4 changes: 0 additions & 4 deletions constants.js

This file was deleted.

10 changes: 9 additions & 1 deletion docs/developer-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The project uses several tools to ensure code quality:

- **ESLint** - For code linting
- **Prettier** - For code formatting
- **Jest** - For testing
- **Vitest** - For testing
- **Husky** - For git hooks
- **lint-staged** - For running checks on staged files
- **markdownlint** - For markdown formatting
Expand Down Expand Up @@ -142,6 +142,14 @@ These tests are skipped locally to avoid environment-specific issues.

## Deployment

Compile the TypeScript code so that JavaScript code will be generated:

```
npm run build
```

The command will create a new folder called `dist/`, which is referenced by `index.js`.

The integration is automatically deployed to Zapier when a new version tag is pushed to GitHub.

1. Create and push a new version tag:
Expand Down
58 changes: 1 addition & 57 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,57 +1 @@
const uploadAsset = require('./actions/upload-asset');
const schedulePlaylistItem = require('./actions/schedule-playlist-item');
const assignScreenToPlaylist = require('./actions/assign-screen-to-playlist');
const completeWorkflow = require('./actions/complete-workflow');
const cleanupZapierContent = require('./actions/cleanup-zapier-content');

const { getScreens } = require('./triggers/get-screens');
const { getPlaylists } = require('./triggers/get-playlists');
const { getAssets } = require('./triggers/get-assets');

// Authentication setup
const authentication = {
type: 'custom',
test: {
headers: {
Authorization: 'Token {{bundle.authData.api_key}}',
},
url: 'https://api.screenlyapp.com/api/v4/assets/',
method: 'GET',
},
fields: [
{
key: 'api_key',
type: 'string',
required: true,
label: 'API Key',
helpText:
'See [this page](https://support.screenly.io/hc/en-us/articles/35897560148371-How-to-Generate-a-Screenly-API-Token) for a guide on how to generate an API key for your Screenly account.',
},
],
};

// Export the app definition
module.exports = {
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,

authentication,

triggers: {
[getScreens.key]: getScreens,
[getPlaylists.key]: getPlaylists,
[getAssets.key]: getAssets,
},

creates: {
[uploadAsset.key]: uploadAsset,
[schedulePlaylistItem.key]: schedulePlaylistItem,
[assignScreenToPlaylist.key]: assignScreenToPlaylist,
[completeWorkflow.key]: completeWorkflow,
[cleanupZapierContent.key]: cleanupZapierContent,
},

searches: {},

resources: {},
};
module.exports = require('./dist').default;
20 changes: 0 additions & 20 deletions jest.config.js

This file was deleted.

13 changes: 0 additions & 13 deletions jest.visual.config.js

This file was deleted.

Loading
Loading