alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
302 stars 236 forks source link

Make it easy for people to update their version of the kit #96

Closed joelanman closed 7 years ago

joelanman commented 8 years ago

As a user of the kit, I need to be able to update the kit on an existing prototype so I can take advantage of new features and bug fixes.

lewismorris commented 8 years ago

Hey Joe,

Is this more around the core of the kit itself, routing, examples etc or more geared towards the assets (CSS/JS/Images) in the kit?

One option for the assets would be to possibly have a bower install via grunt run when starting the app which would pull in the latest assets.

You could then team it up with something like https://www.npmjs.com/package/npm-check-updates which would keep any bower/package.json versions up to date.

joelanman commented 8 years ago

both, but you're right it might be useful to consider them separately.

is bower necessary or could we just use npm for everything?

tombye commented 8 years ago

NPM has pre and post-install hooks you could use:

https://docs.npmjs.com/misc/scripts

You can also point NPM at github repos as well as existing modules which is often the main use for bower in a project: https://docs.npmjs.com/files/package.json#git-urls-as-dependencies

lewismorris commented 8 years ago

I think we could get away with just using NPM.

The link @tombye has shared about using GitHub repos in the package.json could be the perfect option as it could be locked to a specific commit/version (if required) or set to pull the latest from the repo.

gemmaleigh commented 8 years ago

I've started work on this, to keep GOV.UK elements up-to-date using NPM.

This spike only includes updating the Sass files. I'll amend it to include also copying over the images, updating the JavaScript will be a separate PR.

Things left to do:

sanjaypoyzer commented 8 years ago

Is this for people to update their globally installed kit before starting work on a new prototype, or updating the core code on a prototype that's already in development?

sanjaypoyzer commented 8 years ago

Oh and by the way, there's probably crossover here with issue #34.

joelanman commented 8 years ago

@sanjaypoyzer good point - this particular issue is about the latter - updating the core of the kit on existing prototypes

paulmsmith commented 8 years ago

I'm currently just setting an upstream remote in git for each of my kit repositories.

git remote add upstream https://github.com/alphagov/govuk_prototype_kit.git

Then if you run:

git remote

Typically you should see:

heroku
origin
upstream

Then if I want to merge the latest from the kit, I do:

git checkout master
git fetch upstream master
git merge FETCH_HEAD
joelanman commented 8 years ago

@paulmsmith when I tried that a couple times in the past I got some nasty merge conflicts - you ever experience that?

paulmsmith commented 8 years ago

@joelanman I have but only if I've made changes to files outside of /app such as routes.js or server.js

joelanman commented 8 years ago

on occasion we do make changes to /app in the kit, such as the routes.js file, which lives in app. I think for most people, the copy and paste instructions might be more straightforward than potentially fix merging conflicts - what do you reckon?

paulmsmith commented 8 years ago

Oh yes, I agree the copy & paste instructions are probably safest. Merge conflicts can be difficult for less experienced users to deal with.

For those more confident among us, setting an 'upstream' to the kit has worked well for myself and the my team.

joelanman commented 8 years ago

@paulmsmith do you think something like your steps above could be added to the Updating docs as an 'advanced' section? Would you have time to do a PR if so? I'm happy to do it too

paulmsmith commented 8 years ago

@joelanman Sure. I'll do a PR later today.

gemmaleigh commented 7 years ago

Hi @joelanman @paulmsmith are you happy to close this issue?

We have a latest-release branch, so the kit can be updated using @paulmsmith's method described above.

This exists in the documentation here.

paulmsmith commented 7 years ago

I think this issue can be closed now?

joelanman commented 7 years ago

Yep, thanks all