Skip to content

Commit 0afceb7

Browse files
committed
fix package.json
1 parent 44f205c commit 0afceb7

File tree

3 files changed

+42
-57
lines changed

3 files changed

+42
-57
lines changed

package.json

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,14 @@
3535
"extensionDependencies": [
3636
"salesforce.salesforcedx-vscode-core"
3737
],
38-
"main": "out/extension.js",
38+
"main": "out/src/extension.js",
3939
"l10n": "./l10n",
4040
"contributes": {
4141
"menus": {
42-
"editor/context": [
43-
{
44-
"command": "salesforcedx-vscode-offline-app.live-komaci-analysis",
45-
"when": "sf:project_opened && resourceLangId != 'forcesourcemanifest' && sf:has_target_org && resourcePath =~ /lwc/ && resource =~ /.\\.(js|ts||css|html)?$/"
46-
}
47-
],
48-
"explorer/context": [
49-
{
50-
"command": "salesforcedx-vscode-offline-app.live-komaci-analysis",
51-
"when": "sf:project_opened && resourceLangId != 'forcesourcemanifest' && sf:has_target_org && resourcePath =~ /lwc/ && resource =~ /.\\.(js|ts||css|html)?$/"
52-
}
53-
],
5442
"commandPalette": [
5543
{
5644
"command": "salesforcedx-vscode-offline-app.configure-linting-tools",
5745
"when": "sfdx_project_opened"
58-
},
59-
{
60-
"command": "salesforcedx-vscode-offline-app.live-komaci-analysis",
61-
"when": "sf:project_opened && resourceLangId != 'forcesourcemanifest' && sf:has_target_org && resourcePath =~ /lwc/ && resource =~ /.\\.(js|ts||css|html)?$/"
6246
}
6347
]
6448
},
@@ -72,10 +56,6 @@
7256
"command": "salesforcedx-vscode-offline-app.configure-linting-tools",
7357
"title": "%extension.commands.config-linting-tools.title%",
7458
"category": "%extension.commands.salesforce-mobile-offline.category%"
75-
},
76-
{
77-
"command": "salesforcedx-vscode-offline-app.live-komaci-analysis",
78-
"title": "%extension.commands.salesforce-mobile-offline.tooling-hub.live-komaci-analysis%"
7959
}
8060
],
8161
"configuration": {
@@ -118,10 +98,10 @@
11898
"lint": "eslint src --ext ts",
11999
"test": "node ./out/test/runTest.js",
120100
"test-coverage": "node ./out/test/runTest.js --coverage",
121-
"prettier:write": "prettier --write \"src/**/*.{ts, js}\" \"resources/instructions/**/*.html\" \"lsp/server/src/**/*.{ts, js}\" \"lsp/client/src/**/*.{ts, js}\"",
101+
"prettier:write": "prettier --write \"src/**/*.{ts, js}\" \"resources/instructions/**/*.html\" \"src/lsp/server/**/*.{ts, js}\" \"src/lsp/client/**/*.{ts, js}\"",
122102
"prettier:verify": "prettier --list-different \"src/**/*.{ts, js}\" \"resources/instructions/**/*.html\" \"lsp/server/src/**/*.{ts, js}\" \"lsp/client/src/**/*.{ts, js}\"",
123-
"bundle:extension": "esbuild ./src/extension.ts --bundle --outdir=out --format=cjs --target=es2020 --platform=node --external:vscode --external:@salesforce/core --external:@oclif/core --external:@salesforce/lwc-dev-mobile-core --external:mobile-lsp-client --external:mobile-lsp-server --minify --sourcemap",
124-
"vscode:prepublish": "npm run clean && npm run bundle:extension"
103+
"bundle:extension": "esbuild ./src/extension.ts --bundle --outdir=out/src --format=cjs --target=es2020 --platform=node --external:vscode --external:@salesforce/core --external:@oclif/core --external:@salesforce/lwc-dev-mobile-core --minify --sourcemap",
104+
"vscode:prepublish": "npm run clean && npm run compile && npm run bundle:extension"
125105
},
126106
"devDependencies": {
127107
"@babel/cli": "^7.25.9",

package.nls.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,5 @@
88
"extension.commands.salesforce-mobile-offline.eslint.version": "Version of ESLint to include in devDependencies",
99
"salesforce.mobile.extensions": "Salesforce Mobile Extensions",
1010
"extension.displayName": "Salesforce Mobile Extensions for Visual Studio Code",
11-
"extension.description": "Tools to help developers create their Salesforce Mobile experiences in a VSCode development environment.",
12-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.lwc-folder-does-not-exist": "The \"force-app/main/default/lwc\" folder does not exist in your project. This folder is required to create a configuration file for ESLint.",
13-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.package-json-does-not-exist": "Your project does not contain a \"package.json\" specification. You must have a package specification to configure these ESLint packages and their dependencies in your project.",
14-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.add-linting-guidance": "Do you want to add Salesforce code linting guidance for Mobile and Offline capabilities? These tools will identify code patterns that cause problems in Mobile and Offline use cases.",
15-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.error-updating-package-json": "Error updating package.json: {0}",
16-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.error-updating-eslintrc-json": "Error updating .eslintrc.json: {0}",
17-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.updated-package-json": "Updated package.json to include offline linting packages and dependencies.",
18-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.updated-eslintrc-json": "Updated .eslintrc.json to include recommended linting rules.",
19-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.run-install-command": "In the Terminal window, be sure to run the install command for your configured package manager, to install the updated dependencies. For example, \"npm install\" or \"yarn install\".",
20-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.already-configured": "All offline linting packages and dependencies are already configured in your project. No update has been made to package.json.",
21-
"extension.commands.salesforcedx-vscode-offline-app.configure-linting-tools.general-error": "There was an error trying to update either the offline linting dependencies or linting configuration: {0}"
11+
"extension.description": "Tools to help developers create their Salesforce Mobile experiences in a VSCode development environment."
2212
}

src/commands/lint/configureLintingToolsCommand.ts

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,17 @@ enum MessageType {
7979
export class ConfigureLintingToolsCommand {
8080
static async configure(): Promise<boolean> {
8181
const telemetryService = CoreExtensionService.getTelemetryService();
82-
82+
8383
// Send marker to record that the command got executed.
84-
telemetryService.sendCommandEvent(commandName, process.hrtime(), { "metricEvents": MetricEvents.CONFIGURE_LINTING_TOOLS_COMMAND_STARTED });
84+
telemetryService.sendCommandEvent(commandName, process.hrtime(), {
85+
metricEvents: MetricEvents.CONFIGURE_LINTING_TOOLS_COMMAND_STARTED
86+
});
8587

8688
try {
8789
if (!WorkspaceUtils.lwcFolderExists()) {
8890
const event = `${commandName}.${MetricEvents.LWC_FOLDER_DOES_NOT_EXIST}`;
89-
const message = l10n.t(event);
91+
const message =
92+
'The "force-app/main/default/lwc" folder does not exist in your project. This folder is required to create a configuration file for ESLint.';
9093

9194
await this.showMessage(message);
9295
telemetryService.sendException(event, message);
@@ -96,7 +99,8 @@ export class ConfigureLintingToolsCommand {
9699

97100
if (!WorkspaceUtils.packageJsonExists()) {
98101
const event = `${commandName}.${MetricEvents.PACKAGE_JSON_DOES_NOT_EXIST}`;
99-
const message = l10n.t(event);
102+
const message =
103+
'Your project does not contain a "package.json" specification. You must have a package specification to configure these ESLint packages and their dependencies in your project.';
100104

101105
await this.showMessage(message);
102106
telemetryService.sendException(event, message);
@@ -106,7 +110,7 @@ export class ConfigureLintingToolsCommand {
106110

107111
// Ask user to add eslint plugin
108112
const result = await this.showMessage(
109-
l10n.t(`${commandName}.add-linting-guidance`),
113+
'Do you want to add Salesforce code linting guidance for Mobile and Offline capabilities? These tools will identify code patterns that cause problems in Mobile and Offline use cases.',
110114
MessageType.InformationYesNo
111115
);
112116

@@ -118,7 +122,7 @@ export class ConfigureLintingToolsCommand {
118122
modifiedDevDependencies = this.updateDevDependencies();
119123
} catch (error) {
120124
const event = `${commandName}.${MetricEvents.ERROR_UPDATING_PACKAGE_JSON}`;
121-
const message = l10n.t(event, error as Error);
125+
const message = `Error updating package.json: ${error}`;
122126

123127
await this.showMessage(message);
124128
telemetryService.sendException(event, message);
@@ -131,7 +135,7 @@ export class ConfigureLintingToolsCommand {
131135
modifiedEslintrc = this.updateEslintrc();
132136
} catch (error) {
133137
const event = `${commandName}.${MetricEvents.ERROR_UPDATING_ESLINTRC_JSON}`;
134-
const message = l10n.t(event, error as Error);
138+
const message = `Error updating .eslintrc.json: ${error}`;
135139

136140
await this.showMessage(message);
137141
telemetryService.sendException(event, message);
@@ -140,39 +144,53 @@ export class ConfigureLintingToolsCommand {
140144
}
141145

142146
if (modifiedDevDependencies) {
143-
telemetryService.sendCommandEvent(commandName, process.hrtime(), { "metricEvents": MetricEvents.UPDATED_PACKAGE_JSON });
147+
telemetryService.sendCommandEvent(
148+
commandName,
149+
process.hrtime(),
150+
{ metricEvents: MetricEvents.UPDATED_PACKAGE_JSON }
151+
);
144152
this.showMessage(
145-
l10n.t(`${commandName}.${MetricEvents.UPDATED_PACKAGE_JSON}`),
153+
`Updated package.json to include offline linting packages and dependencies.`,
146154
MessageType.InformationOk
147155
);
148156
}
149157

150158
if (modifiedEslintrc) {
151-
telemetryService.sendCommandEvent(commandName, process.hrtime(), { "metricEvents": MetricEvents.UPDATED_ESLINTRC_JSON });
159+
telemetryService.sendCommandEvent(
160+
commandName,
161+
process.hrtime(),
162+
{ metricEvents: MetricEvents.UPDATED_ESLINTRC_JSON }
163+
);
152164
this.showMessage(
153-
l10n.t(`${commandName}.${MetricEvents.UPDATED_ESLINTRC_JSON}`),
165+
`Updated .eslintrc.json to include recommended linting rules.`,
154166
MessageType.InformationOk
155167
);
156168
}
157169

158170
if (modifiedDevDependencies || modifiedEslintrc) {
159171
this.showMessage(
160-
l10n.t(`${commandName}.run-install-command`),
172+
`In the Terminal window, be sure to run the install command for your configured package manager, to install the updated dependencies. For example, "npm install" or "yarn install".`,
161173
MessageType.InformationOk
162174
);
163175
}
164176

165177
if (!modifiedDevDependencies && !modifiedEslintrc) {
166-
telemetryService.sendCommandEvent(commandName, process.hrtime(), { "metricEvents": MetricEvents.ALREADY_CONFIGURED });
167-
const message = l10n.t(`${commandName}.${MetricEvents.ALREADY_CONFIGURED}`);
168-
this.showMessage(message, MessageType.InformationOk);
178+
telemetryService.sendCommandEvent(
179+
commandName,
180+
process.hrtime(),
181+
{ metricEvents: MetricEvents.ALREADY_CONFIGURED }
182+
);
183+
this.showMessage(
184+
`All offline linting packages and dependencies are already configured in your project. No update has been made to package.json.`,
185+
MessageType.InformationOk
186+
);
169187
}
170188

171189
return true;
172190
}
173191
} catch (error) {
174192
const event = `${commandName}.${MetricEvents.GENERAL_ERROR}`;
175-
const message = l10n.t(event, error as Error);
193+
const message = `There was an error trying to update either the offline linting dependencies or linting configuration: ${error}`;
176194

177195
await this.showMessage(message);
178196
telemetryService.sendException(event, message);
@@ -283,11 +301,8 @@ export class ConfigureLintingToolsCommand {
283301
}
284302

285303
export function registerCommand(context: ExtensionContext) {
286-
const disposable = commands.registerCommand(
287-
commandName,
288-
async () => {
289-
await ConfigureLintingToolsCommand.configure();
290-
}
291-
);
304+
const disposable = commands.registerCommand(commandName, async () => {
305+
await ConfigureLintingToolsCommand.configure();
306+
});
292307
context.subscriptions.push(disposable);
293308
}

0 commit comments

Comments
 (0)