The package mangement methodology intended with qfpm is meant to aid with the dependancy management side of salesforce packages. Currently this could be implmented with a private npm service to benefit from the npm dependancy resolution applied to a teams salesforce metadata libraries as they are broken down into packages with a dependancy hierarchy. QFPM could be extended to support the management of sfdx package2 building and installation with dependencies, as well converted to sfdx plugin, if I ever get around to doing it.
-
Updated the commands for the new sf structure
-
The removal of the bin/qfpm script dependancy complete, automated removal doesn't seem to work so feel free to delete them after upgrading
-
Conversion to using native npm bin definition seems stable and opens up better linux support
-
WSL support seems to be working though with a big salesforce asterisk down in the AT4DX example
- Open Git Bash on Windows
- Navigate to folder you want your project
- Create a SFDX project with
sf force project create -n newsfdxproject
- Move into the project folder with
cd newsfdxproject
- Install the qfpm tools with*
npm install qfpm --save --only=prod
- Run setup to create scratch org and deploy dependancies
npm run setup
* all warnings are due to packages salesforce uses in their default project package.json
This example demonstates facilitating two layers of dependancies required to get started with the fflib apex common sample code library. The sample code requries the fflib apex commons library which intern is dependant on the fflib apex mocks library. With example npm packages for both the commons and mocks published publicly to npm, qfpm is able to install all dependancies via soap to avoid source tracking and then push the sample code for work tracked in the scratch org.
- Navigate to the fflib sample code
- Clone the repo locally
git clone https://github.com/apex-enterprise-patterns/fflib-apex-common-samplecode.git
- cd into repo
cd fflib-apex-common-samplecode
- init npm to create package.json
npm init -y
- install the qfpm tools
npm install --save qfpm
- install the the fflib commons
npm install --save npm-fflib-common
- setup scratch org and install all
npm run setup
This example expands on the previous fflib sample code to satisfy the requirments of the at4dx sample code. As before the multi layered fflib commons and mocks are required by the at4dx requirement which also has a parallel dependancy of force-di. All of which are installed via soap into a scratch org with the at4dx sample code pushed for tracking.
- Navigate to the at4dx sample code
- Clone the repo locally
git clone https://github.com/apex-enterprise-patterns/at4dx-samplecode.git
- cd into repo
cd at4dx-samplecode
- init npm to create package.json
npm init -y
- install the qfpm tools
npm install --save qfpm
- install the at4dx libraries
npm install --save npm-at4dx
- setup scratch org and install all*
npm run setup
*sfdx on WSL(maybe linux in general) seems to have an issue thinking the README.md inside the sfdx source dirs is a custom metadata type, so I removed them in the npm package as they just said put stuff here. You can run this command after cloning to delete all the offending README.md files in this repo as a work around.
for x in $(find ./sfdx-source/ -name README.md); do rm -f $x; done
-
Build source into metadata format
- executes sfdx source convert
npm run build
-
Clean up scratch org
- marks projects scratch org for deletion
npm run clean
-
Deploy whole project directly as metadata format
- executes sfdx source deploy
- bypasses source tracking
npm run deploy
-
Push source to scratch org
- executes sfdx source push
npm run push
-
Scratch a new org
- creates new scratch org from config
- checks if org already exists
npm run scratch
-
Setup current project for development
- setups up a scratch org
- deploys all dependancies to scratch org
npm run setup
-
Test project
- runs all tests in scratch org
npm run test