Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Remove NodeGit dependency / add slate dependency #11

Merged
merged 8 commits into from
Jul 28, 2016

Conversation

macdonaldr93
Copy link
Contributor

@Shopify/themes-fed

This is a bit of a crazy refactor. I might have gone a little bit overkill but... my goal was to simplify the process for the first rounds of testing and then we can extend slate cli from there.

I've removed NodeGit as a dependency along with two other packages (bluebird and rimraf). NodeGit requires the end user to setup ssh-agent. If this isn't setup correctly, it can lead to some pretty nasty debugging.

Our alternative approach is for Slate to become a dependency of slate-cli. This change comes with a significant amount of pros.

  • We can now probably version control between slate-cli and slate so breaking changes are less likely.
  • When upgrading slate and slate cli, updating slate cli and including the new version of slate will force slate cli to update the slate package in node_modules.
  • This gives us a good starting point for controlling additional generators contributed to slate; we can vet packages before adding them to slate cli.

The only dependency on NodeGit other than cloning the Slate repo was to initialize git in the newly created theme (slate new theme <theme-name>). For the time being, I removed this feature as I think this might be an over-complication... If a dev wants to track their theme in git, they can easily run git init and get up and running.

Lastly, I would like to update Slate's name in package.json to shopify-slate before it gets published. I'll make a separate PR for that in Slate.

Random error: can't rebuild npm shrinkwrap due to npm/npm#13327.

Ryan Macdonald added 2 commits July 20, 2016 13:33
- remove nodegit
- refactor to only slate for now
@macdonaldr93 macdonaldr93 self-assigned this Jul 20, 2016
}, {
type: 'confirm',
name: 'initGit',
message: 'Will you be tracking this theme in git?'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I feel like we should still do this -- even though we don't want to force the user to have git / ssh installed, we want to make it easy to init a git package if they do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll have to add NodeGit back as a dependency but the API wouldn't rely on the ssh setup for this anyways.

@mcpatten
Copy link
Contributor

super minor feedback, will 🎩 shortly, but generally lgtm.

}
});

if (this.fs.exists(scaffold + '/.npmignore')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-ux I just want to call out this spot... Not sure if this is the best approach but I noticed that npm seems to convert our gitignore to an npmignore on download? Kinda weird...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is fine, given the specific bug we're hitting.

Generally speaking everyone suggests to avoid fs.exists and there's a bunch of literature on why it was deprecated, but I still find valid uses for it on occasion (it might just be that I don't understand the problem well enough to quickly see a better alternative though).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(both you & I have already used fs.exists though in a couple places so NBD :)

@mcpatten
Copy link
Contributor

mcpatten commented Jul 28, 2016

mostly LGTM, probably remove the question about the scaffold you want to start with and 🚀

@macdonaldr93 macdonaldr93 merged commit d01317a into master Jul 28, 2016
@macdonaldr93 macdonaldr93 deleted the remove-nodegit-dep branch July 28, 2016 16:46
@t-kelly
Copy link
Contributor

t-kelly commented Aug 1, 2016

@macdonaldr93, do you know what authentication protocol does NPM use to fetch private repos? In my experience, NPM still uses SSH.

@macdonaldr93
Copy link
Contributor Author

In this case for Slate, it would clone the repo using git. I'm not exactly sure what the fallbacks would be if that fails.

https://docs.npmjs.com/cli/install

Install the package at https://github.com/githubname/githubrepo by attempting to clone it using git.

 npm install mygithubuser/myproject
 npm install github:mygithubuser/myproject

@t-kelly
Copy link
Contributor

t-kelly commented Aug 3, 2016

Does this new approach work when SSH is not configured? Trying to figure out what it's doing differently from NodeGit.

@macdonaldr93
Copy link
Contributor Author

I don't think it would be that different. The other two reasons we opted for this was that:

  1. NodeGit was 66 MB - bloated the tool significantly
  2. Versioning would be better because your version of the cli and the theme would be in sync

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

Successfully merging this pull request may close these issues.

3 participants