-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
src/commands/theme.js
Outdated
@@ -81,6 +81,12 @@ export default function(program) { | |||
|
|||
return null; | |||
}) | |||
.then(() => { | |||
renameFile(join(root, 'config-sample.yml'), join(root, 'config.yml')); | |||
renameFile(join(root, '.gitignore-sample', join(root, '.gitignore'); |
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.
Missing closing ")".
src/utils.js
Outdated
* @param {string} target - The renamed path of the file. | ||
*/ | ||
export function renameFile(current, target) { | ||
rename(current, target, (err) => { |
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.
Should we be wrapping this in return new Promise((resolve, reject) => {});
?
src/utils.js
Outdated
export function renameFile(current, target) { | ||
rename(current, target, (err) => { | ||
if (err) { | ||
throw err; |
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.
If so, reject(err)
here. And resolve()
outside of the condition.
src/commands/theme.js
Outdated
@@ -89,7 +89,6 @@ export default function(program) { | |||
]; | |||
|
|||
function renamePromiseFactory({oldFile, newFile, dir}) { | |||
console.log(` Renaming ${oldFile} to ${newFile}...`); |
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.
Good call removing this.
{oldFile: '.gitignore-sample', newFile: '.gitignore', dir: root}, | ||
]; | ||
|
||
function renamePromiseFactory({oldFile, newFile, dir}) { |
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.
Thanks for this ES6 lesson 🥇
What are you trying to accomplish with this PR?
Companion piece to this PR in
slate
: Shopify/slate#179The idea: After running
slate theme
, you are given an unzippedslate-src.zip
plus two filesconfig-sample
and.gitignore-sample
. Let's save the manual effort of renaming both these files when you start off.Checklist
For contributors:
For maintainers:
package.json
version in a separate PR, if applicable.Considerations: