forked from itchio/itch
/
Gruntfile.js
147 lines (136 loc) · 3.87 KB
/
Gruntfile.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
require('quiet-grunt')
var channel = process.env.CI_CHANNEL || 'stable'
var appName = (channel === 'stable' ? 'itch' : 'kitch')
var fs = require('fs')
var path = require('path')
var packagePath = path.join(__dirname, 'package.json')
var version = process.env.CI_VERSION || JSON.parse(fs.readFileSync(packagePath, { encoding: 'utf8' })).version
var iconsPath = path.join('release', 'images', appName + '-icons')
var icoPath = path.join(iconsPath, 'itch.ico')
var icnsPath = path.join(iconsPath, 'itch.icns')
var installerGifPath = 'release/images/installer.gif'
var electronVersion = '1.4.8'
var outDir = path.join('build', 'v' + version)
var companyName = 'Itch Corp'
var gruntElectronCommon = {
dir: 'stage',
name: appName,
version: electronVersion,
'app-version': version,
prune: true,
asar: true,
overwrite: true,
out: outDir
}
var windowsElectronOptions = Object.assign({}, gruntElectronCommon, {
platform: 'win32',
icon: icoPath,
'version-string': {
CompanyName: companyName,
LegalCopyright: 'MIT license, (c) itch corp.',
FileDescription: appName,
OriginalFileName: appName + '.exe',
FileVersion: version,
AppVersion: version,
ProductName: appName,
InternalName: appName + '.exe'
}
})
var electronInstallerCommon = {
authors: companyName,
exe: appName + '.exe',
description: 'The best way to play itch.io games',
version: version,
title: appName,
// sic. it's really itch.ico
iconUrl: 'http://raw.githubusercontent.com/itchio/itch/master/release/images/' + appName + '-icons/itch.ico',
loadingGif: installerGifPath,
setupIcon: icoPath,
remoteReleases: 'https://github.com/itchio/' + appName,
signWithParams: '/v /s MY /n "itch corp." /fd sha256 /tr http://timestamp.comodoca.com/?td=sha256 /td sha256',
noMsi: true
}
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt)
grunt.initConfig({
// Create a .exe, .app, folder for windows, mac, linux
electron: {
'windows-ia32': {
options: Object.assign({
arch: 'ia32'
}, windowsElectronOptions)
},
'darwin-x64': {
options: Object.assign({}, gruntElectronCommon, {
platform: 'darwin',
arch: 'x64',
icon: icnsPath,
'app-bundle-id': 'io.' + appName + '.mac',
'app-category-type': 'public.app-category.games',
protocols: [{
name: 'itch.io',
schemes: [appName + 'io']
}]
})
},
'linux-ia32': {
options: Object.assign({}, gruntElectronCommon, {
platform: 'linux',
arch: 'ia32'
})
},
'linux-x64': {
options: Object.assign({}, gruntElectronCommon, {
platform: 'linux',
arch: 'x64'
})
}
},
'create-windows-installer': {
'ia32': Object.assign({}, electronInstallerCommon, {
appDirectory: path.join(outDir, appName + '-win32-ia32'),
outputDirectory: process.env.CI_WINDOWS_INSTALLER_PATH || path.join('build', 'squirrel-ia32')
})
},
'ts': {
'default': {
tsconfig: true,
options: {
fast: 'never'
}
}
},
'tslint': {
'options': {
configuration: 'tslint.json',
force: false
},
'files': [
'appsrc/**/*.ts',
'appsrc/**/*.tsx'
]
},
'sass': {
options: {
sourceMap: true
},
dist: {
files: {
'app/style/bundle.css': ['appsrc/style/bundle.scss', 'appsrc/style/**/*.scss']
}
}
},
'copy': {
options: {
mode: true
},
dist: {
files: [
{ expand: true, cwd: 'appsrc', src: ['**/*.html', 'static/**'], dest: 'app' },
{ expand: true, cwd: 'extrajs', src: ['**/*.js'], dest: 'app' }
]
}
}
})
grunt.registerTask('default', ['ts', 'newer:sass', 'newer:copy'])
}