How to use the pkg-fetch.system.toFancyPlatform function in pkg-fetch

To help you get started, we’ve selected a few pkg-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github little-core-labs / pkg-packager / lib / target.js View on Github external
constructor(platform, pathspec, opts) {
    assert(opts && 'object' === typeof opts, '`opts` is not an object.')
    assert('string' === typeof opts.output, '`opts.output` is not a string.')

    const host = system.toFancyPlatform(opts.platform || platform.host)
    const { type = DEFAULT_TYPE } = opts

    assert('string' === typeof type, '`opts.type` is not a string.')

    const basename = path.basename(pathspec)
    const extname = path.extname(pathspec)

    if (Array.isArray(opts.assets)) {
      this.assets = opts.assets
        .filter(Boolean)
        .map((asset) => 'string' === typeof asset
          ? asset.split(':')
          : asset)
        .map((tuple) => Array.isArray(tuple) && 2 === tuple.length
          ? ({ from: tuple[0], to: tuple[1] })
          : tuple)
github little-core-labs / pkg-packager / lib / target.js View on Github external
const { Builder } = require('./builder')
const { system } = require('pkg-fetch')
const assert = require('assert')
const mkdirp = require('mkdirp')
const Batch = require('batch')
const debug = require('debug')('pkg-packager')
const path = require('path')

/**
 * The host platform name in fancy form for `pkg`.
 * @private
 */
const PKG_PLATFORM = system.toFancyPlatform(process.platform)

/**
 * The default builder type based on `PKG_PLATFORM`.
 * @private
 */
const DEFAULT_TYPE = ({
  linux: 'appimage',
  macos: 'appdmg',
  win: 'exe',
})[PKG_PLATFORM]

/**
 * The `Target` class represents a container for
 * a packaging builder target. Builders are loaded based
 * on platform information and target configuration.
 * @public

pkg-fetch

Compiles and stores base binaries for pkg

MIT
Latest version published 1 year ago

Package Health Score

56 / 100
Full package analysis

Similar packages