Skip to content

Commit 6718ae9

Browse files
committed
build: introduce "packageAlpha" task
- `npm run packageAlpha` creates an artifact that can be delivered to users for testing alpha builds. It creates artifact: aws-toolkit-vscode-1.99.0-SNAPSHOT.vsix - Show a warning message on startup if the extension version is such an alpha artifact.
1 parent 76c88fd commit 6718ae9

File tree

7 files changed

+48
-10
lines changed

7 files changed

+48
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ telemetryCache
1010
quickStart.html
1111
.gitcommit
1212
media/libs/
13+
package.json.bk
1314

1415
# Auto generated definitions
1516
src/**/*.gen.ts

CONTRIBUTING.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,22 @@ When you launch the extension or run tests from Visual Studio Code, it will auto
3232

3333
If you prefer, you can build from the command line:
3434

35-
- To build one time: `npm run compile`
36-
- To build and watch for file changes: `npm run watch`
35+
- To build one time:
36+
```
37+
npm run compile
38+
```
39+
- To build and watch for file changes:
40+
```
41+
npm run watch
42+
```
43+
- To build a release artifact:
44+
```
45+
npm run package
46+
```
47+
- To build an "alpha" artifact (useful for letting others test a particular build):
48+
```
49+
npm run packageAlpha
50+
```
3751
3852
#### If you run out of memory while building
3953

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@
851851
"lint": "eslint -c .eslintrc.js --ext .ts .",
852852
"lintfix": "eslint -c .eslintrc.js --fix --ext .ts .",
853853
"package": "vsce package",
854+
"packageAlpha": "sed -i .bk 's/\\( \"version\":\\) .*/\\1 \"1.99.0-SNAPSHOT\",/' package.json && vsce package && mv package.json.bk package.json",
854855
"install-plugin": "vsce package -o aws-toolkit-vscode-test.vsix && code --install-extension aws-toolkit-vscode-test.vsix",
855856
"generateTelemetry": "node node_modules/@aws-toolkits/telemetry/lib/generateTelemetry.js --extraInput=src/shared/telemetry/vscodeTelemetry.json --output=src/shared/telemetry/telemetry.gen.ts",
856857
"generateConfigurationAttributes": "ts-node ./build-scripts/generateConfigurationAttributes.ts",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"AWS.title.createCredentialProfile": "Create a new AWS credential profile",
44
"AWS.title.creatingCredentialProfile": "Saving new credential profile {0}",
55
"AWS.title.selectCredentialProfile": "Select an AWS credential profile",
6+
"AWS.startup.toastIfAlpha": "AWS Toolkit PREVIEW. (To get the latest STABLE version, uninstall this version.)",
67
"AWS.cdk.explorerTitle": "AWS CDK Explorer (Preview)",
78
"Aws.cdk.explorerNode.noApps": "[No CDK Apps found in Workspaces]",
89
"Aws.cdk.explorerNode.app.noConstructTree": "[Unable to load construct tree for this App. Run `cdk synth`]",

src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
aboutToolkit,
3434
getToolkitEnvironmentDetails,
3535
showQuickStartWebview,
36-
toastNewUser,
36+
showWelcomeMessage,
3737
} from './shared/extensionUtilities'
3838
import { getLogger, Logger } from './shared/logger'
3939
import { activate as activateLogger } from './shared/logger/activation'
@@ -194,7 +194,7 @@ export async function activate(context: vscode.ExtensionContext) {
194194
await activateStepFunctions(context, awsContext, toolkitOutputChannel)
195195
})
196196

197-
toastNewUser(context)
197+
showWelcomeMessage(context)
198198

199199
await loginWithMostRecentCredentials(toolkitSettings, loginManager)
200200

src/shared/extensionUtilities.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ext } from '../shared/extensionGlobals'
1212
import { mostRecentVersionKey, pluginVersion } from './constants'
1313
import { readFileAsString } from './filesystemUtilities'
1414
import { getLogger } from './logger'
15+
import { VSCODE_EXTENSION_ID, EXTENSION_ALPHA_VERSION } from './extensions'
1516

1617
const localize = nls.loadMessageBundle()
1718

@@ -156,9 +157,9 @@ export function setMostRecentVersion(context: vscode.ExtensionContext): void {
156157
}
157158

158159
/**
159-
* Publishes a toast with a link to the welcome page
160+
* Shows a message with a link to the quickstart page.
160161
*/
161-
async function promptQuickStart(): Promise<void> {
162+
async function showQuickstartPrompt(): Promise<void> {
162163
const view = localize('AWS.command.quickStart', 'View Quick Start')
163164
const prompt = await vscode.window.showInformationMessage(
164165
localize(
@@ -174,18 +175,33 @@ async function promptQuickStart(): Promise<void> {
174175
}
175176

176177
/**
177-
* Checks if a user is new to this version
178-
* If so, pops a toast with a link to a quick start page
178+
* Shows a "new version" or "alpha version" message.
179+
*
180+
* - If extension version is "alpha", shows a warning message.
181+
* - If extension version was not previously run on this machine, shows a toast
182+
* with a link to the quickstart page.
183+
* - Otherwise does nothing.
179184
*
180185
* @param context VS Code Extension Context
181186
*/
182-
export function toastNewUser(context: vscode.ExtensionContext): void {
187+
export function showWelcomeMessage(context: vscode.ExtensionContext): void {
188+
const version = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)?.packageJSON.version
189+
if (version === EXTENSION_ALPHA_VERSION) {
190+
vscode.window.showWarningMessage(
191+
localize(
192+
'AWS.startup.toastIfAlpha',
193+
'AWS Toolkit PREVIEW. (To get the latest STABLE version, uninstall this version.)'
194+
)
195+
)
196+
return
197+
}
198+
183199
try {
184200
if (isDifferentVersion(context)) {
185201
setMostRecentVersion(context)
186202
// the welcome toast should be nonblocking.
187203
// tslint:disable-next-line: no-floating-promises
188-
promptQuickStart()
204+
showQuickstartPrompt()
189205
}
190206
} catch (err) {
191207
// swallow error and don't block extension load

src/shared/extensions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ export const VSCODE_EXTENSION_ID = {
77
awstoolkit: 'amazonwebservices.aws-toolkit-vscode',
88
python: 'ms-python.python',
99
}
10+
11+
/**
12+
* Version of the .vsix produced by the `packageAlpha` script.
13+
*/
14+
export const EXTENSION_ALPHA_VERSION = '1.99.0-SNAPSHOT'

0 commit comments

Comments
 (0)