Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #1801, combine configure-raven.js with the raven.js client, into …
Browse files Browse the repository at this point in the history
…/install-raven.js

Load raven via require() instead of a direct link.  Remove the now-unneeded static/vendor/ directory, and Makefile rules related to it
  • Loading branch information
ianb committed Nov 1, 2016
1 parent 6db660d commit 6841236
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ static_addon_dest := $(static_addon_source:%=build/%)
static_js_source := $(wildcard static/js/*.js)
static_js_dest := $(static_js_source:%.js=build/server/%.js)

static_vendor_source := $(shell find -L static/vendor -type f)
static_vendor_dest := $(static_vendor_source:%=build/server/%)

lib_source := $(wildcard addon/lib/*.js)
lib_dest := $(lib_source:%.js=build/%.js)

Expand Down Expand Up @@ -74,10 +71,6 @@ build/addon/data/vendor/%.js: addon/data/vendor/%.js
@mkdir -p $(@D)
cp $< $@

build/server/static/vendor/%: static/vendor/%
@mkdir -p $(@D)
cp $< $@

build/server/static/homepage/%.js: static/homepage/%.js
@mkdir -p $(@D)
cp $< $@
Expand Down Expand Up @@ -253,7 +246,7 @@ build/server/export-shots.sh: server/src/export-shots.sh
# The intention here is to only write build-time when something else needs
# to be regenerated, but for some reason this gets rewritten every time
# anyway:
build/server/build-time.js: homepage $(server_dest) $(shared_server_dest) $(sass_server_dest) $(imgs_server_dest) $(static_js_dest) $(static_vendor_dest) build/server/export-shots.sh $(patsubst server/db-patches/%,build/server/db-patches/%,$(wildcard server/db-patches/*))
build/server/build-time.js: homepage $(server_dest) $(shared_server_dest) $(sass_server_dest) $(imgs_server_dest) $(static_js_dest) build/server/export-shots.sh $(patsubst server/db-patches/%,build/server/db-patches/%,$(wildcard server/db-patches/*))
@mkdir -p $(@D)
./bin/build-scripts/write_build_time > build/server/build-time.js

Expand Down
3 changes: 1 addition & 2 deletions server/src/reactruntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ exports.HeadTemplate = class HeadTemplate extends React.Component {
<link rel="shortcut icon" href={this.props.staticLink("/static/img/pageshot-icon-32.png")} />
{ analyticsScript }
{ activationScript }
{ this.props.sentryPublicDSN ? <script src={ this.props.staticLink("/static/vendor/raven.js") } /> : null }
{ this.props.sentryPublicDSN ? <script src={this.props.staticLink("/configure-raven.js")} /> : null }
{ this.props.sentryPublicDSN ? <script src={this.props.staticLink("/install-raven.js")} /> : null }
{this.props.children}
</head>
);
Expand Down
6 changes: 5 additions & 1 deletion server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ app.get("/parent-helper.js", function (req, res) {
jsResponse(res, script);
});

app.get("/configure-raven.js", function (req, res) {
const ravenClientJs = readFileSync(require.resolve("raven-js/dist/raven.min"), {encoding: "UTF-8"});

app.get("/install-raven.js", function (req, res) {
setCache(res);
if (! req.config.sentryPublicDSN) {
jsResponse(res, "");
Expand All @@ -266,6 +268,8 @@ app.get("/configure-raven.js", function (req, res) {
// FIXME: this monkeypatch is because our version of Raven (6.2) doesn't really work
// with our version of Sentry (8.3.3)
let script = `
${ravenClientJs}
(function () {
var old_captureException = Raven.captureException.bind(Raven);
Raven.captureException = function (ex, options) {
Expand Down
1 change: 0 additions & 1 deletion static/vendor/raven.js

This file was deleted.

0 comments on commit 6841236

Please sign in to comment.