Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

wscript-avoider

ilg-ul383MIT4.0.1

DEPRECATED: Validation code to avoid running under Windows Script Host (specific to older Windows machines)

wscript, windows, avoid

readme

DEPRECATED!

After a thorough analysis, it was discovered that the design of this module is flowed, the detection of WSH cannot be performed later in the code, since WSH will not run the advanced ES6 classes.

The correct sequence is to run the check right at the beginning of the script.

Example of a CLI launcher which refuses to run on WSH:

#!/usr/bin/env node
// Mandatory shebang must point to `node` and this file must be executable.

; (function () { // wrapper in case we're in module_context mode
  /* global WScript */
  if (typeof WScript !== 'undefined') {
    // Windows only: the script was caught by WSH, not node.
    WScript.echo('Run this with node, not the Windows Script Host\n\n')
    WScript.quit(1)
  }

  // --------------------------------------------------------------------------

  const Main = require('../index.js').Main

  // `start()` is async (a promise), thus `.then()` is needed
  // to wait for it to complete.
  Main.start().then(
    (code) => process.exit(code)
  )
})()

changelog

Change log

Changes in reverse chronological order.

v4.0.1 (2019-01-27)

  • add DEPRECATED to the package description.

v4.0.0 (2019-01-27)

  • DEPRECATED!

v3.0.2 (2017-09-18)

  • modernize, use './index.js' that includes 'lib/*'
  • use package.lock

v3.0.1 (2017-03-27)

  • add 'standard' badge
  • use // export ... as comment in the sources.

v3.0.0 (2017-03-26)

  • change the export method, as a member of an object, to be more similar to ES6
export class WscriptAvoider { ... }
...
import { WscriptAvoider } from 'wscript-avoider.js'

v2.0.1 (2017-03-26)

  • add badges
  • add Travis files

v2.0.0 (2017-03-26)

Warning: Incompatible API, using a static class instead of a single function.

Usage:

const appName = 'name'
const WscriptAvoider = require('wscript-avoider')
WscriptAvoider.quitIfWscript(appName)

Other changes:

  • ownership transfered to the xpack project
  • 'standard' style enforced
  • camelCase names used instead of lowercase with underscore

v1.1.1 (2016-09-21)

First functional version.

Usage:

const app_name = 'name'
const avoider = require('wscript-avoider')
avoider.quit_if_wscript(app_name)

v1.0.0 (2016-09-20)

Initial commit.