App build configuration

Hey,

I would like to write some custom parameters to .unoproj and read them in my application, when it’s launched. Reading would happen preferable with JS. This would allow me to create several .unoproj files with different configuration and therefor create several different apps from my code base.

Is this already possible? And if not, could it be added?

Other way to do this would allow adding a filename to Includes. This would take the file from configs folder and store it as Config.js and it could be accessed in JS with just require(“Config.js”)

“Includes”: [
{file:“configs/ConfigBobby.js:Bundle”, name:“Config.js”}
]

… or something, you know what’s best. Anyway this is a feature I would really like to have.

Hey Simo,

This sounds like something you can achieve using a preprocess step before building your Uno project.
I know some people are automatically converting javascript ES6 to plain old ES5 using 3rdparty tools for instance.

So you can use your Uno project as usual:

"Includes": [
  "Config.js:Bundle"
]

And for instance use a build/configure script to create Config.js before triggering a build:

if [ "$IS_BOBBY" ]; then
  cp config/ConfigBobby.js Config.js
else
  cp config/ConfigDefault.js Config.js
fi

fuse build ...

.gitignore:

/Config.js

In the future we might implement script hooks (pre/post-build steps) in Uno projects to support things like this better.

A more portable alternative might be to defer the logic to your JavaScript instead of using a build script:

if (is_bobby)
    require("config/ConfigBobby.js");
else
    require("config/ConfigDefault.js");

Thanks dude, the config copy before build sounds just fine to me.