-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 89233e3
Showing
14 changed files
with
465 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# dependencies | ||
bower_components/ | ||
node_modules/ | ||
vendor/ | ||
|
||
# package manager files | ||
npm-debug.log* | ||
package-lock.json | ||
yarn-error.log | ||
|
||
# project specific | ||
*.exe | ||
todo.md |
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,6 @@ | ||
.travis.yml | ||
gulpfile.json | ||
gulpfile.json | ||
tsconfig.json | ||
tslint.json | ||
yarn.lock |
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,24 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- "6" | ||
git: | ||
depth: 1 | ||
branches: | ||
only: | ||
- master | ||
cache: | ||
timeout: 1800 | ||
yarn: true | ||
directories: | ||
- node_modules | ||
env: | ||
- CXX=g++-4.8 | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-4.8 | ||
notifications: | ||
email: false |
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,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 Jan T. Sott | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,52 @@ | ||
# makensis | ||
|
||
[](https://www.npmjs.org/package/makensis) | ||
[](https://www.npmjs.org/package/makensis) | ||
[](https://travis-ci.org/idleberg/node-makensis) | ||
[](https://david-dm.org/idleberg/node-makensis) | ||
[](https://david-dm.org/idleberg/node-makensis?type=dev) | ||
|
||
A Node wrapper for `makensis`, the NSIS compiler | ||
|
||
## Installation | ||
|
||
`npm install -g -makensis` | ||
|
||
## Usage | ||
|
||
```js | ||
import { compiler as makensis} from 'makensis'; | ||
const options = { | ||
verbose: 2, | ||
define: { | ||
'SPECIAL_BUILD': true | ||
} | ||
} | ||
|
||
makensis.compile('/path/to/installer.nsi', options) | ||
}).catch((err) => { | ||
console.error(err); | ||
}); | ||
``` | ||
|
||
### Methods | ||
|
||
`compile(script, [options])` | ||
|
||
Compile specified script with MakeNSIS | ||
|
||
`version()` | ||
|
||
Returns version of MakeNSIS | ||
|
||
`cmdhelp([command])` | ||
|
||
Returns usage information for a specific command, or a list all commands | ||
|
||
## License | ||
|
||
This work is licensed under [The MIT License](https://opensource.org/licenses/MIT) | ||
|
||
## Donate | ||
|
||
You are welcome support this project using [Flattr](https://flattr.com/submit/auto?user_id=idleberg&url=https://github.com/idleberg/node-makensis) or Bitcoin `17CXJuPsmhuTzFV2k4RKYwpEHVjskJktRd` |
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,49 @@ | ||
/* | ||
* vscode-gulpfile.js | ||
* | ||
* Copyright (c) 2016, 2017 Jan T. Sott | ||
* Licensed under the MIT license. | ||
*/ | ||
|
||
// Dependencies | ||
const gulp = require('gulp'); | ||
const debug = require('gulp-debug'); | ||
const tslint = require('gulp-tslint'); | ||
const jsonlint = require('gulp-jsonlint'); | ||
|
||
// Supported files | ||
const tsFiles = [ | ||
'src/*.ts', | ||
]; | ||
|
||
const jsonFiles = [ | ||
'package.json', | ||
'tsconfig.json', | ||
'tslint.json' | ||
]; | ||
|
||
// Lint TypeScript | ||
gulp.task('lint:ts', gulp.series( (done) => { | ||
gulp.src(tsFiles) | ||
.pipe(debug({title: 'tslint'})) | ||
.pipe(tslint({ | ||
formatter: "prose" | ||
})) | ||
.pipe(tslint.report()) | ||
done(); | ||
})); | ||
|
||
// Lint JSON | ||
gulp.task('lint:json', gulp.series( (done) => { | ||
gulp.src(jsonFiles) | ||
.pipe(debug({title: 'json-lint'})) | ||
.pipe(jsonlint()) | ||
.pipe(jsonlint.failAfterError()) | ||
.pipe(jsonlint.reporter()); | ||
done(); | ||
})); | ||
|
||
// Available tasks | ||
gulp.task('lint', gulp.parallel('lint:ts', 'lint:json', (done) => { | ||
done(); | ||
})); |
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,63 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var util_1 = require("./util"); | ||
/** | ||
* Returns usage information for a command, or list all commands | ||
* @param {string} [command] - an NSIS command | ||
* @returns {string} - usage description | ||
*/ | ||
var cmdhelp = function (command) { | ||
if (command === void 0) { command = ''; } | ||
var args = ['-CMDHELP']; | ||
if (typeof command !== 'undefined' && command !== '') { | ||
args.push(command); | ||
} | ||
return util_1.spawnMakensis(args); | ||
}; | ||
exports.cmdhelp = cmdhelp; | ||
/** | ||
* Compile specified script with MakeNSIS | ||
* @param {string} script - path to NSIS script | ||
* @param {Object} options - compiler options | ||
*/ | ||
var compile = function (script, options) { | ||
if (options === void 0) { options = null; } | ||
options || (options = {}); | ||
var args = []; | ||
if (Number.isInteger(options.verbose) && options.verbose >= 0 && options.verbose <= 4) { | ||
args.push('-V' + options.verbose); | ||
} | ||
if (options.pause === true) { | ||
args.push('-PAUSE'); | ||
} | ||
if (options.nocd === true) { | ||
args.push('-NOCD'); | ||
} | ||
if (options.noconfig === true) { | ||
args.push('-NOCONFIG'); | ||
} | ||
if (options.strict === true) { | ||
args.push('-WX'); | ||
} | ||
if (typeof options.define !== 'undefined') { | ||
Object.keys(options.define).forEach(function (key) { | ||
args.push("-D" + key + "=" + options.define[key]); | ||
}); | ||
} | ||
if (typeof options.execute !== 'undefined') { | ||
options.execute.forEach(function (key) { | ||
args.push("-X" + key); | ||
}); | ||
} | ||
args.push(script); | ||
return util_1.spawnMakensis(args); | ||
}; | ||
exports.compile = compile; | ||
/** | ||
* Returns version of MakeNSIS | ||
* @returns {string} - compiler version | ||
*/ | ||
var version = function () { | ||
return util_1.spawnMakensis(['-VERSION']); | ||
}; | ||
exports.version = version; |
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,28 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var makensis = require("./makensis"); | ||
var options = { | ||
verbose: 2, | ||
define: { | ||
'SHOW_WARNING': 'true' | ||
}, | ||
execute: [ | ||
'OutFile inst.exe' | ||
] | ||
}; | ||
makensis.compile('/Users/jan/Desktop/_nsis/error.nsi', options) | ||
.then(function (stdStream) { | ||
console.log(stdStream); | ||
}).catch(function (stdErr) { | ||
console.error(stdErr); | ||
}); | ||
// makensis.version().then((version) => { | ||
// console.log(version); | ||
// }).catch((error) => { | ||
// console.error(error); | ||
// }); | ||
// makensis.cmdhelp('OutFile').then((version) => { | ||
// console.log(version); | ||
// }).catch((error) => { | ||
// console.error(error); | ||
// }); |
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,29 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var child_process_1 = require("child_process"); | ||
var stringify = function (data) { | ||
return data.toString().trim(); | ||
}; | ||
exports.stringify = stringify; | ||
var spawnMakensis = function (args) { | ||
return new Promise(function (resolve, reject) { | ||
var stdOut = ''; | ||
var stdErr = ''; | ||
var cmd = child_process_1.spawn('makensis', args); | ||
cmd.stdout.on('data', function (data) { | ||
stdOut += stringify(data); | ||
}); | ||
cmd.stderr.on('data', function (data) { | ||
stdErr += stringify(data); | ||
}); | ||
cmd.on('close', function (code) { | ||
if (code === 0) { | ||
resolve(stdOut); | ||
} | ||
else { | ||
reject(stdErr); | ||
} | ||
}); | ||
}); | ||
}; | ||
exports.spawnMakensis = spawnMakensis; |
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,26 @@ | ||
{ | ||
"name": "makensis", | ||
"version": "0.0.0", | ||
"description": "", | ||
"main": "lib/makensis.js", | ||
"keywords": [ | ||
"nsis", | ||
"makensis" | ||
], | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^8.0.19", | ||
"gulp": "github:gulpjs/gulp#4.0", | ||
"gulp-debug": "^3.1.0", | ||
"gulp-jsonlint": "^1.2.0", | ||
"gulp-tslint": "^8.1.1", | ||
"tslint": "^5.5.0", | ||
"typescript": "^2.3.4" | ||
}, | ||
"scripts": { | ||
"build": "tsc -p ./", | ||
"prepublish": "npm run build", | ||
"test": "gulp lint" | ||
} | ||
} |
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,82 @@ | ||
import { spawnMakensis } from './util'; | ||
|
||
interface CompilerOptions { | ||
define?: Object; | ||
execute?: Array<string>; | ||
nocd?: boolean; | ||
noconfig?: boolean; | ||
pause?: boolean; | ||
strict?: boolean; | ||
verbose?: number; | ||
} | ||
|
||
/** | ||
* Returns usage information for a command, or list all commands | ||
* @param {string} [command] - an NSIS command | ||
* @returns {string} - usage description | ||
*/ | ||
const cmdhelp = (command: string = '') => { | ||
let args: Array<string> = ['-CMDHELP']; | ||
|
||
if (typeof command !== 'undefined' && command !== '') { | ||
args.push(command); | ||
} | ||
return spawnMakensis(args); | ||
}; | ||
|
||
/** | ||
* Compile specified script with MakeNSIS | ||
* @param {string} script - path to NSIS script | ||
* @param {Object} options - compiler options | ||
*/ | ||
const compile = (script: string, options: CompilerOptions = null) => { | ||
options || (options = {}); | ||
|
||
let args: Array<string> = []; | ||
|
||
if (Number.isInteger(options.verbose) && options.verbose >= 0 && options.verbose <= 4) { | ||
args.push('-V' + options.verbose); | ||
} | ||
|
||
if (options.pause === true) { | ||
args.push('-PAUSE'); | ||
} | ||
|
||
if (options.nocd === true) { | ||
args.push('-NOCD'); | ||
} | ||
|
||
if (options.noconfig === true) { | ||
args.push('-NOCONFIG'); | ||
} | ||
|
||
if (options.strict === true) { | ||
args.push('-WX'); | ||
} | ||
|
||
if (typeof options.define !== 'undefined') { | ||
Object.keys(options.define).forEach(function(key) { | ||
args.push(`-D${key}=${options.define[key]}`); | ||
}); | ||
} | ||
|
||
if (typeof options.execute !== 'undefined') { | ||
options.execute.forEach(function(key) { | ||
args.push(`-X${key}`); | ||
}); | ||
} | ||
|
||
args.push(script); | ||
|
||
return spawnMakensis(args); | ||
}; | ||
|
||
/** | ||
* Returns version of MakeNSIS | ||
* @returns {string} - compiler version | ||
*/ | ||
const version = () => { | ||
return spawnMakensis(['-VERSION']); | ||
}; | ||
|
||
export { compile, cmdhelp, version }; |
Oops, something went wrong.