Open jbubik opened 1 year ago
Hooray 3 is public now!
Yeah, I was holding off from updating this until 3.0.0 was out. I'm not sure when I'll be working on it - quite busy for the next month or two - but it's definitely planned :)
WIP :)
@jbubik Here's a test build from commit 41a1a76 - Let me know if it works for you :)
@featherbear sorry for delay, had some issues upgrading RPi to Ubuntu 22.04 LTS. Now I tested with Companion 3.0.1 (IMG distribution) in /opt/companion and your test build in /opt/companion-module-dev. Unfortunately it fails:
2023-10-02T22:40:50.140Z,"Log/Controller","info","Application starting"
2023-10-02T22:40:50.151Z,"Log/Controller","info","Build 3.0.1+6068-stable-a05a9c89"
...
2023-10-02T22:40:52.775Z,"Instance/Modules","info","Looking for extra modules in: /opt/companion-module-dev"
2023-10-02T22:40:52.781Z,"Instance/Modules","info","Found 1 extra modules"
...
2023-10-02T22:40:52.898Z,"Instance/Modules","info","presonus-studiolive@0.0.0: PreSonus: StudioLive III (Overridden)"
...
2023-10-02T22:41:05.859Z,"Instance/Controller","info","Adding connection presonus-studiolive StudioLive III"
2023-10-02T22:41:05.869Z,"Instance/ModuleHost","info","Starting connection: "presonus-studiolive"(n97jXTB76oYOYjr3X7OOY)"
2023-10-02T22:41:05.932Z,"Instance/ModuleHost","debug","Connection "presonus-studiolive" started"
2023-10-02T22:41:06.151Z,"Instance/presonus-studiolive","verbose","stderr: node:internal/modules/cjs/loader:1078
throw err;
^
Error: Cannot find module 'tslib'
Require stack:
- /opt/companion-module-dev/module-presonus-studiolive/node_modules/@companion-module/base/dist/index.js
- /opt/companion-module-dev/module-presonus-studiolive/dist/index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Module._load (node:internal/modules/cjs/loader:920:27)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/opt/companion-module-dev/module-presonus-studiolive/node_modules/@companion-module/base/dist/index.js:4:17)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/opt/companion-module-dev/module-presonus-studiolive/node_modules/@companion-module/base/dist/index.js',
'/opt/companion-module-dev/module-presonus-studiolive/dist/index.js'
]
}
Node.js v18.16.0
"
The last message was repeated many times in logfile. The web UI was stuck on "Starting connection" and no configuration options for the module ever came up. I tested both with clean 3.0 settings and with my upgraded 2.4.0 settings.
I have also tried git clone
of your repository per MANUAL_INSTALL.md instructions, but the module was not built properly. File dist/index.js was missing.
Any suggestions? I may be doing something wrong.
@jbubik, ah... not sure why it stopped working.. I definitely tried it on a fresh device.. I've changed some settings, can you try this version
I've not tested it as I'm out on the road, but it seems to at least load past that tslib load error
@featherbear: tslib error fixed indeed. With this second artifact it fails on this line of src/index.ts:
this.client.on(MessageCode.ParamValue, () => {
this.checkFeedbacks('ChannelMute')
})
TS code above is compiled into this JS:
this.client.on(import_presonus_studiolive_api.MessageCode.ParamValue, () => {
this.checkFeedbacks("ChannelMute");
});
Throws this error:
ERROR
Cannot read properties of undefined (reading 'ParamValue')
I am afraid the artifact contains only dist/index.js and no other JS files from all the libraries in node_modules! I have copied all JS files to the module directory this way:
tar -c `find node_modules -name \*.js`|tar -C module-presonus-studiolive -x
That didn't fix the issue, and later proved unnecessary.
This change finally helped:
this.client.on("PV", () => {
this.checkFeedbacks('ChannelMute')
})
this.client.on("PC", () => {
this.checkFeedbacks('ChannelColour')
})
this.client.on("JM", (json) => {
if (json.id == 'RenamedPreset' || json.id == 'StoredPreset') SceneDebouncer.touch()
})
}
Using literal strings instead of referencing constants from a subclass helps. Bug in esbuild???
Now I can connect, I see model and serial number, I can mute/unmute channels. I had to recreate my configs from Companion 2.4, the action IDs have changed in 3.0 :-(
Ahh dang.. I'll have to check the bundler options when I get the time. There's probably a flag or two that I can add to magically fix everything!
When this plugin gets into the official Companion build though, we won't need to worry about the node_modules :) These errors are all just from me trying to make a standalone plugin build easier to distribute... guess it was not.
That said, since you're nerdy enough to look into the code, you could probably have just run yarn build
and called it a day haha
--
And.. yeah sorry about the action IDs.. had to change them to fit the new 3.0 syntax.. but good to hear it works!
Hi @featherbear, I can read the source code of several programming languages, but I cannot code much. And these tools like yarn
, rimraf
, tsc
I know nothing about. PR #6 contains the new commands to build this module in Companion 3.0 - for noobs like me ;-)
Considering Action IDs I exported my config into JSON and compared. Original config from Companion 2.4 (not working with current module)
"channel": "LINE,1",
New config created in Companion 3.0 (working with current module):
"channel": "LINE|1",
It is probably connected to this definition in src/util/Constants.ts
export const ValueSeparator = '|'
This ValueSeparator is used on several places. You can let it be as is. I will mass-replace the separator in a text editor and import back. This hack could be documented in the README for everyone upgrading from pre-3.0 version.
Thanks for this nice module and your work!
Hi Andrew, Companion 3.0.0 is out. This module doesn't work as-is. Do you have plans to update?
Can I help somehow? I have only created a module once and it was in JS (not TS). So almost no experience on my part. Julian made the required changes for Companion 3.0.0 for that module in May. You can see his commits in that repo: companion-module-ezcoo-matrix.
Jan
Quoting from Release Notes:
BREAKING CHANGES
CORE FEATURES AND IMPROVEMENTS