Jump to content
🌟 NOTIFICATION/Benachrichtigung: Welcome to our New Store! - shelly.com 🌟 ×

Is there any useful template / dev environment for Shelly script project?


Recommended Posts

https://vitejs.dev/Hello,

I think, it would be really useful to have some template project or starter JS/TS project which have common things configured:

- standard JS project with package.json with useful pre-defined scripts and README.md with basic info / documentation (not long)

- JavaScript or TypeScript support (where TS files from src folder are transpiled into dist folder) and of course dist folder will be mentioned in .gitignore file

- ESLint for static code analysis with useful rules that will be helpful for Shelly-specific environment (which will take into consideration Shelly Script Language Features and limitations (which are defined in https://shelly-api-docs.shelly.cloud/gen2/Scripts/ShellyScriptLanguageFeatures)

- checks for Shelly limitations like:

 •• max. size of output script file,

 •• exceeded Resource Limits (defined in: https://shelly-api-docs.shelly.cloud/gen2/Scripts/ShellyScriptLanguageFeatures#resource-limits):

 •• Limited levels of nested anonymous functions (https://shelly-api-docs.shelly.cloud/gen2/Scripts/ShellyScriptLanguageFeatures#limited-levels-of-nested-anonymous-functions)

\---> most of them can be implemented in ESLint (as custom ESLint plugin or using no-restricted-sytax rule)

 

- build tool to transpile modern syntax of TS/JS language into Shelly compatibile subset of JS (for example: Vite / swc / esbuild / Babel, ...)

- possibility to make debugging more easy

  • simple example which just occurred to my mind - create 2 output JS shelly scripts:
    1.) development version (with enabled debug logging)
    2.) production version (where final JS shelly script will not contain debug related code like logs, ...

- optional: unit testing support (for testing code locally, with some helpful mocks)

 

I know how to implement all of the ideas I mentioned. I have already completed a small portion (approximately 10%) of one of my projects. However, I do not have the time to improve and implement the above-mentioned ideas, or it will be very slow if you wait for me to complete them.

Edited by xnd
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Erstelle neue...