Skip to content

Commit

Permalink
Merge pull request #145 from unindented/node-6
Browse files Browse the repository at this point in the history
Drop Node 4 support
  • Loading branch information
malept authored Oct 5, 2018
2 parents 82ad864 + 7bbddc5 commit 12987d3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js
node_js:
- '10'
- '8'
- '6'
- '4'

env:
- DEBUG="electron-installer-debian"
Expand Down
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,33 @@
"test": "npm run lint && npm run spec"
},
"engines": {
"node": ">=4.0.0"
"node": ">=6.0.0"
},
"dependencies": {
"asar": "^0.14.0",
"cross-spawn-promise": "^0.10.1",
"debug": "^3.1.0",
"fs-extra": "^5.0.0",
"get-folder-size": "^1.0.0",
"debug": "^4.0.1",
"fs-extra": "^7.0.0",
"get-folder-size": "^2.0.0",
"glob": "^7.1.2",
"lodash": "^4.17.4",
"mkdirp": "^0.5.1",
"pify": "^3.0.0",
"pify": "^4.0.0",
"semver": "^5.4.1",
"temp": "^0.8.3",
"word-wrap": "^1.2.3",
"yargs": "^11.0.0"
"yargs": "^12.0.2"
},
"devDependencies": {
"chai": "^4.1.2",
"eslint": "^4.9.0",
"eslint-config-standard": "^11.0.0",
"eslint": "^5.6.1",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"mocha": "^5.0.5",
"mz": "^2.7.0",
"nyc": "^11.4.1",
"nyc": "^13.0.1",
"promise-retry": "^1.1.1"
}
}
25 changes: 12 additions & 13 deletions src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const debug = require('debug')
const fs = require('fs-extra')
const fsize = require('get-folder-size')
const glob = require('glob')
const mkdirp = require('mkdirp')
const path = require('path')
const pify = require('pify')
const temp = require('temp').track()
Expand Down Expand Up @@ -84,7 +83,7 @@ function transformVersion (version) {
* read from `package.json`, and some are hardcoded.
*/
function getDefaults (data) {
const src = {src: data.src}
const src = { src: data.src }
return Promise.all([readMeta(data), getSize(src), dependencies.getElectronVersion(src)])
.then(results => {
const pkg = results[0] || {}
Expand Down Expand Up @@ -171,7 +170,7 @@ function getOptions (data, defaults) {
.replace(/\r\n/g, '\n') // Fixes errors when finding blank lines in Windows
.replace(/^$/mg, '.')
.split('\n')
.map(line => wrap(line, {width: 80, indent: ' '}))
.map(line => wrap(line, { width: 80, indent: ' ' }))
.join('\n')
}

Expand Down Expand Up @@ -211,7 +210,7 @@ function createControl (options, dir) {
const controlDest = path.join(dir, 'DEBIAN/control')
options.logger(`Creating control file at ${controlDest}`)

return pify(mkdirp)(path.dirname(controlDest), '0755')
return fs.ensureDir(path.dirname(controlDest), '0755')
.then(() => generateTemplate(options, controlSrc))
.then(data => fs.outputFile(controlDest, data))
.catch(wrapError('creating control file'))
Expand Down Expand Up @@ -244,7 +243,7 @@ function createBinary (options, dir) {
const binDest = path.join(binDir, options.name)
options.logger(`Symlinking binary from ${binSrc} to ${binDest}`)

return pify(mkdirp)(binDir, '0755')
return fs.ensureDir(binDir, '0755')
.catch(wrapError('creating binary path'))
.then(() => fs.symlink(binSrc, binDest, 'file'))
.catch(wrapError('creating binary file'))
Expand All @@ -260,7 +259,7 @@ function createDesktop (options, dir) {
const desktopDest = path.join(dir, 'usr/share/applications', `${options.name}.desktop`)
options.logger(`Creating desktop file at ${desktopDest}`)

return pify(mkdirp)(path.dirname(desktopDest), '0755')
return fs.ensureDir(path.dirname(desktopDest), '0755')
.catch(wrapError('creating desktop path'))
.then(() => generateTemplate(options, desktopSrc))
.then(data => fs.outputFile(desktopDest, data))
Expand All @@ -275,7 +274,7 @@ function createPixmapIcon (options, dir) {
const iconFile = path.join(dir, 'usr/share/pixmaps', `${options.name}.png`)
options.logger(`Creating icon file at ${iconFile}`)

return pify(mkdirp)(path.dirname(iconFile), '0755')
return fs.ensureDir(path.dirname(iconFile), '0755')
.catch(wrapError('creating icon path'))
.then(() => fs.copy(options.icon, iconFile))
.then(() => fs.chmod(iconFile, '0644'))
Expand All @@ -291,7 +290,7 @@ function createHicolorIcon (options, dir) {
const iconFile = path.join(dir, 'usr/share/icons/hicolor', resolution, 'apps', `${options.name}.${iconExt}`)
options.logger(`Creating icon file at ${iconFile}`)

return pify(mkdirp)(path.dirname(iconFile), '0755')
return fs.ensureDir(path.dirname(iconFile), '0755')
.then(() => fs.copy(icon, iconFile))
.then(() => fs.chmod(iconFile, '0644'))
.catch(wrapError('creating icon file'))
Expand All @@ -316,7 +315,7 @@ function createCopyright (options, dir) {
const copyrightFile = path.join(dir, 'usr/share/doc', options.name, 'copyright')
options.logger(`Creating copyright file at ${copyrightFile}`)

return pify(mkdirp)(path.dirname(copyrightFile), '0755')
return fs.ensureDir(path.dirname(copyrightFile), '0755')
.then(() => copyLicense(options, copyrightFile))
.then(() => fs.chmod(copyrightFile, '0644'))
.catch(wrapError('creating copyright file'))
Expand All @@ -330,7 +329,7 @@ function createOverrides (options, dir) {
const overridesDest = path.join(dir, 'usr/share/lintian/overrides', options.name)
options.logger(`Creating lintian overrides at ${overridesDest}`)

return pify(mkdirp)(path.dirname(overridesDest), '0755')
return fs.ensureDir(path.dirname(overridesDest), '0755')
.then(() => generateTemplate(options, overridesSrc))
.then(data => fs.outputFile(overridesDest, data))
.then(() => fs.chmod(overridesDest, '0644'))
Expand All @@ -345,7 +344,7 @@ function createApplication (options, dir) {
const licenseFile = path.join(applicationDir, 'LICENSE')
options.logger(`Copying application to ${applicationDir}`)

return pify(mkdirp)(applicationDir, '0755')
return fs.ensureDir(applicationDir, '0755')
.then(() => fs.copy(options.src, applicationDir))
.then(() => fs.unlink(licenseFile))
.catch(wrapError('copying application directory'))
Expand All @@ -361,7 +360,7 @@ function createDir (options) {
return pify(temp.mkdir)('electron-')
.then(dir => {
tempDir = path.join(dir, `${options.name}_${options.version}_${options.arch}`)
return pify(mkdirp)(tempDir, '0755')
return fs.ensureDir(tempDir, '0755')
})
.catch(wrapError('creating temporary directory'))
}
Expand Down Expand Up @@ -411,7 +410,7 @@ function movePackage (options, dir) {
const template = options.rename(options.dest, path.basename(file))
const dest = _.template(template)(options)
options.logger(`Moving file ${file} to ${dest}`)
return fs.move(file, dest, {clobber: true})
return fs.move(file, dest, { clobber: true })
}))).catch(wrapError('moving package files'))
}

Expand Down
2 changes: 1 addition & 1 deletion test/helpers/dependencies.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const _ = require('lodash')
const exec = require('mz/child_process').exec
const { exec } = require('mz/child_process')

const dependencies = require('../../src/dependencies')

Expand Down
4 changes: 2 additions & 2 deletions test/helpers/describe_installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports.cleanupOutputDir = function cleanupOutputDir (outputDir) {
}

module.exports.tempOutputDir = function tempOutputDir (customDir) {
return customDir ? path.join(os.tmpdir(), customDir) : temp.path({prefix: 'electron-installer-debian-'})
return customDir ? path.join(os.tmpdir(), customDir) : temp.path({ prefix: 'electron-installer-debian-' })
}

module.exports.testInstallerOptions = function testInstallerOptions (outputDir, installerOptions) {
Expand All @@ -37,5 +37,5 @@ module.exports.testInstallerOptions = function testInstallerOptions (outputDir,
options: {
arch: 'amd64'
}
}, installerOptions, {dest: outputDir})
}, installerOptions, { dest: outputDir })
}
4 changes: 2 additions & 2 deletions test/installer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const chai = require('chai')
const exec = require('mz/child_process').exec
const { exec } = require('mz/child_process')
const fs = require('fs-extra')
const path = require('path')

Expand Down Expand Up @@ -123,7 +123,7 @@ describe('module', function () {
.then(() => exec('dpkg-deb -x bartest_amd64.deb .', { cwd: outputDir }))
.then(() => fs.readFile(path.join(outputDir, 'usr/share/applications/bartest.desktop')))
.then(data => {
if (data.toString().indexOf('Comment=Hardcoded comment') === -1) {
if (!data.toString().includes('Comment=Hardcoded comment')) {
throw new Error('Did not use custom template')
}
return Promise.resolve()
Expand Down

0 comments on commit 12987d3

Please sign in to comment.