# @pony-ci/sfdx-node

> Execute sfdx commands in node.

Latest version **1.0.4** (published 2020-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pony-ci/sfdx-node
pnpm add @pony-ci/sfdx-node
yarn add @pony-ci/sfdx-node
bun add @pony-ci/sfdx-node
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-04-18 |
| First published | 2020-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 6 |
| Unpacked size | 26.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Ondřej Kratochvíl |
| Maintainers | ponyci |
| Keywords | sfdx, cli, salesforcedx, node, dx, salesforce, salesforce-alm |

## Links

- npm: https://www.npmjs.com/package/@pony-ci/sfdx-node
- Repository: https://github.com/pony-ci/sfdx-node
- Homepage: https://github.com/pony-ci/sfdx-node#readme
- Issues: https://github.com/pony-ci/sfdx-node/issues
- npm.io page: https://npm.io/package/@pony-ci/sfdx-node

## Dependencies (6)

- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [hook-std](https://npm.io/package/hook-std.md) ^2.0.0
- [salesforce-alm](https://npm.io/package/salesforce-alm.md) ^48.8.0
- [@salesforce/core](https://npm.io/package/@salesforce/core.md) ^2
- [@pony-ci/cli-exec](https://npm.io/package/@pony-ci/cli-exec.md) ^1.0.6
- [@salesforce/command](https://npm.io/package/@salesforce/command.md) ^2

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-04-18
- 1.0.3 — 2020-04-18
- 1.0.2 — 2020-04-18
- 1.0.1 — 2020-04-18
- 1.0.0 — 2020-04-15

## README

# sfdx-node

[![CircleCI](https://circleci.com/gh/pony-ci/sfdx-node.svg?style=svg)](https://circleci.com/gh/pony-ci/sfdx-node)
[![npm](https://badge.fury.io/js/%40pony-ci%2Fsfdx-node.svg)](https://badge.fury.io/js/%40pony-ci%2Fsfdx-node)
[![License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/pony-ci/sfdx-node/blob/master/LICENSE)

Execute sfdx commands in node.  
The sfdx-cli itself doesn't have to be installed.

## Usage
All commands are asynchronous.
```javascript
// run tests
await sfdx.force.apex.test.run({targetusername: 'username'});

// set default username
await sfdx.force.config.set({}, 'defaultusername=username');

// set global default username
await sfdx.force.config.set({global: true}, 'defaultusername=username');

// suppress stdout and stderr
await sfdx.force.config.set({quiet: true}, 'defaultusername=username');
```

## SFDX Plugins
This module includes the `force` plugin by default.
You can override this plugin with a different version or even add support for other plugins.
To add or override plugin, add node module containing the commands into dependencies in your `package.json` file.
Then register the commands using `registerNamespace` function.
```javascript
// override force plugin
const FORCE_PATH = path.dirname(require.resolve('salesforce-alm'));
registerNamespace({
    commandsDir: path.join(FORCE_PATH, 'commands'),
    namespace: 'force'
});

// add custom plugin
const PLUGIN_PATH = path.dirname(require.resolve('my-plugin-module'));
registerNamespace({
    commandsDir: path.join(PLUGIN_PATH, 'commands'),
    namespace: 'namespace'
});
``` 

Requirements for plugins.
* Commands must be in the `<commandsDir>/<namespace>/` directory.  
* Each command file must contain one of the following:  
    * default export of a class extending `SfdxCommand`
    * export of a class extending the ToolbeltCommand and its name must be in camel case, 
    without namespace name and with `Command` suffix,
    e.g. `OrgCreateCommand` for `force/org/create.js` file where `force` is a namespace.  

Even some first versions of force commands don't fulfil these requirements.  

## License
This software is released under the [MIT License](https://github.com/pony-ci/sfdx-node/blob/master/LICENSE).

---
_Source: https://npm.io/package/@pony-ci/sfdx-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
