abaplint / transpiler

ABAP to JS transpiler & runtime
https://transpiler.abaplint.org
MIT License
82 stars 23 forks source link

Add dependencies (libs) from filesystem using env variables #1442

Open iliyan-velichkov opened 5 months ago

iliyan-velichkov commented 5 months ago

Currently, when I want to add local (on the filesystem) dependencies (libs) for the transpilation and lint I add something like

abaplint.json:

{
    "global": {
        "files": "/{src/abap,test/src}/**/*.*",
        "skipGeneratedFunctionGroups": true,
        "skipGeneratedGatewayClasses": true,
        "skipGeneratedPersistentClasses": true
    },
    "dependencies": [
        {
            "files": "/**/*.*",
            "folder": "/../../../../root/registry/public/kronos/src/abap"
        }
    ],
...

abap_transpile.json:

{
  "input_folder": "{src/abap,test/src}",
  "input_filter": [],
  "output_folder": "dist/abap",
  "libs": [
    {
      "url": "https://github.com/open-abap/open-abap-core"
    },
    {
      "files": "/**/*.*",
      "folder": "/../../../../root/registry/public/kronos/src/abap"
    }
  ],
  "write_unit_tests": true,
  "write_source_map": true,
  "options": {
    "ignoreSyntaxCheck": false,
    "addFilenames": true,
    "addCommonJS": true,
    "unknownTypes": "runtimeError",
    "skip": []
  }
}

In our scenario this relative path may not be always valid. That's why I want to be able to use environment variable in the folders value to specify the path of the sources. For example something like the following

    {
      "files": "/**/*.*",
      "folder": "$KRONOS_ABAP_API_FOLDER"
    }

or

    {
      "files": "/**/*.*",
      "folder": "$KRONOS_API_FOLDER/abap"
    }
larshp commented 5 months ago

hmm, yea, well, hmm, why not