3

I'm using Yeoman to generate out an angular app. Once I'm happy with my app, I run grunt which creates a production-ready version of my application in a folder called /dist at the root of my project.

I've then initialised this /dist directory as a Git repository with git init and pushed the files up to Bitbucket, where they currently sit right now.

What I'm asking is do I have to compile my production-ready app with grunt every time I want to make a commit? It seems I have to. I'm thinking this setup might not be the most productive way to do this?

Am I missing something, is there an easier and more productive way to handling this?

2
  • 2
    Basically, you are checking the wrong thing into git. Your main application in the root directory is what you actually want to share and collab on with other people. The /dist directory is for exactly what you said, pushing to production where performance, etc matters most. You can make /dist a git repo but it's only purpose should basically be pushing to your production server. Every other commit during development should be done on your apps root repo. Also, you can't collab with people if you only use /dist because that is the "packed" version of your app Commented Dec 8, 2014 at 16:20
  • @snowman4415 Would you need to make two repos, or a repo within a repo (root folder and /dist)? Could you explain the best way to handle something like this? Commented Dec 8, 2014 at 17:03

1 Answer 1

3

That workflow is odd.

Only source code should be in your git repository. Not the compiled/minified files. Source code is what matters.

When you colaborate with somebody else, they should run grunt tasks on their own.

Dist package should be created before deploy to production. Or on regular basis by the continuous integration server.

Sign up to request clarification or add additional context in comments.

4 Comments

Yeah, it felt odd. Say I push the entire root repo to Bitbucket, is there a way to just pull down just the /dist directory onto the server? Or is it worth putting the entire repo on my web server, and pointing the site to my /dist folder? Sorry for the silly question.
I suppose you are trying to do some kind of "git deploy". According to: stackoverflow.com/questions/10124223/… Its possible to checkout single directory. But still you shouldnt commit compiled dist directory into your repository. its odd, and application will became fragile, because when you fix some bug and dont run build manualy, your dist is not updated. So ... I would suggest to forget about that thing. And rather think about deploy script, which will provide atomic deploy - 1.pulls current version, 2.run build 3.copy dist to the server
Do you know where I can get some information about a deploy script like that? I assumed such a generator like Yeoman, would have an easy option to deploy the finished app via Git.
I write these scripts on my own. I don't use git for deploy. For me its just scipt "deploy.sh" where I basicly do pull to tmp, gulp build, and then rsync /dist to production server via ssh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.