@ds-sfdc/sfparty 1.5.1 โ†’ 1.5.3

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.
@@ -9,8 +9,12 @@ on:
9
9
  jobs:
10
10
  build:
11
11
  runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ node: [18, 20]
12
15
  env:
13
16
  working-directory: ./
17
+ HUSKY: 0 # Disable Husky during the CI/CD process
14
18
  steps:
15
19
  - run: echo "๐ŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
16
20
  - run: echo "๐Ÿง This job is now running on a ${{ runner.os }} server hosted by GitHub!"
@@ -20,7 +24,7 @@ jobs:
20
24
  - name: Setup node ${{ matrix.node }}
21
25
  uses: actions/setup-node@v3
22
26
  with:
23
- node-version: 19
27
+ node-version: ${{ matrix.node }}
24
28
  cache: 'npm'
25
29
  cache-dependency-path: '**/package-lock.json'
26
30
  - run: npm ci
@@ -35,4 +39,4 @@ jobs:
35
39
  - run: echo "๐Ÿงช Running tests ${{ job.status }}."
36
40
  - run: npm test
37
41
  working-directory: ${{env.working-directory}}
38
- - run: echo "๐Ÿ This job's status is ${{ job.status }}."
42
+ - run: echo "๐Ÿ This job's status is ${{ job.status }}."
@@ -0,0 +1,5 @@
1
+ {
2
+ "editor.formatOnPaste": true,
3
+ "editor.formatOnSave": true,
4
+ "editor.formatOnType": true
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ds-sfdc/sfparty",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Salesforce metadata XML splitter for CI/CD",
5
5
  "type": "module",
6
6
  "repository": {
@@ -12,9 +12,8 @@
12
12
  },
13
13
  "main": "src/index.js",
14
14
  "scripts": {
15
- "test": "jest",
16
- "prepack": "pinst --disable",
17
- "postpack": "pinst --enable"
15
+ "test": "jest --no-cache",
16
+ "prepare": "husky || true"
18
17
  },
19
18
  "keywords": [
20
19
  "salesforce,metadata,xml,split,yaml,json"
@@ -22,31 +21,33 @@
22
21
  "author": "Tim Paulaskas",
23
22
  "license": "BSD-3-Clause",
24
23
  "dependencies": {
25
- "axios": "^1.2.2",
26
- "cli-color": "^2.0.3",
27
- "cli-spinners": "^2.7.0",
24
+ "axios": "^1.6.8",
25
+ "cli-color": "^2.0.4",
26
+ "cli-spinners": "^2.9.2",
28
27
  "convert-hrtime": "^5.0.0",
29
28
  "js-yaml": "^4.1.0",
30
- "log-update": "^5.0.1",
31
- "marked": "^4.2.12",
32
- "marked-terminal": "^5.1.1",
33
- "pinst": "^3.0.0",
34
- "pretty-quick": "^3.1.3",
35
- "semver": "^7.3.8",
36
- "util": "^0.10.3",
37
- "winston": "^3.8.2",
29
+ "log-update": "^6.0.0",
30
+ "marked": "^12.0.1",
31
+ "marked-terminal": "^7.0.0",
32
+ "pretty-quick": "^4.0.0",
33
+ "semver": "^7.6.0",
34
+ "util": "^0.12.5",
35
+ "winston": "^3.13.0",
38
36
  "xml2js": "^0.6.2",
39
- "yargs": "^17.6.2"
37
+ "yargs": "^17.7.2"
40
38
  },
41
39
  "devDependencies": {
42
- "@babel/core": "^7.20.12",
43
- "@babel/preset-env": "^7.20.2",
44
- "@commitlint/cli": "^17.4.0",
45
- "@commitlint/config-conventional": "^17.4.0",
46
- "babel-jest": "^29.3.1",
47
- "jest": "^29.3.1",
48
- "nodemon": "^3.0.3",
49
- "prettier": "^2.8.3"
40
+ "@babel/core": "^7.24.4",
41
+ "@babel/preset-env": "^7.24.4",
42
+ "@commitlint/cli": "^19.2.1",
43
+ "@commitlint/config-conventional": "^19.1.0",
44
+ "babel-jest": "^29.7.0",
45
+ "eslint": "^9.0.0",
46
+ "husky": "^9.0.11",
47
+ "jest": "^29.7.0",
48
+ "lint-staged": "^15.2.2",
49
+ "nodemon": "^3.1.0",
50
+ "prettier": "^3.2.5"
50
51
  },
51
52
  "engines": {
52
53
  "node": ">=0.11"
@@ -58,5 +59,11 @@
58
59
  "directories": {
59
60
  "lib": "lib",
60
61
  "test": "tests"
62
+ },
63
+ "lint-staged": {
64
+ "*.js": [
65
+ "eslint --fix",
66
+ "prettier --write"
67
+ ]
61
68
  }
62
69
  }
package/src/index.js CHANGED
File without changes
@@ -126,11 +126,11 @@ export function saveFile(
126
126
  fileName = fileName.replaceSpecialChars()
127
127
  switch (format) {
128
128
  case 'json':
129
- let jsonString = JSON.stringify(json, null, '\t')
129
+ const jsonString = JSON.stringify(json, null, '\t')
130
130
  fsTmp.writeFileSync(fileName, jsonString)
131
131
  break
132
132
  case 'yaml':
133
- let doc = yaml.dump(json)
133
+ const doc = yaml.dump(json)
134
134
  fsTmp.writeFileSync(fileName, doc)
135
135
  break
136
136
  }
@@ -151,7 +151,11 @@ export function readFile(filePath, convert = true, fsTmp = fs) {
151
151
  flag: 'r',
152
152
  })
153
153
  if (convert && filePath.indexOf('.yaml') != -1) {
154
- result = yaml.load(data)
154
+ result = yaml.load(data, {
155
+ onWarning: (warning) => {
156
+ throw new Error(`YAML parsing warning: ${warning}`)
157
+ },
158
+ })
155
159
  } else if (convert && filePath.indexOf('.json') != -1) {
156
160
  result = JSON.parse(data)
157
161
  } else if (convert && filePath.indexOf('.xml') != -1) {
@@ -173,7 +177,7 @@ export function readFile(filePath, convert = true, fsTmp = fs) {
173
177
  async function convertXML(data) {
174
178
  return new Promise((resolve, reject) => {
175
179
  try {
176
- let parser = new Parser()
180
+ const parser = new Parser()
177
181
  parser.parseString(data, function (err, result) {
178
182
  if (err) throw err
179
183
  resolve(result)
@@ -89,7 +89,7 @@ export class Combine {
89
89
 
90
90
  if (!fileUtils.directoryExists({ dirPath: that.sourceDir, fs }))
91
91
  reject(`Path does not exist: ${that.sourceDir}`)
92
- let types = ['directories', 'singleFiles', 'main']
92
+ const types = ['directories', 'singleFiles', 'main']
93
93
  types.forEach((type) => {
94
94
  if (that.metadataDefinition[type] !== undefined) {
95
95
  that.#types = that.#types.concat(
@@ -120,9 +120,7 @@ export class Combine {
120
120
  that.#delta = that.metadataDefinition.delta && global.git.delta
121
121
 
122
122
  if (that.#delta) {
123
- const pathMatch = `/${that.metadataDefinition.directory}/${
124
- that.#fileName.shortName
125
- }/`
123
+ const pathMatch = `/${that.metadataDefinition.directory}/${that.#fileName.shortName}/`
126
124
 
127
125
  // get a list of all the added files
128
126
  that.#addedFiles = global.metaTypes[
@@ -148,7 +146,7 @@ export class Combine {
148
146
  )
149
147
  }
150
148
 
151
- let success = processParts(that)
149
+ const success = processParts(that)
152
150
  // Ensure we only match existing metadata type directory and item
153
151
 
154
152
  if (success) {
@@ -253,7 +251,7 @@ export class Combine {
253
251
  `main.${global.format}`,
254
252
  ),
255
253
  }
256
- let success = processFile(that, key, fileObj, 'main')
254
+ const success = processFile(that, key, fileObj, 'main')
257
255
  if (!success) {
258
256
  throw new Error('delete XML')
259
257
  }
@@ -559,7 +557,7 @@ export class Combine {
559
557
 
560
558
  function hydrateObject(that, json, key, fileObj) {
561
559
  const sortKey = that.metadataDefinition.sortKeys[key]
562
- let object = json.object
560
+ const object = json.object
563
561
 
564
562
  try {
565
563
  json[key].forEach((arrItem) => {
@@ -631,9 +629,9 @@ export class Combine {
631
629
  }
632
630
 
633
631
  function finishMessage(that) {
634
- let executionTime = getTimeDiff(BigInt(that.#startTime))
635
- let durationMessage = `${executionTime.seconds}.${executionTime.milliseconds}s`
636
- let stateIcon =
632
+ const executionTime = getTimeDiff(BigInt(that.#startTime))
633
+ const durationMessage = `${executionTime.seconds}.${executionTime.milliseconds}s`
634
+ const stateIcon =
637
635
  that.#errorMessage == ''
638
636
  ? global.icons.success
639
637
  : global.icons.fail
@@ -746,7 +744,7 @@ function arrangeKeys(that, json, key = undefined) {
746
744
 
747
745
  function getTimeDiff(startTime, endTime = process.hrtime.bigint()) {
748
746
  const diff = BigInt(endTime) - BigInt(startTime)
749
- let executionTime = convertHrtime(diff)
747
+ const executionTime = convertHrtime(diff)
750
748
  executionTime.seconds = Math.round(executionTime.seconds)
751
749
  executionTime.milliseconds = Math.round(executionTime.milliseconds / 1000)
752
750
  if (executionTime.milliseconds == 0 && executionTime.nanoseconds > 0)