Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

makensis

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

makensis

A Node wrapper for makensis, the NSIS compiler

  • 0.26.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
253
decreased by-26.45%
Maintainers
1
Weekly downloads
 
Created
Source

makensis

npm npm CI David

A Node wrapper for makensis, the compiler for NSIS installers. Supports both, native and Wine.

Prerequisites

Make sure that NSIS is properly installed with makensis in your PATH environment variable.

Windows

Download the NSIS installer from SourceForge and run setup. Once completed, you need to edit your environmental variable manually.

Alternatively, you can install NSIS using the Scoop package manager:

$ scoop install nsis/nsis

Linux

Install NSIS from your distribution's default package manager, for example:

# Debian
$ sudo apt-get install nsis

# Red Hat
$ sudo dnf install nsis

macOS

Install NSIS using Homebrew or MacPorts:

# Homebrew
$ brew install nsis

# MacPorts
$ port install nsis

Wine

You can setup NSIS in your Wine environment, but keep in mind that Wine writes standard streams while executing makensis. To disable these debug messages, set the WINEDEBUG environment variable to -all.

Installation

yarn add makensis || npm install makensis

Usage

Example usage in script:

import * as NSIS from 'makensis';

const options = {
    verbose: 2,
    define: {
        SPECIAL_BUILD: true,
    },
};

// Asynchronous: async/await
try {
    let output = await NSIS.compile('path/to/installer.nsi', options);
    console.log('Compiler output:', output);
} catch (error) {
    console.error(error);
}

// Asynchronous: Promise API
NSIS.compile('path/to/installer.nsi', options)
    .then((output) => {
        console.log('Compiler output:', output);
    })
    .catch((error) => {
        console.error(error);
    });

// Synchronous
let output = NSIS.compile.sync('path/to/installer.nsi', options);
console.log('Compiler output:', output);

Methods

Note: Any of the following methods is asynchronous. To use their synchronous counterpart, append .sync() to the method name, e.g. compile.sync() instead of compile().

commandHelp

Usage: commandHelp([command], [options], [spawnOptions])

Returns usage information for a specific command, or a list all commands. Equivalent of the -CMDHELP switch.

compile

Usage: compile(script, [options], [spawnOptions])

Compiles specified script with MakeNSIS. The script can be omitted in favor of preExecute / postExecute.

headerInfo

Usage: headerInfo([options], [spawnOptions])

Returns information about which options were used to compile MakeNSIS. Equivalent of the -HDRINFO switch.

license

Usage: license([options], [spawnOptions])

Returns MakeNSIS software license. Equivalent of the -LICENSE switch.

nsisDir

Usage: nsisDir([options], [spawnOptions])

Returns the path of ${NSISDIR}.

version

Usage: version([options], [spawnOptions])

Returns version of MakeNSIS. Equivalent of the -VERSION switch.

Options

Note: Some of these options are limited to NSIS v3 (see the changelog for details)

verbose

Type: integer

Verbosity where x is 4=all, 3=no script,2=no info, 1=no warnings, 0=none. Equivalent of the -V switch.

pause

Type: boolean

Pauses after execution. Equivalent of the -PAUSE switch.

noCD

Type: boolean

Disables the current directory change to that of the .nsi file. Equivalent of the -NOCD switch.

noConfig

Type: boolean

Disables inclusion of <path to makensis.exe>/nsisconf.nsh. Equivalent of the -NOCONFIG switch.

priority

Type: integer

Sets the compiler process priority, where x is 5=realtime, 4=high, 3=above normal, 2=normal, 1=below normal, 0=idle. Equivalent of the -P switch.

Note: Only available on Windows

inputCharset

Type: string

allows you to specify a specific codepage for files without a BOM (ACP|OEM|CP#|UTF8|UTF16<LE|BE>). Equivalent of the -INPUTCHARSET switch.

outputCharset

Type: string

Allows you to specify the codepage used by stdout when the output is redirected (ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM]). Equivalent of the -OUTPUTCHARSET switch.

Note: Only available on Windows

strict

Type: boolean

Treat warnings as errors. Equivalent of the -WX switch.

ppo / safePPO

Type: boolean

Will only run the preprocessor and print the result to stdout. The safe version will not execute instructions like !appendfile or !system. !packhdr and !finalize are never executed. Equivalent of the -PPO / SAFEPPO switches.

Aliases: PPO / safeppo

define

Type: Object

Defines symbols for the script [to value]. Equivalent of the -D switch.

Example
define: {
    "SPECIAL_BUILD": true,
    "LANGUAGE": "English"
}
preExecute

Type: string | string[]

Prepends script-commands to the script, can be passed as array or multiline-script. Equivalent of the -X switch when used before passing a script.

Example
preExecute: ['SetCompressor lzma', 'SetCompressorDictSize 16'];
postExecute

Type: string | string[]

Appends script-commands to the script, can be passed as array or multiline-script. Equivalent of the -X switch when used after passing a script.

Example
postExecute: [`DetailPrint "That's all Folks!"`];
wine

Type: boolean

Run makensis on Wine

json

Type: boolean

Return output from makensis as an object

pathToMakensis

Type: string

Specifies a custom path to makensis

rawArguments

Type: string | string[]

Specifies raw arguments for makensis. For complex quote combinations, consider supplying the arguments as array.

Note: These will be added to the compiler arguments last and will hence overwrite any of the NSIS options above!

Events

This module emits three types of events you can hook into using the on() and once() methods:

stdout

Gives access to an object containing the current line, and whether it contains a warning of the path of the outfile.

stderr

Gives access to an object containing the current line.

exit

Gives access to an object containing the exit code, the full stdout and stderr, and the number of warnings.

License

This work is licensed under The MIT License

Keywords

FAQs

Package last updated on 28 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc