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

Building my project with metalsmith obliterates src, .git directories #41

Closed
srcreigh opened this issue Apr 8, 2014 · 5 comments
Closed

Comments

@srcreigh
Copy link
Contributor

srcreigh commented Apr 8, 2014

Repro steps

git clone https://github.com/srcreigh/srcreigh.github.io.git
cd srcreigh.github.io/
git checkout 368d07158b684 # broken on this commit
cd _src/
./setup.sh
npm install metalsmith@0.6.0 --save
nodejs build.js

I'm working on getting to the bottom of this. It's a pretty serious issue

@srcreigh
Copy link
Contributor Author

srcreigh commented Apr 8, 2014

Update: It deletes .git/ and the source directory without using any middleware

@srcreigh
Copy link
Contributor Author

srcreigh commented Apr 9, 2014

I think this functionality should instead be implemented as a plugin (might already be implemented as a plugin, metalsmith-cleanscript does something related).

Alternatively, at the very least, it should be configurable.. Although that might mean an extension of the javascript API if I'm not mistaken, which wouldn't be very good.

@ericgj
Copy link

ericgj commented Apr 9, 2014

As a workaround you could build to the standard "build" dir and move the files afterwards, either in the build callback or just like nodejs build.js && mv build/* ..

or even something like this if you wanted your gh-pages branch to be "pristine": (haven't tested)

git checkout --orphan gh-pages 
git rm -fr .
git checkout master -- ./_src
nodejs ./_src/build.js && mv ./_src/build/* . && rm -fr ./_src

@srcreigh
Copy link
Contributor Author

@ericgj sorry for missing your suggestion here!

@ianstormtaylor
Copy link
Contributor

Definitely down for this to be configurable. Discussion here: #51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants