-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from electron-userland/ts-installer-dmg
refactor: convert to typescript and upgrade Node.js versions
- Loading branch information
Showing
15 changed files
with
943 additions
and
533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ coverage/ | |
npm-debug.log | ||
package-lock.json | ||
test/fixture* | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,47 +2,58 @@ | |
"name": "electron-installer-dmg", | ||
"description": "Create DMG installers for your electron apps.", | ||
"version": "4.0.0", | ||
"main": "./src/index.js", | ||
"main": "./dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
"author": "Lucas Hrabovsky <[email protected]> (http://imlucas.com)", | ||
"homepage": "http://github.com/electron-userland/electron-installer-dmg", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/electron-userland/electron-installer-dmg.git" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"coverage": "nyc --reporter=lcov --reporter=text npm run spec", | ||
"lint": "eslint src test bin", | ||
"spec": "mocha", | ||
"test": "npm run lint && npm run spec" | ||
"lint": "eslint src test --ext js,ts", | ||
"spec": "ts-mocha test/*.test.ts", | ||
"test": "tsc && npm run lint && npm run spec", | ||
"prepublishOnly": "tsc" | ||
}, | ||
"bin": { | ||
"electron-installer-dmg": "bin/electron-installer-dmg.js" | ||
"electron-installer-dmg": "dist/electron-installer-dmg-bin.js" | ||
}, | ||
"engines": { | ||
"node": ">= 12.13.0" | ||
"node": ">= 16" | ||
}, | ||
"files": [ | ||
"bin", | ||
"dist", | ||
"resources", | ||
"src", | ||
"usage.txt" | ||
], | ||
"dependencies": { | ||
"debug": "^4.3.2", | ||
"minimist": "^1.1.1" | ||
"minimist": "^1.2.7" | ||
}, | ||
"optionalDependencies": { | ||
"appdmg": "^0.6.4" | ||
}, | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"@electron/get": "^1.1.0", | ||
"eslint": "^7.32.0", | ||
"@electron/get": "^2.0.2", | ||
"@types/appdmg": "^0.5.2", | ||
"@types/debug": "^4.1.7", | ||
"@types/minimist": "^1.2.2", | ||
"@types/mocha": "^10.0.0", | ||
"@types/node": "^18.11.7", | ||
"@typescript-eslint/eslint-plugin": "6.21.0", | ||
"@typescript-eslint/parser": "6.21.0", | ||
"eslint": "^8.26.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-import": "^2.23.4", | ||
"extract-zip": "^2.0.1", | ||
"mocha": "^9.0.3", | ||
"nyc": "^15.1.0" | ||
"nyc": "^15.1.0", | ||
"ts-mocha": "^10.0.0", | ||
"typescript": "5.5.2" | ||
}, | ||
"keywords": [ | ||
"mongodb.js", | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env node | ||
|
||
/* eslint no-console:0 no-sync:0 */ | ||
import * as fs from 'fs'; | ||
import * as minimist from 'minimist'; | ||
import * as path from 'path'; | ||
|
||
import { createDMG, ElectronInstallerDMGOptions } from '.'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const pkg: { version: string } = require('../package.json'); | ||
|
||
const usage = fs.readFileSync(path.resolve(__dirname, '../usage.txt')).toString(); | ||
const args = minimist<Pick<ElectronInstallerDMGOptions, 'overwrite' | 'icon' | 'background' | 'title' | 'format'> & { | ||
out?: string; | ||
'icon-size'?: string; | ||
}>(process.argv.slice(2), { | ||
boolean: ['overwrite'], | ||
string: ['out', 'icon', 'icon-size', 'background', 'title', 'format'], | ||
}); | ||
|
||
const [appPath, name] = args._; | ||
|
||
const options: ElectronInstallerDMGOptions = { | ||
appPath, | ||
name, | ||
overwrite: args.overwrite, | ||
icon: args.icon, | ||
iconSize: args['icon-size'] ? parseInt(args['icon-size'], 10) : undefined, | ||
background: args.background, | ||
title: args.title, | ||
format: args.format, | ||
out: args.out, | ||
}; | ||
|
||
if (args.help || args.h || !options.appPath || !options.name) { | ||
console.error(usage); | ||
process.exit(1); | ||
} | ||
|
||
if (args.version) { | ||
console.error(pkg.version); | ||
process.exit(1); | ||
} | ||
|
||
createDMG(options) | ||
.then(() => { | ||
console.log(`Wrote DMG to:\n${args.dmgPath}`); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.