Skip to content
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.

Feature/brunch1 #250

Closed
wants to merge 11 commits into from
Closed

Feature/brunch1 #250

wants to merge 11 commits into from

Conversation

ajthomascouk
Copy link
Contributor

No description provided.

@neilbmclaughlin
Copy link
Contributor

neilbmclaughlin commented Oct 16, 2017

We discussed this in the dev catchup and the feeling is that brunch should be a dev dependency since it would be preferable if it wasn't deployed to production. The reason being that it is an unnecessary surface area in terms of security risk. This is pertinent given the snyk warning. Do you think this can be resolved given that you run brunch specifically when the env is production?

ajthomascouk added 6 commits October 17, 2017 14:02
🐛 add call to correct script

🐍 regenerate yarn.lock following rebase
🐛 add call to correct script

🐍 regenerate yarn.lock following rebase
@ajthomascouk ajthomascouk requested review from st3v3nhunt and removed request for neilbmclaughlin October 17, 2017 14:52
Copy link
Contributor

@st3v3nhunt st3v3nhunt left a comment

Choose a reason for hiding this comment

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

I've got a few points/questions recorded on this PR. They are as much for myself to remind me what I need to change as anything.
I've got a branch with additional changes in that I'll finish and submit a PR into this one once I've done it.
Which is a long way to say, don't bother making these changes as I'll be doing it.

  • Should the assets referenced within the css be hashed too? What are the implications of the externally hosted assets e.g. the fonts using this approach?

@@ -1,5 +1,8 @@
FROM node:8.4.0-alpine

RUN apk add --no-cache python=2.7.13-r1 git-perl bash make gcc g++
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are all these packages needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@markysoft can you explain please?

Copy link
Contributor

Choose a reason for hiding this comment

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

Brunch relies on node-sass, which requires python.
node-sass bundles a number of pre-compiled binaries for popular distributions, but not the flavour of linux we use.

I've added lines to the Docker file to install the pre-requisites as decribed in the issue sass/node-sass#1589

The issue has been fixed in master on node-sass, but it has not been released since May

Dockerfile Outdated
@@ -23,6 +26,6 @@ USER root
RUN find /code -user 0 -print0 | xargs -0 chown "$USERNAME":"$USERNAME"
USER $USERNAME

RUN [ "yarn", "run", "build-css" ]
RUN yarn run brunch-build
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to have run here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, thought i tried it without. Okay.

sourceMaps: false,
plugins: {
afterBrunch: [
'sleep 1s && yarn map-replace app/views/layout.nunjucks < assets.json'
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does this come from?

brunch-config.js Outdated
},
overrides: {
development: {
sourceMaps: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are source maps not used in development?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't use them. But I guess "this is for everyone" So i'll put them back.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't bother making any changes. See #250 (review)

brunch-config.js Outdated
fingerprint: {
srcBasePath: 'public/',
destBasePath: 'public/',
hashLength: 8
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this as 8 is the default value

package.json Outdated
@@ -4,7 +4,7 @@
"description": "Web app to display useful information about GP practices Pharmacies",
"main": "server.js",
"scripts": {
"build-css": "./css-build",
"brunch-build": "yarn brunch build --production",
Copy link
Contributor

Choose a reason for hiding this comment

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

--production isn't needed.

package.json Outdated
@@ -18,7 +18,7 @@
"precommit": "yarn git-hook",
"prepush": "yarn git-hook && yarn snyk test",
"start": "node app.js",
"start-watch": "nodemon app.js | ./node_modules/bunyan/bin/bunyan & nodemon -e scss -x yarn build-css -- compact",
"start-watch": "yarn brunch watch & nodemon app.js | ./node_modules/bunyan/bin/bunyan",
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be running as development

* Use source maps in dev
* Clear old hashed files (for dev)
* Remove default and otherwise unnecessary values
@ajthomascouk
Copy link
Contributor Author

ajthomascouk commented Oct 19, 2017

@st3v3nhunt wrote:

Should the assets referenced within the css be hashed too? What are the implications of the externally hosted assets e.g. the fonts using this approach?

Are the images cached? They change so rarely, do we need to bother?

@st3v3nhunt
Copy link
Contributor

PR #256 created for some tweaks to this PR.
The variable qs (in https://github.com/nhsuk/profiles/pull/250/files#diff-624f0d73fb727e28599e9c0cafef6db5L17) is used for cache busting the JS too.
As part of this change it would be good to get the JS done in the same way.

@st3v3nhunt
Copy link
Contributor

Superseded by #250

@st3v3nhunt st3v3nhunt closed this Oct 30, 2017
@st3v3nhunt st3v3nhunt deleted the feature/brunch1 branch October 30, 2017 12:14
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.

4 participants