Commit graph

49 commits

Author SHA1 Message Date
Matthew Taylor
ce9b3561f2 use custom-defined internal separator
There is some stacking that happens in object keys that had been using the `-` to track language/view hierarchies, which was thrown off by view names that used a `-` in them. Switch to using `:`, and also make it customizable. Fixes #655
2016-07-01 14:27:41 -04:00
Matthew Taylor
dfc4f9574d use route aliases for generalizable route patterns
1. match all `^/explore` to www
2. match all `^/search` to www
3. match all `^/conference` to www
2016-06-14 11:28:20 -04:00
Ray Schamp
e323cbbb9f Terminate view.html rewrite rule
Otherwise anything with html in the path matches. Fixes #527
2016-05-31 09:38:13 -04:00
Ray Schamp
19758f3901 Merge pull request #521 from rschamp/bugfix/cache-condition
[Release] Fix cache condition request
2016-05-27 14:10:33 -04:00
Ray Schamp
ca97838695 Fix cache condition request
The response from the request condition includes fields we don't want to send up with the cache condition
2016-05-27 13:50:13 -04:00
Matthew Taylor
affec666d2 Use the condition statement for the error log 2016-05-26 19:51:57 -04:00
Matthew Taylor
1f25fec353 Add condition to errors for fastly config 2016-05-26 19:41:03 -04:00
Ray Schamp
8ded5cb267 Always use regex form of route patterns
When talking to Fastly, don't ever use an express-style url pattern for consistency, and so we don't use : characters in condition names.
2016-05-20 10:33:13 -04:00
Matthew Taylor
cf2165d295 Merge pull request #497 from mewtaylor/feature/conference-schedule
Feature: conference schedule page
2016-05-19 18:04:04 -04:00
Matthew Taylor
d69de477a1 Merge branch 'develop' of https://github.com/LLK/scratch-www into feature/conference-schedule
* 'develop' of https://github.com/LLK/scratch-www: (32 commits)
  Lint
  Bundle all locale data
  Don't bundle polyfills
  Set up Raven within init.js
  Prefix privacyPolicy message string
  Exclude minified javascript from linting
  One space more
  Changes "interfacesto" to "interfaces to"
  Remove tag target
  Filter before mapping to avoid returning undefined
  Fix Pass condition for "static" routes
  Spacing2
  Mangling is the default
  Spacing
  Update for typography fixes
  Cherry pick PR #476 into master
  Add invisible spacer to anchored sections
  For Developers
  Lint JSON, expand and simplify lint step
  Fix banned user redirect
  ...

# Conflicts:
#	src/redux/actions.js
#	src/redux/reducer.js
2016-05-19 13:25:36 -04:00
Matthew Taylor
1e57262771 Add fastly rule for express uri patterns
convert path variables in express (i.e. dev-server) into rules that work for fastly (i.e. `.+?`). I tried to make it `\w+?`, but javascript seemed to either want no `\`'s or two `\`'s
2016-05-19 11:36:03 -04:00
Matthew Taylor
4165132a3e use more descriptive variable names in loops
thanks @rschamp!
2016-05-19 10:43:25 -04:00
Matthew Taylor
fa566ac140 Fix tests, and make error check specific
Since it's using `require` to get the localisation strings, check if the error is `MODULE_NOT_FOUND` before moving on – because if it isn't, then there is an unknown error that should be thrown. Thanks @rschamp for the suggestion!
2016-05-19 06:56:45 -04:00
Matthew Taylor
1f871e7cf1 Use routes.json to get localization paths
Before we were using glob, which was about to start failing on subdirectories in views (which we started using in `conference`). Instead of searching for `l10n.json`, it seemed more appropriate to instead look for localization by using the configured pages that need to be localized.
2016-05-18 09:49:49 -04:00
Ray Schamp
ca546552b9 Filter before mapping to avoid returning undefined
If the map function doesn't return anything, the added item is undefined. Avoid this by filtering the array before mapping.
2016-05-17 13:49:03 -04:00
Ray Schamp
bb70629b6b Fix Pass condition for "static" routes
Previously we relied on the static directory to construct the pass condition, but this doesn't include many things added to the build other than static files. So instead of adding these explicitly through `extraAppRoutes`, base the Pass condition on the final build, but exclude the view .html files. This way the version.txt, routes.json, and all directories added by webpack will be resolved to S3 rather than scratchr2.
2016-05-17 12:20:45 -04:00
Ray Schamp
fce7c0cd9b Purge all after configuring Fastly 2016-04-29 15:52:16 -04:00
Ray Schamp
dd1c2c1627 Use s3cmd to sync with S3 2016-04-29 15:52:15 -04:00
Ray Schamp
62ff7f615a Remove deleted files from S3 on build 2016-04-28 17:07:11 -04:00
Ray Schamp
fbaa2d2ed9 Consolidate pass condition to one req.url~ check 2016-04-28 14:18:42 -04:00
Ray Schamp
a08f56230a Raise priority of rewrite conditions
This avoids a situation where going to http://staging.scratch.mit.edu/hoc will redirect to https://staging.scratch.mit.edu/hoc.html.
2016-04-27 15:27:45 -04:00
Ray Schamp
39063ae76c End static directories with / in Pass condition
Otherwise, any URL beginning with static path names go to S3.
2016-04-25 14:32:52 -04:00
Ray Schamp
19a0ed3f4b Remove spaces from condition
This condition exceeded 512 characters. We will have to rethink how to construct this.
2016-04-22 09:54:14 -04:00
Matthew Taylor
bf1a99fd63 use route name now with updated strucutre
Thanks @rschamp for this!
2016-04-21 18:16:49 -04:00
Ray Schamp
b8bfe46890 Configure redirect routes in Fastly 2016-04-19 18:42:03 -04:00
Ray Schamp
ff70324fb5 Use s3 module to deploy to S3 2016-04-19 16:35:51 -04:00
Ray Schamp
494085247d Activate after configuring Fastly 2016-04-19 13:04:45 -04:00
Ray Schamp
f90adfcadb Be explicit, direct app requests to S3 2016-04-19 10:50:57 -04:00
Ray Schamp
303b5c44a8 Lint bin subdirectories 2016-04-19 10:47:33 -04:00
Ray Schamp
eb5edc293d Linting 2016-04-18 14:07:27 -04:00
Ray Schamp
43788eb7d8 Split server and routes/config
Turn HtmlGeneratorPlugin into a module
Turn server into dev-server and simplify it
2016-04-18 14:07:11 -04:00
Ray Schamp
707af8dbe9 Use async.auto to make dependencies clearer
Thanks @thisandagain — now I know why you said async.auto is so awesome.

Also throw the error so we get a stacktrace, and make the bucket name and service ID into constants.
2016-04-18 13:23:23 -04:00
Ray Schamp
32611c9cba Fix rewrite priority
The order of the rewrite conditions needs to be internally consistent so we can control specificity with routes.json
2016-04-16 14:08:53 -04:00
Ray Schamp
c6abc2ae7b Fix cache_settings request 2016-04-16 14:05:16 -04:00
Ray Schamp
ab0979b958 Add docstrings 2016-04-16 13:46:03 -04:00
Ray Schamp
5846dcacc8 Use constants instead of functions for strings 2016-04-16 13:01:39 -04:00
Ray Schamp
0aa9b7c587 Untangle the requests a bit with help from async 2016-04-16 12:49:48 -04:00
Ray Schamp
87da93f9ea Move some fastly-specific stuff into a module 2016-04-16 10:17:20 -04:00
Ray Schamp
de5f36b649 Add script for configuring Fastly for S3
* Builds the Pass condition based on the static directory and view routes.
* Updates Fastly with new header and conditions based on the view routes.
* Uses a nice module for interacting with fastly :)

Needs some major cleanup but it works. Hopefully Travis will work too.
2016-04-15 19:42:57 -04:00
Matthew Taylor
b903067658 Update the cards with new grouped structure 2016-03-23 16:37:15 -04:00
Matthew Taylor
5d693ed53d Add /info/cards/ route
Also implements a method for handling translation of static files as described in https://github.com/LLK/scratch-www/issues/372#issuecomment-193350144
2016-03-23 16:37:15 -04:00
Matthew Taylor
c448b15dd4 Refactor build-locales a bit
This makes a couple of procedure-specific parts into methods in `locale-compare`, so that they can be tested more readily.
2016-03-23 08:22:09 -04:00
Matthew Taylor
3c2fec42f2 Only catch the ENOENT error
The catch there before is meant to just continue if it comes across a file that doesn't exist (in which case the language will default to english). However, it was not specific enough – now, it only catches the error if the file doesn't exist, and throws anything else, preveting a build.
2016-03-22 16:25:05 -04:00
Matthew Taylor
1ad1380eff simplify to one loop
thanks @rschamp!
2016-01-22 10:16:18 -05:00
Matthew Taylor
a0d92dacfc Add general localizations to nonlocalized pages
For nav/footer purposes.
2016-01-19 15:52:42 -05:00
Matthew Taylor
4f704a3a4b Make error output optional for filestream 2016-01-14 08:14:38 -05:00
Matthew Taylor
ceec694b2a Revert "Migrate to using a loader method"
This reverts commit 214430b0c4.
2016-01-08 13:50:58 -05:00
Matthew Taylor
214430b0c4 Migrate to using a loader method
This moves all locale/translation building to a dependency, `scratch-www-intl-loader`, as well as tests associated with it. Also gets rid of the `make translations` step.
2016-01-07 17:01:57 -05:00
Matthew Taylor
8ae98d703f Make localizations view-based
1. Load locale strings into `window._messages` in a separate file added to `template.html`, which contains view-specific and general strings
2. Update build-locales to compile separate files
2016-01-06 14:09:32 -05:00