At the moment, we are not accepting external contributions. Please watch this space to know when we open.
Clone a copy of sfdx-scanner code through git:
git clone https://github.com/forcedotcom/sfdx-scanner.git
Build first time using yarn:
cd sfdx-scanner
yarn --ignore-scripts && yarn build
Run any sf scanner command by replacing sf
with bin/dev.js
or bin/dev.cmd
from sfdx-scanner directory. For example, you can invoke list
command with:
bin/dev.js scanner rule list
Checkout a branch copy of dev
branch. Make your changes and write unit tests in ./test/
directory.
To run tests, use:
yarn test
Before pushing your changes and creating a PR, run this to make sure the build would remain stable:
yarn --ignore-scripts && yarn build && yarn test && yarn lint
We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the .vscode
directory of this plugin is a launch.json
config file, which allows you to attach a debugger to the node process when running your commands.
To debug the scanner rule list
command:
- Start the inspector
If you linked your plugin to the sf cli, call your command with the dev-suspend
switch:
$ sf scanner rule list --dev-suspend
Alternatively, to call your command using the bin/dev.js
or bin/dev.cmd
script, set the NODE_OPTIONS
environment variable to --inspect-brk
when starting the debugger:
$ NODE_OPTIONS=--inspect-brk bin/dev.js scanner rule list
- Set some breakpoints in your command code
- Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
- In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
- Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
- Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5).
Congrats, you are debugging!
Create PR with work item name in the title - this would look like: `@W-1234567@ Descriptive title of work``
Also, add helpful information about your changes so that reviewers can navigate easily and know what to look for.
- Checkout and pull master. Update package.json and increment the version appropriately, of the form X.Y.Z.
- Commit and push your change. This is also a good opportunity to 'yarn upgrade' and commit the new yarn.lock file.
- git tag v<X.Y.Z>
- git push origin v<X.Y.Z>
- CircleCI is triggered to test and deploy a new package with your new version.