commit
9bcd186d8f
|
@ -1,5 +1,6 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
public/bundle.js
|
||||
public/version.json
|
||||
static/*
|
||||
!static/info.txt
|
||||
|
|
|
@ -1336,8 +1336,7 @@
|
|||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "1.1.2",
|
||||
|
@ -2025,6 +2024,11 @@
|
|||
"integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=",
|
||||
"dev": true
|
||||
},
|
||||
"git-rev-sync": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/git-rev-sync/-/git-rev-sync-1.9.1.tgz",
|
||||
"integrity": "sha1-oMLj3TkqvPa3aWLif8dfsyI0Sc4="
|
||||
},
|
||||
"glob": {
|
||||
"version": "6.0.4",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
|
||||
|
@ -2280,6 +2284,11 @@
|
|||
"resolved": "https://registry.npmjs.org/intel/-/intel-1.2.0.tgz",
|
||||
"integrity": "sha1-EdEUfraz9Fgr31M3s31UFYTp5B4="
|
||||
},
|
||||
"interpret": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz",
|
||||
"integrity": "sha1-y8NcYu7uc/Gat7EKgBURQBr8D5A="
|
||||
},
|
||||
"ipaddr.js": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.3.0.tgz",
|
||||
|
@ -3207,8 +3216,7 @@
|
|||
"path-parse": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz",
|
||||
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=",
|
||||
"dev": true
|
||||
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME="
|
||||
},
|
||||
"path-platform": {
|
||||
"version": "0.11.15",
|
||||
|
@ -3620,6 +3628,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"rechoir": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
|
||||
"integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q="
|
||||
},
|
||||
"redent": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",
|
||||
|
@ -3690,8 +3703,7 @@
|
|||
"resolve": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.3.3.tgz",
|
||||
"integrity": "sha1-ZVkHw0aahoDcLeOidaj91paR8OU=",
|
||||
"dev": true
|
||||
"integrity": "sha1-ZVkHw0aahoDcLeOidaj91paR8OU="
|
||||
},
|
||||
"resolve-from": {
|
||||
"version": "1.0.1",
|
||||
|
@ -3832,6 +3844,18 @@
|
|||
"integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=",
|
||||
"dev": true
|
||||
},
|
||||
"shelljs": {
|
||||
"version": "0.7.7",
|
||||
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.7.tgz",
|
||||
"integrity": "sha1-svXHfvlxSPS09uImguELuoZnz/E=",
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
|
||||
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
"cross-env": "^5.0.1",
|
||||
"express": "^4.15.3",
|
||||
"express-handlebars": "^3.0.0",
|
||||
"git-rev-sync": "^1.9.1",
|
||||
"helmet": "^3.6.1",
|
||||
"jquery": "^3.2.1",
|
||||
"mozlog": "^2.1.1",
|
||||
|
@ -38,12 +39,13 @@
|
|||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/mozilla/something-awesome/",
|
||||
"license": "MPL-2.0",
|
||||
"repository": "mozilla/something-awesome",
|
||||
"scripts": {
|
||||
"bundle": "browserify frontend/src/main.js | uglifyjs > public/bundle.js",
|
||||
"bundle": "browserify frontend/src/main.js | uglifyjs > public/bundle.js && node scripts/version",
|
||||
"dev": "watchify frontend/src/main.js -o public/bundle.js -d | node server/portal_server",
|
||||
"format": "prettier 'frontend/src/*.js' 'public/*.css' 'server/*.js' 'test/*.js' --single-quote --write",
|
||||
"format": "prettier '{frontend/src/,scripts/,server/,test/}*.js' 'public/*.css' --single-quote --write",
|
||||
"lint": "npm-run-all lint:*",
|
||||
"lint:css": "stylelint 'public/*.css'",
|
||||
"lint:js": "eslint .",
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const pkg = require('../package.json');
|
||||
|
||||
let commit;
|
||||
|
||||
try {
|
||||
commit = require('git-rev-sync').short();
|
||||
} catch (err) {
|
||||
// Whatever...
|
||||
}
|
||||
|
||||
const filename = path.join(__dirname, '..', 'public', 'version.json');
|
||||
const filedata = {
|
||||
commit,
|
||||
source: pkg.homepage,
|
||||
version: pkg.version
|
||||
};
|
||||
|
||||
fs.writeFileSync(filename, JSON.stringify(filedata, null, 2) + '\n');
|
|
@ -19,6 +19,8 @@ const mozlog = require('./log.js');
|
|||
|
||||
const log = mozlog('portal.server');
|
||||
|
||||
const STATIC_PATH = path.join(__dirname, '../public');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.engine(
|
||||
|
@ -33,7 +35,7 @@ app.set('view engine', 'handlebars');
|
|||
app.use(helmet());
|
||||
app.use(busboy());
|
||||
app.use(bodyParser.json());
|
||||
app.use(express.static(path.join(__dirname, '../public')));
|
||||
app.use(express.static(STATIC_PATH));
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.render('index', {
|
||||
|
@ -164,6 +166,10 @@ app.get('/__heartbeat__', (req, res) => {
|
|||
storage.ping().then(() => res.sendStatus(200), () => res.sendStatus(500));
|
||||
});
|
||||
|
||||
app.get('/__version__', (req, res) => {
|
||||
res.sendFile(path.join(STATIC_PATH, 'version.json'));
|
||||
});
|
||||
|
||||
app.listen(conf.listen_port, () => {
|
||||
log.info('startServer:', `Portal app listening on port ${conf.listen_port}!`);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue