Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds ability to ignore git dependencies #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const merge = require("lodash/merge")
const debounce = require("lodash/debounce")
const { spawn } = require("yarn-or-npm")
const tar = require("tar")
const yargs = require('yargs');

async function installRelativeDeps() {
const projectPkgJson = readPkgUp.sync()
Expand Down Expand Up @@ -108,13 +109,17 @@ async function libraryHasChanged(name, libDir, targetDir, hashStore) {

async function findFiles(libDir, targetDir) {
const ignore = ["**/*", "!node_modules", "!.git"]
const { argv: { ignoreGit } } = yargs
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you register the option in cli.js instead of inline in this function? Otherwise the option would be shown in the help etc.

.alias('i', 'ignoreGit')
.describe('ignoreGit', 'ignoring git dependencies');

// TODO: use resolved paths here
if (targetDir.indexOf(libDir) === 0) {
// The target dir is in the lib directory, make sure that path is excluded
ignore.push("!" + targetDir.substr(libDir.length + 1).split(path.sep)[0])
}
const files = await globby(ignore, {
gitignore: true,
gitignore: !ignoreGit,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read this correctly, I'm confused by the name now, ignoreGit is now off by default, which turns the option to globby on. But if you pass the ignoreGit flag, the gitignore flag will not be applied. Could you either find a better name, or remove the negation and default to true?

cwd: libDir,
nodir: true
})
Expand Down