purposefile
Make sure every file in your repo is exactly where it should be.
Install
npm install --save-dev purposefile
Usage
First create a .purposefile
in the root of your project like this:
.purposefile Configures purposefile
.gitignore Configures git to ignore certain files
.prettierrc Configures Prettier
package.json Configures npm and related tools
package-lock.json Lock file for npm dependencies
tsconfig.json Configures TypeScript
README.md Documentation for repo
LICENSE License for package
node_modules/** Dependencies installed by npm
src/**/*.ts Source files
!src/**/*.test.ts Don't place test files within src/
test/**/*.test.ts Test files
dist/**/*.{js,d.ts}{,.map} Built source files
Then run:
npx purposefile
If all the files in the repo are known, you'll get:
Or if there's any unknown files:
If you want to check the purpose of a file you can run:
purposefile path/to/file
If you want to check the purpose of many files at once you can also specify globs:
purposefile '**' --ignore '**/node_modules/**'
Note: You can specify multiple
--ignore
patterns to exclude files from being listed.
If you want to check purposefile
before every commit, you can do so with Husky:
{
"husky": {
"hooks": {
"pre-commit": "purposefile" // Or "purposefile && lint-staged" if you use `lint-staged`
}
}
}