diff --git a/.travis.yml b/.travis.yml index dce86b79ec8d8..2c3533f22fbed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_script: script: - npm run lint - npm run test:js - - if node_modules/.bin/check-node-version --node '< 8.0' > /dev/null; then echo "Skipping build."; else make website; fi + - if node_modules/.bin/check-node-version --node '< 8.0' > /dev/null; then echo "Skipping build."; else BASE_URL=/ npm run build; fi jobs: include: diff --git a/Makefile b/Makefile index c9d80a94612ae..cbd37dae07f8c 100644 --- a/Makefile +++ b/Makefile @@ -4,31 +4,28 @@ favicon: node lib/badge-cli.js '' '' '#bada55' .png > favicon.png website: - LONG_CACHE=false BASE_URL=https://img.shields.io npm run build + LONG_CACHE=false BASE_URL=/ npm run build -deploy: deploy-s0 deploy-s1 deploy-s2 deploy-gh-pages +deploy: website deploy-s0 deploy-s1 deploy-s2 deploy-gh-pages deploy-s0: # Ship a copy of the front end to each server for debugging. # https://github.com/badges/shields/issues/1220 - LONG_CACHE=false BASE_URL=https://s0.shields-server.com npm run build - git add -f Verdana.ttf private/secret.json index.html + git add -f Verdana.ttf private/secret.json build/ git commit -m'MUST NOT BE ON GITHUB' git push -f s0 HEAD:master git reset HEAD~1 git checkout master deploy-s1: - LONG_CACHE=false BASE_URL=https://s1.shields-server.com npm run build - git add -f Verdana.ttf private/secret.json index.html + git add -f Verdana.ttf private/secret.json build/ git commit -m'MUST NOT BE ON GITHUB' git push -f s1 HEAD:master git reset HEAD~1 git checkout master deploy-s2: - LONG_CACHE=false BASE_URL=https://s2.shields-server.com npm run build - git add -f Verdana.ttf private/secret.json index.html + git add -f Verdana.ttf private/secret.json build/ git commit -m'MUST NOT BE ON GITHUB' git push -f s2 HEAD:master git reset HEAD~1 @@ -43,7 +40,7 @@ deploy-gh-pages: git checkout master deploy-heroku: - git add -f Verdana.ttf private/secret.json index.html + git add -f Verdana.ttf private/secret.json build/ git commit -m'MUST NOT BE ON GITHUB' git push -f heroku HEAD:master git reset HEAD~1 diff --git a/app.json b/app.json index b14d16d58dcc8..7e43331522f9b 100644 --- a/app.json +++ b/app.json @@ -14,6 +14,10 @@ "NPM_CONFIG_PRODUCTION": { "description": "Configure whether devDependencies are installed (they are needed for the build).", "value": "false" + }, + "BASE_URL": { + "description": "The base URL to use in the frontend build", + "value": "/" } }, "formation": { diff --git a/frontend/components/badge-examples.js b/frontend/components/badge-examples.js index 5d681ddd57897..601c30336cc4f 100644 --- a/frontend/components/badge-examples.js +++ b/frontend/components/badge-examples.js @@ -1,13 +1,13 @@ -import { URL } from '../lib/url-api'; +import URLPath from 'url-path'; import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; function resolveUri (uri, baseUri, options) { const { longCache } = options || {}; - const result = new URL(uri, baseUri); + const result = new URLPath(uri, baseUri); if (longCache) { - result.searchParams.maxAge = '2592000'; + result.searchParams.set('maxAge', '2592000'); } return result.href; } diff --git a/frontend/lib/static-badge-uri.js b/frontend/lib/static-badge-uri.js index 020ef6bb61e39..80abf96f2f385 100644 --- a/frontend/lib/static-badge-uri.js +++ b/frontend/lib/static-badge-uri.js @@ -1,4 +1,4 @@ -import { URL } from './url-api'; +import URLPath from 'url-path'; export function encodeField(s) { return encodeURIComponent(s.replace(/-/g, '--').replace(/_/g, '__')); @@ -6,7 +6,7 @@ export function encodeField(s) { export default function staticBadgeUri(baseUri, subject, status, color, options) { const path = [subject, status, color].map(encodeField).join('-'); - const uri = new URL(`/badge/${path}.svg`, baseUri); + const uri = new URLPath(`/badge/${path}.svg`, baseUri); Object.keys(options || {}).forEach(k => { uri.searchParams.set(k, options[k]); }) diff --git a/frontend/lib/url-api.js b/frontend/lib/url-api.js deleted file mode 100644 index b2f13bf2cbad8..0000000000000 --- a/frontend/lib/url-api.js +++ /dev/null @@ -1,8 +0,0 @@ -if (typeof window === 'undefined') { - module.exports = require('url'); -} else { - module.exports = { - URL: window.URL, - URLSearchParams: window.URLSearchParams, - }; -} diff --git a/package-lock.json b/package-lock.json index 2ae570f832a2d..103ac919456b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -245,6 +245,21 @@ } } }, + "JSONSelect": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", + "integrity": "sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40=" + }, + "JSONStream": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", + "integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", + "dev": true, + "requires": { + "jsonparse": "1.3.1", + "through": "2.3.8" + } + }, "abab": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", @@ -2670,8 +2685,8 @@ "integrity": "sha512-8od6g684Fhi5Vpp4ABRv/RBsW1AY6wSHbJHEK6FGTv+8jvAAnlABniZu/FVmX9TcirkHepaEsa1QGkRvbg0CKw==", "dev": true, "requires": { - "is-text-path": "1.0.1", "JSONStream": "1.3.1", + "is-text-path": "1.0.1", "lodash": "4.17.4", "meow": "3.7.0", "split2": "2.2.0", @@ -5237,15 +5252,6 @@ } } }, - "string_decoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", - "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", - "dev": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -5257,6 +5263,15 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", + "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", + "dev": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -6548,12 +6563,12 @@ "resolved": "https://registry.npmjs.org/jison/-/jison-0.4.13.tgz", "integrity": "sha1-kEFwfWIkE2f1iDRTK58ZwsNvrHg=", "requires": { + "JSONSelect": "0.4.0", "cjson": "0.2.1", "ebnf-parser": "0.1.10", "escodegen": "0.0.21", "esprima": "1.0.4", "jison-lex": "0.2.1", - "JSONSelect": "0.4.0", "lex-parser": "0.1.4", "nomnom": "1.5.2" }, @@ -6805,21 +6820,6 @@ "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", "dev": true }, - "JSONSelect": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", - "integrity": "sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40=" - }, - "JSONStream": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", - "integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", - "dev": true, - "requires": { - "jsonparse": "1.3.1", - "through": "2.3.8" - } - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -11852,11 +11852,6 @@ "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, "string-hash": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.1.tgz", @@ -11899,6 +11894,11 @@ } } }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -12686,6 +12686,12 @@ } } }, + "url-path": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/url-path/-/url-path-0.1.1.tgz", + "integrity": "sha512-DQByXz6WBWMHVlRRuSgJrW/UYPFAyGnBTpeSB4LWN5iGe7sVuUEQsh3j9Wh34T+6l4Ftyy9ezbme1nY2jvRUEg==", + "dev": true + }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", diff --git a/package.json b/package.json index efa3b74cfc72c..29a1b08d80132 100644 --- a/package.json +++ b/package.json @@ -124,10 +124,11 @@ "rimraf": "^2.6.2", "sazerac": "^0.4.2", "semver-regex": "^1.0.0", - "sinon": "^4.0.1" + "sinon": "^4.0.1", + "url-path": "^0.1.1" }, "engines": { - "node": "6.x", + "node": "8.x", "npm": "5.x" } } diff --git a/public/_next b/public/_next new file mode 120000 index 0000000000000..f77deb55cea60 --- /dev/null +++ b/public/_next @@ -0,0 +1 @@ +../build/_next \ No newline at end of file diff --git a/public/index.html b/public/index.html index 79c5d6f02c996..e615c7b28652a 120000 --- a/public/index.html +++ b/public/index.html @@ -1 +1 @@ -../index.html \ No newline at end of file +../build/index.html \ No newline at end of file diff --git a/public/logo.svg b/public/logo.svg deleted file mode 120000 index b70ce767f0d4a..0000000000000 --- a/public/logo.svg +++ /dev/null @@ -1 +0,0 @@ -../logo.svg \ No newline at end of file diff --git a/public/static b/public/static new file mode 120000 index 0000000000000..70f6e5fb7c980 --- /dev/null +++ b/public/static @@ -0,0 +1 @@ +../build/static \ No newline at end of file