Kipper-Lang / Kipper

The Kipper programming language for Browsers and Node.js 🦊✨ Made at HTL Leonding & JKU Linz
https://kipper-lang.org
GNU General Public License v3.0
26 stars 4 forks source link

[Feature] Add config file support for `@kipper/cli` #508

Closed Luna-Klatzer closed 4 months ago

Luna-Klatzer commented 1 year ago

Is there an existing proposal for this?

This feature does not exist in the latest version

Proposal

Add support for a config file that can be read by the Kipper CLI and used to specify project-wide config options that define options such as compile target, warnings, optimisation level etc. (similar to the CLI command line flags & arguments).

The file would have a JSON format and be most likely named kip-config.json or kipper-config.json.

Exact behaviour / changes you want

Luna-Klatzer commented 1 year ago

With this issue, a new package called @kipper/config will be introduced in version 0.11.0, which will wrap the load and interpretation behaviour for a Kipper config file. This package will have a flexible structure, meaning that both the config file class and interpreter class can be modified/adjusted depending on the use class (e.g. when being used in the CLI that for example the resources files are loaded into the build folder, which would be unique behaviour to the CLI).

The processing pipeline would look like this:

  1. JSON Parsing and loading of file or raw string, which is then wrapped using KipperConfigFile. With the creation of the config file instance the ConfigInterpreter can also be specified.
  2. The specified ConfigInterpreter instance verifies that the file is in the correct format (file schema) and performs meta-actions (such as "extend"), as well as ensures the given options are valid (e.g. the target specified even exists or that given resource paths are valid).
  3. The ConfigInterpreter "compiles" the file into a fully qualified object, which now contains other than just strings also the correct data structures that are also now internally used, such as the CompileConfig interface from the @kipper/core package. in form of the compileConfig property This compiled output object is now reserved for internal usage and will be passed onto the @kipper/cli or @kipper/core, where the required actions are performed, such as copying all resources files (cli) or modifying the compiler behaviour (core).

This package also will be versioned alongside all other packages, although the file schema will be fully backwards-compatible, meaning that every option once released should be available forever (unless deprecated in favor of another option), so that a config file from example v0.11.0 can be used without changing anything even if updating to newer versions such as 0.12.0 or 0.13.0, or even maybe a jump like 1.0.0.

Luna-Klatzer commented 4 months ago

Should be finished by the first of July! Once this is done we should then move towards focusing on releasing a preview for a stable release and then finishing the first stable release.

Luna-Klatzer commented 4 months ago

Implemented by #519.

Luna-Klatzer commented 4 months ago

The last two goals will be implemented with another issue: