Similar issue in gs-plugins repo.
The problem
Developer often need to reuse existing code and configs. This way companies developer and reuse their infra. This infra could be docker files, helm charts, plugins (datasource, eventsource), sample code, project scaffoldings, READMEs, whole projects itself or anything under the sun.
Currently there is now way for a developer to import files from another folder (a remote git repository, or a local folder). This is useful when importing sample code and configs from a Godspeed plugin, project template or a starter scaffolding.
. The developer should be able to pick up and choose what it wants to use in the project.
For ex. a kafka plugin could have sample docker-compose, .env , config, src, docs, README.md, tsconfig.json, a docs/swagger.json etc. Developer may choose to import selected files and configs.
Developer may choose to do this during plugin installation process or anytime after it is installed.
The (proposed) solution
How to solve
defaults:
mergePolicy: 'append' # <MergePolicy can be append or overwrite. Default value of this default mergePolicy is append. This applies at a file level.
imports: # Each array item is either a string or a kay value pair
# {[key:String]: <MergePolicy | undefined>} Each entry (as you would express in Typescript)
- .env: append # can leave value as append, overwrrite or undefined.
# If you leave undefined default merge policy
# will get executed
- config: overwrite # path can be a folder or a file
- src/datasources/types/kafka.ts # use default defaults.mergePolicy
- src/eventsources/types/kafka.ts # use default defaults.mergePolicy
- src/events/kafka/helloworld.ts # use default defaults.mergePolicy
- src/functions/kafka/ts/helloworld.ts # use default defaults.mergePolicy
- src/functions/kafka/yaml/helloworld.yaml # use default defaults.mergePolicy
Similar issue in gs-plugins repo.
The problem
Developer often need to reuse existing code and configs. This way companies developer and reuse their infra. This infra could be docker files, helm charts, plugins (datasource, eventsource), sample code, project scaffoldings, READMEs, whole projects itself or anything under the sun.
Currently there is now way for a developer to import files from another folder (a remote git repository, or a local folder). This is useful when importing sample code and configs from a Godspeed plugin, project template or a starter scaffolding.
. The developer should be able to pick up and choose what it wants to use in the project.
For ex. a kafka plugin could have sample docker-compose, .env , config, src, docs, README.md, tsconfig.json, a docs/swagger.json etc. Developer may choose to import selected files and configs.
The (proposed) solution
src/{events,functions,mappings}, config/{default,custom-environment-variables}extract,How to solve
exportConfigwill be a yaml/json file path or a JSON itself). Define a json format in which the importing logic from the source folder is defined (for ex. which files, folder to import. whether to import in append mode or overwrite mode. Can set merge policy per file or for the whole folder. Default merge mode is append mode (in case the file exists in destination folder).exports file. This can be done before, during or after the plugin install process (Go back to the 1st point of this list).