Skip to content

Commit e391c17

Browse files
committed
Fix building without SSH config
1 parent 9cdba0a commit e391c17

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

build.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const fs = require('fs');
55
const path = require('path');
66
const keepAsset = require('./keepAsset');
77
const {NodeSSH} = require('node-ssh');
8-
const sshConfig = require('./ssh.json');
98
const zlib = require('zlib');
109

1110
const npmCmd = /^win/.test(process.platform) ? 'npm.cmd' : 'npm';
@@ -19,6 +18,13 @@ child.stdout.on('data', (chunk) => {
1918
const publicPath = __dirname + '/public/';
2019
const distPath = __dirname + '/dist/';
2120

21+
let sshConfig;
22+
try {
23+
sshConfig = fs.readFileSync(path.join(__dirname, 'ssh.json'), 'utf8');
24+
} catch(err) {
25+
console.log('No SSH config, skipping upload');
26+
}
27+
2228
function copyFiles(source, destination) {
2329
if(!fs.existsSync(destination)) {
2430
fs.mkdirSync(destination);
@@ -81,6 +87,10 @@ const onCompiled = async() => {
8187
copyFiles(distPath, publicPath);
8288
clearOldFiles();
8389

90+
if(!sshConfig) {
91+
return;
92+
}
93+
8494
const archiveName = 'archive.zip';
8595
const archivePath = path.join(__dirname, archiveName);
8696
execSync(`zip -r ${archivePath} *`, {

0 commit comments

Comments
 (0)