-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,030 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended' | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
project: './tsconfig.json' | ||
}, | ||
rules: { | ||
'@typescript-eslint/array-type': ['error', {default: 'generic'}], | ||
'@typescript-eslint/brace-style': 'error', | ||
'@typescript-eslint/comma-spacing': 'error', | ||
'@typescript-eslint/explicit-function-return-type': 'error', | ||
'@typescript-eslint/func-call-spacing': 'error', | ||
'@typescript-eslint/indent': ['error', 2], | ||
'@typescript-eslint/lines-between-class-members': ['error', {"exceptAfterSingleLine": true}], | ||
'@typescript-eslint/no-base-to-string': 'error', | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'@typescript-eslint/no-extra-parens': 'error', | ||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error', {"allowComparingNullableBooleansToTrue": false, "allowComparingNullableBooleansToFalse": false}], | ||
'@typescript-eslint/no-var-requires': 'error', | ||
'@typescript-eslint/prefer-optional-chain': 'error', | ||
'@typescript-eslint/prefer-readonly': 'error', | ||
'@typescript-eslint/quotes': ['error', 'single', {"allowTemplateLiterals": false}], | ||
'@typescript-eslint/semi': ['error'], | ||
'@typescript-eslint/space-before-function-paren': ['error', 'never'], | ||
'@typescript-eslint/type-annotation-spacing': 'error', | ||
'comma-dangle': 'error', | ||
'no-confusing-arrow': 'error', | ||
'no-lonely-if': 'error', | ||
'no-trailing-spaces': 'error', | ||
'no-unneeded-ternary': 'error', | ||
'one-var': ['error', 'never'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "10:00" | ||
target-branch: "beta" | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "10:00" | ||
open-pull-requests-limit: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: NodeJS | ||
|
||
on: | ||
push: | ||
branches: '**' | ||
pull_request: | ||
release: # Run when release is created | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x, 12.x, 13.x, 14.x] | ||
os: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm install and build | ||
run: | | ||
npm ci | ||
npm run build --if-present | ||
env: | ||
CI: true | ||
|
||
publish-npm: | ||
# publish only if we are on our own repo, event was 'release' (a tag was created) and the tag starts with "v" (aka version tag) | ||
if: github.repository == 'Sunoo/homebridge-smtp-motion' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') | ||
|
||
needs: build # only run if build succeeds | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 10 # use the minimum required version | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.npm_token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/env node | ||
|
||
const fs = require('fs'); | ||
const semver = require('semver'); | ||
const child_process = require('child_process'); | ||
|
||
function getTagVersionFromNpm(tag) { | ||
try { | ||
return child_process.execSync(`npm info ${package.name} version --tag="${tag}"`).toString('utf8').trim(); | ||
} catch (e) { | ||
return null; | ||
} | ||
} | ||
|
||
// load package.json | ||
const package = JSON.parse(fs.readFileSync('package.json', 'utf8')); | ||
|
||
// work out the correct tag | ||
const currentLatest = getTagVersionFromNpm('latest') || '0.0.0'; | ||
const currentBeta = getTagVersionFromNpm('beta') || '0.0.0'; | ||
const latestNpmTag = semver.gt(currentBeta, currentLatest, { includePrerelease: true }) ? currentBeta : currentLatest; | ||
const publishTag = semver.gt(package.version, latestNpmTag, { includePrerelease: true }) ? package.version : latestNpmTag; | ||
|
||
// save the package.json | ||
package.version = publishTag; | ||
fs.writeFileSync('package.json', JSON.stringify(package, null, 4)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish Beta | ||
|
||
on: | ||
workflow_dispatch | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
ref: beta | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 10 | ||
- name: npm install and build | ||
run: | | ||
npm ci | ||
npm run build --if-present | ||
env: | ||
CI: true | ||
|
||
publish-npm: | ||
if: github.repository == 'Sunoo/homebridge-smtp-motion' | ||
|
||
needs: build | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 10 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: node .github/workflows/prerelease.js | ||
- run: npm --no-git-tag-version version prerelease --preid=beta | ||
- run: npm publish --tag=beta | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Stale | ||
|
||
on: | ||
issues: | ||
types: [reopened] | ||
schedule: | ||
- cron: "*/60 * * * *" | ||
|
||
jobs: | ||
stale: | ||
|
||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_STEP_DEBUG: true | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.' | ||
stale-pr-message: 'This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.' | ||
stale-issue-label: 'stale' | ||
stale-pr-label: 'stale' | ||
days-before-stale: 7 | ||
days-before-close: 2 | ||
exempt-issue-labels: 'long running,help wanted' | ||
exempt-pr-labels: 'awaiting-approval,work-in-progress' | ||
remove-stale-when-updated: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"default": true, | ||
"line_length": false, | ||
"no-duplicate-heading": false | ||
} |
Oops, something went wrong.