Skip to content

Commit f4e2d0d

Browse files
Merge master into feature/q-dev-execution
2 parents 23155fc + 987e2fc commit f4e2d0d

File tree

6 files changed

+27
-13
lines changed

6 files changed

+27
-13
lines changed

packages/amazonq/src/extensionNode.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { DevOptions } from 'aws-core-vscode/dev'
1717
import { Auth } from 'aws-core-vscode/auth'
1818
import api from './api'
1919
import { activate as activateCWChat } from './app/chat/activation'
20+
import { beta } from 'aws-core-vscode/dev'
2021

2122
export async function activate(context: vscode.ExtensionContext) {
2223
// IMPORTANT: No other code should be added to this function. Place it in one of the following 2 functions where appropriate.
@@ -59,6 +60,7 @@ async function activateAmazonQNode(context: vscode.ExtensionContext) {
5960
filetypes.activate()
6061

6162
await setupDevMode(context)
63+
await beta.activate(context)
6264
}
6365

6466
/**

packages/core/src/dev/activation.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
import * as vscode from 'vscode'
7-
import * as config from './config'
87
import { createCommonButtons } from '../shared/ui/buttons'
98
import { createQuickPick } from '../shared/ui/pickerPrompter'
109
import { SkipPrompter } from '../shared/ui/common/skipPrompter'
@@ -14,9 +13,6 @@ import { Commands } from '../shared/vscode/commands2'
1413
import { createInputBox } from '../shared/ui/inputPrompter'
1514
import { Wizard } from '../shared/wizards/wizard'
1615
import { deleteDevEnvCommand, installVsixCommand, openTerminalCommand } from './codecatalyst'
17-
import { watchBetaVSIX } from './beta'
18-
import { isCloud9 } from '../shared/extensionUtilities'
19-
import { isReleaseVersion } from '../shared/vscode/env'
2016
import { isAnySsoConnection } from '../auth/connection'
2117
import { Auth } from '../auth/auth'
2218
import { getLogger } from '../shared/logger'
@@ -194,10 +190,6 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
194190

195191
const editor = new ObjectEditor()
196192
ctx.subscriptions.push(openStorageCommand.register(editor))
197-
198-
if (!isCloud9() && !isReleaseVersion() && config.betaUrl) {
199-
ctx.subscriptions.push(watchBetaVSIX(config.betaUrl))
200-
}
201193
}
202194

203195
async function openMenu(options: MenuOption[]): Promise<void> {

packages/core/src/dev/beta.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import { isUserCancelledError, ToolkitError } from '../shared/errors'
1818
import { telemetry } from '../shared/telemetry/telemetry'
1919
import { cast } from '../shared/utilities/typeConstructors'
2020
import { CancellationError } from '../shared/utilities/timeoutUtils'
21+
import { isAmazonQ, isCloud9, productName } from '../shared/extensionUtilities'
22+
import * as config from './config'
23+
import { isReleaseVersion } from '../shared/vscode/env'
2124

2225
const localize = nls.loadMessageBundle()
2326

@@ -39,6 +42,16 @@ async function updateBetaToolkitData(vsixUrl: string, data: BetaToolkit) {
3942
})
4043
}
4144

45+
/**
46+
* Set up "beta" update monitoring.
47+
*/
48+
export async function activate(ctx: vscode.ExtensionContext) {
49+
const betaUrl = isAmazonQ() ? config.betaUrl.amazonq : config.betaUrl.toolkit
50+
if (!isCloud9() && !isReleaseVersion() && betaUrl) {
51+
ctx.subscriptions.push(watchBetaVSIX(betaUrl))
52+
}
53+
}
54+
4255
/**
4356
* Watch the beta VSIX daily for changes.
4457
* If this is the first time we are watching the beta version or if its been 24 hours since it was last checked then try to prompt for update
@@ -75,11 +88,12 @@ async function runAutoUpdate(vsixUrl: string) {
7588
async function checkBetaUrl(vsixUrl: string): Promise<void> {
7689
const resp = await got(vsixUrl).buffer()
7790
const latestBetaInfo = await getExtensionInfo(resp)
78-
if (VSCODE_EXTENSION_ID.awstoolkit !== `${latestBetaInfo.publisher}.${latestBetaInfo.name}`) {
91+
const extId = isAmazonQ() ? VSCODE_EXTENSION_ID.amazonq : VSCODE_EXTENSION_ID.awstoolkit
92+
if (extId !== `${latestBetaInfo.publisher}.${latestBetaInfo.name}`) {
7993
throw new ToolkitError('URL does not point to an AWS Toolkit artifact', { code: 'InvalidExtensionName' })
8094
}
8195

82-
const currentVersion = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)?.packageJSON.version
96+
const currentVersion = vscode.extensions.getExtension(extId)?.packageJSON.version
8397
if (latestBetaInfo.version !== currentVersion) {
8498
const tmpFolder = await makeTemporaryToolkitFolder()
8599
const betaPath = vscode.Uri.joinPath(vscode.Uri.file(tmpFolder), path.basename(vsixUrl))
@@ -141,7 +155,7 @@ async function promptInstallToolkit(pluginPath: vscode.Uri, newVersion: string,
141155
const response = await vscode.window.showInformationMessage(
142156
localize(
143157
'AWS.dev.beta.updatePrompt',
144-
`New version of AWS Toolkit is available at the [beta URL]({0}). Install the new version "{1}" to continue using the beta.`,
158+
`New version of ${productName()} is available at the [beta URL]({0}). Install the new version "{1}" to continue using the beta.`,
145159
vsixUrl,
146160
newVersion
147161
),

packages/core/src/dev/config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
// This file is strictly used for private development
6+
// This file is for internal testing.
77
// Nothing in this file should have a truthy value on mainline
88

9-
export const betaUrl = ''
9+
export const betaUrl = {
10+
amazonq: '',
11+
toolkit: '',
12+
}
1013

1114
// feature flag for SQL transformations
1215
export const isSQLTransformReady = false

packages/core/src/dev/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
*/
55

66
export { DevOptions, updateDevMode } from './activation'
7+
export * as beta from './beta'

packages/core/src/extensionNode.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { activate as activateEcs } from './awsService/ecs/activation'
3535
import { activate as activateAppRunner } from './awsService/apprunner/activation'
3636
import { activate as activateIot } from './awsService/iot/activation'
3737
import { activate as activateDev } from './dev/activation'
38+
import * as beta from './dev/beta'
3839
import { activate as activateApplicationComposer } from './applicationcomposer/activation'
3940
import { activate as activateRedshift } from './awsService/redshift/activation'
4041
import { activate as activateIamPolicyChecks } from './awsService/accessanalyzer/activation'
@@ -106,6 +107,7 @@ export async function activate(context: vscode.ExtensionContext) {
106107

107108
try {
108109
await activateDev(context)
110+
await beta.activate(context)
109111
} catch (error) {
110112
getLogger().debug(`Developer Tools (internal): failed to activate: ${(error as Error).message}`)
111113
}

0 commit comments

Comments
 (0)