npm.io
1.0.4 • Published 3d ago

@simplysf/simply-plugin-kit

Licence
Apache-2.0
Version
1.0.4
Deps
3
Size
24 kB
Vulns
0
Weekly
0
Stars
1

@simplysf/simply-plugin-kit

NPM Downloads/week License: Apache-2.0

Shared oclif command building blocks for @simplysf Salesforce CLI plugins. This is not a Salesforce CLI plugin itself — it's a plain library consumed by the other packages in this monorepo.

It exists as its own package rather than living in @simplysf/simply-core so that simply-core stays free of a @salesforce/sf-plugins-core dependency. Anything here that needs the oclif flag layer belongs on this side of that line.

Install

npm install @simplysf/simply-plugin-kit

Usage

import { Messages } from '@salesforce/core';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';

export default class MyCommand extends SfCommand<void> {
  public static readonly flags = {
    ...SfCommand.baseFlags,
    ...targetOrgFlags,
    sobject: Flags.string({ summary: messages.getMessage('flags.sobject.summary'), required: true }),
  };

  public async run(): Promise<void> {
    const { flags } = await this.parse(MyCommand);
    const connection = requireConnection(flags);
    // ...
  }
}

API

Export Description
targetOrgFlags The --target-org / --api-version flag pair every org-touching command declares.
requireConnection(flags) Resolves the connection for --target-org at --api-version, throwing TargetOrgConnectionFailedError if none could be established.
TargetOrgFlagValues Structural type for the parsed flags requireConnection reads.

Issues

Please report any issues at https://github.com/SimplySF/simply-node/issues

Contributing

This package is part of the @simplysf/simply monorepo. See CONTRIBUTING.md for what's specific to this package, and the repo's root CONTRIBUTING.md for repo structure, setup, commit conventions, and how to submit a pull request. Please also read our Code of Conduct.

License

Licensed under the Apache-2.0 license.

Keywords