Hello,
I would like to try and introduce new features to Alarmo. In particular, I would like to add smart lock integration so users will be able to manage all user codes in Alarmo for both Alarm and Smart Locks.
Also, I would like to add the option to disarm using the Smart Lock keypad.
First thing, I am trying to setup a development environment. I do have experience in software development, but I never developed HA addon.
I managed to get the python part of the code to work, but I am not able to trigger build for the frontend piece. (the command that generates alarmo/frontend/dist/alarm-panel.js)
I wonder if you will be able to help me figure how to resolve it. Here is what I get:
➜ frontend git:(master) ✗ npm run-script build
> [email protected] build /config/custom_components/alarmo_2/frontend
> npm run lint && npm run rollup && npm run babel
> [email protected] lint /config/custom_components/alarmo_2/frontend
> eslint src/**/*.ts --fix
/config/custom_components/alarmo_2/frontend/src/common/modes.ts
4:36 error Parsing error: Unexpected token :
/config/custom_components/alarmo_2/frontend/src/common/navigation.ts
1:8 error Parsing error: Unexpected token interface
/config/custom_components/alarmo_2/frontend/src/components/alarmo-chip-set.ts
6:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/components/alarmo-chip.ts
4:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/components/alarmo-collapsible.ts
4:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/components/alarmo-select.ts
19:8 error Parsing error: Unexpected token type
/config/custom_components/alarmo_2/frontend/src/components/alarmo-selector.ts
6:8 error Parsing error: Unexpected token type
/config/custom_components/alarmo_2/frontend/src/components/alarmo-table.ts
12:8 error Parsing error: Unexpected token interface
/config/custom_components/alarmo_2/frontend/src/components/collapsible-section.ts
5:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/components/settings-row.ts
4:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/components/time-slider.ts
6:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/data/actions.ts
8:42 error Parsing error: Unexpected token :
/config/custom_components/alarmo_2/frontend/src/data/sensors.ts
8:37 error Parsing error: Unexpected token :
/config/custom_components/alarmo_2/frontend/src/data/websockets.ts
14:33 error Parsing error: Unexpected token :
/config/custom_components/alarmo_2/frontend/src/dialogs/confirm-delete-dialog.ts
7:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/dialogs/create-area-dialog.ts
15:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/dialogs/create-sensor-group-dialog.ts
16:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/dialogs/edit-master-dialog.ts
8:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/dialogs/error-dialog.ts
6:1 error Parsing error: Unexpected character '@'
/config/custom_components/alarmo_2/frontend/src/dialogs/manage-sensor-groups-dialog.ts
14:1 error Parsing error: Unexpected character '@'
✖ 20 problems (20 errors, 0 warnings)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lint: `eslint src/**/*.ts --fix`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-04-28T18_57_21_274Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `npm run lint && npm run rollup && npm run babel`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-04-28T18_57_21_298Z-debug.log
➜ frontend git:(master) ✗
In addition, I tried to skip the linter:
➜ frontend git:(master) ✗ npm run rollup && npm run babel
> [email protected] rollup /config/custom_components/alarmo_2/frontend
> rollup -c
(node:182667) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
[!] RollupError: Node tried to load your configuration file as CommonJS even though it is likely an ES module. To resolve this, change the extension of your configuration to ".mjs", set "type": "module" in your package.json file or pass the "--bundleConfigAsCjs" flag.
Original error: Cannot use import statement outside a module
https://rollupjs.org/command-line-interface/#bundleconfigascjs
/config/custom_components/alarmo_2/frontend/rollup.config.js:1
import nodeResolve from 'rollup-plugin-node-resolve';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1029:16)
at Module._compile (internal/modules/cjs/loader.js:1078:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:979:32)
at Function.Module._load (internal/modules/cjs/loader.js:819:12)
at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:203:29)
at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async getConfigFileExport (/usr/lib/node_modules/rollup/dist/shared/loadConfigFile.js:432:17)
at async Object.loadConfigFile (/usr/lib/node_modules/rollup/dist/shared/loadConfigFile.js:391:59)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] rollup: `rollup -c`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] rollup script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-04-28T18_59_31_328Z-debug.log
➜ frontend git:(master) ✗
Thank you!