forked from Rich-Harris/packd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
46 lines (38 loc) · 1.2 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const path = require( 'path' );
const sander = require( 'sander' );
exports.root = path.resolve( __dirname );
exports.tmpdir = process.env.NOW ? `/tmp` : `${exports.root}/.tmp`;
exports.registry = 'https://registry.npmjs.org';
if ( !process.env.NOW ) {
try {
sander.rimrafSync( exports.tmpdir );
sander.mkdirSync( exports.tmpdir );
} catch ( err ) {
// already exists
}
}
exports.npmInstallEnvVars = [];
exports.debugEndpoints = true;
exports.additionalBundleResHeaders = {
'Cache-Control': 'max-age=86400',
};
if (process.env.AWS) {
const cacheExpiration = 60 * 60 * 24 * 365;
exports.npmInstallEnvVars = ["npm_config_cache=~/.npm"];
exports.debugEndpoints = false;
exports.additionalBundleResHeaders = {
'Cache-Control': 'public, max-age=' + cacheExpiration,
'X-Content-Type-Options': 'nosniff',
'Access-Control-Allow-Origin': '*',
'Access-Control-Request-Method': 'GET',
'X-Powered-By': 'https://github.com/rich-harris/packd',
'Strict-Transport-Security': `max-age=${cacheExpiration}; includeSubDomains; preload`,
};
exports.onBadRequest = function (res) {
res.status( 200 );
};
exports.onError = function (res) {
// error will be propagated in the logs
res.status( 200 );
};
}