forked from desktop/desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdist-info.js
97 lines (79 loc) · 2.32 KB
/
dist-info.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
'use strict'
const path = require('path')
const os = require('os')
const projectRoot = path.join(__dirname, '..')
const appPackage = require(path.join(projectRoot, 'app', 'package.json'))
function getDistPath () {
return path.join(projectRoot, 'dist', `${getProductName()}-${process.platform}-x64`)
}
function getProductName () {
const productName = appPackage.productName
return process.env.NODE_ENV === 'development' ? `${productName}-dev` : productName
}
function getCompanyName () {
return appPackage.companyName
}
function getVersion () {
return appPackage.version
}
function getOSXZipName () {
const productName = getProductName()
return `${productName}.zip`
}
function getOSXZipPath () {
return path.join(getDistPath(), '..', getOSXZipName())
}
function getWindowsInstallerName () {
const productName = getProductName()
return `${productName}Setup.msi`
}
function getWindowsInstallerPath () {
return path.join(getDistPath(), '..', 'installer', getWindowsInstallerName())
}
function getWindowsStandaloneName () {
const productName = getProductName()
return `${productName}Setup.exe`
}
function getWindowsStandalonePath () {
return path.join(getDistPath(), '..', 'installer', getWindowsStandaloneName())
}
function getWindowsFullNugetPackageName () {
return `${getWindowsIdentifierName()}-${getVersion()}-full.nupkg`
}
function getWindowsFullNugetPackagePath () {
return path.join(getDistPath(), '..', 'installer', getWindowsFullNugetPackageName())
}
function getBundleID () {
return appPackage.bundleID
}
function getUserDataPath () {
if (process.platform === 'win32') {
return path.join(process.env.APPDATA, getProductName())
} else if (process.platform === 'darwin') {
const home = os.homedir()
return path.join(home, 'Library', 'Application Support', getProductName())
} else {
console.error(`I dunno how to review for ${process.platform} :(`)
process.exit(1)
}
}
function getWindowsIdentifierName () {
return 'GitHubDesktop'
}
module.exports = {
getDistPath,
getProductName,
getCompanyName,
getVersion,
getOSXZipName,
getOSXZipPath,
getWindowsInstallerName,
getWindowsInstallerPath,
getWindowsStandaloneName,
getWindowsStandalonePath,
getWindowsFullNugetPackageName,
getWindowsFullNugetPackagePath,
getBundleID,
getUserDataPath,
getWindowsIdentifierName
}