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

Compile doesn’t ignore www/ #307

Open
kennethormandy opened this issue Jul 3, 2014 · 12 comments
Open

Compile doesn’t ignore www/ #307

kennethormandy opened this issue Jul 3, 2014 · 12 comments
Assignees
Labels

Comments

@kennethormandy
Copy link
Collaborator

Root-style apps with a compile www/ directory will have the www/ compiled within it then next time, until Harp finally throws an error. Eventually, you can end up with www/www until you get:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: ENOENT, open '/Users/Kenneth/Sites/kennethormandy/eventuell/www/.git/HEAD'
@howardroark
Copy link

Is the idea that harp is not meant to be used as a "root-style" app? I notice that when I run harp compile that the .git folder ends up in www. I was hoping to be able to have a workflow of harp compile + aws s3 sync www s3://bucket, but I don't want to be serving my git config to the public.

Is the only way to avoid this to keep my harp app nested one folder deep within my project?

@edrex
Copy link
Contributor

edrex commented Mar 12, 2015

I am also irked that my .git folder is ending up in www. There are a lot of ways in which the "root style" is more natural 🐘, but root style apps at the top level of a git or mercurial repo are broken.

I appreciate the strong convention over configuration stance, but it really seems like an ignore key is needed in _harp.json for root-style apps.

🐘

  • Github resolves absolute paths like "/media/rickroll.gif" relative to the repo root
  • prose.io does the same.

@sintaxi
Copy link
Owner

sintaxi commented Mar 12, 2015

If .git files are being copied its a bug.

@silentrob
Copy link
Collaborator

Here is the line that is happening.

var gitRegExp = new RegExp(/^.git/)

There is really no reason to compile that regex for every file.

@edrex
Copy link
Contributor

edrex commented Mar 17, 2015

Added failing tests for omitting .git and www in #427. Thanks for providing awesome support all around guys.

@sintaxi
Copy link
Owner

sintaxi commented Mar 17, 2015

Thanks @edrex! Very helpful.

@edrex
Copy link
Contributor

edrex commented Mar 18, 2015

I can take a crack at fixing. Is processing www/confirmed as incorrect behavior?

@edrex
Copy link
Contributor

edrex commented Mar 18, 2015

Seems like adding the .git pattern to terraform.helpers.shouldIgnore would work.

For the output dir, harp should be smart enough to ignore a user-specified output dir if it is in the project dir.

@edrex
Copy link
Contributor

edrex commented Mar 18, 2015

@silentrob I think that check is about preserving a .git dir in the output path. Probably to support github pages deployment?

@howardroark
Copy link

Is there any need for "dot files" to ever end up in the compiled output? I guess .htaccess could be one.

@edrex
Copy link
Contributor

edrex commented Mar 18, 2015

also .well-known. people might get annoyed if harp switched to a whitelisting approach and they needed one that wasn't on the list.

@edrex
Copy link
Contributor

edrex commented Mar 18, 2015

Ok so I pushed some harp tests that more specifically target the problem behavior.

When outputPath is in projectPath and outputPath contains a .git dir, the .git dir is copied because:

  1. helpers.prime skips deleting it.
  2. terraform.helpers.shouldIgnore doesn't ignore it.

2 is a bug, fixed in sintaxi/terraform#84

Also included a test that .git in the project dir isn't copied, failing because of 2.

Possibly, harp should add a check to see if a target file is under outputPath before acting on it, but generally helpers.prime ensures that outputPath is empty except for .git dirs.

Ready for review.

@misterhtmlcss misterhtmlcss self-assigned this Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants