Authored by 陈峰

Merge branch 'feature/qk' into 'release/6.9.5'

Feature/qk



See merge request !86
@@ -21,6 +21,7 @@ const cpPaths = [ @@ -21,6 +21,7 @@ const cpPaths = [
21 'utils', 21 'utils',
22 'apps/index.html', 22 'apps/index.html',
23 `dist/statics/${pkg.name}/degrade-${pkg.version}.html`, 23 `dist/statics/${pkg.name}/degrade-${pkg.version}.html`,
  24 + `dist/statics/${pkg.name}/pkg-${pkg.version}.json`,
24 'dist/manifest.json', 25 'dist/manifest.json',
25 'dist/manifest.server.json' 26 'dist/manifest.server.json'
26 ]; 27 ];
@@ -7,6 +7,7 @@ const yohoLib = require('yoho-node-lib'); @@ -7,6 +7,7 @@ const yohoLib = require('yoho-node-lib');
7 const pkg = require('./package.json'); 7 const pkg = require('./package.json');
8 const devtools = require('./doraemon/middleware/devtools'); 8 const devtools = require('./doraemon/middleware/devtools');
9 const _ = require('lodash'); 9 const _ = require('lodash');
  10 +let pkgJson;
10 11
11 // 全局注册library 12 // 全局注册library
12 yohoLib.global(config); 13 yohoLib.global(config);
@@ -35,12 +36,24 @@ exports.createApp = async(app) => { @@ -35,12 +36,24 @@ exports.createApp = async(app) => {
35 }); 36 });
36 } 37 }
37 38
  39 + if (!app.locals.devEnv) {
  40 + pkgJson = require(`./pkg-${pkg.version}.json`);
  41 + }
  42 +
38 app.use('/grass/node/status.html', (req, res) => { 43 app.use('/grass/node/status.html', (req, res) => {
39 res.status(200).end(); 44 res.status(200).end();
40 }); 45 });
41 app.head('*', (req, res) => { 46 app.head('*', (req, res) => {
42 res.status(200).end(); 47 res.status(200).end();
43 }); 48 });
  49 + app.get('/grass/pkg.json', (req, res) => {
  50 + res.set({
  51 + 'Cache-Control': 'no-cache',
  52 + Pragma: 'no-cache',
  53 + Expires: (new Date(1900, 0, 1, 0, 0, 0, 0)).toUTCString()
  54 + });
  55 + res.send(pkgJson);
  56 + });
44 57
45 app.use(require('./doraemon/middleware/backlist')); 58 app.use(require('./doraemon/middleware/backlist'));
46 59