Skip to content

Commit

Permalink
feat: update to semantic versioning
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Buchleitner <[email protected]>
  • Loading branch information
mabunixda committed Mar 4, 2021
1 parent 65c476d commit 96a3b9f
Show file tree
Hide file tree
Showing 13 changed files with 437 additions and 2,671 deletions.
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.travis.yml
*.md
Dockerfile
Makefile
data
node_modules
.travis.yml
*.md
*.sh
4 changes: 3 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ globals:
SharedArrayBuffer: readonly
parserOptions:
ecmaVersion: 2018
rules: {}
rules: {
"max-len": ["warn", {"code": 80}]
}
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
node: [10, 12]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@master
- name: Shell Linter
uses: azohra/[email protected]
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: install check deps
run: npm install npm-check mocha eslint
- name: npm-check
run: ./node_modules/npm-check/bin/cli.js --skip-unused
- name: lint
run: ./scripts/lint.sh
- run: npm ci
- run: npm test
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
- uses: go-semantic-release/action@v1
id: semrel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
update-file: package.json
changelog-generator-opt: "emojis=true"
- run: npm publish
if: steps.semrel.outputs.version != ''
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33 changes: 0 additions & 33 deletions .github/workflows/push.yml

This file was deleted.

13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
FROM nodered/node-red-docker:slim-v10

COPY docker-package.json /usr/src/node-red/package.json
COPY ./ /usr/src/alexa-node
FROM nodered/node-red:1.2.6-12-minimal

USER root
COPY docker-package.json /usr/src/node-red/package-patch.json
RUN awk -F':' '{system("npm install "$1)}' package-patch.json \
&& rm /usr/src/node-red/package-patch.json

## install custom deps
RUN npm install
COPY ./ /usr/src/alexa-node

## link dev code
RUN npm link /usr/src/alexa-node/

# USER node-red

3 changes: 2 additions & 1 deletion alexa/alexa-home-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ module.exports = function(RED) {
lights: node.generateAPIDeviceList(id),
date: new Date().toISOString().split('.').shift(),
};
const content = Mustache.render(template, data).replace(/(\{\s+)?,?[^,]+_emptyIteratorStopper": \{\}/g, '$1');
const content = Mustache.render(template, data)
.replace(/(\{\s+)?,?[^,]+_emptyIteratorStopper": \{\}/g, '$1');
RED.log.debug(node.name + + '/' + id +
' - listing ' + request.params.username +
' #' + data.lights.length + ' api information to ' +
Expand Down
28 changes: 16 additions & 12 deletions alexa/alexa-hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ AlexaHub.prototype.createServer = function(protocol, options) {
const app = express();
node.app = app;
node.ip = '0.0.0.0';
if (process.env.ALEXA_IP !== undefined ) {
if (process.env.ALEXA_IP !== undefined) {
node.ip = process.env.ALEXA_IP;
node.controller.log('Using ' + node.ip + ' to listing to alexa commands');
}
Expand All @@ -37,7 +37,9 @@ AlexaHub.prototype.createServer = function(protocol, options) {
return;
});

app.use(bodyParser.json({type: '*/*'}));
app.use(bodyParser.json({
type: '*/*',
}));

app.use(function(err, req, res, next) {
if (err instanceof SyntaxError && err.status === 400 && 'body' in err) {
Expand All @@ -48,10 +50,10 @@ AlexaHub.prototype.createServer = function(protocol, options) {
});

app.use(function(req, res, next) {
node.controller.debug(req.connection.remoteAddress + '-' +
node.port + '/' +
req.method + ' -> ' +
req.url);
node.controller.log(req.connection.remoteAddress + '-' +
node.port + '/' +
req.method + ' -> ' +
req.url);
if (Object.keys(req.body).length > 0) {
node.controller.debug('Request body: ' + JSON.stringify(req.body));
}
Expand Down Expand Up @@ -114,22 +116,24 @@ AlexaHub.prototype.startSsdp = function(protocol) {
node.controller.log(node.id + ' - alexa-home - Starting SSDP');
const hueuuid = node.controller.formatHueBridgeUUID(node.id);
const Ssdp = require('node-ssdp').Server;
node.ssdpServer = new Ssdp({
location: {
let location = process.env.ALEXA_URI + '/alexa-home/setup.xml';
if (process.env.ALEXA_URI == undefined) {
location = {
protocol: protocol + '://',
port: node.port,
path: '/alexa-home/setup.xml',
},
};
}
node.ssdpServer = new Ssdp({
location: location,
udn: 'uuid:' + hueuuid,
});
node.ssdpServer.addUSN('upnp:rootdevice');
node.ssdpServer.addUSN('urn:schemas-upnp-org:device:basic:1');
node.ssdpServer.reuseAddr = true;
node.ssdpServer.start();

node.controller.log(node.id + ' - announcing: ' +
protocol + '://*:' +
node.port + '/alexa-home/setup.xml');
node.controller.log(node.id + ' - announcing location is ' + location);
};


Expand Down
41 changes: 3 additions & 38 deletions docker-package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,3 @@
{
"name": "node-red-docker",
"version": "1.0.0",
"description": "A visual tool for wiring the Internet of Things",
"homepage": "http://nodered.org",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/node-red/node-red-docker.git"
},
"main": "node_modules/node-red/red/red.js",
"scripts": {
"start": "node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS"
},
"contributors": [{
"name": "Dave Conway-Jones"
},
{
"name": "Nick O'Leary"
},
{
"name": "James Thomas"
}
],
"dependencies": {
"node-red": "1.0.0",
"node-red-node-msgpack": "*",
"node-red-node-base64": "*",
"node-red-node-suncalc": "*",
"node-red-node-random": "*",
"node-red-node-feedparser": "*",
"node-red-contrib-loxone": "*",
"node-red-contrib-samsung-tv": "*"
},
"engines": {
"node": "4.*.*"
}
}
"node-red-contrib-loxone": "*"
"node-red-contrib-samsung-tv": "*"
"node-red-contrib-alexa-remote2": "*"
Loading

0 comments on commit 96a3b9f

Please sign in to comment.