Skip to content

Commit

Permalink
Upgrade prototype kit and govuk-frontend (#35)
Browse files Browse the repository at this point in the history
* Update run-sequence from 1.2.2 to 2.2.1

Tested by ensuring that the gulp tasks in gulp/tasks.js that use run-sequence still run without error.

* Update standard from 10.0.2 to 11.0.1 and fix violations

* Update sync-request from 4.1.0 to 6.0.0

Tested by ensuring that the release url on the `/docs/install` page is still generated correctly (sync-request is only used by the getLatestRelease in lib/utils, which is used on the /docs/install page to automatically link to the latest release from GitHub)

* Document changes in changelog

* Update govuk-frontend dependency to 1.1.1

* Unify download link approach

Within the docs we link to `/prototype-admin/download-latest` which looks up the latest release from GitHub and redirects to the zip download.

On the install page itself, we look up the latest release URL and then link directly to GitHub from the page.

This moves the `/prototype-admin/download-latest` to `/docs/install` so that it can live within the docs folder and unifies the two approaches so that we consistently use the `/docs/download` URL. This means that we are no longer blocking on a GitHub request before we can render the install page – and that we only make the request to GitHub if the user actually tries to download the kit.

* Simplify getLatestRelease logic

- Rather than trying to extract the tag name from the zipball URL, use the value of `name` that we get in the response data
- Use template literals to build the zip URL rather than multiple variables and concatenation
- Avoid assigning things to variables that aren't used more than once (githubUrl, options) which also reduces the amount of seeking you have to do through the code
- Remove url, zipUrl variables by assigning to releaseUrl directly and `return`ing from every scenario

* Specify node dependency using caret notation

This fixes an issue when deploying to CloudFoundry instances (such as GOV.UK PaaS) where the buildpack fails on the semver range:

```
   -----> Nodejs Buildpack version 1.6.28
   -----> Installing binaries
          engines.node (package.json): >=8.9.1 <9.0
          engines.npm (package.json): unspecified (use default)
          **WARNING** Dangerous semver range (>) in engines.node. See: http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
          **ERROR** Unable to install node: improper constraint: >=8.9.1 <9.0
   Failed to compile droplet: Failed to run all supply scripts: exit status 14
```

Using ^8.9.1 instead which is semantically equivalent (any version greater than 8.9.1 but less than 9.0) allows the app to deploy successfully:

```
   -----> Nodejs Buildpack version 1.6.28
   -----> Installing binaries
          engines.node (package.json): ^8.9.1
          engines.npm (package.json): unspecified (use default)
   -----> Installing node 8.11.3
          Download [https://buildpacks.cloudfoundry.org/dependencies/node/node-8.11.3-linux-x64-34b80d71.tgz]
```

* Document in changelog

* Add data- tracking attributes to docs/index page

* Add data- tracking attributes to header navigation

Unfortunately at the moment we cannot pass
data attributes to items, so we have to replace
the Nunjucks macro with HTML.

* Add example of using data in Nunjucks macros

* Document in CHANGELOG

* Simplify start page

As seen in this PR: alphagov/govuk-frontend#807

* Improve error handling

- Use 'next' and middleware to handle errors, this is the documented way to handle errors in Express
- Use console.error to output errors when rendering templates - these were previously hidden
- Remove custom route for index.html, handle it with matchRoutes for consistency

* update changelog

* Document steps needed when updating the kit

from version beta-9 to beta-10

* Update GOV.UK Frontend to 1.2.0

* Document in CHANGELOG

* Add Elements, Frontend Toolkit and GOV.UK Template modules

* Add gulp tasks for v6 support

* create v6 app to serve old prototype files from app/v6

* add backward compatibility documentation

* update changelog

* support old unbranded template

* v7.0.0

* Update install-the-kit.md

- correct reference to '3.0.0' folder
- simplify instructions for just installation, not returning
- drop instructions for 'My Documents' - this was for Windows older than Vista apparently

* Update template-question-page-blank.html

Link to the home page instead of the Question page pattern - people could need any of the components or patterns, not necessarily guidance on the Question page itself

* Update CHANGELOG.md

* rename and reorganise template pages to be easier to use

* update changelog

* Add prototype kit version and github link to footer

Signed-off-by: Mike Shaw <mike.shaw@dwp.gsi.gov.uk>

* Add item to CHANGELOG for adding kit version to footer

Signed-off-by: Mike Shaw <mike.shaw@dwp.gsi.gov.uk>

* Amend prototype kit link to go to heroku site

Signed-off-by: Mike Shaw <mike.shaw@dwp.gsi.gov.uk>

* Changed block name to bodyEnd to fix scripts

* Update CHANGELOG.md

* Update GOV.UK Frontend to 1.3.0

* Document in CHANGELOG

* Load environment variables before requiring routes

Code in `route.js` may be looking for environment variables. If the environment variables aren’t loaded beforehand this will cause an exception.

I suspect this worked fine before alphagov/govuk-prototype-kit@bbe15e8#diff-78c12f5adc1848d13b1c6f07055d996e, which reordered the first lines in `server.js`.

This commit moves the loading of environment variables to before the requiring of any `routes.js` files.

* CHANGELOG

* v7.1.0

* Updating deprecated support email address

* Restart the app if environment variables change

Could be confusing why your changes aren’t having any effect.

Doing this using the existing file-extension-based config doesn’t work
because nodemon doesn’t undestand that `.env` is a file with no name,
and an extension of `env`. So I’ve removed the file-extension-based
stuff entirely and rewritten it to use globbing.

Tested locally that:
- changing `server.js` or `.env` causes the app to restart
- changing a file inside `node_modules` _doesn’t_ cause the app to
  restart

* Make it more difficult to accidentally clear the session data

* Changelog entry

* Move clears data page to prototype-admin

* Update title and put back link before the content

* Allow nested objects in session

E.g.

<input name="example1[name]" value="Hello 123">
<input name="example2[name]" value="Hello 456">
<input name="example3[name]" value="Hello 789">

* Clear session with empty object

Compatibility with other session stores that have no `.destroy()` method

* Add config to allow permanent session in cookie

Persists data between Node.js restarts

* Use path to gulp executable for spawn

Previously the spawn command just took `gulp` as an argument, which worked when running the app via `npm start`. However, running `node start` would fail because it couldn't find `gulp`. It would look globally, whereas `npm start` would look locally. Referencing the path within `node_modules` directly means both commands can be used to start and run the app.

* Update changelog with entry for gulp executable issue

Signed-off-by: Mike Shaw <mike.shaw@dwp.gsi.gov.uk>

* Update tips-and-tricks.md

* Update GOV.UK Frontend to 2.0.0

* Document in CHANGELOG

* Release v8.0.0

* Update wording on when Protoype Kit
started using GOV.UK Frontend  instead
of GOV.UK Elements

Needs updating now that we have release version 8.

* Update GOV.UK Frontend dependency to 2.1.0

* Use header macro instead of HTML

We have done the work to allow attributes to be added to navigation
items, which means we can now use the macro instead of plain HTML

* Document in CHANGELOG

* Release v8.1.0

* Set stylesheet media to all

In GOV.UK Frontend components no longer have separate print stylesheet;
print styles are built into the component partials

By setting media to all we allow those styles to apply in print situations.

* Document in CHANGELOG

* fix About link in nav

* Use form POST request when clearing session data

This builds on the work done in #588.

Previously the ‘clear data’ feature used two GET requests – one to display the confirmation screen, and a second to actually clear the session data. This is not ideal because GET requests are meant to be nullipotent (to have no side effects), and links from the docs part of the kit were still pointing to the old URL, which bypassed the confirmation screen.

This adds a form to the confirmation screen which POSTs to itself (/prototype-admin/clear-data), and changes the old data-clearing route to match.

* Use consistent page titles

* Document in changelog

* Update GOV.UK Frontend dependency

Update to v2.2.0

* Import character-count component

Make it available in the app views

* Document in CHANGELOG

* Release 8.2.0

* Heroku review app config

Required config to enable review apps on Heroku

* Fixed path for page templates in tutorials-and-examples

The site referred to docs/views/examples, which was incorrect.

* Add first draft of Notify integration guidance

Adapted from: https://gist.github.com/quis/1136d255a5cdc47f4b72bc5bf234cf97

* Rewrite instructions to add more context

The previous instructions were a very bare-bones draft which assumed a
lot of context.

This commit attempts to rewrite them for someone without knowledge of
what Notify is, or how an API works.

Hopefully this is enough so that someone who is confident using the
prototype kit can integrate their prototype with Notify.

* Remove duplicate send/sent

* Remove use of shell redirection to save key

* Capitalise GitHub

* Remove unneeded explanation of  variable

* Use HTML not macro for form example

* Fix line telling people where to put routing code

* Add CHANGELOG entry

* Add link to docs about using Notify

* Tidy code block in Notify guidance

* Removed dependency

* Add npm install reminder on crash

* Add standardjs and supertest to dev dependencies

* Setup exclusion list for the generated ZIP download

Make use of `.gitattributes` file to list all files that we don't want
to include in the ZIP users download.

As per https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_exporting_your_repository

* Update govuk-frontend to 2.3.0

* Document in CHANGELOG

* Add step by step navigation

* remove data-track-count (seems unused here)

* remove tracking code

* refactor scss

* fix javascript for Standard

* Changelog

* Release 8.3.0

* Fix list of excluded styles

* Move closing H1 tag onto the same line as the opening tag

In prototype kit training some users were confused by the fact that the closing tag was not on the same line as the opening tag – inconsistent with the paragraph tags in the same file.

* Avoid double-nested buttons in step-by-step navigation

Instead, these are added by JS automatically

* Link to new GOV.UK Notify documentation

We’re now publishing our documentation using the tech docs tool, and hosting it at https://docs.notifications.service.gov.uk/node.html

* Make unbranded layout available in app views

* Enable global styles in unbranded.css

* Document in CHANGELOG

* Update GOV.UK Frontend to v2.4.0

* Release v8.4.0

New features:

- [#642 Update GOV.UK Frontend to v2.4.0](alphagov/govuk-prototype-kit#642)

Bug fixes:

- [#634 Avoid double-nested buttons in step-by-step navigation](alphagov/govuk-prototype-kit#634)

- [#638 Make unbranded template available for use in app/views](alphagov/govuk-prototype-kit#638)

* Initial commit of moving tests over to Jest

After running jest-codemon

* Rename test to __tests__

* Removes gulp mocha

I was able to get rid of the gulp task and just call it straight from
`npm test`.

* Move listener to listen-on-port.js

This listener which looks out for file changes using BrowserSync doesn't need
to be part of `server.js` as it's only needed for npm start. We added a new file called
`listen-on-port.js` - this needs to be separate from `server.js` for Jest to work
correctly.

More detail here:
http://www.albertgao.xyz/2017/05/24/how-to-test-expressjs-with-jest-and-supertest/#2-Separate-your-app-and-sever

* Add changelog

* Revert "Replacing Mocha with Jest"

* Initial commit of moving tests over to Jest

After running jest-codemon

* Rename test to __tests__

* Removes gulp mocha

I was able to get rid of the gulp task and just call it straight from
`npm test`.

* Move listener to listen-on-port.js

This listener which looks out for file changes using BrowserSync doesn't need
to be part of `server.js` as it's only needed for npm start. We added a new file called
`listen-on-port.js` - this needs to be separate from `server.js` for Jest to work
correctly.

More detail here:
http://www.albertgao.xyz/2017/05/24/how-to-test-expressjs-with-jest-and-supertest/#2-Separate-your-app-and-sever

* Add changelog

* Start listen-on-port.js for Heroku

* updates support details

I tried to follow the pattern we use in Design System
https://design-system.service.gov.uk/#support

* Add note about frontend survey to README

* Test forceHttps functionality

Add tests that check that on production HTTP requests
 are redirected to HTTPS

* Refactors force-https-redirect.js specs

There is no need to have before/after all hooks if specs dont require us
to change environment variables

* Fix link context in step-by-step templates
Link context (price) wasn't showing correctly previously

* Document in changelog

* Revert "Add note about frontend survey to README"

* Moves basicAuth out of lib/utils.js

This is the first step to improving our implementation of middleware and
and testing stragety. It extracts the basicAuth method in utils.js and
places it into its own file. This will be easier to test and manage. At
this point it has only been manually test on a local machine but automated
unit tests will be added next.

* Adds basic unit tests for authentication

This unit test just tests the middleware in its current state. Ideally
we should only add this functionality to production environment or
if the user specifically needs to have basic auth enabled.

The next bit of work will be to move the logic out of the server.js into
the middleware itself.

* Refactor authentication to use console.error

* Moves middleware logic from server.js to authentication.js

Easy to manage/maintain and Developers can see when the middleware would
be applied and when. The middleware is not completely independant from the
rest of the server configuration.

* Adds unit tests for when the kit is running in non-prod environment

* Bump GOV.UK Frontend to latest release

* Gulp 4.0.0 upgrade

- upgrade gulp to 4.0.0
- substitute gulp-clean for del
- remove reliance on run-sequence by using in-built gulp functions

* Update CHANGELOG.md

- add PR #659 to changelog

* Grouped dependencies

- group dependencies to GOV.UK standard

* Update watch.js

- replace gulp.series on watch tasks with gulp.task

* Gulp task improvements

- fix public path for clean task
- run clean task before all others

* update Standard

* standard 12 fixes

* changelog

* Replaces gutil-color with ansi-colors

* Replaces gutil.log with fancy logs

* Removes gulp-util as its now deprecated

gulp-util is deprecated - replace it, following the guidelines at
https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

We only used this for logging and colouring our log outputs.

* Adds entry to changelog

* Add acorn dependency to fix npm warning

It seems there is a problem with npm installing 'peer dependencies'
npm's warning says that we need to install this dependency ourselves.
The bug is tracked here:
eslint/eslint#11018

* changelog

* Move acorn to dependency

We dont really need it but its needed for Standard and gulp-sourcemaps.

Heroku removes dev dependency by default.

* updates changelog

* Update GOV.UK Frontend to version 2.5.0

* Import new components Accordion and Summary List

* Update CHANGELOG

* Replace check answers pattern with updated code

* Update button text and licence period content

* changelog

* Release 8.5.0

* Update GOV.UK Frontned to version 2.6.0

* Release 8.6.0

* add guidance for CSS, JavaScript and images

* Test on on macOS and Windows and both Node 10 / 8

Update the Travis config to build on both macOS and Windows as well as Linux, and against both Node 8 and LTS (currently 10)

Travis combines the OS and Node JS versions, so both Node versions will be tested on every operating system.

There is a known issue with Windows builds on Travis where the build fails if you have encrypted variables.

Splitting the deploy step (which is the step that requires the encrypted variable) into its own job means that the encrypted variables are not present when testing on Windows.

* Remove before_deploy step

Each stage runs one after another, but will only proceed if all jobs in the previous stage have passed successfully, so this check is not necessary.

* Add new deploy key for Travis

In order to make the tests pass on Windows, we need to remove any encrypted variables from the Travis repository settings and specify them in the repo config file instead.

This adds a new deploy key encrypted using an encrypted env variable DEPLOY_KEY and updates the release script to use it.

Co-authored-by: Hanna Laakso <hanna.laakso@digital.cabinet-office.gov.uk>

* Tidy up config and release script

* Update documentation for create-release

* Remove verification

The SSH command will always exit with an error code, even if it connects successfully, because GitHub does not provide shell access.

We could allow this to fail, but we're not sure it's that useful, so let's just remove it for now.

* update docs and package.json to Node 10 LTS

* Adds Extension Framework for departments to use their own frontend system

As a developer/Designer, I would like to use my departments frontend system
alongside govuk-frontend. So that I can prototype using the same components
and patterns that will be used in production.

This should not be a breaking change for any existing kits.
This is a soft release where GOV.UK Design System team would like HMRC
to test before releasing this more widely.

A proper release with documentation etc. will be done once this has been
battle tested with HMRC.

Co-authored-by: Alistair Laing <alistair.laing@digital.cabinet-office.gov.uk>
Co-authored-by: Hanna Laakso <hanna.laakso@digital.cabinet-office.gov.uk>

* Update govuk-frontend from 2.6.0 to 2.7.0

This is so we can pick up govuk-prototype-kit.config.json file which
was added to govuk-frontend to support this extensions feature.

* Fixed extensions for windows (including tests).

* Release 8.7.0

* Don't include travis files
  • Loading branch information
fofr committed Mar 8, 2019
1 parent b796f60 commit 2df922c
Show file tree
Hide file tree
Showing 22 changed files with 944 additions and 49 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ignore tracking usage data config - we want a different one for each user
usage-data-config.json
# ignore extension SCSS because it's dynamically generated
lib/extensions/_extensions.scss
.env
.sass-cache
.DS_Store
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 8.7.0

Features:
- [#613 Update to GOV.UK Frontend version 2.7.0 and adds experimental extensions feature](https://github.com/alphagov/govuk-prototype-kit/pull/613) (See GOV.UK Frontend 2.7.0 [release notes](https://github.com/alphagov/govuk-frontend/releases/tag/v2.7.0)). Big thanks @matcarey (https://github.com/matcarey)
As this is an **experimental** feature it should be used at your own risk, and is likely to change. Please contact us if you're interested in trying it out.

- [#687 Update docs and package.json to Node 10 LTS](https://github.com/alphagov/govuk-prototype-kit/pull/687)

- [#683 add guidance for CSS, JavaScript and images](https://github.com/alphagov/govuk-prototype-kit/pull/683)

# 8.6.0

Features:
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.6.0
8.7.0
65 changes: 65 additions & 0 deletions __tests__/spec/sanity-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ var path = require('path')
var fs = require('fs')
var assert = require('assert')

function readFile (pathFromRoot) {
return fs.readFileSync(path.join(__dirname, '../../' + pathFromRoot), 'utf8')
}
/**
* Basic sanity checks on the dev server
*/
Expand Down Expand Up @@ -40,4 +43,66 @@ describe('The Prototype Kit', () => {
expect(response.type).toBe('text/html')
})
})

describe('extensions', () => {
it('should allow known assets to be loaded from node_modules', (done) => {
request(app)
.get('/extension-assets/govuk-frontend/all.js')
.expect('Content-Type', /application\/javascript; charset=UTF-8/)
.expect(200)
.end(function (err, res) {
if (err) {
done(err)
} else {
assert.strictEqual('' + res.text, readFile('node_modules/govuk-frontend/all.js'))
done()
}
})
})

it('should allow known assets to be loaded from node_modules', (done) => {
request(app)
.get('/assets/images/favicon.ico')
.expect('Content-Type', /image\/x-icon/)
.expect(200)
.end(function (err, res) {
if (err) {
done(err)
} else {
assert.strictEqual('' + res.body, readFile('node_modules/govuk-frontend/assets/images/favicon.ico'))
done()
}
})
})

it('should not expose everything', function (done) {
request(app)
.get('/assets/common.js')
.expect(404)
.end(function (err, res) {
if (err) {
done(err)
} else {
done()
}
})
})

describe('misconfigured prototype kit - while upgrading kit developer did not copy over changes in /app folder', () => {
it('should still allow known assets to be loaded from node_modules', (done) => {
request(app)
.get('/node_modules/govuk-frontend/all.js')
.expect('Content-Type', /application\/javascript; charset=UTF-8/)
.expect(200)
.end(function (err, res) {
if (err) {
done(err)
} else {
assert.strictEqual('' + res.text, readFile('node_modules/govuk-frontend/all.js'))
done()
}
})
})
})
})
})
4 changes: 2 additions & 2 deletions app/assets/sass/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ $govuk-global-styles: true;
// Not in design system:
$button-colour: #00823b;

// Import GOV.UK Frontend
@import "node_modules/govuk-frontend/all";
// Import GOV.UK Frontend and any extension styles if extensions have been configured
@import "lib/extensions/extensions";

// Take a look at in app/assets/sass/patterns/ to see which files are imported.
@import 'patterns/simplemde-theme';
Expand Down
4 changes: 4 additions & 0 deletions app/views/includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<!--[if gt IE 8]><!--><link href="/public/stylesheets/application.css" media="all" rel="stylesheet" type="text/css" /><!--<![endif]-->
<!--[if gt IE 8]><!--><link href="/public/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" /><!--<![endif]-->

{% for stylesheetUrl in extensionConfig.stylesheets %}
<link href="{{ stylesheetUrl }}" rel="stylesheet" type="text/css" />
{% endfor %}

<script>
var data = {{ data | dump | safe }};
</script>
6 changes: 5 additions & 1 deletion app/views/includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
<script src="/public/javascripts/modules/edge.js"></script>
<script src="/public/javascripts/modules/copy-content.js"></script>
<script src="/public/javascripts/modules/toggle-form.js"></script>
<script src="/node_modules/govuk-frontend/all.js"></script>

{% for scriptUrl in extensionConfig.scripts %}
<script src="{{scriptUrl}}"></script>
{% endfor %}

<script src="/public/javascripts/application.js"></script>

{% if useAutoStoreData %}
Expand Down
44 changes: 44 additions & 0 deletions app/views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

{% extends "layout.html" %}

{% block pageTitle %}
GOV.UK Prototype Kit
{% endblock %}

{% block content %}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">
The GOV.UK Prototype Kit
<span class="govuk-caption-xl">{{releaseVersion}}</span>
</h1>{{releaseVersion | log }}
<p>
This kit lets you rapidly create HTML prototypes of GOV.UK services.
</p>

<p>
It contains all you need to prototype anything from simple static pages to complex, data-driven transactions.
</p>

<h2 class="govuk-heading-m">About this page</h2>

<p>We recommend you add links to your prototype to this page, rather than delete it.
You'll find this page in the kit at '/app/views/index.html'.</p>

<p>You can change the service name by editing the file '/app/config.js'.</p>

<h2 class="govuk-heading-m">Examples and documentation</h2>

<ul class="govuk-list govuk-list--bullet">
<li><a href="/docs/tutorials-and-examples">Example pages and documentation</a></li>
<li>
<a href="https://design-system.service.gov.uk">
GOV.UK Design System
</a>
</li>
</ul>
</div>
</div>

{% endblock %}
45 changes: 23 additions & 22 deletions create-release.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
#!/bin/bash
set -e

REPO_PATH='alphagov/govuk-prototype-kit'

echo "Add config for alphagov/$REPO_PATH"
# Check for the TRAVIS environment variable
if [[ -z "${TRAVIS}" ]]; then
echo "⛔️ Refusing to run outside of Travis..."
exit 1
fi

# Configure git...
git config --global user.name "Travis CI"
git config --global user.email "travis@travis-ci.org"
git remote add origin_ssh git@github.com:$REPO_PATH.git
git remote add origin_ssh git@github.com:alphagov/govuk-prototype-kit.git

# This openssl command was generated automatically by `travis encrypt-file`, see `.travis/README.md` for more details
openssl aes-256-cbc -K $encrypted_a0ab9bc5246b_key -iv $encrypted_a0ab9bc5246b_iv -in .travis/govuk_prototype_kit.enc -out ~/.ssh/id_rsa -d
chmod 600 ~/.ssh/id_rsa
# Decrypt deploy key.
#
# See `.travis/README.md` for more details
openssl aes-256-cbc -d -k $DEPLOY_KEY \
-in .travis/prototype-kit-deploy-key.enc \
-out ~/.ssh/id_rsa

echo "Check to see if the version file has been updated"
chmod 600 ~/.ssh/id_rsa

# Get the version from the version file
VERSION_TAG="v`cat VERSION.txt`"

# Create a new tag - if the version file has been updated and a tag for that
# version doesn't already exist

# Check to make sure the tag doesn't already exist
# Check that there's not a tag for the current version already
if ! git rev-parse $VERSION_TAG >/dev/null 2>&1; then
echo "Creating new tag: $VERSION_TAG"

# Create a new tag and push to Github
# Create a new tag and push to GitHub.
#
# GitHub will automatically create a release for the tag, ignoring any files
# specified in the .gitattributes file
echo "🏷 Creating new tag: $VERSION_TAG"
git tag $VERSION_TAG
git push origin_ssh $VERSION_TAG

# This tag will trigger the builds for the deploy providers marked "# For tagged commits" in .travis.yml

# Alias branch for the most recently released tag, for easier diffing
# Force push local `master` branch to the `latest-release` branch on Github
# Force push the latest-release branch to this commit
echo "💨 Pushing latest-release branch to GitHub"
git push --force origin_ssh master:latest-release
echo "Pushed latest-release branch to GitHub"

else
echo "Not creating a new tag, or updating the latest-release branch as the tag already exists..."
echo "😴 Current version already exists as a tag on GitHub. Nothing to do."
fi
84 changes: 84 additions & 0 deletions docs/documentation/adding-css-javascript-and-images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Adding CSS, JavaScript and Images

The Prototype Kit comes with standard GOV.UK Frontend styles and components for you to use in your prototypes. However if you need to add your own CSS (Cascading Style Sheets), JavaScript or images, use the `/app/assets` folder.

The Prototype Kit processes all the files in the `/app/assets` folder, and puts the processed files in `/public`.

Do not change files in the `/public` folder because it’s deleted and rebuilt every time you make a change to your prototype.

## CSS

CSS lets you change how web pages look, for example text sizes, colours or spacing.

To add styles use:

```
/app/assets/sass/application.scss
```

Do not edit the file `/public/styles/application.css` because it’s deleted and rebuilt every time you make a change to your prototype.

The Prototype Kit uses [Sass](https://sass-lang.com/guide), which adds extra features to CSS.

### Using import

If you have a very long application.scss file, you can split it up into multiple files and import those into `application.scss`. Use an underscore (_) at the start of the import file filenames, for example:

```
/app/assets/sass/_admin.scss
```

Import this file into your `application.scss` file without the underscore:

```
@import "admin";
```

## JavaScript

You can use JavaScript to make changes to a web page without loading a new one. For example a user could enter some numbers, then JavaScript displays the results of a calculation without loading a new page.

To add JavaScript use:

```
/app/assets/javascripts/application.js
```

Do not edit the file `/public/javascript/application.js` because it’s deleted and rebuilt every time you make a change to your prototype.

## Images

If you add images to `/app/assets/images` the Prototype Kit will copy them to `/public`.

For example if you add an image:

```
/app/assets/images/user.png
```

Use it in your page like this:

```
<img src="/public/images/user.png" alt="User icon">
```

Use ‘alt’ text to describe the image for screen readers.

Do not put files directly in `/public` because it’s deleted and rebuilt every time you make a change to your prototype.

## Other files

If you need to use other files in your prototype, you can add them to `/app/assets` and the Prototype Kit will copy them to `/public`. You can use sub-folders in the assets folder.

For example if you add a PDF:

```
/app/assets/downloads/report.pdf
```

Link to it like this:

```
<a href="/public/downloads/report.pdf">Download the report</a>
```
Do not put files directly in `/public` because it’s deleted and rebuilt every time you make a change to your prototype.
3 changes: 3 additions & 0 deletions docs/documentation/extension-system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Extension system

The extension system information should go here before it's adopted into GOVUK.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ It's built on the [Express](http://expressjs.com/) framework, and uses [GOV.UK F

## Requirements

node.js - version 8.x.x
node.js - version 10.x.x

## Install dependencies

Expand Down
Loading

0 comments on commit 2df922c

Please sign in to comment.