rflib-plugin 0.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/LICENSE +28 -0
- package/README.md +66 -0
- package/lib/commands/rflib/logging/apex/instrument.d.ts +31 -0
- package/lib/commands/rflib/logging/apex/instrument.js +232 -0
- package/lib/commands/rflib/logging/apex/instrument.js.map +1 -0
- package/lib/commands/rflib/logging/lwc/instrument.d.ts +32 -0
- package/lib/commands/rflib/logging/lwc/instrument.js +238 -0
- package/lib/commands/rflib/logging/lwc/instrument.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/messages/rflib.logging.apex.instrument.md +46 -0
- package/messages/rflib.logging.lwc.instrument.md +64 -0
- package/oclif.lock +8593 -0
- package/oclif.manifest.json +197 -0
- package/package.json +211 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
{
|
|
2
|
+
"commands": {
|
|
3
|
+
"rflib:logging:apex:instrument": {
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"args": {},
|
|
6
|
+
"description": "Analyzes Apex classes and adds RFLIB logging statements for method entry and error handling. Adds class-level logger initialization if not already present. \nFor Apex Test classes, the `@TestSetup` method will be updated to include `rflib_TestUtil.prepareLoggerForUnitTests();` to avoid test failures caused by the logging framework.",
|
|
7
|
+
"examples": [
|
|
8
|
+
"- Add logging statements to all Apex classes in a directory:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes\n\n- Preview changes without modifying files:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes --dryrun\n\n- Add logging statements and format code:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes --prettier"
|
|
9
|
+
],
|
|
10
|
+
"flags": {
|
|
11
|
+
"json": {
|
|
12
|
+
"description": "Format output as json.",
|
|
13
|
+
"helpGroup": "GLOBAL",
|
|
14
|
+
"name": "json",
|
|
15
|
+
"allowNo": false,
|
|
16
|
+
"type": "boolean"
|
|
17
|
+
},
|
|
18
|
+
"flags-dir": {
|
|
19
|
+
"helpGroup": "GLOBAL",
|
|
20
|
+
"name": "flags-dir",
|
|
21
|
+
"summary": "Import flag values from a directory.",
|
|
22
|
+
"hasDynamicHelp": false,
|
|
23
|
+
"multiple": false,
|
|
24
|
+
"type": "option"
|
|
25
|
+
},
|
|
26
|
+
"sourcepath": {
|
|
27
|
+
"char": "s",
|
|
28
|
+
"description": "Path to the source directory containing Apex classes that should be instrumented with RFLIB logging statements. Test classes (ending with 'Test.cls') are automatically excluded.",
|
|
29
|
+
"name": "sourcepath",
|
|
30
|
+
"required": true,
|
|
31
|
+
"summary": "Directory containing Apex classes to instrument with logging.",
|
|
32
|
+
"hasDynamicHelp": false,
|
|
33
|
+
"multiple": false,
|
|
34
|
+
"type": "option"
|
|
35
|
+
},
|
|
36
|
+
"dryrun": {
|
|
37
|
+
"char": "d",
|
|
38
|
+
"description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
|
|
39
|
+
"name": "dryrun",
|
|
40
|
+
"summary": "Preview changes without modifying files.",
|
|
41
|
+
"allowNo": false,
|
|
42
|
+
"type": "boolean"
|
|
43
|
+
},
|
|
44
|
+
"prettier": {
|
|
45
|
+
"char": "p",
|
|
46
|
+
"description": "When enabled, formats the modified Apex files using prettier-plugin-apex after adding logging statements. Maintains consistent code style.",
|
|
47
|
+
"name": "prettier",
|
|
48
|
+
"summary": "Format modified files using Prettier.",
|
|
49
|
+
"allowNo": false,
|
|
50
|
+
"type": "boolean"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"hasDynamicHelp": false,
|
|
54
|
+
"hiddenAliases": [],
|
|
55
|
+
"id": "rflib:logging:apex:instrument",
|
|
56
|
+
"pluginAlias": "rflib-plugin",
|
|
57
|
+
"pluginName": "rflib-plugin",
|
|
58
|
+
"pluginType": "core",
|
|
59
|
+
"strict": true,
|
|
60
|
+
"summary": "Instrument Apex classes with RFLIB logging statements automatically.",
|
|
61
|
+
"enableJsonFlag": true,
|
|
62
|
+
"isESM": true,
|
|
63
|
+
"relativePath": [
|
|
64
|
+
"lib",
|
|
65
|
+
"commands",
|
|
66
|
+
"rflib",
|
|
67
|
+
"logging",
|
|
68
|
+
"apex",
|
|
69
|
+
"instrument.js"
|
|
70
|
+
],
|
|
71
|
+
"aliasPermutations": [],
|
|
72
|
+
"permutations": [
|
|
73
|
+
"rflib:logging:apex:instrument",
|
|
74
|
+
"logging:rflib:apex:instrument",
|
|
75
|
+
"logging:apex:rflib:instrument",
|
|
76
|
+
"logging:apex:instrument:rflib",
|
|
77
|
+
"rflib:apex:logging:instrument",
|
|
78
|
+
"apex:rflib:logging:instrument",
|
|
79
|
+
"apex:logging:rflib:instrument",
|
|
80
|
+
"apex:logging:instrument:rflib",
|
|
81
|
+
"rflib:apex:instrument:logging",
|
|
82
|
+
"apex:rflib:instrument:logging",
|
|
83
|
+
"apex:instrument:rflib:logging",
|
|
84
|
+
"apex:instrument:logging:rflib",
|
|
85
|
+
"rflib:logging:instrument:apex",
|
|
86
|
+
"logging:rflib:instrument:apex",
|
|
87
|
+
"logging:instrument:rflib:apex",
|
|
88
|
+
"logging:instrument:apex:rflib",
|
|
89
|
+
"rflib:instrument:logging:apex",
|
|
90
|
+
"instrument:rflib:logging:apex",
|
|
91
|
+
"instrument:logging:rflib:apex",
|
|
92
|
+
"instrument:logging:apex:rflib",
|
|
93
|
+
"rflib:instrument:apex:logging",
|
|
94
|
+
"instrument:rflib:apex:logging",
|
|
95
|
+
"instrument:apex:rflib:logging",
|
|
96
|
+
"instrument:apex:logging:rflib"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"rflib:logging:lwc:instrument": {
|
|
100
|
+
"aliases": [],
|
|
101
|
+
"args": {},
|
|
102
|
+
"description": "Analyzes Lightning Web Component JavaScript files and adds RFLIB logging statements for:\n- Method entry logging with parameter values\n- Error logging in try-catch blocks\n- Error logging in Promise catch handlers\n- Condition logging in if/else blocks\n- Adds logger import if not present\n- Adds logger initialization if not present\n- Formats modified files using Prettier (optional)",
|
|
103
|
+
"examples": [
|
|
104
|
+
"- Add logging to all LWC files:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc\n\n- Preview changes:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --dryrun\n\n- Add logging and format code:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --prettier\n\n- Process specific component:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc/myComponent"
|
|
105
|
+
],
|
|
106
|
+
"flags": {
|
|
107
|
+
"json": {
|
|
108
|
+
"description": "Format output as json.",
|
|
109
|
+
"helpGroup": "GLOBAL",
|
|
110
|
+
"name": "json",
|
|
111
|
+
"allowNo": false,
|
|
112
|
+
"type": "boolean"
|
|
113
|
+
},
|
|
114
|
+
"flags-dir": {
|
|
115
|
+
"helpGroup": "GLOBAL",
|
|
116
|
+
"name": "flags-dir",
|
|
117
|
+
"summary": "Import flag values from a directory.",
|
|
118
|
+
"hasDynamicHelp": false,
|
|
119
|
+
"multiple": false,
|
|
120
|
+
"type": "option"
|
|
121
|
+
},
|
|
122
|
+
"sourcepath": {
|
|
123
|
+
"char": "s",
|
|
124
|
+
"description": "Path to the source directory containing Lightning Web Component JavaScript files that should be instrumented with RFLIB logging statements. Aura component files are automatically excluded. The command will:\n- Process all .js files in the directory and subdirectories\n- Skip files in 'aura' directories\n- Add import statement: import { createLogger } from 'c/rflibLogger'\n- Add logger initialization: const logger = createLogger('ComponentName')",
|
|
125
|
+
"name": "sourcepath",
|
|
126
|
+
"required": true,
|
|
127
|
+
"summary": "Directory containing LWC JavaScript files to instrument with logging.",
|
|
128
|
+
"hasDynamicHelp": false,
|
|
129
|
+
"multiple": false,
|
|
130
|
+
"type": "option"
|
|
131
|
+
},
|
|
132
|
+
"dryrun": {
|
|
133
|
+
"char": "d",
|
|
134
|
+
"description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes. Shows:\n- Files that would be modified\n- Number of processed files\n- Number of modified files\n- Number of formatted files",
|
|
135
|
+
"name": "dryrun",
|
|
136
|
+
"summary": "Preview changes without modifying files.",
|
|
137
|
+
"allowNo": false,
|
|
138
|
+
"type": "boolean"
|
|
139
|
+
},
|
|
140
|
+
"prettier": {
|
|
141
|
+
"char": "p",
|
|
142
|
+
"description": "When enabled, formats the modified JavaScript files using Prettier after adding logging statements. Maintains consistent code style with:\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs",
|
|
143
|
+
"name": "prettier",
|
|
144
|
+
"summary": "Format modified files using Prettier.",
|
|
145
|
+
"allowNo": false,
|
|
146
|
+
"type": "boolean"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"hasDynamicHelp": false,
|
|
150
|
+
"hiddenAliases": [],
|
|
151
|
+
"id": "rflib:logging:lwc:instrument",
|
|
152
|
+
"pluginAlias": "rflib-plugin",
|
|
153
|
+
"pluginName": "rflib-plugin",
|
|
154
|
+
"pluginType": "core",
|
|
155
|
+
"strict": true,
|
|
156
|
+
"summary": "Instrument Lightning Web Components with RFLIB logging statements automatically.",
|
|
157
|
+
"enableJsonFlag": true,
|
|
158
|
+
"isESM": true,
|
|
159
|
+
"relativePath": [
|
|
160
|
+
"lib",
|
|
161
|
+
"commands",
|
|
162
|
+
"rflib",
|
|
163
|
+
"logging",
|
|
164
|
+
"lwc",
|
|
165
|
+
"instrument.js"
|
|
166
|
+
],
|
|
167
|
+
"aliasPermutations": [],
|
|
168
|
+
"permutations": [
|
|
169
|
+
"rflib:logging:lwc:instrument",
|
|
170
|
+
"logging:rflib:lwc:instrument",
|
|
171
|
+
"logging:lwc:rflib:instrument",
|
|
172
|
+
"logging:lwc:instrument:rflib",
|
|
173
|
+
"rflib:lwc:logging:instrument",
|
|
174
|
+
"lwc:rflib:logging:instrument",
|
|
175
|
+
"lwc:logging:rflib:instrument",
|
|
176
|
+
"lwc:logging:instrument:rflib",
|
|
177
|
+
"rflib:lwc:instrument:logging",
|
|
178
|
+
"lwc:rflib:instrument:logging",
|
|
179
|
+
"lwc:instrument:rflib:logging",
|
|
180
|
+
"lwc:instrument:logging:rflib",
|
|
181
|
+
"rflib:logging:instrument:lwc",
|
|
182
|
+
"logging:rflib:instrument:lwc",
|
|
183
|
+
"logging:instrument:rflib:lwc",
|
|
184
|
+
"logging:instrument:lwc:rflib",
|
|
185
|
+
"rflib:instrument:logging:lwc",
|
|
186
|
+
"instrument:rflib:logging:lwc",
|
|
187
|
+
"instrument:logging:rflib:lwc",
|
|
188
|
+
"instrument:logging:lwc:rflib",
|
|
189
|
+
"rflib:instrument:lwc:logging",
|
|
190
|
+
"instrument:rflib:lwc:logging",
|
|
191
|
+
"instrument:lwc:rflib:logging",
|
|
192
|
+
"instrument:lwc:logging:rflib"
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"version": "0.1.2"
|
|
197
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rflib-plugin",
|
|
3
|
+
"description": "Utility commands to help with the adoption of the RFLIB open-source library for Salesforce.",
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@oclif/core": "^4",
|
|
7
|
+
"@salesforce/core": "^8",
|
|
8
|
+
"@salesforce/sf-plugins-core": "^12",
|
|
9
|
+
"prettier": "^3.4.2",
|
|
10
|
+
"prettier-plugin-apex": "^2.2.2"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@commitlint/cli": "^19.6.1",
|
|
14
|
+
"@oclif/plugin-command-snapshot": "^5.1.9",
|
|
15
|
+
"@salesforce/cli-plugins-testkit": "^5.3.10",
|
|
16
|
+
"@salesforce/dev-scripts": "^10",
|
|
17
|
+
"eslint-plugin-sf-plugin": "^1.18.6",
|
|
18
|
+
"husky": "^8.0.0",
|
|
19
|
+
"oclif": "^4.17.4",
|
|
20
|
+
"ts-node": "^10.9.2",
|
|
21
|
+
"typescript": "^5.4.5"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18.0.0"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"/lib",
|
|
28
|
+
"/messages",
|
|
29
|
+
"/oclif.manifest.json",
|
|
30
|
+
"/oclif.lock"
|
|
31
|
+
],
|
|
32
|
+
"keywords": [
|
|
33
|
+
"force",
|
|
34
|
+
"salesforce",
|
|
35
|
+
"salesforcedx",
|
|
36
|
+
"sf",
|
|
37
|
+
"sf-plugin",
|
|
38
|
+
"sfdx",
|
|
39
|
+
"sfdx-plugin"
|
|
40
|
+
],
|
|
41
|
+
"license": "BSD-3-Clause",
|
|
42
|
+
"oclif": {
|
|
43
|
+
"commands": "./lib/commands",
|
|
44
|
+
"bin": "sf",
|
|
45
|
+
"topicSeparator": " ",
|
|
46
|
+
"devPlugins": [
|
|
47
|
+
"@oclif/plugin-help"
|
|
48
|
+
],
|
|
49
|
+
"topics": {
|
|
50
|
+
"rflib": {
|
|
51
|
+
"description": "description for rflib",
|
|
52
|
+
"subtopics": {
|
|
53
|
+
"logging": {
|
|
54
|
+
"description": "description for rflib.logging",
|
|
55
|
+
"subtopics": {
|
|
56
|
+
"apex": {
|
|
57
|
+
"description": "description for rflib.logging.apex"
|
|
58
|
+
},
|
|
59
|
+
"lwc": {
|
|
60
|
+
"description": "description for rflib.logging.lwc"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"flexibleTaxonomy": true
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "wireit",
|
|
71
|
+
"clean": "sf-clean",
|
|
72
|
+
"clean-all": "sf-clean all",
|
|
73
|
+
"compile": "wireit",
|
|
74
|
+
"docs": "sf-docs",
|
|
75
|
+
"format": "wireit",
|
|
76
|
+
"link-check": "wireit",
|
|
77
|
+
"lint": "wireit",
|
|
78
|
+
"postinstall": "yarn husky install || echo \"Unable to install Husky. If you are in a CI/CD job, that's ok !\"",
|
|
79
|
+
"postpack": "sf-clean --ignore-signing-artifacts",
|
|
80
|
+
"prepack": "sf-prepack",
|
|
81
|
+
"test": "wireit",
|
|
82
|
+
"test:nuts": "wireit",
|
|
83
|
+
"test:only": "wireit",
|
|
84
|
+
"version": "oclif readme",
|
|
85
|
+
"prepare": "husky install"
|
|
86
|
+
},
|
|
87
|
+
"publishConfig": {
|
|
88
|
+
"access": "public",
|
|
89
|
+
"registry": "https://registry.npmjs.org/"
|
|
90
|
+
},
|
|
91
|
+
"wireit": {
|
|
92
|
+
"build": {
|
|
93
|
+
"dependencies": [
|
|
94
|
+
"compile",
|
|
95
|
+
"lint"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"compile": {
|
|
99
|
+
"command": "tsc -p . --pretty --incremental",
|
|
100
|
+
"files": [
|
|
101
|
+
"src/**/*.ts",
|
|
102
|
+
"**/tsconfig.json",
|
|
103
|
+
"messages/**"
|
|
104
|
+
],
|
|
105
|
+
"output": [
|
|
106
|
+
"lib/**",
|
|
107
|
+
"*.tsbuildinfo"
|
|
108
|
+
],
|
|
109
|
+
"clean": "if-file-deleted"
|
|
110
|
+
},
|
|
111
|
+
"format": {
|
|
112
|
+
"command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"",
|
|
113
|
+
"files": [
|
|
114
|
+
"src/**/*.ts",
|
|
115
|
+
"test/**/*.ts",
|
|
116
|
+
"schemas/**/*.json",
|
|
117
|
+
"command-snapshot.json",
|
|
118
|
+
".prettier*"
|
|
119
|
+
],
|
|
120
|
+
"output": []
|
|
121
|
+
},
|
|
122
|
+
"lint": {
|
|
123
|
+
"command": "eslint src test --color --cache --cache-location .eslintcache",
|
|
124
|
+
"files": [
|
|
125
|
+
"src/**/*.ts",
|
|
126
|
+
"test/**/*.ts",
|
|
127
|
+
"messages/**",
|
|
128
|
+
"**/.eslint*",
|
|
129
|
+
"**/tsconfig.json"
|
|
130
|
+
],
|
|
131
|
+
"output": []
|
|
132
|
+
},
|
|
133
|
+
"test:compile": {
|
|
134
|
+
"command": "tsc -p \"./test\" --pretty",
|
|
135
|
+
"files": [
|
|
136
|
+
"test/**/*.ts",
|
|
137
|
+
"**/tsconfig.json"
|
|
138
|
+
],
|
|
139
|
+
"output": []
|
|
140
|
+
},
|
|
141
|
+
"test": {
|
|
142
|
+
"dependencies": [
|
|
143
|
+
"test:compile",
|
|
144
|
+
"test:only",
|
|
145
|
+
"lint"
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"test:only": {
|
|
149
|
+
"command": "nyc mocha \"test/**/*.test.ts\"",
|
|
150
|
+
"env": {
|
|
151
|
+
"FORCE_COLOR": "2"
|
|
152
|
+
},
|
|
153
|
+
"files": [
|
|
154
|
+
"test/**/*.ts",
|
|
155
|
+
"src/**/*.ts",
|
|
156
|
+
"**/tsconfig.json",
|
|
157
|
+
".mocha*",
|
|
158
|
+
"!*.nut.ts",
|
|
159
|
+
".nycrc"
|
|
160
|
+
],
|
|
161
|
+
"output": []
|
|
162
|
+
},
|
|
163
|
+
"test:command-reference": {
|
|
164
|
+
"command": "node --loader ts-node/esm --no-warnings=ExperimentalWarning \"./bin/dev.js\" commandreference:generate --erroronwarnings",
|
|
165
|
+
"files": [
|
|
166
|
+
"src/**/*.ts",
|
|
167
|
+
"messages/**",
|
|
168
|
+
"package.json"
|
|
169
|
+
],
|
|
170
|
+
"output": [
|
|
171
|
+
"tmp/root"
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"test:deprecation-policy": {
|
|
175
|
+
"command": "node --loader ts-node/esm --no-warnings=ExperimentalWarning \"./bin/dev.js\" snapshot:compare",
|
|
176
|
+
"files": [
|
|
177
|
+
"src/**/*.ts"
|
|
178
|
+
],
|
|
179
|
+
"output": [],
|
|
180
|
+
"dependencies": [
|
|
181
|
+
"compile"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"test:json-schema": {
|
|
185
|
+
"command": "node --loader ts-node/esm --no-warnings=ExperimentalWarning \"./bin/dev.js\" schema:compare",
|
|
186
|
+
"files": [
|
|
187
|
+
"src/**/*.ts",
|
|
188
|
+
"schemas"
|
|
189
|
+
],
|
|
190
|
+
"output": []
|
|
191
|
+
},
|
|
192
|
+
"test:nuts": {
|
|
193
|
+
"command": "nyc mocha \"test/**/*.nut.ts\" --slow 4500 --timeout 600000",
|
|
194
|
+
"dependencies": [
|
|
195
|
+
"compile"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
"link-check": {
|
|
199
|
+
"command": "node -e \"process.exit(process.env.CI ? 0 : 1)\" || linkinator \"**/*.md\" --skip \"CHANGELOG.md|node_modules|test/|confluence.internal.salesforce.com|my.salesforce.com|%s\" --markdown --retry --directory-listing --verbosity error",
|
|
200
|
+
"files": [
|
|
201
|
+
"./*.md",
|
|
202
|
+
"./!(CHANGELOG).md",
|
|
203
|
+
"messages/**/*.md"
|
|
204
|
+
],
|
|
205
|
+
"output": []
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"exports": "./lib/index.js",
|
|
209
|
+
"type": "module",
|
|
210
|
+
"author": "Johannes Fischer"
|
|
211
|
+
}
|