forked from GetPublii/Publii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
156 lines (138 loc) · 4.01 KB
/
gulpfile.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
148
149
150
151
152
153
154
155
156
"use strict";
/*
* Necessary plugins
*/
const gulp = require('gulp');
const sass = require('gulp-sass');
const exec = require('child_process').exec;
const fs = require('fs');
const electron = require('gulp-electron');
const winInstaller = require('electron-windows-installer');
const info = require('./app/package.json');
/*
* Paths configuration
*/
const paths = {
"frontend-js": 'app/js/front-end/',
"backend-js": 'app/back-end/',
"sass": 'app/src/scss/editor/',
"css": 'app/dist/css/',
"base": 'app/'
};
/*
* Parse SASS into CSS
*/
gulp.task('prepare-editor-css', function() {
gulp.src(paths.sass + 'editor.scss')
.pipe(sass())
.pipe(gulp.dest(paths['css']));
gulp.src(paths.sass + 'editor-options.scss')
.pipe(sass())
.pipe(gulp.dest(paths['css']));
});
/*
* Build
*/
gulp.task('build', function() {
let buildData = JSON.parse(fs.readFileSync('app/back-end/builddata.json'));
buildData.build += 1;
buildData = JSON.stringify(buildData);
fs.writeFileSync('app/back-end/builddata.json', buildData);
exec('node_modules/.bin/electron app/', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
});
});
/*
* Packaging
*/
gulp.task('package', function() {
gulp.src("")
.pipe(electron({
src: './app',
packageJson: info,
release: './dist',
cache: './cache',
version: 'v1.4.15',
packaging: true,
platforms: ['win32-ia32', 'darwin-x64'],
platformResources: {
darwin: {
CFBundleDisplayName: info.name,
CFBundleIdentifier: info.bundle,
CFBundleName: info.name,
CFBundleVersion: info.version
},
win: {
"version-string": info.version,
"file-version": info.version,
"product-version": info.version
}
}
}))
.pipe(gulp.dest(""));
});
/*
* Creating Windows Installer
*/
gulp.task('create-win-installer', function(done) {
winInstaller({
appDirectory: './Publii-win32-x64',
loadingGif: './app/src/assets/installation/loading.gif',
outputDirectory: './release',
exe: 'Publii.exe',
name: 'Publii',
setupExe: 'PubliiSetup.exe',
title: 'Publii',
owners: 'TidyCustoms',
authors: 'TidyCustoms',
iconUrl: 'https://tidycustoms.net/images/tidycustoms.ico',
setupIcon: './app/src/assets/installation/icon.ico'
}).then(done).catch(done);
});
/*
* Creating Windows Installer for bleeding egde
*/
gulp.task('create-win-prerelease', function(done) {
winInstaller({
appDirectory: './Publii-win32-x64',
loadingGif: './app/src/assets/installation/loading-prerelease.gif',
outputDirectory: './release',
exe: 'Publii.exe',
name: 'Publii',
setupExe: 'PubliiSetup.exe',
title: 'Publii',
owners: 'TidyCustoms',
authors: 'TidyCustoms',
iconUrl: 'https://tidycustoms.net/images/tidycustoms.ico',
setupIcon: './app/src/assets/installation/icon.ico'
}).then(done).catch(done);
});
/*
* Creating macOS Installer
*/
gulp.task('create-mac-installer', function() {
const createDMG = require('electron-installer-dmg');
createDMG({
appPath: './Publii-darwin-x64/Publii.app',
name: 'Publii',
icon: './app/src/assets/installation/volume.icns',
overwrite: true
}, function (err) {
console.log(err)
})
});
/*
* Creating macOS Installer for bleeding edge
*/
gulp.task('create-mac-prerelease', function() {
const createDMG = require('electron-installer-dmg');
createDMG({
appPath: './Publii-darwin-x64/Publii.app',
name: 'Publii',
icon: './app/src/assets/installation/volume-prerelease.icns',
overwrite: true
}, function (err) {
console.log(err)
});
});