-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
Tested on Windows 10, node 7.5 👍 |
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.
This review is just from reading the code. Haven't tried it out yet because I don't know how to make my globally installed slate
use this branch. Could @cshold or @macdonaldr93 give me some instructions or point me to some docs?
src/commands/migrate.js
Outdated
|
||
if (!isShopifyTheme(workingDirectory)) { | ||
console.log(''); | ||
console.error(yellow(' Your theme doesn\'t have /layout/theme.liquid. We have to assume your theme isn\'t a Shopify theme')); |
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.
Small change, but I prefer the message focus on the root directory instead of a "your theme isn't a theme" message.
Suggestion: ' The directory doesn't have /layout/theme.liquid. We have to assume this isn't a Shopify theme.'
src/commands/migrate.js
Outdated
const answers = await prompt({ | ||
type: 'confirm', | ||
name: 'confirmation', | ||
message: 'Warning! This will move files in your theme. Are you sure you want to proceed?', |
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.
Moving files in the theme sounds like it's going to be random. All this is doing is moving everything into a new src
directory and creating two empty directories, correct?
Suggestion: 'Warning! This will change your theme's folder structure. Are you sure you want to proceed?'
@NathanPJF sounds good 👍 I've updated the messages accordingly. To get this up and running, all need is |
src/commands/migrate.js
Outdated
return; | ||
} | ||
|
||
if (!existsSync(configYml)) { |
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.
While testing with no config.yml
I realized this helpful message is really easy to miss as it's outputted at the top of a long list of console messages. Video: http://take.ms/fgZ3B
Let's put it as one of the last messages after a successful migration.
README.md
Outdated
slate migrate | ||
``` | ||
|
||
Converts an existing theme to work with Slate. Run this command from your project root to install dependencies and your theme files moved to to a `src/` directory. Use [theme commands](#theme-commands) to start developing. An empty `styles/` and `scripts/` folder will also be created. |
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
icons/
directory. - Updated instructions from other docs PR.
Converts an existing theme to work with Slate. Run this command from your project root to install dependencies and restructure your theme files into a `src/` directory. Empty `icons/`, `styles/` and `scripts/` folders will also be created.
Create `config.yml` in your root using [this sample file](https://github.com/Shopify/slate/blob/master/config-sample.yml), then use [theme commands](#theme-commands) to start developing.
src/commands/migrate.js
Outdated
|
||
if (!isShopifyTheme(workingDirectory)) { | ||
console.log(''); | ||
console.error(yellow(' The directory doesn\'t have /layout/theme.liquid. We have to assume this isn\'t a Shopify theme')); |
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.
Minor edit: "The current directory"
src/commands/migrate.js
Outdated
console.log(''); | ||
|
||
if (existsSync(srcDir)) { | ||
console.error(yellow(' Your theme already has a src directory')); |
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 feel this isn't enough information to the user to quit the process.
Suggestion:
console.error(yellow(' Migrate task could not create a new src directory since your theme already has one.'));
console.error(yellow(' Please remove or rename your current src directory.'));
src/utils.js
Outdated
*/ | ||
export function isShopifyThemeWhitelistedDir(directory) { | ||
const whitelist = ['assets', 'layout', 'config', 'locales', 'sections', 'snippets', 'templates']; | ||
return whitelist.indexOf(directory) > 0; |
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.
return whitelist.indexOf(directory) > -1;
This function is ignoring the assets/
directory since it is element 0
. Video: http://take.ms/umfXJ
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 totally had -1
and I don't know why I convinced myself 0
was right in a later commit lol Thanks for catching this.
@NathanPJF ready for another round or approval |
@cshold @macdonaldr93 did another run through and it's good. I added an alias for |
Carson and I were chatting about the alias and Carson was thinking it would best not to have one. You wouldn't accidentally want to run this command. I'm indifferent. What do you think @NathanPJF ? |
@macdonaldr93 I'm indifferent. I can remove it. |
Remove alias for `migrate`
Made a new release (v0.9.0) and published 🎉 🎉 |
This PR introduces
slate migrate
— a task to be used on an existing Shopify theme to get it ready for use with Slate tools.Steps to test:
slate build
on existing theme and work from thedist
directory)slate migrate
from root of themelayout/theme.liquid
before going too farslate start
@Shopify/themes-fed
cc @m-ux @macdonaldr93