-
Notifications
You must be signed in to change notification settings - Fork 22
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
Reorganize development environment #77
Comments
Progress devcontainerDate: @2023.04.05 Testing with container in host mode. No portmapping yet. This DOES work!!!! dev-sak:
container_name: dev-sak
network_mode: host
image: mcr.microsoft.com/devcontainers/javascript-node:20
command: /bin/sh -c "while sleep 60000; do :; done"
volumes:
- $DOCKERDIR/dev/sak/workspaces:/workspaces
- $DOCKERDIR/dev/sak/vscode:/vscode
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro Use vscode to
|
Progress PackageStatus @2023.04.05 PackageDefine the overall package with fixed dependencies for the imports, ie 1:1 to make sure things work {
"name": "swiss-army-knife",
"version": "2.4.2",
"description": "Swiss Army Knife for Lovelace",
"main": "srcjs/swiss-army-knife-card.js",
"type": "module",
"scripts": {
"build": "npm run lint && npm run rollup",
"rollup": "rollup -c",
"lint": "eslint srcjs/*.js",
"watch": "rollup -c --watch",
"postversion": "npm run build",
"audit-fix": "npx yarn-audit-fix"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.1.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-terser": "0.4.1",
"eslint": "8.39.0",
"eslint-config-airbnb-base": "^15.0.0",
"rollup": "^3.21.4",
"rollup-plugin-serve": "^2.0.2"
},
"dependencies": {
"@formatjs/intl-utils": "^3.8.4",
"custom-card-helpers": "^1.8.0",
"home-assistannpt-js-websocket": "^5.7.0",
"lit-element": "^2.5.1",
"lit-html": "^1.4.1"
}
} InstallationInstall all these packages from within a terminal window in vscode with: npm install |
Progress LintingStatus @2023.04.05 eslintThis is a big one. As I never used lint with very strict rules, every misplaced space or brace is an error. So I got a lot of them, and disabled (for now) most errors: extends: airbnb-base
parserOptions:
ecmaVersion: 2020
sourceType: module
rules:
no-else-return: 0
no-underscore-dangle: 0
nonblock-statement-body-position: 0
curly: 0
no-return-assign: 0
consistent-return: 0
no-mixed-operators: 0
class-methods-use-this: 0
no-nested-ternary: 0
camelcase: 0
# Added for convenience to check eslint...
max-len: 0
no-console: 0
no-plusplus: 0
eqeqeq: 0
no-irregular-whitespace: 0
no-restricted-globals: 0
no-undef: 0
no-unused-vars: 0
no-use-before-define: 0
no-multi-assign: 0
no-case-declarations: 0
no-inner-declarations: 0
array-callback-return: 0
block-scoped-var: 0
max-classes-per-file: 0
no-new-func: 0
no-bitwise: 0
no-prototype-builtins: 0
no-var: 0
vars-on-top: 0
no-constant-condition: 0
no-empty: 0
default-case: 0
default-case-last: 0
prefer-const: 0
no-redeclare: 0
no-setter-return: 0
brace-style: 0
no-lonely-if: 0
operator-assignment: 0
no-shadow: 0
func-names: 0
no-sequences: 0
prefer-destructuring: 0
no-restricted-syntax: 0
no-unused-expressions: 0
no-loop-func: 0
no-useless-escape: 0
import/no-unresolved: 0
no-template-curly-in-string: 0
import/extensions: 0
globals:
window: true
Event: true
customElements: true |
Progress RollupStatus @2023.04.05 RollupRolling up to a .js file with all the imports in it, so no need for loading external packages anymore. Me happy!! No more cors problems and loading problems/time-outs. For now, the directories Use Use The custom-card is available from Home Assistant using the following resource definition in - url: http://bfs:5050/swiss-army-knife-card-bundle.js
type: module Rollup definition file
|
The Problem To Be Solved
Development is currently done in the most simple way: a single source file that is part of my Home Assistant configuration and edited directly.
If the source file is split up into multiple files, a build environment is required to create the distribution.
It also makes it important to have a remote docker development environment, so the card can be active at all times and used in my HA environment.
(Optional): Suggested Solution
As mentioned on Discord by one of the developers: visual studio code remote containers now enable a fully remote environment: source files are also stored in the docker container, and vs code can still access these files:
This was previously also possible, but with a lot of work. I could never get it to work, or had constant issues. Now it should work out of the box!
That will hopefully help me with more code quality issues, like issue #76. I would be nice to solve that problem...
The text was updated successfully, but these errors were encountered: