sfdx-prebuilt
v5.9.4
Published
Automatically install Salesforce DX
Downloads
15
Readme
sfdx-prebuilt
An NPM installer for SFDX, API interface for Force.com and all Salesforce DX features.
Building and Installing
npm install sfdx-prebuilt
Or grab the source and
node ./install.js
What this installer is really doing is just grabbing a particular "blessed" (by this module) version of SFDX. As new versions of SFDX are released and vetted, this module will be updated accordingly.
Running via node
The package exports a path
string that contains the path to the
SFDX binary/executable.
Below is an example of using this package via node.
var path = require('path')
var childProcess = require('child_process')
var sfdx = require('sfdx-prebuilt')
var binPath = sfdx.path
var childArgs = [
'force',
'--help'
]
childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
// handle results
})
Or exec()
method is also provided for convenience:
var sfdx = require('sfdx-prebuilt')
var program = sfdx.exec('force', '--help')
program.stdout.pipe(process.stdout)
program.stderr.pipe(process.stderr)
program.on('exit', function(code) {
// do something on end
})
Note: childProcess.spawn() is called inside exec()
.
Versioning
The major and minor number tracks the version of SFDX that will be installed. The patch number is incremented when there is either an installer update or a patch build of the sfdx binary.