-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Setup Guide
Welcome to the Salesforce Metadata Opener developer onboarding guide. This document helps you set up your local environment to develop, run, test, and package the VS Code extension.
Install the following first:
-
VS Code
>= 1.102.0 -
Node.js
>= 20.xand npm>= 9.x - Git
-
Salesforce CLI (
sf) on yourPATH -
VSCE (
@vscode/vsce) if you want to package.vsixfiles locally - Recommended VS Code extension: ESLint
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# restart your shell, then:
nvm install 20
nvm use 20
node -v
npm -vWindows users can use nvm-windows or install Node from nodejs.org.
Install the sf CLI for your OS. After installation:
sf --versiongit clone https://github.com/gitmatheus/sf-metadata-opener.git
cd sf-metadata-opener
npm cinpm ci gives deterministic installs that match the lockfile.
Launch a VS Code Extension Development Host.
npm run localnpm run local-no-extThis project uses esbuild and prepares the manifest before compiling.
npm run compilenpm run watchThis runs watch:esbuild and watch:tsc in parallel.
npm test
npm run lintnpm test triggers pretest, which compiles tests, compiles the extension, and lints the code.
Create a production bundle:
npm run packageCreate a .vsix for local installation:
vsce package --no-dependenciesnpm run publish also calls vsce package --no-dependencies.
From package.json:
| Script | What it does |
|---|---|
prepare:manifest |
Builds the extension manifest files before compile |
check-types |
Type checks with tsc --noEmit
|
compile |
Runs manifest prep, type check, then node esbuild.js
|
watch |
Runs watch:* scripts in parallel |
watch:esbuild |
node esbuild.js --watch |
watch:tsc |
tsc --noEmit --watch |
package |
Production build via node esbuild.js --production
|
vscode:prepublish |
Calls npm run package
|
publish |
vsce package --no-dependencies |
compile-tests |
Compiles tests to out with tsc
|
watch-tests |
Watches tests to out
|
pretest |
Runs compile-tests, compile, and lint
|
lint |
ESLint on src with .ts files |
test |
Runs tests via vscode-test
|
local-no-ext |
Compile, then launch VS Code with other extensions disabled |
local |
Compile, then launch VS Code with this folder as the dev extension |
-
src/TypeScript sources -
scripts/manifest/manifest generation scripts -
esbuild.jsbuild configuration -
dist/output folder for bundled extension -
package.jsonscripts and dependencies -
tsconfig.jsonTypeScript configuration -
webpack.config.jspresent for historical reasons, current builds use esbuild
Authenticate a default org for testing.
sf org login web -s -a mySandbox
sf org listThe extension resolves metadata with sf data query in many flows, so make sure your default org is set correctly.
Open VS Code Settings and search for Salesforce Metadata Opener, or set them in settings.json.
{
"SalesforceMetadataOpener.useSfCommandToOpenMetadata": true,
"SalesforceMetadataOpener.deployBeforeOpen": true
}-
useSfCommandToOpenMetadatacontrols whether the extension may usesf org open --source-filefor supported types, or always build direct URLs -
deployBeforeOpencontrols whether to deploy the local file before opening
npm ci-
npm run watchin one terminal -
npm run localin another terminal - Open a Salesforce project folder with metadata files
- Use the context menu or Command Palette to trigger commands
-
sfnot found. Install the Salesforce CLI and add it to yourPATH -
Engine mismatch. Update VS Code to
1.102.0or newer -
Type errors. Ensure Node 18 is active, then
npm ciagain -
No context menu items. Confirm the file name matches a supported pattern, for example
.flow-meta.xml,.bot-meta.xml,.dashboard-meta.xml,.report-meta.xml -
Dev host does not reload. Keep
npm run watchrunning, or runnpm run compile -
Packaging errors. Install
@vscode/vsceglobally before runningvsce package
Create a branch, run npm run watch and npm run local, and iterate.
Open a pull request when ready. Happy building.