Skip to content

Commit

Permalink
Add filter for files passed as parameter to not be ignored (#313)
Browse files Browse the repository at this point in the history
* add filter for files

* consider ignore files without eol at the end
  • Loading branch information
0xGabi authored Jan 4, 2019
1 parent 458a6f4 commit e8c90f6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/commands/apm_cmds/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,21 @@ async function prepareFilesForPublishing(
const filter = ignore().add(ignorePatterns)
const projectRoot = findProjectRoot()

function createFilter(files, ignorePath) {
let f = fs.readFileSync(ignorePath).toString()
files.forEach(file => {
f = f.concat(`\n!${file}`)
})
return f
}

const ipfsignorePath = path.resolve(projectRoot, '.ipfsignore')
if (pathExistsSync(ipfsignorePath)) {
filter.add(fs.readFileSync(ipfsignorePath).toString())
filter.add(createFilter(files, ipfsignorePath))
} else {
const gitignorePath = path.resolve(projectRoot, '.gitignore')

if (pathExistsSync(gitignorePath)) {
filter.add(fs.readFileSync(gitignorePath).toString())
filter.add(createFilter(files, gitignorePath))
}
}

Expand Down

0 comments on commit e8c90f6

Please sign in to comment.