Homey (docker) development environment
â›” [DEPRECATED] Active at https://github.com/cghome/create-homey-app
After my old MacMini had died (RIP), I decided that my new computer (MacBook Pro) should no longer be a "Node.js Versions Messi". Because different server applications need different configurations and versions to load and manage. For example, if a Node.js app has not been used for a while, there is a good chance that it won't work properly anymore and you have to adapt the whole environment first. Only to find out afterwards, that there are new problems with another server app.
For this reason, I no longer install a server (Nodejs app, DB, etc.) directly on the computer, but create a separate docker image/container for all of them.
Homey-Dev is a development environment consisting of the normal Homey-App and a runtime environment (via athom-cli) in a (Homey-Dev) docker container. The container is controlled by various commands (see Bash commands), which are defined as "bash-functions" during installation.
Furthermore, different Build-Tools commands are integrated, which are implemented as npm-scripts and can be used with "homey-run ..." or "npm run ..." (If node.js is installed on host). In addition, a remote debugger can be defined for the Homey-App in development mode.
- Bash compatible OS (Tested with macOS Mojave)
- Docker installed
- Git installed
- Github account
- Athom developer account
[Optional]
- Node.js installed on host
curl -s https://raw.githubusercontent.com/cgHome/homey-dev/master/install.sh | bash && source ~/.bashrc
git config --global hub.protocol https
git config --global credential.helper store
git config --global credential.helper 'cache --timeout 7200'
git config --global user.name ["GITUSER_NAME"]
git config --global user.email ["name@example.com"]
Optional:
git config --global color.ui auto
git config --global format.pretty oneline
unset -f homey-dev homey-run homey-start homey-createApp && rm ~/.bashrc
# OR remove the homey bash-functions on ~/.bashrc
unset -f homey-dev homey-run homey-start homey-createApp && nano ~/.bashrc
# Reinstall docker-image
[app-root] docker container rm -f ${PWD##*/}
[app-root] docker rmi cghome/homey-dev
# Reinstall the Homey-Dev bash-functions (if needed)
unset -f homey-dev homey-run homey-start homey-createApp && nano ~/.bashrc
curl -s https://raw.githubusercontent.com/cgHome/homey-dev/master/install.sh | bash && source ~/.bashrc
# Start new Homey-Dev app-container
[app-root] homey-start
Attention:
After the bashrc-file modification, you have to reload the file (source ~/.bashrc) or restart the terminal-session.
homey-dev <command> Run a bash command inside your homey-dev container
homey-run <npm-script> Run a npm-script inside homey-dev container
homey-start Start a homey-dev container for your homey-app
homey-createApp Create a new homey-app & homey-dev container
info Homey-App (container) information
test Run a Homey-App in development/debug mode
setup Setup (install) a Homey-App
build Build a Homey-App for publishing
deploy:xxx Workflow: build, push & relase on github and publish them to the Homey Apps Store.
deploy:major - MAJOR version when you make incompatible API changes.
deploy:minor - MINOR version when you add functionality in a backwards-compatible manner, and
deploy:patch - PATCH version when you make backwards-compatible bug fixes. (see semver.org)
init:app (Re)Initialize package.json based on homey-app/app.json (see .npm-init.js)
[User-Scripts] User defined npm-scripts.
# Format
"[Name]": "npm run -s _homeyRun -- [Name] && exit; [App-Container commands]"
# Sample
"foo": "npm run -s _homeyRun -- foo && exit; echo \">> bar on: (${HOSTNAME})\" "
(There is also a sample app see: org.cflat-inc.homey-app)
curl -s https://raw.githubusercontent.com/cgHome/homey-dev/master/install.sh | bash && source ~/.bashrc
[repo] homey-createApp
[app-root] homey-start
[app-root] homey-dev npm init -y
'use strict';
const Homey = require('homey');
const DEBUG = process.env.DEBUG === '1';
class App extends Homey.App {
constructor(...args) {
super(...args);
};
onInit() {
this.log(`${ this.id } is running...(debug mode ${ DEBUG ? 'on' : 'off' })`);
if (DEBUG) {
require('inspector').open(9229, '0.0.0.0');
};
};
}
module.exports = App;
{
"type": "node",
"request": "attach",
"name": "Attach to Homey",
"address": "xxx.xxx.xxx.xxx", <- Homey IpAdr
"port": 9229,
"localRoot": "${workspaceFolder}",
"remoteRoot": "/",
}
[app-root] homey-run test
[app-root] npm run test <- (*1)
[app-root] homey-run deploy:minor
[app-root] npm run deploy:minor <- (*1)
[app-root] homey-run setup
[app-root] npm run setup <- (*1)
(*1 = If node.js is installed on host)
v0.3.0
- Some changes for the new Homey-App Store
- Rename homey bash-cmd to homey-dev
- Change npm-package athom-cli to homey
v0.2.2
- npm-script 'install' to 'setup' renamed
v0.2.1
- _homeyRun dedection fixed
v0.2.0
- Homey-Dev Build-Tools added
v0.1.0
- Initial release
- See homey-dev/pulls
Copyright 2018, 2018 cflat-inc.org under MIT License