New template parser with JS - mrtrizer/FlappyTools GitHub Wiki

I think about moving to Node.JS from Python. Profs:

  • Same language as used in FlappyEngine for scripting
  • Brackets are useful for template writing and parsing without spikes.
  • Native JSON support. JSON is represented as object instead dictionaries in Python.

Draws:

  • Node.js is less native for users (I think). Python is installed by default in many distributives. We used to Python as default script language.

Example of possible project template:

{!config.name!}.pro

QT += core

TARGET = {!name!}
CONFIG += console
CONFIG -= app_bundle
CONFIG += c++14

TEMPLATE = app

{?
var srcList = config.src_list.map(function(item) {
    return path.join({OUT_PATH, item});
});
?}

{? 
searchFiles(config.qt.src_list, ".*\.h").forEach(function(item) { 
    print("HEADERS += " + item + "\");
});
?}

{? 
searchFiles(config.qt.src_list, ".*\.cpp").forEach(function(item) { 
    print(item);
});
?}

config.json

{
    "name": "Experiment",
    "src_list":["src"],
    "modules":["modules/core"]
    "qt": {
        "modules":["modules/qt"]
        "include"
    }
}

templates.list

engine/templates
templates