Skip to content

Commit 7218743

Browse files
authored
Merge pull request #15 from elastic/update-vale-checker
Update vale checker
2 parents f42ba10 + 7d777c7 commit 7218743

File tree

4 files changed

+365
-2
lines changed

4 files changed

+365
-2
lines changed

esbuild.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const webOptions = {
4646
platform: 'browser',
4747
// Mark Node.js built-ins as external so they don't cause errors
4848
// In the web version, we'll need to handle these differently
49-
external: [...baseOptions.external, 'path', 'fs', 'https'],
49+
external: [...baseOptions.external, 'path', 'fs', 'https', 'os'],
5050
define: {
5151
'process.env.IS_WEB': 'true',
5252
},

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "elastic-docs-v3-utilities",
33
"displayName": "Elastic Docs Utilities",
44
"description": "Utilities for Elastic Docs authoring",
5-
"version": "0.12.7",
5+
"version": "0.12.8",
66
"publisher": "Elastic",
77
"repository": {
88
"type": "git",
@@ -51,6 +51,14 @@
5151
{
5252
"command": "elastic-docs-v3.refreshVersions",
5353
"title": "Elastic Docs: Refresh Versions Cache"
54+
},
55+
{
56+
"command": "elastic-docs-v3.checkValeUpdates",
57+
"title": "Elastic Docs: Check for Vale Style Guide Updates"
58+
},
59+
{
60+
"command": "elastic-docs-v3.testValeUpdateNotification",
61+
"title": "Elastic Docs: Test Vale Update Notification"
5462
}
5563
]
5664
},

src/extension.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { SubstitutionCodeActionProvider } from './substitutionCodeActionProvider
3131
import { UndefinedSubstitutionValidator } from './undefinedSubstitutionValidator';
3232
import { substitutionCache, initializeSubstitutionsForWeb } from './substitutions';
3333
import { VersionsCache } from './versionsCache';
34+
import { ValeUpdateChecker } from './valeUpdateChecker';
3435

3536
import { outputChannel } from './logger';
3637
import { performanceLogger } from './performanceLogger';
@@ -59,6 +60,12 @@ export function activate(context: vscode.ExtensionContext): void {
5960
outputChannel.appendLine(`Failed to initialize substitutions for web: ${err}`);
6061
});
6162

63+
// Check for Vale style guide updates (async, non-blocking)
64+
const valeUpdateChecker = ValeUpdateChecker.getInstance();
65+
valeUpdateChecker.checkForUpdates().catch(err => {
66+
outputChannel.appendLine(`Failed to check for Vale updates: ${err}`);
67+
});
68+
6269
// Apply color customizations programmatically
6370
applyColorCustomizations();
6471

@@ -336,6 +343,31 @@ export function activate(context: vscode.ExtensionContext): void {
336343
})
337344
);
338345

346+
// Register command to manually check for Vale style guide updates
347+
context.subscriptions.push(
348+
vscode.commands.registerCommand('elastic-docs-v3.checkValeUpdates', async () => {
349+
try {
350+
await vscode.window.withProgress({
351+
location: vscode.ProgressLocation.Notification,
352+
title: "Checking for Vale style guide updates...",
353+
cancellable: false
354+
}, async () => {
355+
await valeUpdateChecker.checkForUpdates();
356+
});
357+
} catch (error) {
358+
vscode.window.showErrorMessage(`Failed to check for Vale updates: ${error}`);
359+
outputChannel.appendLine(`Error checking for Vale updates: ${error}`);
360+
}
361+
})
362+
);
363+
364+
// Register command to test Vale update notification (for development/testing)
365+
context.subscriptions.push(
366+
vscode.commands.registerCommand('elastic-docs-v3.testValeUpdateNotification', async () => {
367+
await valeUpdateChecker.simulateUpdateNotification();
368+
})
369+
);
370+
339371
// Periodically refresh versions cache (every hour)
340372
const refreshInterval = setInterval(() => {
341373
versionsCache.refreshIfNeeded().then(() => {

0 commit comments

Comments
 (0)