Node script that automatically populates your conventional commit scopes in your repositories .vscode/settings.json
file, used by the VSCode CComits extension to help developers in your team create meaningfull commit messages. The script uses the paths of folders, and sub-folders by default to create these scopes.
- Requires Node v.16 or higher
- Copy the
index.js
file from this repo, and paste it at the root level of your repository. - Execute the script with
node index.js
Conventional Commits specification is a convention for writing commit messages. It provides a set of rules for creating an explicit commit history, and if used properly, can be used to auto generate changelogs.
The script simply traverses your working directory, stores the names of all folders and sub-folders in a list before iterating over that list and creating an entry for each element in your .vscode/settings.json
- .vscode
- front-end
- components
- public
- back-end
- random
Given the folder structure above, after placing the script at root level and executing it with node index.js
your workspace setting will automatically populate with a list of scope strings.
The script will write all folder and sub-folder names to the scopes
key in your local conventional commit workspace settings after execution.
{
// .vscode/settings.json
"conventionalCommits.scopes": [
"backend",
"front-end",
"front-end/components",
"front-end/public",
"random",
]
}
CComits VSCode Extension will then be able to auto suggest the scopes generated whenever you use the extension to commit.
Scopes should indicate the module, package, or area of the code that was affected by the changes made in the commit. Rather than using specific file paths, directories feels better to use and are easy to automatically generate.
Option for specifying every file as well as ignoring paths in .gitignore is planned for this script. Feel free to make a PR if you miss any functionality.