Giter VIP home page Giter VIP logo

sfdx-plugin-generate's Introduction

Description

=== WARNING === This plugin has been deprecated and is no longer supported. Please use the salesforcecli/plugin-dev plugin instead.

This is the generator plugin for building plugins for the Salesforce CLI. The generated sfdx plugin and command are built on top of the oclif cli framework. A plug-in adds functionality to Salesforce CLI. Some plug-ins are provided by Salesforce and are installed by default when you install the CLI. Some plug-ins, built by Salesforce and others, you install. When you have a requirement that an existing plug-in doesn’t meet, you can build your own using Node.js.

Note: As of @salesforce/[email protected], if you want to override the static usage property you must use a getter. For consistency, we recommend keeping the standard behavior rather than overriding the usage property.

Usage

Check Your Salesforce CLI Version

Starting with Salesforce CLI version 6.8.2, the plug-in generator is offered as a core plugin and can be used out of the box. To check your Salesforce CLI version:

$ sfdx --version
sfdx-cli/6.42.0-ae478b3cb8 (darwin-x64) node-v8.9.4

Generate a Salesforce CLI Plugin

Follow the **Salesforce CLI Plug-In Developer Guide **to create and update your plug-in. In the guide you will discover how to develop your own plug-ins for Salesforce CLI. Explore the Salesforce CLI architecture. Learn how to generate a plug-in using Salesforce Plug-In Generator, how to use Salesforce’s libraries to add functionality to your plug-in, and how to debug issues. Learn about our suggested style guidelines for naming and messages, and about our recommended best practices for plug-ins. And, peruse useful resources.

Related Docs and Repositories

sfdx-plugin-generate's People

Contributors

amphro avatar callumdenby avatar clairebianchi avatar cristiand391 avatar dependabot[bot] avatar discori avatar github-actions[bot] avatar greenkeeper[bot] avatar heroku-cli avatar imjohnmdaniel avatar jchappell82 avatar jdx avatar kbierbaum avatar maggiben avatar mdonnalley avatar mshanemc avatar nsamsami avatar oclif-bot avatar peternhale avatar rasphilco avatar rodesp avatar ruthemmanuelle avatar semantic-release-bot avatar shetzel avatar snyk-bot avatar svc-cli-bot avatar svc-scm avatar tnoonan-salesforce avatar vamsimundra avatar zcei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sfdx-plugin-generate's Issues

Error thrown when running tests

Reporting a bug

Error "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session" thrown when running tests of a command which includes a method call "conn.metadata.describe".

What is the current behavior?

I'm trying to test a command which includes the following code:

    const conn = this.org.getConnection();
    const result = await conn.metadata.describe(await this.org.retrieveMaxApiVersion());
    this.ux.log(result);

with the following test:

describe('hello:metadata', () => {
  test
    .withOrg({ username: '[email protected]' }, true)
    .withConnectionRequest(request => Promise.resolve({ metadataObjects: [ { directoryName: 'objects', inFolder: false, metaFile: false, suffix: 'object', xmlName: 'CustomObject' }] }))
    .stdout()
    .command(['hello:metadata', '--targetusername', '[email protected]'])
    .it('runs hello:metadata --targetusername [email protected]', ctx => {
      expect(ctx.stdout).to.contain('objects');
    });
});

But I'm always receiving the following error: "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session"

What is the expected behavior?

$ sfdx --version
sfdx-cli/6.35.1-8b7320f7c2 (darwin-x64) node-v8.9.4

Guide to create a new Plugin is not working - Globby Missing Dependency

Summary

Followed the step by step from here and it failed while trying to run bin\run.cmd hello:org -h or bin\run hello:org -h

Bellow are pictures trying to execute the command.
image

image

Also, after run the command sfdx plugins:link I got the same message about missing Globby and the namespace was added to my sfdx but has no commands. This is another bug probably.
image

Steps To Reproduce:

On Windows follow this guide

Expected result

The command should work as described in the step by step

Actual result

It will fail while running bin\run.cmd hello:org -h or bin\run hello:org -h

Additional information

Yarn install says that my project is setup properly
image

yarn version:
image

SFDX CLI Version:
image

OS and version:
Windows 10

sfdx plugins:install @<org_scope>/<plugin_name> error: pluginName cannot be nll

I thought I'd try my hand at writing a plugin for the sfdx cli, which I succeeded at. I was able to publish it publically to npm as my user (https://www.npmjs.com/package/dsy-sfdx-plugins), and install it in the cli using 
sfdx plugins:install dsy-sfdx-plugins

However I then realised I would prefer it to be listed under my Company's Organization, so I created one, changed the scope of the package to my new Organization, and published it like so (forcing it to be public):
npm publish --access public
This appeared on npm correctly: https://www.npmjs.com/package/@desynit/dsy-sfdx-plugins and marked as public. Hooray!

BUT THEN
When I tried to install it I saw the following error:
$ sfdx plugins:install @desynit/dsy-sfdx-plugins Installing plugin @desynit/dsy-sfdx-plugins... Installing plugin @desynit/dsy-sfdx-plugins... Checking for digital signature. ! pluginName cannot be nll
pluginname cannot be nll

I assume this is an issue with the sfdx plugin machinery somewhere, and I think this is the best place to enquire about it / report the issue?

Mismatched version in @oclif/plugin-warn-if-update-available & @oclif/plugin-not-found

bug

What is the current behavior?

Everything is working fine when I use sfdx plugins:generate but I'm getting several warnings:

(node:4780) Warning: Mismatched version in @oclif/plugin-warn-if-update-available plugin manifest. Expected: 1.5.4 Received: 1.5.1
This usually means you have an oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing.
(node:4780) Warning: Mismatched version in @oclif/plugin-not-found plugin manifest. Expected: 1.2.1 Received: 1.2.0
This usually means you have an oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing.
(node:4780) Warning: Mismatched version in @oclif/plugin-warn-if-update-available plugin manifest. Expected: 1.5.4 Received: 1.5.1
This usually means you have an oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing.
(node:4780) Warning: Mismatched version in @oclif/plugin-not-found plugin manifest. Expected: 1.2.1 Received: 1.2.0
This usually means you have an oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing.

What is the expected behavior?

No warning should appear.

sfdx --version
sfdx-cli/6.38.0-0d66175ccf (windows-x64) node-v8.9.4
sfdx plugins --core
@salesforce/plugin-generator 0.0.13
@salesforce/sfdx-trust 1.0.8 (core)
builtins 1.0.0 (core)
salesforcedx 44.5.0
sfdx-djc-plugin 0.0.2 (link)
texei-sfdx-plugin 0.0.3

hello:org example does not work

Do you want to request a feature or report a bug?

bug
What is the current behavior?

From my desktop on a personal machine:

sfdx plugins:generate testplug --defaults
cd .\testplug\
.\bin\run sfdx hello:org -h

Result:
Error: command sfdx not found

What is the expected behavior?

Command to compile and write to the console the behavior from the example

All below are in system environment variable PATH and user environment variable PATH:

C:\Users\myusername\AppData\Roaming\nvm
C:\Program Files\nodejs
C:\Users\myusername\AppData\Roaming\npm
C:\Program Files\Salesforce CLI\bin
C:\Users\myusername\AppData\Local\sfdx\client\bin

Config:

OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.17134 N/A Build 17134
Node: v8.11.4
NPM: 5.6.0
SFDX: sfdx-cli/6.44.0-dead729fb5 (windows-x64) node-v8.9.4

Attempting to follow example posted @ https://developer.salesforce.com/docs/atlas.en-us.216.0.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_generate_scaffold.htm

Please let me know any additional steps if needed.

Errors publishing freshly scaffolded plug-in

Summary

I'm seeing errors when running npm publish on a freshly scaffolded plug-in. All I've done is create the plug-in and check that hello:org runs as expected, but I think the prepack script is erroring when the typescript is compiled.

Steps To Reproduce:

  1. Scaffold a new plug-in as detailed in the developer guide
  2. Check that hello:org works - bin/run hello:org <username>
  3. Execute npm publish to compile and publish the plug-in

Expected result

Plug-in should publish without errors

Actual result

> [email protected] prepack .
> rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme

node_modules/@oclif/parser/lib/index.d.ts:16:60 - error TS2344: Type 'TArgs' does not satisfy the constraint 'any[]'.
  Type '{ [name: string]: string; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 29 more.

16 }>(argv: string[], options: Input<TFlags>): Output<TFlags, TArgs>;
                                                              ~~~~~

node_modules/@oclif/command/lib/command.d.ts:69:70 - error TS2344: Type 'A' does not satisfy the constraint 'any[]'.
  Type '{ [name: string]: any; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 29 more.

69     }>(options?: Parser.Input<F>, argv?: string[]): Parser.Output<F, A>;
                                                                        ~

src/commands/hello/org.ts:86:39 - error TS2339: Property 'file' does not exist on type 'any[]'.

86     if (this.flags.force && this.args.file) {
                                         ~~~~

src/commands/hello/org.ts:87:62 - error TS2339: Property 'file' does not exist on type 'any[]'.

87       this.ux.log(`You input --force and a file: ${this.args.file as string}`);
                                                                ~~~~


Found 4 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] prepack: `rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prepack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Additional information

Feel free to attach a screenshot.

SFDX CLI Version: sfdx-cli/7.126.0 darwin-x64 node-v16.13.0

OS and version: MacOS Monterey 12.0.1

Plugin generation failed: Class static side 'typeof Org' incorrectly extends base class static side 'typeof SfdxCommand'

While running sfdx plugins:generate, everything works fine until the tsc command is called and fails with the following error:

$ rm -rf lib && tsc && oclif-dev manifest && oclif-dev readme
src/commands/hello/org.ts(11,22): error TS2417: Class static side 'typeof Org' incorrectly extends base class static side 'typeof SfdxCommand'.
  Types of property 'flagsConfig' are incompatible.
    Type '{ name: IOptionFlag<string>; force: IBooleanFlag<boolean>; }' is not assignable to type 'SfdxFlagsConfig'.
      Property 'name' is incompatible with index signature.
        Type 'IOptionFlag<string>' is not assignable to type 'string | boolean | IBooleanFlag<any> | JsonMap | IOptionFlag<any>'.
          Type 'IOptionFlag<string>' is not assignable to type 'IOptionFlag<any>'.
            Type 'IOptionFlag<string>' is not assignable to type '{ completion?: ICompletion; }'.
              Types of property 'completion' are incompatible.
                Type 'ICompletion' is not assignable to type 'ICompletion'. Two different types with this name exist, but they are unrelated.
                  Types of property 'cacheKey' are incompatible.
                    Type '(ctx: ICompletionContext) => Promise<string>' is not assignable to type '(ctx: ICompletionContext) => Promise<string>'. Two different types with this name exist, but they are unrelated.
                      Types of parameters 'ctx' and 'ctx' are incompatible.
                        Type 'ICompletionContext' is not assignable to type 'ICompletionContext'. Two different types with this name exist, but they are unrelated.
                          Types of property 'config' are incompatible.
                            Type 'IConfig' is not assignable to type 'IConfig'. Two different types with this name exist, but they are unrelated.
                              Property 'channel' is missing in type 'IConfig'.

I'm on windows, don't know if this changes something.

vscode debugging is broken

Summary

vscode launch.json is outdated and broken.

Steps To Reproduce:

  1. Generate a new plugin
  2. Follow instructions here

Expected result

vscode would start a debugger and break on entry

Actual result

Error in the debug console:

Error processing "attach": Error: Both localRoot and remoteRoot must be specified.
    at RemotePathTransformer.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.node-debug2/node_modules/vscode-chrome-debug-core/out/src/transformers/remotePathTransformer.js:43:23)

Additional information

Feel free to attach a screenshot.

SFDX CLI Version:
sfdx-cli/7.54.4-8ff9ba9cc5 darwin-x64 node-v10.15.3

OS and version:
OSX 10.14.5

Documentation still refers to "yarn prepare" instead of "yarn prepack"

Summary

The Salesforce CLI Plug-In Developer Guide (v48.0) still mentions to run "yarn prepare" instead of "yarn prepack" at https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_style_descriptions.htm (last line on page)

Steps To Reproduce:

  1. Generate new plugin with sfdx plugins:generate myplugin
  2. Read https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_style_descriptions.htm (last line on page)
  3. Try to run yarn prepare as specified in the docs

Expected result

Documentation should specify yarn prepack not yarn prepare

Actual result

$ yarn prepare
yarn run v1.21.1
error Command "prepare" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Additional information

SFDX CLI Version:

$ sfdx --version
sfdx-cli/7.42.1-e41dbeb8d9 darwin-x64 node-v10.15.3
$ sfdx plugins --core
@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.2.3 (core)
@oclif/plugin-help 2.2.1 (core)
@oclif/plugin-not-found 1.2.3 (core)
@oclif/plugin-plugins 1.7.8 (core)
@oclif/plugin-update 1.3.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.0.5 (core)
analytics 1.2.1 (core)
generator 1.1.1 (core)
salesforcedx 47.15.0 (core)
├─ salesforcedx-templates 47.16.0 (core)
└─ salesforce-alm 47.14.0 (core)

sfdx-cli 7.42.1 (core)
sfdx-waw-plugin 1.5.0
shane-sfdx-plugins 4.14.5

OS and version:
MacOS 10.14.6

Version of Node required is different to developer guide

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

  1. Prepare computer as per the docs, including checking that I have version 8 of node - I have 8.4.0 installed.
  2. Scaffold plugin as per the docs

Throws the following error:

[3/5] 🚚 Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=8.9.4".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
(node:96523) [MODULE_NOT_FOUND] Error Plugin: mentz: Cannot find module '@salesforce/command'

This resulted in the dependencies stanza of package.json being left empty and the plugin failing to run as it couldn't find the @salesforce/command module.

Using node version 8.9.4, everything worked as expected.

What is the expected behavior?

The version of node detailed in the docs should allow the plugin generator to successfully scaffold the plugin.

Please mention your Salesforce CLI and OS version.

CLi sfdx-cli/6.44.0-dead729fb5 (darwin-x64) node-v8.9.4

OS: Mac OS X 10.14.2 18C54

Wrong type definitions fetched for DescribeGlobalResult and DescribeGlobalSObjectResult

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

  • Create a new folder and go into it using cd.
  • Run sfdx plugins:generate and hit enter to run with the default settings.
  • Run more ./node_modules/@types/jsforce/describe-result.d.ts
  • The following content appears:
export interface DescribeSObjectResult {
    label: string;
    fields: object[];
}

export interface DescribeGlobalResult {
    activateable: boolean;
    createable: boolean;
    custom: boolean;
    customSetting: boolean;
    deletable: boolean;
    deprecatedAndHidden: boolean;
    feedEnabled: boolean;
    hasSubtypes: boolean;
    isSubtype: boolean;
    keyPrefix: string;
    label: string;
    labelPlural: string;
    layoutable: boolean;
    mergeable: boolean;
    mruEnabled: boolean;
    name: string;
    queryable: boolean;
    replicateable: boolean;
    retrieveable: boolean;
    searchable: boolean;
    triggerable: boolean;
    undeletable: boolean;
    updateable: boolean;
}

What is the expected behavior?

The content should be that of this file from the TS type definitions for JSForce in DefinitelyTyped.

SFDX version: sfdx-cli/6.43.1-6021deb31d (darwin-x64) node-v8.9.4
OS version: macOS 10.14.2

sfdx plugins --core
@salesforce/plugin-generator 1.0.1 (core)
@salesforce/sfdx-trust 1.0.8 (core)
builtins 1.0.0 (core)
salesforcedx 44.10.0 (core)

--dev-suspend not working

I am getting an error while trying to run my plugin with --dev-suspend flag.

$ sfdx test:myplugin:set -u xxx -d ./fields.csv --dev-suspend
ERROR running set: Unexpected argument: --dev-suspend
See more help with --help

OS:Windows 7, using bash shell
$ sfdx --version
sfdx-cli/6.34.0-6fec0d751a (windows-x64) node-v8.9.4

Error: command hello:org not found

Summary

Error: command hello:org not found is displayed when starting the bin/run hello:org -h command after the plug-in generation on sfdx-cli/7.65.2-0f0403b8cc only!

Steps To Reproduce:

  1. Update sfdx cli to sfdx-cli/7.65.2-0f0403b8cc
  2. Run sfdx plugins:generate to generate the plugin
  3. Run bin/run hello:org -h

Expected result

Hello Org command help should be displayed

Actual result

Error: command hello:org not found is displayed

Workaround

This is coming from the tsconfig.json that doesn't have the rootDir compiler options attribute, it's working when adding it.

SFDX CLI Version: sfdx-cli/7.65.2-0f0403b8cc

OS and version: macOS Catalina 10.15.3

Template Output: `npm run test` gives little output / as if no tests ran.

Summary

On a newly generated plugin template, running tests via npm run test gives weird output (as if no tests ran).

Steps To Reproduce:

  1. Install SFDX, run sfdx plugins:generate. Smash enter/default options.
  2. npm install
  3. npm run test
  4. Get output that looks like this.
    image

Expected result

See test names, and actual code coverage info.

Actual result

image

Additional information

SFDX CLI Version:
sfdx-cli/7.63.0 win32-x64 node-v12.18.1
OS and version:
Windows 10 Pro 2004

Publishing fails to include commands

Bug

I've executed the following without making any changes to the generated code:

mkdir sfdx-ntx-plugin-test
cd sfdx-ntx-plugin-test
sfdx plugins:generate // and stepped through questions
yarn run prepare
yarn publish // publishes fine
sfdx plugins:install sfdx-ntx-plugin-test // installs fine
sfdx hello:org // error

The error looks like this and is because the "commands" folder is missing:
! 'MODULE_NOT_FOUND': Cannot find module 'C:\Users\VidalB\AppData\Local\sfdx\plugins\node_modules\sfdx-ntx-plugin-test\lib\commands\hello\org'

I would have expected this folder to contain the compiled js from the org.ts file.

sfdx-cli/6.31.0-32aa4b4408 (windows-x64) node-v8.9.4
Microsoft Windows 10 Enterprise - 10.0.17134 Build 17134

hello:org does not work

Do you want to request a feature or report a bug?

Report a bug.

What is the current behavior?

  1. Create a folder somewhere and go into it.
  2. Initialize a plugin in the folder, e.g. using sfdx plugins:generate --defaults
  3. Link the plugin for its use with sfdx: sfdx plugins:link .
  4. Run sfdx hello:org -u [aliasName]

The result is:

ERROR running Org:  Invalid URI "/services/data/v39.0/query?q=Select%20Name%2C%20TrialExpirationDate%20from%20Organization"

What is the expected behavior?

The expected result would be something along the lines of this string:

let outputString = `Hello ${name}! This is org: ${orgName}`;

Please mention your Salesforce CLI and OS version.

Running on macOS 10.14.2.

sfdx --version
sfdx-cli/6.43.1-6021deb31d (darwin-x64) node-v8.9.4
sfdx plugins --core
@salesforce/plugin-generator 1.0.1 (core)
@salesforce/sfdx-trust 1.0.8 (core)
builtins 1.0.0 (core)
salesforcedx 44.10.0 (core)
test 0.0.0 (link)

plugin help shows <%= command.id %> instead of hello:org

Summary

plugin help shows <%= command.id %> instead of hello:org

Steps To Reproduce:

  1. sfdx plugins:generate
  2. sfdx plugins:link
  3. sfdx help hello:org

Expected result

$ sfdx hello:org [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal]

Actual result

$ sfdx <%= command.id %> [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal]

Additional information

This is related to the changes in "@salesforce/[email protected]" (/forcedotcom/cli-packages#42)

Errors thrown via SfdxError are not appearing: sfdx xyz:myplugin:set -u alias -p=xyz

Reporting a bug

Errors thrown via SfdxError from the plugin are not appearing when the plugin is invoked via
$sfdx xyz:myplugin:set -u myalias -p=xyz

but when invoked through ./bin/run, it would display the error messages.

What is the current behavior?

When run from sfdx, plugin does not display exception message. It simply return without displaying the exception message.
$ sfdx xyz:myplugin:set -u venkattemp -o=campaign -profiles="*"
Validating flags...
$

Where as when I run it from the ./bin in the plugin directory using run, it would work as expected.
$ ./bin/run xyz:myplugin:set -u venkattemp -o=campaign -profiles="*"
Validating flags... done
ERROR running set: --profiles and --filter must be specified when --sobjects is used
$

Please mention your Salesforce CLI and OS version.
OS: Windows 7
$ sfdx --version
sfdx-cli/6.34.0-6fec0d751a (windows-x64) node-v8.9.4

Is there something that I am missing here, a setting or something?

Errors after installing sample plugin

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Execute:

sfdx plugins:generate kbtest2, accept all the defaults
cd kbtest2
sfdx plugins:link

Output:

Installing dependencies for /Users/kbowden/kbtest2... done
Running prepare script for /Users/kbowden/kbtest2... done

Execute:
sfdx plugins

Output:

Running prepare script for /Users/kbowden/kbtest2... done
▸ Error parsing plugin /Users/kbowden/kbtest2
▸ 'MODULE_NOT_FOUND': Cannot find module '/Users/kbowden/kbtest2'
▸ Error parsing plugin /Users/kbowden/kbtest2
▸ 'MODULE_NOT_FOUND': Cannot find module '/Users/kbowden/kbtest2'

This output is produced for every sfdx command thereafter.

Executing sfdx plugins:unlink kbtest2 says that it isn't installed, but the behaviour continues. I have to uninstall sfdx and re-install it to fix.

When executed via bin/run, the plugin behaves as expected, so it seems to be how the plugin is associated with sfdx rather than errors in the plugin itself,

What is the expected behavior?

Linking the example plugin should not cause sfdx to throw errors.

Please mention your Salesforce CLI and OS version.

MacOS version 10.13.5 (17F77
sfdx-cli/6.21.0-9db990b3c9 (darwin-x64) node-v8.9.4

Generated plugin fails when linking

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Returns an error message when trying to link a generated plugin

mkdir plug1
cd .\plug1
sfdx plugins:generate plug1

It generates the expected scaffolding files.
When attempting to install dependencies, it gets to

sam
[3/5] Fetching packages...
[.......................................................................................] 0/202The system cannot find the path specified

I then run:
sfdx plugins:link

and get this output:

Installing dependencies for C:\Users\myusername\Desktop\plug1
|     yarn --non-interactive
|     --mutex=file:C:\Users\myusername\AppData\Local\sfdx\yarn
|     --cache-folder=C:\Users\myusernae\AppData\Local\sfdx\yarn exited
|    with code 1
|    error Command failed with exit code 1
|

Then try:
sfdx hello:org -u myPreviouslySetAlias

I receive:

|    hello:org is not a sfdx command
|    Perhaps you meant force:org
|    Run sfdx help for a list of available topics

What is the expected behavior?

It should print out the org command from the generated example

OS: 10.0.16299 N/A Build 16299
SFDX CLI Version: sfdx-cli/6.44.0-dead729fb5 (windows-x64) node-v8.9.4
Node: 8.9.4
NPM: 6.4.1

"Buffer() is deprecated"

Do you want to request a feature or report a bug?

A bug

What is the current behavior?

Running sfdx plugins:generate issues the following warning after running yard add v1.0.1:

(node:12066) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

What is the expected behavior?

Expected behavior: No warning

sfdx-cli: 6.34.0-6fec0d751a (darwin-x64) node-v8.9.4
OS version: macOS 10.14 Mojave

Error generating plugin

I've been using the plugin generator without any issues up until now, but today I received the following error when creating the plugin (and also if I executed "yarn run prepare") :

--- snip ---

$ rm -rf lib && tsc && oclif-dev manifest && oclif-dev readme
src/commands/hello/org.ts(11,22): error TS2417: Class static side 'typeof Org' incorrectly extends base class static side 'typeof SfdxCommand'.
Types of property 'flagsConfig' are incompatible.
Type '{ name: IOptionFlag; force: IBooleanFlag; }' is not assignable to type 'SfdxFlagsConfig'.
Property 'name' is incompatible with index signature.
Type 'IOptionFlag' is not assignable to type 'string | boolean | IBooleanFlag | JsonMap | IOptionFlag'.
Type 'IOptionFlag' is not assignable to type 'IOptionFlag'.
Type 'IOptionFlag' is not assignable to type '{ completion?: ICompletion; }'.
Types of property 'completion' are incompatible.
Type 'ICompletion' is not assignable to type 'ICompletion'. Two different types with this name exist, but they are unrelated.
Types of property 'cacheKey' are incompatible.
Type '(ctx: ICompletionContext) => Promise' is not assignable to type '(ctx: ICompletionContext) => Promise'. Two different types with this name exist, but they are unrelated.
Types of parameters 'ctx' and 'ctx' are incompatible.
Type 'ICompletionContext' is not assignable to type 'ICompletionContext'. Two different types with this name exist, but they are unrelated.
Types of property 'config' are incompatible.
Type 'IConfig' is not assignable to type 'IConfig'. Two different types with this name exist, but they are unrelated.
Property 'channel' is missing in type 'IConfig'.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

--- snip ---

I've added the full output in the attachment -
plugin_generate_output.txt

System info:

ProductName: Mac OS X
ProductVersion: 10.13.4
BuildVersion: 17E202

sfdx version:

sfdx-cli/6.17.0-b1f53723b9 (darwin-x64) node-v8.9.4

In case it was anything specific to my name/description etc, I've also tried creating one where I accept the defaults for everything other than the name, but got the same result.

Execute force namespace commands from plugin

Do you want to request a feature or report a bug?

Request a feature

What is the expected behavior?

Is it likely that we'll be able to execute commands from other namespaces as part of our plugins? For example, I'd like to be have a command that carries out some processing (e.g. to generate a package.xml) and then execute force:mdapi:retrieve. At the moment I'm using node scripts that carry out the processing and then executes sfdx, but that means the two items are a bit more independent of each other than I'd like.

This wouldn't be something that I'd want to do for every deployment, so I'm assuming that hooks wouldn't be the right solution, but don't really know anything about hooks so could easily be wrong!

MissingBundleError Plugin: XXX Missing bundle for locale en_US.

Summary

When I try to run sfdx plugins:link it tells me I'm "Missing bundle for locale en_US."

Steps To Reproduce:

  1. generate a new plugin
  2. attempt to link

Expected result

It should link

Actual result

(node:95931) MissingBundleError Plugin: sfdx-git-packager: Missing bundle sfdx-git-diff-to-pkg:package for locale en_US.
module: @oclif/[email protected]
task: toCached
plugin: sfdx-git-packager
root: /Users/charlesjonas/Documents/code/sfdx-git-diff-to-pkg
See more details with DEBUG=*
(node:95931) MissingBundleError Plugin: sfdx-git-packager: Missing bundle sfdx-git-diff-to-pkg:package f
or locale en_US.
module: @oclif/[email protected]
task: toCached
plugin: sfdx-git-packager
root: /Users/charlesjonas/Documents/code/sfdx-git-diff-to-pkg
See more details with DEBUG=*
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It
 is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning " > [email protected]" has unmet peer dependency "typescript@>=2.3.0-dev || >=2.4.0-dev || >=2.5.0-d
ev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev".
warning " > [email protected]" has unmet peer dependency "typescript@>=2.0".
sfdx-cli: linking plugin sfdx-git-packager... done
(node:95931) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit

Additional information

Feel free to attach a screenshot.

SFDX CLI Version:
7.23.1-ced0ec4940

OS and version:
osx 10.14.5

yarn run prepack fails for newly generated plugin

Summary

yarn run prepack throws error TS2440: Import declaration conflicts with local declaration of 'ConfigContents'

Steps To Reproduce:

$ sfdx plugins:generate foo # accept all defaults
$ cd foo
$ yarn run prepack

Expected result

yarn run prepack should succeed

Actual result

yarn run v1.19.1
$ rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme
node_modules/@salesforce/core/lib/config/configStore.d.ts:4:10 - error TS2440: Import declaration conflicts with local declaration of 'ConfigContents'.

4 import { ConfigContents } from './configStore';
           ~~~~~~~~~~~~~~


Found 1 error.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Additional information

It seems that this started to fail since typescript was being resolved to v3.7.2 on generating the plugin.

SFDX CLI Version: sfdx-cli/7.33.2 darwin-x64 node-v12.12.0

$ sfdx plugins --core
@oclif/plugin-commands 1.2.3 (core)
@oclif/plugin-help 2.2.1 (core)
@oclif/plugin-not-found 1.2.3 (core)
@oclif/plugin-plugins 1.7.8 (core)
@oclif/plugin-update 1.3.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.0.7 (core)
analytics 1.2.2 (core)
generator 1.1.2 (core)
salesforcedx 47.6.2 (core)
├─ salesforce-alm 47.9.0 (core)
└─ salesforcedx-templates 47.6.2 (core)
sfdx-cli 7.33.2 (core)

OS and version: MacOS Catalina (10.15.1)

No documentation for testing

Feature request

I tried to look at the tests generated by the plugin, and write my own.
However, I couldn't find any documentation for this (like what is "withOrg" ?).
Could we have some documentation on what's available ?

Plugin failure after install of sfdx for windows

Hi ,

It seems automatic scripts to load dependencies of SFDX plugins contains hardcoded Linux instructions.

Would it be possible to check the current system, or use cross-platform languages to perform file operations ?

To reproduce:

  • Install plugin sfdx_metadatas_filtering
    sfdx plugins:install sfdx_metadatas_filtering

  • Launch a standard command like sfdx force:org:open -> the plugin dependencies retrieval will be initiated, then it will crash when "rm" command is triggered

Many thanks & best regards

image

Error: command hello:org not found caused by incorrect folder structure on plugin

Summary

When using sfdx plugins:generate, the package.json file has an NPM script as follows

"commands": "./lib/commands"

but in the custom plugin directory structure, commands folder is under src folder.

This causes any plug-in commands to fail unless you change the NPM script to point to the correct filder.

Steps To Reproduce:

  1. Follow the steps documented here to scaffold a cli plugin https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_generate_scaffold.htm
  2. Run /bin/run hello:org

Result: hello:org is not a command

  1. Go to the package.json and modify the NPM script to point to src/commands
  2. Run /bin/run hello:org

Result: it works now

Expected result

The package.json NPM script should accurately reflect the directly structured provided.

Actual result

There's a mismatch between the NPM script and the directory structure.

Additional information

Feel free to attach a screenshot.

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):

sfdx-cli/7.78.1-5a65d9dd2f darwin-x64 node-v12.18.3

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)

@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.0 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.1 (core)
@oclif/plugin-update 1.3.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-diff 0.0.6
@salesforce/sfdx-scanner 2.4.0
@salesforce/sfdx-trust 3.4.3 (core)
alias 1.1.2 (core)
analytics 1.12.1 (core)
auth 1.3.0 (core)
config 1.1.10 (core)
documentor 0.0.0 (link) /Users/pgonzalez/Documents/trailheadOrgs/org1/documentor
generator 1.1.3 (core)
salesforcedx 50.3.1 (core)
├─ templates 50.1.0 (core)
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
├─ salesforce-alm 50.3.1 (core)
├─ custom-metadata 1.0.10 (core)
└─ apex 0.1.2 (core)
sfdx-cli 7.78.1 (core)

OS and version:

MacOS Catalina version 10.15.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.