-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Add support for metalsmith builder hooks #428
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
Conversation
I think this would be even better with tests. |
I'll write one test that writes target files to another destination, as I think it would be a common use case. |
Test written. I have also removed |
@@ -254,7 +265,7 @@ describe('vue-cli', () => { | |||
expect(getTemplatePath('../template')).to.equal(path.join(__dirname, '/../../../template')) | |||
}) | |||
|
|||
it.only('points out the file in the error', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Still it would be even better if test code exercises more paths like for before and after.
delete files['readme.md'] | ||
files['custom/readme.md'] = readme | ||
|
||
console.log(files) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oups yes :)
|
||
var readme = files['readme.md'] | ||
delete files['readme.md'] | ||
files['custom/readme.md'] = readme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure. What you're doing here in custom metalsmith plugin is you're moving file from root template directory into custom
directory, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's it.
@@ -0,0 +1,17 @@ | |||
module.exports = { | |||
"metalsmith": function (metalsmith, opts, helpers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides this one you can also test before
and after
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just push a new commit with an additional test, and better assertions
0a8c6a7
to
0125ac7
Compare
@Toilal looks good, thank you! |
Close #427