Commit Graph

54 Commits

Author SHA1 Message Date
Paul Melnikow
ae37e9b723 Add a diagnostic page for testing logos (#2890)
It can be helpful to have some diagnostic pages for development and quality control. I added one here for the logos, which renders all the named logos in ?style=flat and ?style=social.
2019-02-08 00:08:45 -05:00
Paul Melnikow
9070570a39 Update deploy script for Gatsby deploy (#2944)
Knock on wood, that deploy went remarkably well. 👔
2019-02-07 00:59:33 -05:00
Paul Melnikow
d8ce045ead Adopt Gatsby (#2906)
While Next.js can handle static sites, we've had a few issues with it, notably a performance hit at runtime and some bugginess around routing and SSR. Gatsby being fully intended for high-performance static sites makes it a great technical fit for the Shields frontend. The `createPages()` API should be a really nice way to add a page for each service family, for example.

This migrates the frontend from Next.js to Gatsby. Gatsby is a powerful tool, which has a bit of downside as there's a lot to dig through. Overall I found configuration easier than Next.js. There are a lot of plugins and for the most part they worked out of the box. The documentation is good.

Links are cleaner now: there is no #. This will break old links though perhaps we could add some redirection to help with that. The only one I’m really concerned about `/#/endpoint`. I’m not sure if folks are deep-linking to the category pages.

There are a lot of enhancements we could add, in order to speed up the site even more. In particular we could think about inlining the SVGs rather than making separate requests for each one.

While Gatsby recommends GraphQL, it's not required. To keep things simple and reduce the learning curve, I did not use it here.

Close #1943 
Fix #2837 Fix #2616
2019-02-06 16:37:55 -05:00
Paul Melnikow
3a7bddbc26 Consolidate service definition schema, removing support for previewUrl (#2895)
This removes `LONG_CACHE` and its descendants, which was a feature that added `?maxAge` to the live preview badges in the frontend. Since they are all static that is no longer needed, as the static badges all have longer cache timeouts regardless.
2019-01-30 18:35:11 -06:00
Paul Melnikow
47bb03572b Set redirectUrl for production; rely on NODE_CONFIG_ENV being set earlier (#2656) 2019-01-06 12:56:26 -05:00
Paul Melnikow
bc0be4f619 Fixes for config update (#2655)
Ref #2626 #2654
2019-01-06 12:23:58 -05:00
Paul Melnikow
fa5309400d PaaS, CI, and production-friendly config (#2626)
This implements the configuration mechanism I described in #2621. The heavy lifting is delegated to [node-config](https://github.com/lorenwest/node-config) with a minor assist from [dotenv](https://github.com/motdotla/dotenv).

`private/secret.json` has been replaced with environment variables and/or `config/local.yml`. See `doc/server-secrets.md`.
2019-01-06 10:42:09 -05:00
Paul Melnikow
a7efd88ceb Revert to standard CI image and remove lingering references to fonts (#2326)
Follow-on to #2311.
2018-11-18 09:08:23 -05:00
chris48s
b68ac16092 Move NPM package files out of /lib ; affects [resharper nuget myget dub chocolatey github] (#2300)
* move gh-badges files out of /lib

As far as possible, this is just moving files
around and updating paths however there are 2
functional changes in this commit:
- remove use of lib/register-chai-plugins.spec
  in badge-cli.spec.js
- remove use of starRating()
  in text-measurer.spec.js

* update service tests that use colorscheme.json

* split package.json in two

* clean up import

* don't hard-code path

* start a changelog

* put a license file in the package dir

* re-organise documentation 📚

* don't pack test files

* remove favicon from Makefile

* give package its own test command

* link the docs better in README
2018-11-15 18:48:01 +00:00
Paul Melnikow
94611fb0e4 Rewrite server deploy script (#1793)
To run this requires renaming `private/secret.json` to `private/secret-production.json` in the working tree used for deployment.

Goals:

- Ensure production secrets are not used in development
- Avoid modifying the current working tree
- Avoid branch switching: make sure the current ref gets deployed
    - If something other than `master` is deployed, leave `HEAD` alone; don't reset to `master`
- Ensure the build runs before server deploy (#1941)

This makes use of Git working trees, which is a relatively new but stable feature in Git. I was initially reluctant to use git worktree, mostly because I don't like adding new tooling that isn't necessary. The other alternative I experimented with was copying or re-cloning to an entirely separate working copy. This was messier and more brittle than using `git worktree`.
2018-10-30 17:08:52 -04:00
Paul Melnikow
a16d436602 Optionally persist [Github] tokens in Redis (#1939)
This is a fairly simple addition of a Redis-backed TokenPersistence. When GithubConstellation is initialized, it will create a FsTokenPersistence or a RedisTokenPersistence based on configuration. Have added tests of the Redis backend as an integration test, and ensured the server starts up correctly when a `REDIS_URL` is configured.

Ref: #1848
2018-08-19 10:27:23 -04:00
Paul Melnikow
e39b280d44 Fixes for github deploy (#1774)
This addresses some long-standing comments in https://github.com/badges/shields/issues/1458#issuecomment-368270996

We should also adopt Gatsby, create-react-app, or something similar designed for static sites, to eliminate the unnecessary runtime dependency on Next.js while also letting someone else maintain our front-end tooling. :-D These alternative tools might work just fine in subdirectories without config, and we might be able to leave Jekyll turned on (though we don’t need it). However these git-related changes are orthogonal.

- Don’t check out master, making it possible to deploy the currently checked-out commit
- Disable Jekyll which we don’t need. This allows _next folders to be deployed, and the related URL rewriting to be removed.
- Completely empty the deploy branch’s index before deployment. This prevents errors from broken symlinks, while preserving the commit history in the deploy branch.
- Do the deployment work in a git working tree. This requires Git 2.18 but makes it possible to do the above very safely.
2018-07-18 19:46:27 -07:00
Thaddee Tyl
0ae322b524 Commit index.html and _next on gh-page deployment
Fixes #1458.
2018-02-25 01:14:26 +01:00
Thaddee Tyl
36a22549e5 Add build folder for gh-pages deployment
Fixes #1458.
2018-02-25 01:14:26 +01:00
Paul Melnikow
2be271c22b Frontend: Allow BASE_URL to be unset (#1306)
- Do not use bogus `'undefined'` as base URI
2017-12-01 16:34:31 -05:00
Paul Melnikow
c5e31b5de1 Fix frontend deploy and Heroku staging (#1288)
- Heroku reads the Node version from package.json. We're about to upgrade to Node 8 so this change to `engines` is only pre-emptive. It won't have any effect on the production servers.
- The production deploy scripts were missing the frontend files. This fixes that.
- This modifies the build setup to allow `BASE_URL=/`, which makes all requests relative to the page itself. That simplifies deploying the "debugging" frontend to the production servers, and makes it easy to host the frontend on Heroku.
2017-11-29 17:59:01 -05:00
Paul Melnikow
4b5bf03fea Rewrite frontend in React (#1273)
I rewrote the frontend in React using a module bundler. It's matched feature-for-feature with the current frontend, with only slight changes in the styling. I did not fuss about making the styling identical; the badge popup looks particularly different.

This makes the front end much easier to develop. I'm really looking forward to implementing #701, to which this paves the way.

This makes light use of Next.js, which provides webpack config and dev/build tooling. We’ll probably replace it with create-react-app or our own webpack setup because unfortunately it comes with a lot of runtime overhead (the build is 400k).

Let’s open new issues for bugs and features, and track other follow-ups here: https://github.com/badges/shields/projects/1
2017-11-28 11:34:17 -05:00
Paul Melnikow
a2f5cbb03a Push frontend to production servers at /index.html (#1222)
* Push frontend to production servers at /index.html

Local production builds will use local server instead of img.shields.io, to support local testing

* Restore https://img.shields.io to example URIs
2017-11-01 20:48:01 +01:00
Paul Melnikow
91eaa2958c Move gh-badges CLI into lib/ 2017-10-30 21:46:50 -04:00
Paul Melnikow
bde4d925f2 Retire try.html and create new dev + prod builds (#1194)
- Followup from #1163
- Retire try.html
- Separate build config for dev and production
    - Move config for badge examples into the JS build
- Move the prod transform into npm scripts
    - In the future this could be handled using a bundler plugin
- make website builds production build as before
- Run the production build in CI to make sure it’s working
- Build the frontend on Heroku
2017-10-28 14:02:45 -04:00
Paul Melnikow
ef86288eab Fix production build for quoting style of generated frontend
The quoting style chnaged in b411f08.

This is to fix the production build, in which image links were all broken because they pointed to shields.io instead of img.shields.io.
2017-10-22 09:39:09 -04:00
Paul Melnikow
b411f08ad1 Generate badge examples from data + code (#1163)
This pull request sets us up to generate the badge examples dynamically from data and code.

Right now, try.html is still checked in, mostly for the benefit of reading this diff, though it should be removed on the next pass to avoid unnecessary complexity at merge time.
2017-10-20 17:33:12 -04:00
Paul Melnikow
cca46b7e94 Generate index.html only on gh-pages when deploying
- Build index.html at deploy time
- Update corresponding documentation references
- Since index.html is untracked, git add needs -f
- Clarify gh-pages generated commit message
- Improve Makefile dependencies related to website generation

As discussed in #936, tracking the index.html causes makes PRs longer / noisier
and causes extra merge conflicts. More importantly, it causes contributors to
inadvertently edit the wrong file, which causes extra work (#949) or
contributions to be lost (#898).

Since there's no need for index.html in development (everything uses try.html) a
logical solution is to generate and commit the index.html at deploy time.

Recording compiled or generated files in a deploy commit is a reasonable
practice for git-based deploys (Heroku, gh-pages, and others).

The old version of this was slightly "unsafe" for my taste, in that it depended
on the local copy of gh-pages (if it existed) and master. The new version just
replaces gh-pages with master + the new commit.

Closes #936.

Fixes #954 (the PR).
2017-04-25 23:40:08 +02:00
Thaddee Tyl
982bcf62aa Add s2 server
Part of #868.
2017-02-13 00:54:23 +01:00
Thaddee Tyl
7c8b0e3d32 Contain all private files in private/ 2017-02-05 16:24:35 +01:00
Thaddee Tyl
3cf2a3ae52 make website: support both Linux and macOS 2016-08-13 20:54:32 +02:00
Thaddee Tyl
bfcdc4af1d make website: use macOS' sed -E 2016-08-12 20:50:15 +02:00
Thaddee Tyl
89401b13af make website: output newline on macOS' sed 2016-08-09 19:11:01 +02:00
Thaddee Tyl
08d3be0a28 website: detect query string when adding HTTP caching
Related to 89affa49fe.
Closes #639, #691, #697.
2016-04-26 09:46:50 +02:00
Thaddee Tyl
89affa49fe website: use heavy HTTP caching
This will hopefully help a bit for #633.
2016-04-10 13:43:00 +02:00
Thaddee Tyl
d1a962152d Support the new server 2016-02-08 20:27:17 +01:00
Thaddee Tyl
7443648063 Remove dead make entries 2015-11-07 17:55:33 +01:00
Thaddee Tyl
3bb0d92b2c Deploy vs. Deploy Heroku 2015-09-12 15:34:04 +02:00
Thaddee Tyl
f204d4a21e Prepare new server deploy script 2015-07-07 09:26:23 +02:00
Thaddee Tyl
a3f36176e0 Uppercase the "generated" warning in index.html 2015-03-24 09:02:03 +01:00
Thaddee Tyl
9d8b3cfc1e Change ajax domain request. 2015-01-08 19:22:31 +01:00
Thaddee Tyl
abbd893e2e use https for images and in the dialog
Closes #329
2014-12-19 15:57:49 +01:00
Thaddee Tyl
9cba12c11b website: use https on badge examples
Closes #329
2014-12-19 15:40:01 +01:00
Thaddee Tyl
ed68a39956 fix make favicon 2014-11-21 23:54:36 +01:00
Thaddee Tyl
f45ba3f8d1 make test
See #269
2014-09-27 23:16:45 +02:00
Thaddee Tyl
32435e8fc0 website: Mention that it is generated. 2014-08-21 22:50:13 +02:00
Thaddee Tyl
2f12470c2d Use GitHub OAuth apps to increase rate limits. 2014-06-02 23:28:54 +02:00
Thaddee Tyl
00caf7bb12 Force a gh-pages update. 2014-05-30 21:17:45 +02:00
Thaddee Tyl
5685238956 Using Redis to store analytics on Heroku. 2014-04-07 23:29:30 +00:00
Thaddee Tyl
2d99c5b232 [deploy] force add the font file. 2014-03-04 13:57:43 +01:00
Thaddee Tyl
300b0688c2 [website] Make the widget work on localhost. 2014-02-26 13:34:59 +01:00
Thaddee Tyl
556f2aae0c Deploy includes uploading the new website. 2014-02-26 11:17:28 +01:00
Thaddee Tyl
b0a16af913 Omit old files. 2014-02-19 13:46:27 +01:00
Thaddee Tyl
109a437d0a try.html for testing, index.html generated. 2014-02-15 22:42:25 +01:00
Thaddee Tyl
b888feb353 makefile: phony favicon. 2014-01-19 13:56:25 +01:00