@terafina/tffa-sfdx-plugin 2.2.1 → 2.2.3-rc.1

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.
Files changed (42) hide show
  1. package/README.md +30 -10
  2. package/bin/pmd/apex_ruleset.xml +321 -0
  3. package/bin/pmd/lib/animal-sniffer-annotations-1.14.jar +0 -0
  4. package/bin/pmd/lib/antlr-2.7.7.jar +0 -0
  5. package/bin/pmd/lib/antlr-runtime-3.5.2.jar +0 -0
  6. package/bin/pmd/lib/antlr4-runtime-4.7.2.jar +0 -0
  7. package/bin/pmd/lib/aopalliance-1.0.jar +0 -0
  8. package/bin/pmd/lib/asm-9.2.jar +0 -0
  9. package/bin/pmd/lib/cglib-3.3.0.jar +0 -0
  10. package/bin/pmd/lib/common_2.13-4.2.0.jar +0 -0
  11. package/bin/pmd/lib/commons-lang3-3.8.1.jar +0 -0
  12. package/bin/pmd/lib/error_prone_annotations-2.1.3.jar +0 -0
  13. package/bin/pmd/lib/gson-2.8.9.jar +0 -0
  14. package/bin/pmd/lib/j2objc-annotations-1.1.jar +0 -0
  15. package/bin/pmd/lib/javax.inject-1.jar +0 -0
  16. package/bin/pmd/lib/jcommander-1.48.jar +0 -0
  17. package/bin/pmd/lib/jol-core-0.4.jar +0 -0
  18. package/bin/pmd/lib/jsr305-3.0.2.jar +0 -0
  19. package/bin/pmd/lib/logback-classic-1.2.9.jar +0 -0
  20. package/bin/pmd/lib/logback-core-1.2.9.jar +0 -0
  21. package/bin/pmd/lib/pmd-apex-6.47.0.jar +0 -0
  22. package/bin/pmd/lib/pmd-apex-jorje-6.47.0-lib.jar +0 -0
  23. package/bin/pmd/lib/pmd-apex-jorje-6.47.0.pom +140 -0
  24. package/bin/pmd/lib/pmd-core-6.47.0.jar +0 -0
  25. package/bin/pmd/lib/rhino-1.7.14.jar +0 -0
  26. package/bin/pmd/lib/saxon-9.1.0.8-dom.jar +0 -0
  27. package/bin/pmd/lib/saxon-9.1.0.8.jar +0 -0
  28. package/bin/pmd/lib/slf4j-api-1.7.32.jar +0 -0
  29. package/bin/pmd/lib/snakeyaml-1.30.jar +0 -0
  30. package/bin/pmd/lib/stringtemplate-3.2.1.jar +0 -0
  31. package/bin/update.sh +49 -0
  32. package/lib/commands/tffa/lint.d.ts +2 -0
  33. package/lib/commands/tffa/lint.js +14 -1
  34. package/lib/commands/tffa/lint.js.map +1 -1
  35. package/lib/shared/pmd/apex.d.ts +8 -0
  36. package/lib/shared/pmd/apex.js +111 -0
  37. package/lib/shared/pmd/apex.js.map +1 -0
  38. package/lib/shared/pmd/jreSetupManager.d.ts +17 -0
  39. package/lib/shared/pmd/jreSetupManager.js +135 -0
  40. package/lib/shared/pmd/jreSetupManager.js.map +1 -0
  41. package/oclif.manifest.json +1 -1
  42. package/package.json +17 -15
package/README.md CHANGED
@@ -6,6 +6,13 @@ tffa-sfdx-plugin is a SalesforceDX plugin from Terafina containing tools for sca
6
6
 
7
7
  ## Setup
8
8
 
9
+ Before you get started, install the required software on your computer.
10
+
11
+ 1. Install Java from [OpenJDK Runtime Environment 18.9 (build 11.0.2+9)](https://openjdk.java.net/install/) or via [brew](https://formulae.brew.sh/formula/openjdk@11) .Some features in Salesforce Extensions for VS Code depend upon the Java Platform.
12
+ 2. Install [sfdx-cli](https://developer.salesforce.com/tools/sfdxcli) for osx using `npm install -g sfdx-cli`
13
+
14
+ For information about installing Salesforce CLI, see the Salesforce DX Setup Guide.
15
+
9
16
  ### **Install as a SalesforceDX Plugin**
10
17
 
11
18
  ```
@@ -34,7 +41,7 @@ $ npm install -g @terafina/tffa-sfdx-plugin
34
41
  $ sfdx COMMAND
35
42
  running command...
36
43
  $ sfdx (--version|-v)
37
- @terafina/tffa-sfdx-plugin/2.2.1 linux-x64 node-v16.13.1
44
+ @terafina/tffa-sfdx-plugin/2.2.3-rc.1 linux-x64 node-v16.13.1
38
45
  $ sfdx --help [COMMAND]
39
46
  USAGE
40
47
  $ sfdx COMMAND
@@ -47,7 +54,7 @@ USAGE
47
54
  <!-- commands -->
48
55
  * [`sfdx help [COMMAND]`](#sfdx-help-command)
49
56
  * [`sfdx tffa:apexdoc [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffaapexdoc--d-directory---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
50
- * [`sfdx tffa:lint [-s <directory>] [-m <integer>] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffalint--s-directory--m-integer--j---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
57
+ * [`sfdx tffa:lint [-s <directory>] [-m <integer>] [-p] [-r <filepath>] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffalint--s-directory--m-integer--p--r-filepath--j---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
51
58
  * [`sfdx tffa:meta [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffameta--s-directory--d-directory--c-directory--o-jsoncsvhuman--f---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
52
59
  * [`sfdx tffa:ping [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffaping---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
53
60
  * [`sfdx version`](#sfdx-version)
@@ -95,21 +102,23 @@ EXAMPLES
95
102
  Generate Apex API Documentation : $sfdx tffa:apexdoc
96
103
  ```
97
104
 
98
- _See code: [src/commands/tffa/apexdoc.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v2.2.1/src/commands/tffa/apexdoc.ts)_
105
+ _See code: [src/commands/tffa/apexdoc.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v2.2.3-rc.1/src/commands/tffa/apexdoc.ts)_
99
106
 
100
- ## `sfdx tffa:lint [-s <directory>] [-m <integer>] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
107
+ ## `sfdx tffa:lint [-s <directory>] [-m <integer>] [-p] [-r <filepath>] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
101
108
 
102
109
  scan a sfdx project and provide a violations report based on defined standards
103
110
 
104
111
  ```
105
112
  USAGE
106
- $ sfdx tffa:lint [-s <directory>] [-m <integer>] [-j] [--loglevel
113
+ $ sfdx tffa:lint [-s <directory>] [-m <integer>] [-p] [-r <filepath>] [-j] [--loglevel
107
114
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
108
115
 
109
116
  FLAGS
110
117
  -j, --json generate json output
111
118
  -m, --minapi=<value> [default: 53] minimum api version to
112
119
  use during quality checks
120
+ -p, --pmd generate pmd output
121
+ -r, --rulesetpath=<value> path to pmd ruleset
113
122
  -s, --sourcefolder=<value> [default: .] directory containing
114
123
  sfdx project
115
124
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
@@ -122,7 +131,7 @@ EXAMPLES
122
131
  Scan a sfdx project and provide list of code violations : $sfdx tffa:scan
123
132
  ```
124
133
 
125
- _See code: [src/commands/tffa/lint.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v2.2.1/src/commands/tffa/lint.ts)_
134
+ _See code: [src/commands/tffa/lint.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v2.2.3-rc.1/src/commands/tffa/lint.ts)_
126
135
 
127
136
  ## `sfdx tffa:meta [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
128
137
 
@@ -151,7 +160,7 @@ EXAMPLES
151
160
  scan a sfdx project for metadata : $sfdx tffa:meta
152
161
  ```
153
162
 
154
- _See code: [src/commands/tffa/meta.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v2.2.1/src/commands/tffa/meta.ts)_
163
+ _See code: [src/commands/tffa/meta.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v2.2.3-rc.1/src/commands/tffa/meta.ts)_
155
164
 
156
165
  ## `sfdx tffa:ping [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
157
166
 
@@ -173,14 +182,25 @@ EXAMPLES
173
182
  $ sfdx tffa:ping
174
183
  ```
175
184
 
176
- _See code: [src/commands/tffa/ping.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v2.2.1/src/commands/tffa/ping.ts)_
185
+ _See code: [src/commands/tffa/ping.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v2.2.3-rc.1/src/commands/tffa/ping.ts)_
177
186
 
178
187
  ## `sfdx version`
179
188
 
180
189
  ```
181
190
  USAGE
182
- $ sfdx version
191
+ $ sfdx version [--json] [--verbose]
192
+
193
+ FLAGS
194
+ --verbose Show additional information about the CLI.
195
+
196
+ GLOBAL FLAGS
197
+ --json Format output as json.
198
+
199
+ FLAG DESCRIPTIONS
200
+ --verbose Show additional information about the CLI.
201
+
202
+ Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
183
203
  ```
184
204
 
185
- _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v1.0.4/src/commands/version.ts)_
205
+ _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v1.1.1/src/commands/version.ts)_
186
206
  <!-- commandsstop -->
@@ -0,0 +1,321 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <ruleset
3
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ name="Default ruleset used by the CodeClimate Engine for Salesforce.com Apex"
6
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"
7
+ >
8
+ <description>Default ruleset used by the Code Climate Engine for Salesforce.com Apex</description>
9
+ <exclude-pattern>.*/.sfdx/.*</exclude-pattern>
10
+ <exclude-pattern>.*/data/.*</exclude-pattern>
11
+ <exclude-pattern>.*/design/.*</exclude-pattern>
12
+ <exclude-pattern>.*/mdapi-source/.*</exclude-pattern>
13
+ <exclude-pattern>.*/guides/.*</exclude-pattern>
14
+ <exclude-pattern>.*/dist/.*</exclude-pattern>
15
+ <exclude-pattern>.*/scripts/.*</exclude-pattern>
16
+ <exclude-pattern>.*/node_modules/.*</exclude-pattern>
17
+ <!-- BEST PRACTICES -->
18
+ <!-- <rule
19
+ ref="category/apex/bestpractices.xml/ApexAssertionsShouldIncludeMessage"
20
+ message="Apex test assert statement should make use of the message parameter."
21
+ >
22
+ <priority>3</priority>
23
+ <properties>
24
+
25
+ </properties>
26
+ </rule> -->
27
+ <rule ref="category/apex/bestpractices.xml/AvoidLogicInTrigger" message="Avoid logic in triggers">
28
+ <priority>3</priority>
29
+ <properties />
30
+ </rule>
31
+ <!--
32
+ <rule ref="category/apex/bestpractices.xml/UnusedLocalVariable" message="Variable ''{0}'' defined but not used">
33
+ <priority>3</priority>
34
+ <properties></properties>
35
+ </rule> -->
36
+ <rule
37
+ ref="category/apex/bestpractices.xml/ApexUnitTestClassShouldHaveAsserts"
38
+ message="Apex unit test classes should have at least one System.assert() or assertEquals() or AssertNotEquals() call"
39
+ >
40
+ <priority>3</priority>
41
+ <properties />
42
+ </rule>
43
+ <rule
44
+ ref="category/apex/bestpractices.xml/ApexUnitTestMethodShouldHaveIsTestAnnotation"
45
+ message="Apex test methods should have @isTest annotation."
46
+ >
47
+ <priority>3</priority>
48
+ <properties />
49
+ </rule>
50
+ <rule
51
+ ref="category/apex/bestpractices.xml/ApexUnitTestShouldNotUseSeeAllDataTrue"
52
+ message="@isTest(seeAllData=true) should not be used in Apex unit tests because it opens up the existing database data for unexpected modification by tests"
53
+ >
54
+ <priority>3</priority>
55
+ <properties />
56
+ </rule>
57
+ <!-- DESIGN -->
58
+ <rule ref="category/apex/design.xml/ExcessiveClassLength" message="Avoid really long classes (lines of code)">
59
+ <priority>3</priority>
60
+ <properties>
61
+ <property name="minimum" value="4000" />
62
+ </properties>
63
+ </rule>
64
+ <rule ref="category/apex/design.xml/ExcessiveParameterList" message="Avoid long parameter lists">
65
+ <priority>3</priority>
66
+ <properties>
67
+ <property name="minimum" value="10" />
68
+ </properties>
69
+ </rule>
70
+ <!-- <rule ref="category/apex/design.xml/ExcessivePublicCount" message="This class has too many public methods and attributes">
71
+ <priority>3</priority>
72
+ <properties>
73
+ <property name="minimum" value="1000" />
74
+ </properties>
75
+ </rule> -->
76
+ <rule ref="category/apex/design.xml/NcssConstructorCount" message="The constructor has an NCSS line count of {0}">
77
+ <priority>3</priority>
78
+ <properties>
79
+ <property name="minimum" value="40" />
80
+ </properties>
81
+ </rule>
82
+ <rule ref="category/apex/design.xml/NcssMethodCount" message="The method {0}() has an NCSS line count of {1}">
83
+ <priority>3</priority>
84
+ <properties>
85
+ <property name="minimum" value="200" />
86
+ </properties>
87
+ </rule>
88
+ <rule ref="category/apex/design.xml/NcssTypeCount" message="The type has an NCSS line count of {0}">
89
+ <priority>3</priority>
90
+ <properties>
91
+ <property name="minimum" value="1500" />
92
+ </properties>
93
+ </rule>
94
+ <rule ref="category/apex/design.xml/AvoidDeeplyNestedIfStmts" message="Deeply nested if..else statements are hard to read">
95
+ <priority>3</priority>
96
+ <properties>
97
+ <property name="problemDepth" value="10" />
98
+ </properties>
99
+ </rule>
100
+ <rule ref="category/apex/design.xml/CyclomaticComplexity">
101
+ <priority>3</priority>
102
+ <properties>
103
+ <property name="classReportLevel" value="800" />
104
+ <property name="methodReportLevel" value="100" />
105
+ </properties>
106
+ </rule>
107
+ <rule ref="category/apex/design.xml/CognitiveComplexity">
108
+ <priority>3</priority>
109
+ <properties>
110
+ <property name="classReportLevel" value="800" />
111
+ <property name="methodReportLevel" value="100" />
112
+ </properties>
113
+ </rule>
114
+ <!-- PERFORMANCE -->
115
+ <rule ref="category/apex/performance.xml/AvoidDebugStatements" message="Avoid debug statements since they impact on performance">
116
+ <priority>3</priority>
117
+ <properties />
118
+ </rule>
119
+ <rule ref="category/apex/performance.xml/OperationWithLimitsInLoop" message="Avoid operations in loops that may hit governor limits">
120
+ <priority>3</priority>
121
+ <properties />
122
+ </rule>
123
+ <!-- <rule
124
+ ref="category/apex/performance.xml/EagerlyLoadedDescribeSObjectResult"
125
+ message="DescribeSObjectResult could be being loaded eagerly with all child relationships."
126
+ >
127
+ <priority>3</priority>
128
+ <properties>
129
+
130
+
131
+
132
+ </properties>
133
+ </rule> -->
134
+ <!-- CODE STYLE -->
135
+ <rule ref="category/apex/codestyle.xml/OneDeclarationPerLine">
136
+ <priority>3</priority>
137
+ <properties />
138
+ </rule>
139
+ <rule ref="category/apex/codestyle.xml/ClassNamingConventions" message="Class names should begin with an uppercase character">
140
+ <priority>3</priority>
141
+ <properties />
142
+ </rule>
143
+ <!-- <rule
144
+ ref="category/apex/codestyle.xml/FieldDeclarationsShouldBeAtStart"
145
+ message="Field declaration for ''{0}'' should be before method declarations in its class"
146
+ >
147
+ <priority>3</priority>
148
+ <properties>
149
+
150
+
151
+
152
+ </properties>
153
+ </rule> -->
154
+ <rule ref="category/apex/codestyle.xml/MethodNamingConventions" message="Method name does not begin with a lower case character.">
155
+ <priority>3</priority>
156
+ <properties />
157
+ </rule>
158
+ <rule
159
+ ref="category/apex/errorprone.xml/MethodWithSameNameAsEnclosingClass"
160
+ message="Classes should not have non-constructor methods with the same name as the class"
161
+ >
162
+ <priority>3</priority>
163
+ <properties />
164
+ </rule>
165
+ <rule ref="category/apex/codestyle.xml/FieldNamingConventions">
166
+ <properties>
167
+ <property name="enumConstantPattern" value="[A-Z][a-zA-Z0-9_]*" />
168
+ <property name="constantPattern" value="[a-zA-Z0-9_]*" />
169
+ <property name="finalPattern" value="[a-zA-Z0-9_]*" />
170
+ <property name="staticPattern" value="[a-zA-Z0-9_]*" />
171
+ <property name="instancePattern" value="[a-zA-Z][a-zA-Z0-9_]*" />
172
+ </properties>
173
+ </rule>
174
+ <rule ref="category/apex/codestyle.xml/PropertyNamingConventions">
175
+ <properties>
176
+ <property name="staticPattern" value="[a-z][a-z_A-Z0-9]*" />
177
+ <property name="instancePattern" value="[a-z][a-z_A-Z0-9]*" />
178
+ </properties>
179
+ </rule>
180
+ <rule ref="category/apex/codestyle.xml/FormalParameterNamingConventions">
181
+ <properties>
182
+ <property name="finalMethodParameterPattern" value="[a-z][a-zA-Z0-9]*" />
183
+ <property name="methodParameterPattern" value="[a-z][a-zA-Z0-9_]*" />
184
+ </properties>
185
+ </rule>
186
+ <rule ref="category/apex/codestyle.xml/LocalVariableNamingConventions">
187
+ <properties>
188
+ <property name="finalLocalPattern" value="[a-z][a-zA-Z0-9]*" />
189
+ <property name="localPattern" value="[a-z][a-zA-Z0-9]*" />
190
+ </properties>
191
+ </rule>
192
+ <!-- SECURITY -->
193
+ <rule ref="category/apex/security.xml/ApexInsecureEndpoint" message="Apex callouts should use encrypted communication channels">
194
+ <priority>3</priority>
195
+ <properties />
196
+ </rule>
197
+ <rule
198
+ ref="category/apex/security.xml/ApexSharingViolations"
199
+ message="Apex classes should declare a sharing model if DML or SOQL/SOSL is used"
200
+ >
201
+ <priority>3</priority>
202
+ <properties />
203
+ </rule>
204
+ <rule ref="category/apex/security.xml/ApexOpenRedirect" message="Apex classes should safely redirect to a known location">
205
+ <priority>3</priority>
206
+ <properties />
207
+ </rule>
208
+ <rule ref="category/apex/security.xml/ApexSOQLInjection" message="Apex classes should escape variables merged in DML query">
209
+ <priority>3</priority>
210
+ <properties />
211
+ </rule>
212
+ <rule ref="category/apex/security.xml/ApexXSSFromURLParam" message="Apex classes should escape Strings obtained from URL parameters">
213
+ <priority>3</priority>
214
+ <properties />
215
+ </rule>
216
+ <rule ref="category/apex/security.xml/ApexXSSFromEscapeFalse" message="Apex classes should escape addError strings">
217
+ <priority>3</priority>
218
+ <properties />
219
+ </rule>
220
+ <rule ref="category/apex/security.xml/ApexBadCrypto" message="Apex Crypto should use random IV/key">
221
+ <priority>3</priority>
222
+ <properties />
223
+ </rule>
224
+ <rule ref="category/apex/security.xml/ApexCRUDViolation" message="Validate CRUD permission before SOQL/DML operation">
225
+ <priority>3</priority>
226
+ <properties />
227
+ </rule>
228
+ <rule ref="category/apex/security.xml/ApexDangerousMethods" message="Calling potentially dangerous method">
229
+ <priority>3</priority>
230
+ <properties />
231
+ </rule>
232
+ <rule ref="category/apex/security.xml/ApexSuggestUsingNamedCred" message="Consider using named credentials for authenticated callouts">
233
+ <priority>3</priority>
234
+ <properties />
235
+ </rule>
236
+ <!-- ERROR PRONE -->
237
+ <rule ref="category/apex/codestyle.xml/WhileLoopsMustUseBraces" message="Avoid using 'while' statements without curly braces">
238
+ <priority>3</priority>
239
+ <properties />
240
+ </rule>
241
+ <rule ref="category/apex/codestyle.xml/ForLoopsMustUseBraces" message="Avoid using 'for' statements without curly braces">
242
+ <priority>3</priority>
243
+ <properties />
244
+ </rule>
245
+ <rule ref="category/apex/errorprone.xml/ApexCSRF" message="Avoid making DML operations in Apex class constructor/init method">
246
+ <priority>3</priority>
247
+ <properties />
248
+ </rule>
249
+ <rule ref="category/apex/errorprone.xml/EmptyCatchBlock" message="Avoid empty catch blocks">
250
+ <priority>3</priority>
251
+ <properties />
252
+ </rule>
253
+ <rule ref="category/apex/errorprone.xml/EmptyIfStmt" message="Avoid empty 'if' statements">
254
+ <priority>3</priority>
255
+ <properties />
256
+ </rule>
257
+ <rule ref="category/apex/errorprone.xml/AvoidDirectAccessTriggerMap" message="Avoid directly accessing Trigger.old and Trigger.new">
258
+ <priority>3</priority>
259
+ <properties />
260
+ </rule>
261
+ <rule ref="category/apex/errorprone.xml/AvoidNonExistentAnnotations">
262
+ <properties />
263
+ </rule>
264
+ <rule ref="category/apex/errorprone.xml/AvoidHardcodingId" message="Avoid hardcoding ID's">
265
+ <priority>3</priority>
266
+ <properties />
267
+ </rule>
268
+ <!-- <rule ref="category/apex/errorprone.xml/EmptyStatementBlock" message="Avoid empty 'if' statements">
269
+ <priority>3</priority>
270
+ <properties>
271
+
272
+
273
+
274
+
275
+ </properties>
276
+ </rule>
277
+ -->
278
+ <rule ref="category/apex/errorprone.xml/EmptyWhileStmt" message="Avoid empty 'while' statements">
279
+ <priority>3</priority>
280
+ <properties />
281
+ </rule>
282
+ <rule ref="category/apex/errorprone.xml/EmptyTryOrFinallyBlock" message="Avoid empty try or finally blocks">
283
+ <priority>3</priority>
284
+ <properties />
285
+ </rule>
286
+ <rule
287
+ ref="category/apex/errorprone.xml/InaccessibleAuraEnabledGetter"
288
+ message="AuraEnabled getter must be public or global if is referenced in Lightning components"
289
+ >
290
+ <priority>3</priority>
291
+ <properties />
292
+ </rule>
293
+ <rule
294
+ ref="category/apex/errorprone.xml/MethodWithSameNameAsEnclosingClass"
295
+ message="Non-constructor methods should not have the same name as the enclosing class."
296
+ >
297
+ <priority>3</priority>
298
+ <properties />
299
+ </rule>
300
+ <rule ref="category/apex/errorprone.xml/OverrideBothEqualsAndHashcode" message="Ensure you override both equals() and hashCode()">
301
+ <priority>3</priority>
302
+ <properties />
303
+ </rule>
304
+ <rule ref="category/apex/errorprone.xml/TestMethodsMustBeInTestClasses" message="Test methods must be in test classes">
305
+ <priority>3</priority>
306
+ <properties />
307
+ </rule>
308
+ <!-- END ERROR PRONE -->
309
+ <!-- DOCUMENTATION -->
310
+ <!-- <rule ref="category/apex/documentation.xml/ApexDoc" message="ApexDoc comment is missing or incorrect">
311
+ <priority>3</priority>
312
+ <properties>
313
+ <property name="reportPrivate" value="false" />
314
+ <property name="reportProtected" value="false" />
315
+ <property name="reportMissingDescription" value="false" />
316
+ <property name="reportProperty" value="false" />
317
+
318
+ </properties>
319
+ </rule> -->
320
+ <!-- END DOCUMENTATION -->
321
+ </ruleset>
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,140 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+ <modelVersion>4.0.0</modelVersion>
4
+ <artifactId>pmd-apex-jorje</artifactId>
5
+ <name>PMD Apex Jorje Parser Library</name>
6
+ <packaging>pom</packaging>
7
+
8
+ <parent>
9
+ <groupId>net.sourceforge.pmd</groupId>
10
+ <artifactId>pmd</artifactId>
11
+ <version>6.47.0</version>
12
+ <relativePath>../pom.xml</relativePath>
13
+ </parent>
14
+
15
+ <properties>
16
+ <java.version>8</java.version>
17
+ <apex.jorje.version>2021-10-08-631b8c</apex.jorje.version>
18
+ </properties>
19
+
20
+ <build>
21
+ <plugins>
22
+ <plugin>
23
+ <groupId>org.codehaus.mojo</groupId>
24
+ <artifactId>build-helper-maven-plugin</artifactId>
25
+ <version>3.0.0</version>
26
+ <executions>
27
+ <execution>
28
+ <id>attach-apex-jorje</id>
29
+ <phase>package</phase>
30
+ <goals>
31
+ <goal>attach-artifact</goal>
32
+ </goals>
33
+ <configuration>
34
+ <artifacts>
35
+ <artifact>
36
+ <file>${basedir}/repo/apex/apex-jorje-lsp-minimized/${apex.jorje.version}/apex-jorje-lsp-minimized-${apex.jorje.version}.jar</file>
37
+ <type>jar</type>
38
+ <classifier>lib</classifier>
39
+ </artifact>
40
+ </artifacts>
41
+ </configuration>
42
+ </execution>
43
+ </executions>
44
+ </plugin>
45
+ </plugins>
46
+ </build>
47
+ <dependencies>
48
+ <!-- transitive dependencies of apex-jorje -->
49
+ <dependency>
50
+ <groupId>cglib</groupId>
51
+ <artifactId>cglib</artifactId>
52
+ <version>3.3.0</version> <!-- apex jorje actually depends on 3.2.0 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
53
+ </dependency>
54
+ <dependency>
55
+ <groupId>ch.qos.logback</groupId>
56
+ <artifactId>logback-classic</artifactId>
57
+ <version>1.2.9</version> <!-- apex jorje actually depends on 1.1.7 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
58
+ </dependency>
59
+ <dependency>
60
+ <groupId>ch.qos.logback</groupId>
61
+ <artifactId>logback-core</artifactId>
62
+ <version>1.2.9</version> <!-- apex jorje actually depends on 1.1.7 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
63
+ </dependency>
64
+ <dependency>
65
+ <groupId>com.google.code.findbugs</groupId>
66
+ <artifactId>jsr305</artifactId>
67
+ <version>3.0.2</version>
68
+ </dependency>
69
+ <dependency>
70
+ <groupId>com.google.code.gson</groupId>
71
+ <artifactId>gson</artifactId>
72
+ <!-- apex jorje actually depends on 2.7 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
73
+ </dependency>
74
+ <dependency>
75
+ <groupId>com.google.errorprone</groupId>
76
+ <artifactId>error_prone_annotations</artifactId>
77
+ <version>2.1.3</version>
78
+ </dependency>
79
+ <dependency>
80
+ <groupId>com.google.guava</groupId>
81
+ <artifactId>guava</artifactId>
82
+ <!-- apex jorje actually depends on 26.0-jre (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
83
+ </dependency>
84
+ <dependency>
85
+ <groupId>com.google.j2objc</groupId>
86
+ <artifactId>j2objc-annotations</artifactId>
87
+ <version>1.1</version>
88
+ </dependency>
89
+ <dependency>
90
+ <groupId>org.antlr</groupId>
91
+ <artifactId>antlr-runtime</artifactId>
92
+ </dependency>
93
+ <dependency>
94
+ <groupId>org.antlr</groupId>
95
+ <artifactId>stringtemplate</artifactId>
96
+ <version>3.2.1</version>
97
+ </dependency>
98
+ <dependency>
99
+ <groupId>org.apache.commons</groupId>
100
+ <artifactId>commons-lang3</artifactId>
101
+ <version>3.0</version>
102
+ </dependency>
103
+ <dependency>
104
+ <groupId>org.codehaus.mojo</groupId>
105
+ <artifactId>animal-sniffer-annotations</artifactId>
106
+ <version>1.14</version>
107
+ </dependency>
108
+ <dependency>
109
+ <groupId>org.openjdk.jol</groupId>
110
+ <artifactId>jol-core</artifactId>
111
+ <version>0.4</version>
112
+ </dependency>
113
+ <dependency>
114
+ <groupId>org.slf4j</groupId>
115
+ <artifactId>slf4j-api</artifactId>
116
+ <!-- apex jorje actually depends on 1.7.20 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
117
+ </dependency>
118
+ <dependency>
119
+ <groupId>org.yaml</groupId>
120
+ <artifactId>snakeyaml</artifactId>
121
+ <!-- apex jorje actually depends on 1.17 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
122
+ </dependency>
123
+ <dependency>
124
+ <groupId>aopalliance</groupId>
125
+ <artifactId>aopalliance</artifactId>
126
+ <version>1.0</version>
127
+ </dependency>
128
+ <dependency>
129
+ <groupId>javax.inject</groupId>
130
+ <artifactId>javax.inject</artifactId>
131
+ <version>1</version>
132
+ </dependency>
133
+ <dependency>
134
+ <groupId>org.ow2.asm</groupId>
135
+ <artifactId>asm</artifactId>
136
+ <version>5.0.3</version>
137
+ <scope>runtime</scope>
138
+ </dependency>
139
+ </dependencies>
140
+ </project>
Binary file
Binary file
Binary file
Binary file
Binary file
package/bin/update.sh ADDED
@@ -0,0 +1,49 @@
1
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
2
+ rm -rf ${DIR}/pmd/lib/*
3
+ VERSION=$(curl -s https://api.github.com/repos/pmd/pmd/releases/latest | jq --raw-output ".tag_name")
4
+ DOWNLOAD_URL=$(curl -s https://api.github.com/repos/pmd/pmd/releases/latest | jq --raw-output ".assets[].browser_download_url" | grep pmd-bin)
5
+ echo "version=${VERSION}"
6
+ echo "url=${DOWNLOAD_URL}"
7
+ curl $DOWNLOAD_URL -L -o ${DIR}/pmd.zip
8
+ mkdir -p ${DIR}/pmd
9
+ bsdtar --strip-components=1 -xvf ${DIR}/pmd.zip -C ${DIR}/pmd
10
+ rm ${DIR}/pmd.zip
11
+ cd ./pmd/lib
12
+ rm -rf fast*
13
+ rm -rf groovy*
14
+ rm -rf lenses*
15
+ rm -rf parsers*
16
+ rm -rf protobuf*
17
+ rm -rf scala*
18
+ rm -rf sourcecode*
19
+ rm -rf trees*
20
+ rm -rf jsoup*
21
+ rm -rf pmd-cpp*
22
+ rm -rf pmd-cs*
23
+ rm -rf pmd-dart*
24
+ rm -rf pmd-fortran*
25
+ rm -rf pmd-go*
26
+ rm -rf pmd-groovy*
27
+ rm -rf pmd-jsp*
28
+ rm -rf pmd-kotlin*
29
+ rm -rf pmd-lua*
30
+ rm -rf pmd-matlab*
31
+ rm -rf pmd-modelica*
32
+ rm -rf pmd-objectivec*
33
+ rm -rf pmd-perl*
34
+ rm -rf pmd-php*
35
+ rm -rf pmd-plsql*
36
+ rm -rf pmd-python*
37
+ rm -rf pmd-ruby*
38
+ rm -rf pmd-scala*
39
+ rm -rf pmd-swift*
40
+ rm -rf pmd-ui*
41
+ rm -rf pmd-html*
42
+ rm -rf pmd-java*
43
+ rm -rf pmd-javascript*
44
+ rm -rf pmd-visualforce*
45
+ rm -rf pmd-xml*
46
+ rm -rf pmd-vm*
47
+ cd ../..
48
+ rm -rf ${DIR}/pmd/bin
49
+ rm -rf ${DIR}/pmd/LICENSE
@@ -9,6 +9,8 @@ export default class Lint extends SfdxCommand {
9
9
  sourcefolder: flags.Discriminated<flags.String>;
10
10
  minapi: flags.Discriminated<flags.Number>;
11
11
  json: flags.Discriminated<flags.Boolean<boolean>>;
12
+ pmd: flags.Discriminated<flags.Boolean<boolean>>;
13
+ rulesetpath: flags.Discriminated<flags.String>;
12
14
  };
13
15
  run(): Promise<any>;
14
16
  /**
@@ -9,6 +9,7 @@ const core_1 = require("@salesforce/core");
9
9
  const apex_class_lint_1 = tslib_1.__importDefault(require("../../shared/lint/apex-class-lint"));
10
10
  const ignored_files_1 = tslib_1.__importDefault(require("../../shared/lint/ignored-files"));
11
11
  const metadata_lint_1 = tslib_1.__importDefault(require("../../shared/lint/metadata-lint"));
12
+ const apex_1 = tslib_1.__importDefault(require("../../shared/pmd/apex"));
12
13
  class Lint extends command_1.SfdxCommand {
13
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
15
  async run() {
@@ -16,8 +17,12 @@ class Lint extends command_1.SfdxCommand {
16
17
  let violations = [];
17
18
  await ignored_files_1.default.init(this.flags.sourcefolder);
18
19
  violations = await new apex_class_lint_1.default().scan(this.flags.sourcefolder);
19
- const mViolations = await new metadata_lint_1.default().scan(this.flags.sourcefolder, this.flags.minapi);
20
+ let mViolations = await new metadata_lint_1.default().scan(this.flags.sourcefolder, this.flags.minapi);
20
21
  violations.push(...mViolations);
22
+ if (this.flags.pmd) {
23
+ mViolations = await new apex_1.default().scan(this.flags.sourcefolder, this.flags.rulesetpath);
24
+ violations.push(...mViolations);
25
+ }
21
26
  this.printViolations(this.flags.json, violations);
22
27
  }
23
28
  /**
@@ -54,6 +59,14 @@ Lint.flagsConfig = {
54
59
  json: command_1.flags.boolean({
55
60
  char: 'j',
56
61
  description: 'generate json output'
62
+ }),
63
+ pmd: command_1.flags.boolean({
64
+ char: 'p',
65
+ description: 'generate pmd output'
66
+ }),
67
+ rulesetpath: command_1.flags.filepath({
68
+ char: 'r',
69
+ description: 'path to pmd ruleset'
57
70
  })
58
71
  };
59
72
  //# sourceMappingURL=lint.js.map
@@ -1 +1 @@
1
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AS,CAAC;QAC5B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,GAAG;KACb,CAAC;IACF,MAAM,EAAE,eAAK,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,OAAO,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,sBAAsB;KACpC,CAAC;IACF,GAAG,EAAE,eAAK,CAAC,OAAO,CAAC;QACjB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,qBAAqB;KACnC,CAAC;IACF,WAAW,EAAE,eAAK,CAAC,QAAQ,CAAC;QAC1B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,qBAAqB;KACnC,CAAC;CACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Logger } from '@salesforce/core';
2
+ export default class ApexPMD {
3
+ ignoreFiles: any[];
4
+ logger: Logger;
5
+ scan(sourceFolder: string, rulesetpath: string): Promise<any[]>;
6
+ private executeCmd;
7
+ private parseProblems;
8
+ }
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ /**
5
+ * Copyright (c) NCR Terafina
6
+ **/
7
+ const ChildProcess = tslib_1.__importStar(require("child_process"));
8
+ const path = tslib_1.__importStar(require("path"));
9
+ const os = tslib_1.__importStar(require("os"));
10
+ const core_1 = require("@salesforce/core");
11
+ const JreSetupManager = tslib_1.__importStar(require("./jreSetupManager"));
12
+ const ignored_files_1 = tslib_1.__importDefault(require("../lint/ignored-files"));
13
+ //setup OS constants
14
+ const CLASSPATH_DELM = os.platform() === 'win32' ? ';' : ':';
15
+ class ApexPMD {
16
+ constructor() {
17
+ this.ignoreFiles = [];
18
+ }
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ async scan(sourceFolder, rulesetpath) {
21
+ this.logger = await core_1.Logger.root();
22
+ this.ignoreFiles.push(...ignored_files_1.default.files);
23
+ this.logger.debug(this.ignoreFiles);
24
+ const dir = sourceFolder + '/app/';
25
+ try {
26
+ const data = await this.executeCmd(dir, rulesetpath);
27
+ const violations = this.parseProblems(data, sourceFolder);
28
+ return violations;
29
+ }
30
+ catch (err) {
31
+ console.error(err);
32
+ }
33
+ }
34
+ async executeCmd(targetPath, rulesetpath) {
35
+ const cacheKey = '--no-cache';
36
+ const formatKey = `-f json`;
37
+ const targetPathKey = `-d "${targetPath}"`;
38
+ const javaHome = await JreSetupManager.verifyJreSetup();
39
+ const javaExc = path.join(javaHome, 'bin', 'java');
40
+ const commandBufferSize = 64;
41
+ const pmdBinPath = path.join(__dirname, '../../../', 'bin', 'pmd');
42
+ let rulesetsArg = path.join(pmdBinPath, 'apex_ruleset.xml');
43
+ if (rulesetpath) {
44
+ rulesetsArg = rulesetpath;
45
+ }
46
+ const rulesetsKey = `-R "${rulesetsArg}"`;
47
+ const classPath = [path.join(pmdBinPath, 'lib', '*')].join(CLASSPATH_DELM);
48
+ const pmdKeys = `${formatKey} ${cacheKey} ${targetPathKey} ${rulesetsKey}`;
49
+ const cmd = `${javaExc} -cp "${classPath}" net.sourceforge.pmd.PMD ${pmdKeys}`;
50
+ this.logger.info('PMD Command: ' + cmd);
51
+ const pmdCmd = ChildProcess.exec(cmd, {
52
+ maxBuffer: Math.max(commandBufferSize, 1) * 1024 * 1024
53
+ });
54
+ let stdout = '';
55
+ let stderr = '';
56
+ const pmdPromise = new Promise((resolve, reject) => {
57
+ pmdCmd.addListener('error', e => {
58
+ this.logger.error('error:' + e);
59
+ reject(e);
60
+ });
61
+ pmdCmd.addListener('exit', e => {
62
+ if (e !== 0 && e !== 4) {
63
+ this.logger.error(`Failed Exit Code: ${e}` + stderr);
64
+ reject(stderr);
65
+ }
66
+ else {
67
+ resolve(stdout);
68
+ }
69
+ });
70
+ pmdCmd.stdout.on('data', (m) => {
71
+ this.logger.info('stdout:' + m);
72
+ stdout += m;
73
+ });
74
+ pmdCmd.stderr.on('data', (m) => {
75
+ this.logger.error('stderr:' + m);
76
+ stderr += m;
77
+ });
78
+ });
79
+ return pmdPromise;
80
+ }
81
+ parseProblems(json, sourceFolder) {
82
+ const violations = [];
83
+ this.logger.debug(json);
84
+ if (!json) {
85
+ return violations;
86
+ }
87
+ const p = JSON.parse(json);
88
+ if (!p.files) {
89
+ return violations;
90
+ }
91
+ for (const f of p.files) {
92
+ for (const v of f.violations) {
93
+ // const filename = f.filename.replace(sourceFolder + '/', '');
94
+ const filename = path.basename(f.filename, '.cls');
95
+ const o = {
96
+ label: v.description + ' at line ' + v.beginline,
97
+ message: v.externalInfoUrl,
98
+ category: 'PMD.' + v.rule,
99
+ level: v.priority === 2 ? 'FATAL' : 'WARN',
100
+ exceptions: [filename]
101
+ };
102
+ if (this.ignoreFiles.indexOf(filename) < 0) {
103
+ violations.push(o);
104
+ }
105
+ }
106
+ }
107
+ return violations;
108
+ }
109
+ }
110
+ exports.default = ApexPMD;
111
+ //# sourceMappingURL=apex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apex.js","sourceRoot":"","sources":["../../../src/shared/pmd/apex.ts"],"names":[],"mappings":";;;AAAA;;IAEI;AACJ,oEAA8C;AAC9C,mDAA6B;AAC7B,+CAAyB;AACzB,2CAA0C;AAC1C,2EAAqD;AACrD,kFAAiD;AAEjD,oBAAoB;AACpB,MAAM,cAAc,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAE7D,MAAqB,OAAO;IAA5B;QACE,gBAAW,GAAG,EAAE,CAAC;IAuGnB,CAAC;IApGC,8DAA8D;IACvD,KAAK,CAAC,IAAI,CAAC,YAAoB,EAAE,WAAmB;QACzD,IAAI,CAAC,MAAM,GAAG,MAAM,aAAM,CAAC,IAAI,EAAE,CAAC;QAElC,IAAI,CA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AAC;iBACvB,CAAC;gBACF,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBAC1C,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACpB;aACF;SACF;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAxGD,0BAwGC"}
@@ -0,0 +1,17 @@
1
+ import { AsyncCreatable } from '@salesforce/kit';
2
+ export declare class JreSetupManagerDependencies {
3
+ autoDetectJavaHome(): Promise<string>;
4
+ }
5
+ export declare class JreSetupManager extends AsyncCreatable {
6
+ private logger;
7
+ private dependencies;
8
+ private initialized;
9
+ protected init(): Promise<void>;
10
+ verifyJreSetup(): Promise<string>;
11
+ private findJavaHome;
12
+ private findJavaHomeFromSysVariables;
13
+ private autoDetectJavaHome;
14
+ private verifyJavaVersion;
15
+ private fetchJavaVersion;
16
+ }
17
+ export declare function verifyJreSetup(): Promise<string>;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifyJreSetup = exports.JreSetupManager = exports.JreSetupManagerDependencies = void 0;
4
+ /**
5
+ * Copyright (c) NCR Terafina
6
+ **/
7
+ const core_1 = require("@salesforce/core");
8
+ const kit_1 = require("@salesforce/kit");
9
+ const fs = require("fs");
10
+ const process = require("process");
11
+ const findJavaHome = require("find-java-home");
12
+ const childProcess = require("child_process");
13
+ const path = require("path");
14
+ // Initialize Messages with the current plugin directory
15
+ core_1.Messages.importMessagesDirectory(__dirname);
16
+ const JAVA_HOME_SYSTEM_VARIABLES = ['JAVA_HOME', 'JRE_HOME', 'JDK_HOME'];
17
+ // Exported only to be used by tests
18
+ class JreSetupManagerDependencies {
19
+ autoDetectJavaHome() {
20
+ return new Promise(resolve => {
21
+ findJavaHome({ allowJre: true }, (err, home) => {
22
+ resolve(err ? null : home);
23
+ });
24
+ });
25
+ }
26
+ }
27
+ exports.JreSetupManagerDependencies = JreSetupManagerDependencies;
28
+ class JreSetupManager extends kit_1.AsyncCreatable {
29
+ async init() {
30
+ if (this.initialized) {
31
+ return;
32
+ }
33
+ this.logger = await core_1.Logger.child('verifyJRE');
34
+ this.dependencies = new JreSetupManagerDependencies();
35
+ this.initialized = true;
36
+ }
37
+ async verifyJreSetup() {
38
+ // Find Java Home
39
+ const javaHome = await this.findJavaHome();
40
+ // If we have javaHome, verify that it is a valid path
41
+ fs.statSync(javaHome);
42
+ // If path exists, verify Java version
43
+ await this.verifyJavaVersion(javaHome);
44
+ return javaHome;
45
+ }
46
+ async findJavaHome() {
47
+ let javaHome;
48
+ // First try getting javaHome from config
49
+ // If config doesn't have javaHome, try getting from System Variables
50
+ javaHome = this.findJavaHomeFromSysVariables();
51
+ // If System Variables don't have javaHome, try to detect automatically from javac
52
+ if (!javaHome) {
53
+ javaHome = await this.autoDetectJavaHome();
54
+ }
55
+ // If we reach this point and we somehow still haven't found a javaHome, then we're pretty thoroughly hosed.
56
+ // So we'll just throw an error telling the user to set it themselves.
57
+ if (!javaHome) {
58
+ throw core_1.SfdxError.create('@terafina/tffa-sfdx-plugin', 'jreSetupManager', 'NoJavaHomeFound', []);
59
+ }
60
+ return javaHome;
61
+ }
62
+ findJavaHomeFromSysVariables() {
63
+ let javaHome = null;
64
+ const env = process.env;
65
+ for (const sysVariable of JAVA_HOME_SYSTEM_VARIABLES) {
66
+ javaHome = env[sysVariable];
67
+ if (javaHome) {
68
+ this.logger.trace(`Found javaHome from ${sysVariable} as ${javaHome}`);
69
+ return javaHome;
70
+ }
71
+ }
72
+ return javaHome;
73
+ }
74
+ autoDetectJavaHome() {
75
+ return this.dependencies.autoDetectJavaHome();
76
+ }
77
+ async verifyJavaVersion(javaHome) {
78
+ const versionOut = await this.fetchJavaVersion(javaHome);
79
+ // Version output looks like this:
80
+ // MacOS: "openjdk version "11.0.6" 2020-01-14 LTS\nOpenJDK Runtime Environment Zulu11.37+17-CA (build 11.0.6+10-LTS)\nOpenJDK 64-Bit Server VM Zulu11.37+17-CA (build 11.0.6+10-LTS, mixed mode)\n"
81
+ // Win10: "openjdk 14 2020-03-17\r\nOpenJDK Runtime Environment (build 14+36-1461)\r\nOpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)\r\n"
82
+ // We want to get the "11.0" or "14" part
83
+ // The version number could be of the format 11.0 or 1.8 or 14
84
+ const regex = /(\d+)(\.(\d+))?/;
85
+ const matchedParts = regex.exec(versionOut);
86
+ this.logger.trace(`Version output match for pattern ${regex} is ${matchedParts}`);
87
+ // matchedParts should have four groups: "11.0", "11", ".0", "0" or "14", "14", undefined, undefined
88
+ if (!matchedParts || matchedParts.length < 4) {
89
+ throw core_1.SfdxError.create('@salesforce/sfdx-scanner', 'jreSetupManager', 'VersionNotFound', []);
90
+ }
91
+ const majorVersion = parseInt(matchedParts[1]);
92
+ const minorVersion = matchedParts[3] ? parseInt(matchedParts[3]) : '';
93
+ let version = '';
94
+ // We want to allow 1.8 and greater.
95
+ // Upto JDK8, the version scheme is 1.blah
96
+ // Starting JDK 9, the version scheme is 9.blah for 9, 10.blah for 10, etc.
97
+ // If either version part clicks, we should be good.
98
+ if (majorVersion >= 9) {
99
+ // Accept if Major version is greater than or equal to 9
100
+ version += majorVersion + (minorVersion ? `.${minorVersion}` : '');
101
+ }
102
+ else if (majorVersion === 1 && minorVersion === 8) {
103
+ // Accommodating 1.8
104
+ version += majorVersion + '.' + minorVersion;
105
+ }
106
+ else {
107
+ // Not matching what we are looking for
108
+ throw core_1.SfdxError.create('@salesforce/sfdx-scanner', 'jreSetupManager', 'InvalidVersion', [version]);
109
+ }
110
+ this.logger.trace(`Java version found as ${version}`);
111
+ return;
112
+ }
113
+ async fetchJavaVersion(javaHome) {
114
+ const javaWithFullPath = path.join(javaHome, 'bin', 'java');
115
+ // Run java -version and examine stderr for version
116
+ return new Promise((resolve, reject) => {
117
+ childProcess.execFile(javaWithFullPath, ['-version'], {}, (error, _stdout, stderr) => {
118
+ if (error) {
119
+ return reject(`Could not fetch Java version from path ${javaHome}. Reason: ${error.message}`);
120
+ }
121
+ // TODO: Mac always returns this value in stderr. Check if the behavior is the same for other OS types
122
+ this.logger.trace(`Java version received as ${stderr}`);
123
+ return resolve(stderr);
124
+ });
125
+ });
126
+ }
127
+ }
128
+ exports.JreSetupManager = JreSetupManager;
129
+ // Method that'll be invoked externally
130
+ async function verifyJreSetup() {
131
+ const manager = await JreSetupManager.create({});
132
+ return await manager.verifyJreSetup();
133
+ }
134
+ exports.verifyJreSetup = verifyJreSetup;
135
+ //# sourceMappingURL=jreSetupManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jreSetupManager.js","sourceRoot":"","sources":["../../../src/shared/pmd/jreSetupManager.ts"],"names":[],"mappings":";;;AAAA;;IAEI;AACJ,2CAA+D;AAC/D,yCAAiD;AACjD,yBAA0B;AAC1B,mCAAoC;AACpC,+CAAgD;AAChD,8CAA+C;AAC/C,6BAA8B;AAE9B,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,MAAM,0BAA0B,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAEzE,oCAAoC;AACpC,MAAa,2BAA2B;IACtC,kBAAkB;QAChB,OAAO,IAAI,OAAO,CAAS,OAAO,CAAC,EAAE;YACnC,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AARD,kEAQC;AAED,MAAa,eAAgB,SAAQ,oBAAc;IAKvC,KAAK,CAAC,IAAI;QAClB,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,OAAO;SACR;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,aAAM,CAAC,KAA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"usage":"<%= command.id %> [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["Generate Apex API Documentation :\t$sfdx tffa:apexdoc "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"d","description":"directory containing package metadata","multiple":false,"default":"."}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"d","description":"directory containing package metadata","default":".","input":[],"multiple":false,"type":"option"}}},"tffa:lint":{"id":"tffa:lint","description":"scan a sfdx project and provide a violations report based on defined standards","strict":true,"usage":"<%= command.id %> [-s <directory>] [-m <integer>] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["Scan a sfdx project and provide list of code violations :\t$sfdx tffa:scan"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"generate json output","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"minapi":{"name":"minapi","type":"option","char":"m","description":"minimum api version to use during quality checks","multiple":false,"default":53}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"minapi":{"kind":"integer","char":"m","description":"minimum api version to use during quality checks","default":53,"input":[],"multiple":false,"type":"option"},"json":{"kind":"boolean","char":"j","description":"generate json output","allowNo":false,"type":"boolean"}}},"tffa:meta":{"id":"tffa:meta","description":"scan a sfdx project for metadata","strict":true,"usage":"<%= command.id %> [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["scan a sfdx project for metadata :\t$sfdx tffa:meta"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"destpath":{"name":"destpath","type":"option","char":"d","description":"full path output file","multiple":false,"default":"."},"clientname":{"name":"clientname","type":"option","char":"c","description":"name of the client","multiple":false,"default":"."},"output":{"name":"output","type":"option","char":"o","description":"output format json csv human","helpValue":"(json|csv|human)","multiple":false,"options":["json","csv","human"]},"fields":{"name":"fields","type":"boolean","char":"f","description":"generate field output","allowNo":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"destpath":{"kind":"directory","char":"d","description":"full path output file","default":".","input":[],"multiple":false,"type":"option"},"clientname":{"kind":"directory","char":"c","description":"name of the client","default":".","input":[],"multiple":false,"type":"option"},"output":{"kind":"enum","helpValue":"(json|csv|human)","char":"o","options":["json","csv","human"],"description":"output format json csv human","input":[],"multiple":false,"type":"option"},"fields":{"kind":"boolean","char":"f","description":"generate field output","allowNo":false,"type":"boolean"}}},"tffa:ping":{"id":"tffa:ping","description":"ping","strict":true,"usage":"<%= command.id %> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx tffa:ping "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"}},"args":[{"name":"file"}],"flagsConfig":{}}}}
1
+ {"version":"2.2.3-rc.1","commands":{"tffa:apexdoc":{"id":"tffa:apexdoc","description":"Generate Apex API Documentation","strict":true,"usage":"<%= command.id %> [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["Generate Apex API Documentation :\t$sfdx tffa:apexdoc "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"d","description":"directory containing package metadata","multiple":false,"default":"."}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"d","description":"directory containing package metadata","default":".","input":[],"multiple":false,"type":"option"}}},"tffa:lint":{"id":"tffa:lint","description":"scan a sfdx project and provide a violations report based on defined standards","strict":true,"usage":"<%= command.id %> [-s <directory>] [-m <integer>] [-p] [-r <filepath>] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["Scan a sfdx project and provide list of code violations :\t$sfdx tffa:scan"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"generate json output","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"minapi":{"name":"minapi","type":"option","char":"m","description":"minimum api version to use during quality checks","multiple":false,"default":53},"pmd":{"name":"pmd","type":"boolean","char":"p","description":"generate pmd output","allowNo":false},"rulesetpath":{"name":"rulesetpath","type":"option","char":"r","description":"path to pmd ruleset","multiple":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"minapi":{"kind":"integer","char":"m","description":"minimum api version to use during quality checks","default":53,"input":[],"multiple":false,"type":"option"},"json":{"kind":"boolean","char":"j","description":"generate json output","allowNo":false,"type":"boolean"},"pmd":{"kind":"boolean","char":"p","description":"generate pmd output","allowNo":false,"type":"boolean"},"rulesetpath":{"kind":"filepath","char":"r","description":"path to pmd ruleset","input":[],"multiple":false,"type":"option"}}},"tffa:meta":{"id":"tffa:meta","description":"scan a sfdx project for metadata","strict":true,"usage":"<%= command.id %> [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["scan a sfdx project for metadata :\t$sfdx tffa:meta"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"destpath":{"name":"destpath","type":"option","char":"d","description":"full path output file","multiple":false,"default":"."},"clientname":{"name":"clientname","type":"option","char":"c","description":"name of the client","multiple":false,"default":"."},"output":{"name":"output","type":"option","char":"o","description":"output format json csv human","helpValue":"(json|csv|human)","multiple":false,"options":["json","csv","human"]},"fields":{"name":"fields","type":"boolean","char":"f","description":"generate field output","allowNo":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"destpath":{"kind":"directory","char":"d","description":"full path output file","default":".","input":[],"multiple":false,"type":"option"},"clientname":{"kind":"directory","char":"c","description":"name of the client","default":".","input":[],"multiple":false,"type":"option"},"output":{"kind":"enum","helpValue":"(json|csv|human)","char":"o","options":["json","csv","human"],"description":"output format json csv human","input":[],"multiple":false,"type":"option"},"fields":{"kind":"boolean","char":"f","description":"generate field output","allowNo":false,"type":"boolean"}}},"tffa:ping":{"id":"tffa:ping","description":"ping","strict":true,"usage":"<%= command.id %> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx tffa:ping "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"}},"args":[{"name":"file"}],"flagsConfig":{}}}}
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@terafina/tffa-sfdx-plugin",
3
3
  "description": "sfdx plugin from Terafina containing tools for scanning and extending digital applications for the financial services industry.",
4
- "version": "2.2.1",
4
+ "version": "2.2.3-rc.1",
5
5
  "author": "Terafina Inc",
6
6
  "bugs": "https://github.com/terafinainc/tffa-sfdx-plugin/issues",
7
7
  "dependencies": {
8
- "@oclif/core": "1.9.0",
8
+ "@oclif/core": "1.9.5",
9
9
  "@oclif/plugin-help": "5.1.12",
10
10
  "@oclif/plugin-plugins": "2.1.0",
11
- "@oclif/plugin-version": "1.0.4",
11
+ "@oclif/plugin-version": "1.1.1",
12
12
  "@oclif/plugin-warn-if-update-available": "^2.0.4",
13
- "@salesforce/command": "5.2.0",
13
+ "@salesforce/command": "5.2.1",
14
14
  "@salesforce/core": "2.37.1",
15
- "cheerio": "1.0.0-rc.11",
16
- "csv-stringify": "6.1.0",
15
+ "find-java-home": "1.1.0",
16
+ "cheerio": "1.0.0-rc.12",
17
+ "csv-stringify": "6.1.3",
17
18
  "fs-extra": "10.1.0",
18
19
  "lodash.escape": "4.0.1",
19
20
  "pretty": "2.0.0",
@@ -22,8 +23,8 @@
22
23
  "xml2js": "0.4.23"
23
24
  },
24
25
  "devDependencies": {
25
- "@commitlint/cli": "17.0.2",
26
- "@commitlint/config-angular": "17.0.0",
26
+ "@commitlint/cli": "17.0.3",
27
+ "@commitlint/config-angular": "17.0.3",
27
28
  "@oclif/test": "2.1.0",
28
29
  "@salesforce/dev-config": "3.0.1",
29
30
  "@salesforce/ts-sinon": "1.3.21",
@@ -32,18 +33,18 @@
32
33
  "@types/fs-extra": "9.0.13",
33
34
  "@types/js-yaml": "4.0.5",
34
35
  "@types/mocha": "9.1.1",
35
- "@types/node": "17.0.41",
36
+ "@types/node": "18.0.0",
36
37
  "@types/xml2js": "0.4.11",
37
- "@typescript-eslint/eslint-plugin": "5.27.1",
38
- "@typescript-eslint/parser": "5.27.1",
38
+ "@typescript-eslint/eslint-plugin": "5.30.0",
39
+ "@typescript-eslint/parser": "5.30.0",
39
40
  "chai": "4",
40
- "eslint": "8.17.0",
41
+ "eslint": "8.18.0",
41
42
  "eslint-config-prettier": "8.5.0",
42
43
  "eslint-plugin-deprecation": "1.3.2",
43
44
  "eslint-plugin-header": "3.1.1",
44
45
  "eslint-plugin-import": "2.26.0",
45
46
  "eslint-plugin-jest": "26.5.3",
46
- "eslint-plugin-jsdoc": "39.3.2",
47
+ "eslint-plugin-jsdoc": "39.3.3",
47
48
  "eslint-plugin-prefer-arrow": "1.2.3",
48
49
  "eslint-plugin-sonarjs": "0.13.0",
49
50
  "globby": "11.0.1",
@@ -54,14 +55,14 @@
54
55
  "mocha": "10.0.0",
55
56
  "nyc": "15.1.0",
56
57
  "oclif": "^3",
57
- "prettier": "2.6.2",
58
+ "prettier": "2.7.1",
58
59
  "prettier-plugin-apex": "1.10.0",
59
60
  "properties-parser": "0.3.1",
60
61
  "properties-reader": "2.2.0",
61
62
  "replace-in-file": "6.3.5",
62
63
  "standard-version": "9.5.0",
63
64
  "ts-node": "10",
64
- "typescript": "4.7.3",
65
+ "typescript": "4.7.4",
65
66
  "yargs": "17.5.1"
66
67
  },
67
68
  "engines": {
@@ -70,6 +71,7 @@
70
71
  "files": [
71
72
  "/lib",
72
73
  "/assets",
74
+ "/bin",
73
75
  "/messages",
74
76
  "/npm-shrinkwrap.json",
75
77
  "/oclif.manifest.json"