harp
harp copied to clipboard
Compile doesn’t ignore www/
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'
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?
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 :elephant:, 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.
:elephant:
- Github resolves absolute paths like "/media/rickroll.gif" relative to the repo root
- prose.io does the same.
If .git files are being copied its a bug.
Here is the line that is happening. https://github.com/sintaxi/harp/blob/7a09952fb461b75188450629113333f794d70b26/lib/helpers.js#L315
There is really no reason to compile that regex for every file.
Added failing tests for omitting .git and www in #427. Thanks for providing awesome support all around guys.
Thanks @edrex! Very helpful.
I can take a crack at fixing. Is processing www/confirmed as incorrect behavior?
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.
@silentrob I think that check is about preserving a .git dir in the output path. Probably to support github pages deployment?
Is there any need for "dot files" to ever end up in the compiled output? I guess .htaccess could be one.
also .well-known. people might get annoyed if harp switched to a whitelisting approach and they needed one that wasn't on the list.
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:
helpers.primeskips deleting it.terraform.helpers.shouldIgnoredoesn'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.