-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutils.js
More file actions
30 lines (25 loc) · 767 Bytes
/
utils.js
File metadata and controls
30 lines (25 loc) · 767 Bytes
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
var path = require('path');
var fs = require('fs');
module.exports = {
npmScripts(api, appPath) {
var pkgPath = api.resolvePath(api.getBasePath(), appPath, 'package.json');
var pkg = require(pkgPath);
return pkg.scripts || {};
},
hasPackageLock(api, appPath) {
var lockPath = api.resolvePath(api.getBasePath(), appPath, 'package-lock.json');
return fs.existsSync(lockPath)
},
getImagePrefix(privateRegistry) {
if (privateRegistry && privateRegistry.imagePrefix) {
return `${privateRegistry.imagePrefix}/`;
}
return '';
},
getImageName(appConfig) {
if (appConfig.docker && appConfig.docker.imageName) {
return appConfig.docker.imageName;
}
return `mup-${appConfig.name.toLowerCase()}`;
}
};