qfpm 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.forceignore ADDED
@@ -0,0 +1,8 @@
1
+ # List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status
2
+ # More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm
3
+ #
4
+
5
+ package.xml
6
+ bin/
7
+ etc/
8
+ src/
@@ -0,0 +1,9 @@
1
+ # CONTRIBUTING
2
+
3
+ If I was to update this I'd likely re-write it into javascript and possibly a sfdx plugin, but if one does want to contribute to this in its frankenstien bash javascript form.
4
+
5
+ 1. Clone
6
+ 2. Edit
7
+ 3. Submit Pull Request
8
+ 4. Wait untill it is looked at it
9
+ 5. Repeat as needed
package/README.md CHANGED
@@ -1,12 +1,20 @@
1
+ [![NPM](https://img.shields.io/npm/v/qfpm.svg)](https://www.npmjs.com/package/qfpm)
2
+ [![Downloads/week](https://img.shields.io/npm/dw/qfpm.svg)](https://npmjs.org/package/qfpm)
3
+ ![QFPM Tests](https://github.com/gussamer/qfpm/actions/workflows/qfpmtest.yml/badge.svg)
4
+ [![qfpm](https://snyk.io/advisor/npm-package/qfpm/badge.svg)](https://snyk.io/advisor/npm-package/qfpm)
5
+ [![License](https://img.shields.io/badge/ISC-blue.svg)](https://raw.githubusercontent.com/gussamer/qfpm/master/LICENSE)
1
6
  # QFPM
2
7
 
3
8
  ## QRFDev Package Manager
4
9
 
5
- ### Installs the NPM SFDX Package Dependancy Resolution Proof of Concept scripts
6
- ======================================
10
+ ### A blend of NPM and SFDX into a Salesforce package dependancy management tool set
11
+
12
+ 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.
7
13
 
8
14
  ## Updates
9
15
 
16
+ - Updated the commands for the new sf structure
17
+
10
18
  - The removal of the bin/qfpm script dependancy complete, automated removal doesn't seem to work so feel free to delete them after upgrading
11
19
 
12
20
  - Conversion to using native npm bin definition seems stable and opens up better linux support
@@ -19,7 +27,7 @@
19
27
  1. Navigate to folder you want your project
20
28
  1. Create a SFDX project with
21
29
  ```bash
22
- sfdx force:project:create -n newsfdxproject
30
+ sf force project create -n newsfdxproject
23
31
  ```
24
32
  1. Move into the project folder with
25
33
  ```bash
@@ -34,7 +42,7 @@
34
42
  npm run setup
35
43
  ```
36
44
 
37
- \* qfpm has no external dependancies all warnings are due to packages salesforce uses in their default project package.json
45
+ \* all warnings are due to packages salesforce uses in their default project package.json
38
46
 
39
47
  ## Use
40
48
 
@@ -42,6 +50,8 @@
42
50
 
43
51
  #### Setup FFLIB commons sample code with dependancies
44
52
 
53
+ 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.
54
+
45
55
  1. Navigate to the [fflib sample code](https://github.com/apex-enterprise-patterns/fflib-apex-common-samplecode)
46
56
  1. Clone the repo locally
47
57
  ```bash
@@ -51,9 +61,9 @@
51
61
  ```bash
52
62
  cd fflib-apex-common-samplecode
53
63
  ```
54
- 1. init npm and hit enter through all questions
64
+ 1. init npm to create package.json
55
65
  ```bash
56
- npm init
66
+ npm init -y
57
67
  ```
58
68
  1. install the qfpm tools
59
69
  ```bash
@@ -71,6 +81,8 @@
71
81
 
72
82
  #### Setup AT4DX sample code with dependancies
73
83
 
84
+ 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.
85
+
74
86
  1. Navigate to the [at4dx sample code](https://github.com/apex-enterprise-patterns/at4dx-samplecode)
75
87
  1. Clone the repo locally
76
88
  ```bash
@@ -80,9 +92,9 @@
80
92
  ```bash
81
93
  cd at4dx-samplecode
82
94
  ```
83
- 1. init npm and hit enter through all questions
95
+ 1. init npm to create package.json
84
96
  ```bash
85
- npm init
97
+ npm init -y
86
98
  ```
87
99
  1. install the qfpm tools
88
100
  ```bash
@@ -97,7 +109,11 @@
97
109
  npm run setup
98
110
  ```
99
111
 
100
- *sfdx on WSL(maybe linux in general) seems to have an issue with the README.md inside the sfdx source dirs so I moved them in the npm package
112
+ *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.
113
+
114
+ ```bash
115
+ for x in $(find ./sfdx-source/ -name README.md); do rm -f $x; done
116
+ ```
101
117
 
102
118
  ### Commands
103
119
 
package/SECURITY.md ADDED
@@ -0,0 +1,4 @@
1
+ # Security
2
+ ___
3
+
4
+ Please report any vulnerabilities in the issues here on github as soon as possible. QFPM only depends on SFDX... and NPM and NODE but otherwise has no production dependancies to reduce possible issues but that doesn't preclude the possibility.
package/etc/help.txt CHANGED
@@ -1,9 +1,48 @@
1
1
  QRFDev Package Manager
2
2
 
3
- Welcome!
3
+ Commands
4
4
 
5
- Running this does nothing at all.
5
+ Build source into metadata format
6
6
 
7
- The npm install command writes scripts to the bin folder
7
+ - executes sfdx source convert
8
8
 
9
- The package.json is updated with the script locations
9
+ npm run build
10
+
11
+ Clean up scratch org
12
+
13
+ - marks projects scratch org for deletion
14
+
15
+ npm run clean
16
+
17
+ Deploy whole project directly as metadata format
18
+
19
+ - executes sfdx source deploy
20
+ - bypasses source tracking
21
+
22
+ npm run deploy
23
+
24
+ Push source to scratch org
25
+
26
+ - executes sfdx source push
27
+
28
+ npm run push
29
+
30
+ Scratch a new org
31
+
32
+ - creates new scratch org from config
33
+ - checks if org already exists
34
+
35
+ npm run scratch
36
+
37
+ Setup current project for development
38
+
39
+ - setups up a scratch org
40
+ - deploys all dependancies to scratch org
41
+
42
+ npm run setup
43
+
44
+ Test project
45
+
46
+ - runs all tests in scratch org
47
+
48
+ npm run test
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "qfpm",
3
- "version": "1.1.0",
4
- "description": "installs the NPM SFDX Package Dependancy Resolution Proof of Concept scripts",
3
+ "version": "1.1.2",
4
+ "description": "Salesforce package management tool set for mananging dependencies between packages",
5
5
  "main": "index.js",
6
+ "man": "./README.md",
6
7
  "keywords": [
7
8
  "salesforce",
8
9
  "package",
@@ -0,0 +1,11 @@
1
+ {
2
+ "packageDirectories": [
3
+ {
4
+ "path": "test",
5
+ "default": true
6
+ }
7
+ ],
8
+ "namespace": "",
9
+ "sfdcLoginUrl": "https://login.salesforce.com",
10
+ "sourceApiVersion": "55.0"
11
+ }
package/src/build.sh CHANGED
@@ -12,5 +12,5 @@ if [ "$DXPM_CURRENT_PACKAGE_NAME" = "" ]; then
12
12
  DXPM_CURRENT_PACKAGE_NAME="$($DXPM_NODE_MOD/.bin/qgetprojectname)"
13
13
  fi
14
14
  echo "[+] converting source for $DXPM_CURRENT_PACKAGE_NAME"
15
- sfdx force:source:convert -d "./manifest" -n "$DXPM_CURRENT_PACKAGE_NAME" -p "$($DXPM_NODE_MOD/.bin/qgetsrcfolders)" && wait
15
+ sf force source convert -d "./manifest" -n "$DXPM_CURRENT_PACKAGE_NAME" -p "$($DXPM_NODE_MOD/.bin/qgetsrcfolders)" && wait
16
16
  echo "[+] finished converting source for $DXPM_CURRENT_PACKAGE_NAME"
package/src/clean.sh CHANGED
@@ -12,5 +12,5 @@ if [ "$DXPM_SETUP_PACKAGE_NAME" = "" ]; then
12
12
  DXPM_SETUP_PACKAGE_NAME="$($DXPM_NODE_MOD/.bin/qgetprojectname)"
13
13
  fi
14
14
  echo "[+] checking if $DXPM_SETUP_PACKAGE_NAME scrach org exists and deleting it"
15
- $DXPM_NODE_MOD/.bin/qisscratched && sfdx force:org:delete -u "$DXPM_SETUP_PACKAGE_NAME" -p && wait
15
+ $DXPM_NODE_MOD/.bin/qisscratched && sf org delete scratch -o "$DXPM_SETUP_PACKAGE_NAME" -p && wait
16
16
  echo "[+] finished cleaning $DXPM_SETUP_PACKAGE_NAME scrach org"
package/src/deploy.sh CHANGED
@@ -16,5 +16,5 @@ if [ "$DXPM_CURRENT_PACKAGE_NAME" = "" ]; then
16
16
  fi
17
17
  echo "[+] deploying $DXPM_CURRENT_PACKAGE_NAME metadata to scratch org $DXPM_SETUP_PACKAGE_NAME"
18
18
  #todo: read package.json for all folder locations
19
- sfdx force:source:deploy -p "$($DXPM_NODE_MOD/.bin/qgetsrcfolders)" -w 10 -u "$DXPM_SETUP_PACKAGE_NAME" && wait
19
+ sf force source deploy -p "$($DXPM_NODE_MOD/.bin/qgetsrcfolders)" -w 10 -u "$DXPM_SETUP_PACKAGE_NAME" && wait
20
20
  echo "[+] finished deploying $DXPM_CURRENT_PACKAGE_NAME metadata to scratch org $DXPM_SETUP_PACKAGE_NAME"
@@ -5,7 +5,7 @@ if(process.argv[2]==undefined){
5
5
  var pack = JSON.parse(packageJSON)
6
6
  scratchName=pack.name
7
7
  }else scratchName=process.argv[2]
8
- var orgsJSON = require('child_process').execSync('sfdx force:org:list --json')
8
+ var orgsJSON = require('child_process').execSync('sf force org list --json')
9
9
  var orgs = JSON.parse(orgsJSON).result
10
10
  orgs.scratchOrgs.forEach(org => {
11
11
  if(org.alias==scratchName) process.exit()
package/src/push.sh CHANGED
@@ -11,5 +11,5 @@ if [ "$DXPM_SETUP_PACKAGE_NAME" = "" ]; then
11
11
  DXPM_SETUP_PACKAGE_NAME="$($DXPM_NODE_MOD/.bin/qgetprojectname)"
12
12
  fi
13
13
  echo "[+] pushing source to scratch org $DXPM_SETUP_PACKAGE_NAME"
14
- sfdx force:source:push -f -w 10 -u "$DXPM_SETUP_PACKAGE_NAME" && wait
14
+ sf force source push -f -w 10 -o "$DXPM_SETUP_PACKAGE_NAME" && wait
15
15
  echo "[+] finished pushing source to scratch org $DXPM_SETUP_PACKAGE_NAME"
package/src/scratch.sh CHANGED
@@ -11,8 +11,8 @@ if [ "$DXPM_SETUP_PACKAGE_NAME" = "" ]; then
11
11
  DXPM_SETUP_PACKAGE_NAME="$($DXPM_NODE_MOD/.bin/qgetprojectname)"
12
12
  fi
13
13
  echo "[+] setting up scratch org $DXPM_SETUP_PACKAGE_NAME"
14
- sfdx force:org:create -f $PWD/config/project-scratch-def.json -a "$DXPM_SETUP_PACKAGE_NAME" -d 1 -w 5 && wait
14
+ sf force org create -f $PWD/config/project-scratch-def.json -a "$DXPM_SETUP_PACKAGE_NAME" -d 1 -w 5 && wait
15
15
  echo "[+] finished setting up scratch org $DXPM_SETUP_PACKAGE_NAME"
16
16
  echo "[+] setting scratch org $DXPM_SETUP_PACKAGE_NAME as default locally"
17
- sfdx force:config:set defaultusername=$DXPM_SETUP_PACKAGE_NAME
17
+ sf force config set target-org $DXPM_SETUP_PACKAGE_NAME
18
18
  echo "[+] finished setting scratch org $DXPM_SETUP_PACKAGE_NAME as default username locally"
package/src/test.sh CHANGED
@@ -11,5 +11,5 @@ if [ "$DXPM_SETUP_PACKAGE_NAME" = "" ]; then
11
11
  DXPM_SETUP_PACKAGE_NAME="$($DXPM_NODE_MOD/.bin/qgetprojectname)"
12
12
  fi
13
13
  echo "[+] running tests for $DXPM_SETUP_PACKAGE_NAME"
14
- sfdx force:apex:test:run -l RunLocalTests -d ./test_results -r json -w 10 -u "$DXPM_SETUP_PACKAGE_NAME" && wait
14
+ sf force apex test run -l RunLocalTests -d ./test_results -r json -w 10 -o "$DXPM_SETUP_PACKAGE_NAME" && wait
15
15
  echo "[+] finished running tests for $DXPM_SETUP_PACKAGE_NAME"