Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/LinusU/gitignore-to-dockerignore
Generate an equivalent `.dockerignore` file from an existing `.gitignore` file
https://github.com/LinusU/gitignore-to-dockerignore
Last synced: 12 days ago
JSON representation
Generate an equivalent `.dockerignore` file from an existing `.gitignore` file
- Host: GitHub
- URL: https://github.com/LinusU/gitignore-to-dockerignore
- Owner: LinusU
- Created: 2018-08-07T15:00:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T16:59:31.000Z (11 months ago)
- Last Synced: 2024-10-19T23:27:41.872Z (18 days ago)
- Language: JavaScript
- Size: 32.2 KB
- Stars: 35
- Watchers: 6
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Gitignore → Dockerignore
Generate an equivalent `.dockerignore` file from existing `.gitignore` files.
New in 3.0, handles multiple `.gitignore` files in a directory and its subdirectories, just like Git does.
## Installation
```sh
npm install --save gitignore-to-dockerignore
```## Usage
### API
#### Directory input
```js
import generateDockerignore from 'gitignore-to-dockerignore'console.log(await generateDockerignore(process.cwd()))
// .git/
// node_modules/
// **/*.log
//
// # From tests/.gitignore
// tests/**/*.log
```#### String input
```js
import { convertToDockerignore } from 'gitignore-to-dockerignore'const input = `
/node_modules/
*.log
`console.log(convertToDockerignore(input))
// .git/
// node_modules/
// **/*.log
```### CLI
```sh
# Write a single .dockerignore file from .gitignore files in the current directory and subdirectories
gitignore-to-dockerignore
```