Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/amazonq/src/extensionNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { DevOptions } from 'aws-core-vscode/dev'
import { Auth } from 'aws-core-vscode/auth'
import api from './api'
import { activate as activateCWChat } from './app/chat/activation'
import { beta } from 'aws-core-vscode/dev'

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

await setupDevMode(context)
await beta.activate(context)
}

/**
Expand Down
8 changes: 0 additions & 8 deletions packages/core/src/dev/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import * as vscode from 'vscode'
import * as config from './config'
import { createCommonButtons } from '../shared/ui/buttons'
import { createQuickPick } from '../shared/ui/pickerPrompter'
import { SkipPrompter } from '../shared/ui/common/skipPrompter'
Expand All @@ -14,9 +13,6 @@ import { Commands } from '../shared/vscode/commands2'
import { createInputBox } from '../shared/ui/inputPrompter'
import { Wizard } from '../shared/wizards/wizard'
import { deleteDevEnvCommand, installVsixCommand, openTerminalCommand } from './codecatalyst'
import { watchBetaVSIX } from './beta'
import { isCloud9 } from '../shared/extensionUtilities'
import { isReleaseVersion } from '../shared/vscode/env'
import { isAnySsoConnection } from '../auth/connection'
import { Auth } from '../auth/auth'
import { getLogger } from '../shared/logger'
Expand Down Expand Up @@ -194,10 +190,6 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {

const editor = new ObjectEditor()
ctx.subscriptions.push(openStorageCommand.register(editor))

if (!isCloud9() && !isReleaseVersion() && config.betaUrl) {
ctx.subscriptions.push(watchBetaVSIX(config.betaUrl))
}
}

async function openMenu(options: MenuOption[]): Promise<void> {
Expand Down
20 changes: 17 additions & 3 deletions packages/core/src/dev/beta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { isUserCancelledError, ToolkitError } from '../shared/errors'
import { telemetry } from '../shared/telemetry/telemetry'
import { cast } from '../shared/utilities/typeConstructors'
import { CancellationError } from '../shared/utilities/timeoutUtils'
import { isAmazonQ, isCloud9, productName } from '../shared/extensionUtilities'
import * as config from './config'
import { isReleaseVersion } from '../shared/vscode/env'

const localize = nls.loadMessageBundle()

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

/**
* Set up "beta" update monitoring.
*/
export async function activate(ctx: vscode.ExtensionContext) {
const betaUrl = isAmazonQ() ? config.betaUrl.amazonq : config.betaUrl.toolkit
if (!isCloud9() && !isReleaseVersion() && betaUrl) {
ctx.subscriptions.push(watchBetaVSIX(betaUrl))
}
}

/**
* Watch the beta VSIX daily for changes.
* 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
Expand Down Expand Up @@ -75,11 +88,12 @@ async function runAutoUpdate(vsixUrl: string) {
async function checkBetaUrl(vsixUrl: string): Promise<void> {
const resp = await got(vsixUrl).buffer()
const latestBetaInfo = await getExtensionInfo(resp)
if (VSCODE_EXTENSION_ID.awstoolkit !== `${latestBetaInfo.publisher}.${latestBetaInfo.name}`) {
const extId = isAmazonQ() ? VSCODE_EXTENSION_ID.amazonq : VSCODE_EXTENSION_ID.awstoolkit
if (extId !== `${latestBetaInfo.publisher}.${latestBetaInfo.name}`) {
throw new ToolkitError('URL does not point to an AWS Toolkit artifact', { code: 'InvalidExtensionName' })
}

const currentVersion = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)?.packageJSON.version
const currentVersion = vscode.extensions.getExtension(extId)?.packageJSON.version
if (latestBetaInfo.version !== currentVersion) {
const tmpFolder = await makeTemporaryToolkitFolder()
const betaPath = vscode.Uri.joinPath(vscode.Uri.file(tmpFolder), path.basename(vsixUrl))
Expand Down Expand Up @@ -141,7 +155,7 @@ async function promptInstallToolkit(pluginPath: vscode.Uri, newVersion: string,
const response = await vscode.window.showInformationMessage(
localize(
'AWS.dev.beta.updatePrompt',
`New version of AWS Toolkit is available at the [beta URL]({0}). Install the new version "{1}" to continue using the beta.`,
`New version of ${productName()} is available at the [beta URL]({0}). Install the new version "{1}" to continue using the beta.`,
vsixUrl,
newVersion
),
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

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

export const betaUrl = ''
export const betaUrl = {
amazonq: '',
toolkit: '',
}

// feature flag for SQL transformations
export const isSQLTransformReady = false
1 change: 1 addition & 0 deletions packages/core/src/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*/

export { DevOptions, updateDevMode } from './activation'
export * as beta from './beta'
2 changes: 2 additions & 0 deletions packages/core/src/extensionNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { activate as activateEcs } from './awsService/ecs/activation'
import { activate as activateAppRunner } from './awsService/apprunner/activation'
import { activate as activateIot } from './awsService/iot/activation'
import { activate as activateDev } from './dev/activation'
import * as beta from './dev/beta'
import { activate as activateApplicationComposer } from './applicationcomposer/activation'
import { activate as activateRedshift } from './awsService/redshift/activation'
import { activate as activateIamPolicyChecks } from './awsService/accessanalyzer/activation'
Expand Down Expand Up @@ -106,6 +107,7 @@ export async function activate(context: vscode.ExtensionContext) {

try {
await activateDev(context)
await beta.activate(context)
} catch (error) {
getLogger().debug(`Developer Tools (internal): failed to activate: ${(error as Error).message}`)
}
Expand Down
Loading