A tool to verify your .dockerignore file configuration.
- Visual interface
- Syntax guide for writing a well-formed
.dockerignorefile - Input your
.dockerignoreconfiguration to validate its syntax- Highlight any syntax errors (+ duplicate lines)
- Input a project/directory structure to match using the
.dockerignore- Display all files which will match against the config file, and those that won't
- Input a GitHub URL (public for now, maybe auth in future for private repos?)
- Automagically run the
.dockerignoreagainst the repo's structure
- Automagically run the
- Syntax guide for writing a well-formed
- API
- Allow programmatic
POSTs to a/api/validateendpoint- Response includes information about the validity of the
.dockerignore
- Response includes information about the validity of the
- Allow programmatic
As far as prerequisites go, you will need to have the Vercel CLI installed.
To run this project locally, clone it onto your local machine.
git clone git@github.com:DiggidyDev/dockerignore-validator.gitYou can start a local development server with:
vercel devTo open Cypress for local testing:
npm run testTo run all e2e tests headlessly:
npm run test:e2eTo run all component tests headlessly:
npm run test:cmpUnit testing has been implemented using mocha. As is the convention with component tests, all unit tests should be stored in the same directory as their tested file - not in a separate tests or __tests__ directory.
To run all unit tests, you can use the following command:
npm run test:unitAnd with coverage:
npm run test:unit:covIf you wish to add a new e2e test, it should live under:
cypress/
└── e2e/
└── TestName.cy.ts
If you wish to add a new component test, it should live under:
src/
└── app/
└── components/
└── ComponentName/
├── ComponentName.cy.tsx
└── ComponentName.tsx
Unit tests are discovered under a src/**/*.spec.ts glob pattern. They should be stored in the same directory as the file that they're testing, with the same filename as the prefix. For example:
src/
└── app/
└── utils/
├── foo.ts
└── foo.spec.ts
When interacting with the API, no validation is required as of now.
It's important to note that each Response example is what would be returned from the endpoint as though the Request body was provided.
- Description: Retrieves a GitHub repository's files recursively.
- Method:
GET - Parameters:
url- The URL of the GitHub repository whose files should be fetched. The following URL formats are allowed, wherehttps://is optional and interchangeable withhttp://, andwww.is optional:github.com/DiggidyDev/dockerignore-validator/tree/maingithub.com/DiggidyDev/dockerignore-validator/releases/tag/v0.0.1github.com/DiggidyDev/dockerignore-validator/commit/0116624989d8582e8e20e5a6c285eac598a60fae- For more information on the valid regex types, see
/src/app/utils/validation.spec.ts
- For more information on the valid regex types, see
includeDockerignore- A boolean denoting whether a root-level.dockerignorefile should be fetched, if found
- Request body: N/A
- Response description: An object containing all files, and directories, of the given repository (limited by GitHub's REST API). If no dockerignore was found, the
dockerignorekey will still be returned, just as an empty list. - Response example:
Response MIME type:
{ "dockerignore": [".gitignore", ".git", "build", "node_modules"], "files": [ ".env.test", ".github", // directories are included as part of the files ".github/workflows", ".github/workflows/example.yaml", ".gitignore", "..." ] }application/json
- Description: Validates filepaths against a .dockerignore configuration.
- Method:
POST - Parameters: N/A
- Request body:
{ "dockerignore": ["node_modules", "**/*.jpg"], "files": [ ".gitignore", "hello.jpg", "node_modules/@babel", "src/index.ts" ] } - Response description: An array of booleans, corresponding to each filepath, denoting whether the filepath will be ignored or not
- Response example:
[false, true, true, false]
- Response MIME type:
application/json
- The tree diagram generation tool by @nfriend - all ASCII trees generated in this README have been generated using the tool