list-feature-flags
v1.1.6
Published
`list-feature-flags` is a command-line utility that searches through JavaScript and TypeScript files in a directory for feature flags and experiment keys, and outputs a sorted, unique list of them.
Downloads
11
Readme
list-feature-flags
list-feature-flags is a command-line utility that searches through JavaScript and TypeScript files in a directory for feature flags and experiment keys, and outputs a sorted, unique list of them.
Installation
You can use this utility via npx without installing it:
npx list-feature-flagsOr, install it globally using npm:
npm install -g list-feature-flagsUsage
To use the utility, navigate to the directory containing your JavaScript or TypeScript files and run:
npx list-feature-flags --mode=featureFlagsOr, if you installed it globally:
list-feature-flags --mode=experimentsThe utility allows two modes:
featureFlags: This mode will search for any words matching the regular expressions\bf_\w*\band\bF\w*Feature\b, then applies a series of transformations to convert CamelCase to snake_case, lowercasing the string, removing the trailing_featurepart and finally ensuring the flag starts with_f.experiments: This mode will search for any words matching the regular expressions\be_\w*\band\bE\w*Experiment\b, then applies a similar series of transformations as infeatureFlagsmode, but removes the trailing_experimentpart and ensures the flag starts with_e.
In both modes, files in test, __mocks__, and node_modules directories are excluded from the search. The output lists are sorted and duplicates are removed.
If the --mode flag is not provided, the utility defaults to featureFlags.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Releasing (Semantic Versioning)
The project uses an automated GitHub Actions workflow to bump the npm package version and publish on pushes to the main branch when the latest commit message follows certain Conventional Commit prefixes.
Triggers
The release logic inspects ONLY the latest commit on main:
Commit prefix / pattern -> Bump type:
feat!:orfeat(scope)!:-> majorfix!:orfix(scope)!:-> majorfeat:/feat(scope):-> minorfix:/fix(scope):-> patch- Any commit body line starting with
BREAKING CHANGE:-> major (even without!)
If the last commit subject does not start with feat, fix, or their breaking variants, and there's no BREAKING CHANGE: line, the workflow skips versioning & publish.
Examples
feat: add color legend => minor bump (x.Y.z)
feat(parser)!: rewrite to support locales => major bump (X.y.z)
fix: correct null handling => patch bump (x.y.Z)
fix(api)!: remove deprecated endpoint => major
chore: update docs => no release
Commit body including:
BREAKING CHANGE: output format changed => majorLicense
ISC
