This question may be too open-ended for Stack Overflow, but I'm getting nowhere on my own. I am looking for a way to use automate the use of designated Git submodules based on values in a text file. My company generates a lot of projects, but we reuse a lot of code. We use submodules and tags for this, but the volume is starting to get unwieldy.
I was thinking it would make sense to use something similar to an NPM packages.json file. Maybe like this:
{
"name": "Custom Development Components",
"description": "Reusable objects to increase the efficiency and quality of custom development",
"components": [
{
"name": "stats",
"description": "Statistics",
"URL": "https://my.git.repo/Statistics",
"folder-name": "STATS",
"version": "^"
},
{
"name": "standard",
"description": "Standard",
"URL": "https://my.git.repo/Standard",
"folder-name": "STANDARD",
"version": "X"
},
{
"name": "helpers",
"description": "Helper Objects and Scripts",
"URL": "https://my.git.repo/Helpers",
"folder-name": "HELPERS",
"version": "^"
}
]
}
But I haven't been able to figure out how to parse the JSON and turn it into Git commands. I've fiddled around with using JQ in a Windows batch file (we're all working in Windows environments), but I haven't gotten very far with it. Basically, I'm looking to be able to step through the JSON, find components where the version is a string other than ^ (which may or may not be a specific tag), and import the URL for the submodule.
Any guidance here would be appreciated.