Goodbye JSPM.

This commit is contained in:
Jonathan Cremin 2018-06-02 19:42:45 +00:00
parent 7607759e3f
commit 64c823db55
10 changed files with 1235 additions and 593 deletions

View file

@ -11,7 +11,7 @@ RUN yarn
COPY . .
RUN yarn run jspm && yarn run build
RUN yarn run build
ENV PORT 3000
EXPOSE 3000

7
app.js
View file

@ -13,6 +13,7 @@ import debugname from 'debug';
import * as redis from './lib/redis';
import api, { ws } from './api/app';
import web from './web/app';
import { isContext } from 'vm';
const debug = debugname('hostr');
@ -23,11 +24,11 @@ if (process.env.SENTRY_DSN) {
Raven.config(process.env.SENTRY_DSN);
Raven.install();
app.use(async (ctx, next) => {
this.Raven = Raven;
ctx.Raven = Raven;
await next();
});
app.ws.use(async (ctx, next) => {
this.Raven = Raven;
ctx.Raven = Raven;
await next();
});
}
@ -37,7 +38,7 @@ app.use(helmet());
app.use(async (ctx, next) => {
ctx.set('Server', 'Nintendo 64');
if (ctx.req.headers['x-forwarded-proto'] === 'http') {
ctx.redirect(`https://${this.req.headers.host}${this.req.url}`);
ctx.redirect(`https://${ctx.req.headers.host}${ctx.req.url}`);
return;
}
try {

View file

@ -9,23 +9,27 @@
},
"scripts": {
"build": "npm run build-js && npm run build-sass",
"build-js": "babel -D -m system -d web/public/build -i web/public web/public/src",
"build-sass": "node-sass -r -o web/public/styles/ web/public/styles/",
"build-js": "webpack --progress -p -c webpack.config.js",
"build-sass": "node-sass --include-path ./node_modules/ -r -o web/public/styles/ web/public/styles/",
"cover": "istanbul cover _mocha -- -r babel-register test/**/*.spec.js",
"heroku-postbuild": "jspm install && npm run build",
"heroku-postbuild": "npm run build",
"init": "babel-node -e \"require('./lib/storage').default();\"",
"initdb": "node -r babel-register test/initdb.js",
"jspm": "jspm install",
"lint": "eslint .",
"start": "node -r babel-register app.js",
"test": "npm run test-seed && mocha -r babel-register test/**/*.spec.js",
"test-seed": "babel-node test/fixtures/user.js",
"watch": "concurrently -k -n watch-js,watch-server \"npm run watch-js\" \"npm run watch-server\"",
"watch-js": "babel -Dw -m system -d web/public/build web/public/src",
"watch-js": "webpack --mode=development --progress -c webpack.config.js",
"watch-server": "nodemon -r babel-register -i web/public",
"watch-sass": "node-sass -w -r -o web/public/styles/ web/public/styles/"
"watch-sass": "node-sass --include-path ./node_modules/ -w -r -o web/public/styles/ web/public/styles/"
},
"dependencies": {
"angular": "^1.5.6",
"angular-reconnecting-websocket": "https://github.com/adieu/angular-reconnecting-websocket#0.1.1",
"angular-resource": "^1.5.6",
"angular-route": "^1.5.6",
"angular-strap": "^2.3.8",
"async-busboy": "^0.6.2",
"aws-sdk": "^2.245.1",
"babel": "^6.5.2",
@ -35,18 +39,21 @@
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-register": "^6.9.0",
"basic-auth": "~2.0.0",
"bootstrap-sass": "^3.3.6",
"busboy": "^0.2.14",
"co": "~4.6.0",
"co-redis": "^2.1.0",
"co-views": "~2.1.0",
"copy-webpack-plugin": "^4.5.1",
"debug": "~3.1.0",
"dropzone": "~4.0.1",
"ejs": "^2.6.1",
"form-data": "^2.3.2",
"http-errors": "^1.6.3",
"image-size": "^0.6.2",
"image-type": "^3.0.0",
"jimp": "0.2.28",
"jspm": "0.16.53",
"jquery": "^2.2.4",
"kcors": "^2.2.1",
"koa": "^2.5.1",
"koa-bodyparser": "^4.2.1",
@ -77,11 +84,14 @@
"redis": "^2.8.0",
"sendgrid": "^5.2.3",
"sequelize": "^4.37.10",
"ssh2": "^0.6.1",
"smooth-scroll": "https://github.com/cferdinandi/smooth-scroll#5.3.7",
"statsy": "~0.2.0",
"stripe": "^6.0.0",
"swig": "~1.4.2",
"validate-ip": "^1.0.1"
"validate-ip": "^1.0.1",
"webpack": "^4.10.2",
"webpack-cli": "^3.0.1",
"zeroclipboard": "^2.2.0"
},
"devDependencies": {
"babel-eslint": "^8.2.3",
@ -94,31 +104,5 @@
"nodemon": "^1.17.4",
"supertest": "^3.1.0",
"tmp": "0.0.33"
},
"jspm": {
"directories": {
"baseURL": "web/public"
},
"dependencies": {
"angular": "npm:angular@^1.5.6",
"angular-reconnecting-websocket": "github:adieu/angular-reconnecting-websocket@~0.1.1",
"angular-strap": "npm:angular-strap@^2.3.8",
"angular/resource": "npm:angular-resource@^1.5.6",
"angular/route": "npm:angular-route@^1.5.6",
"bootstrap-sass": "npm:bootstrap-sass@^3.3.6",
"cferdinandi/smooth-scroll": "github:cferdinandi/smooth-scroll@~5.3.7",
"dropzone": "npm:dropzone@~4.0.1",
"jquery": "npm:jquery@^2.2.4",
"zeroclipboard": "npm:zeroclipboard@^2.2.0"
},
"devDependencies": {
"babel": "npm:babel-core@^5.8.24",
"babel-runtime": "npm:babel-runtime@^5.8.24",
"core-js": "npm:core-js@^1.1.4"
}
},
"cacheDirectories": [
"node_modules",
"web/public/jspm_packages"
]
}
}

View file

@ -1,7 +1,7 @@
import angular from 'angular';
import 'angular/route';
import 'angular/resource';
import 'angular-reconnecting-websocket';
import 'angular-route';
import 'angular-resource';
import 'angular-reconnecting-websocket/angular-reconnecting-websocket';
import 'angular-strap/dist/modules/dimensions';
import 'angular-strap/dist/modules/compiler';
import 'angular-strap/dist/modules/tooltip';

View file

@ -6,7 +6,7 @@ html, body {
height: 100%;
}
$icon-font-path: "../jspm_packages/npm/bootstrap-sass@3.3.6/assets/fonts/bootstrap/";
$icon-font-path: "bootstrap-sass/assets/fonts/bootstrap/";
// MAIN VARIABLES
$body-bg: #ededf3;
@ -33,7 +33,7 @@ $nav-pills-active-link-hover-color: $brand-primary;
$tooltip-bg: $brand-primary !default;
@import '../jspm_packages/npm/bootstrap-sass@3.3.6/assets/stylesheets/bootstrap';
@import 'bootstrap-sass/assets/stylesheets/bootstrap';
$throbber-color: #96d4a1 !default;
$throbber-highlight-color: #39b54a !default;

View file

@ -10,7 +10,7 @@ body {
min-height: 100%;
}
$icon-font-path: "../jspm_packages/npm/bootstrap-sass@3.3.6/assets/fonts/bootstrap/";
$icon-font-path: "bootstrap-sass/assets/fonts/bootstrap/";
// MAIN VARIABLES
$body-bg: #0d0d1a;
@ -44,7 +44,7 @@ $nav-link-hover-bg: rgba(255,255,255,0);
// bower: scss
@import '../jspm_packages/npm/bootstrap-sass@3.3.6/assets/stylesheets/bootstrap';
@import 'bootstrap-sass/assets/stylesheets/bootstrap';
// endbower
html,
body {

View file

@ -97,10 +97,7 @@
};
</script>
<% } %>
<script src='/jspm_packages/system-polyfills.js'></script>
<script src='/jspm_packages/system.js'></script>
<script src='/config.js'></script>
<script>System.import('/build/app');</script>
<script src="/build/bundle.js"></script>
<script src="https://checkout.stripe.com/checkout.js"></script>
</body>
</html>

13
webpack.config.js Normal file
View file

@ -0,0 +1,13 @@
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
entry: './web/public/src/app.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'web', 'public', 'build')
},
plugins: [
new CopyWebpackPlugin([{ from: './web/public/src/partials', to: 'partials' }])
]
};

View file

@ -1,11 +1,11 @@
import co from 'co';
import kue from 'kue';
import raven from 'raven';
import Raven from 'raven';
import debuglog from 'debug';
const debug = debuglog('hostr:worker');
raven.config(process.env.SENTRY_DSN).install();
Raven.config(process.env.SENTRY_DSN).install();
const queue = kue.createQueue({
redis: process.env.REDIS_URL,
@ -16,7 +16,7 @@ function store(data, done) {
}).catch((err) => {
debug(err);
raven.captureException(err);
Raven.captureException(err);
return done();
});
}

1725
yarn.lock

File diff suppressed because it is too large Load diff