Skip to content

Commit c9ab91e

Browse files
author
Vandita Patidar
committed
Adding fixes for extension
1 parent f59a1d2 commit c9ab91e

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

packages/core/src/awsService/appBuilder/activation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ export const templateToOpenAppComposer = 'aws.toolkit.appComposer.templateToOpen
3232
* IMPORTANT: Views that should work in all vscode environments (node or web)
3333
* should be setup in {@link activateViewsShared}.
3434
*/
35-
export async function activate(context: ExtContext): Promise<void> {
35+
export async function activate(context: ExtContext, ctx: vscode.ExtensionContext): Promise<void> {
3636
// recover context variables from global state when activate
3737
const walkthroughSelected = globals.globalState.get<string>(walkthroughContextString)
3838
if (walkthroughSelected !== undefined) {
3939
await setContext(walkthroughContextString, walkthroughSelected)
4040
}
4141

42-
await registerAppBuilderCommands(context)
42+
await registerAppBuilderCommands(context, ctx)
4343

4444
const appBuilderNode: ToolView[] = [
4545
{
@@ -123,7 +123,7 @@ async function setWalkthrough(walkthroughSelected: string = 'S3'): Promise<void>
123123
*
124124
* @param context VScode Context
125125
*/
126-
async function registerAppBuilderCommands(context: ExtContext): Promise<void> {
126+
async function registerAppBuilderCommands(context: ExtContext, ctx: vscode.ExtensionContext): Promise<void> {
127127
const source = 'AppBuilderWalkthrough'
128128
context.extensionContext.subscriptions.push(
129129
Commands.register('aws.toolkit.installSAMCLI', async () => {
@@ -202,7 +202,7 @@ async function registerAppBuilderCommands(context: ExtContext): Promise<void> {
202202
}
203203
}),
204204
Commands.register({ id: 'aws.toolkit.lambda.createServerlessLandProject', autoconnect: false }, async () => {
205-
await createNewServerlessLandProject(context)
205+
await createNewServerlessLandProject(context, ctx)
206206
})
207207
)
208208
}

packages/core/src/awsService/appBuilder/serverlessLand/main.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { ToolkitError } from '../../../shared/errors'
1818
import { fs } from '../../../shared/fs/fs'
1919
import { getPattern } from '../../../shared/utilities/downloadPatterns'
2020
import { MetadataManager } from './metadataManager'
21+
import type { ExtensionContext } from 'vscode'
2122

2223
export const readmeFile: string = 'README.md'
2324
const serverlessLandOwner = 'aws-samples'
@@ -36,15 +37,15 @@ const serverlessLandRepo = 'serverless-patterns'
3637
* 5. Opens the README.md file if available
3738
* 6. Handles errors and emits telemetry
3839
*/
39-
export async function createNewServerlessLandProject(extContext: ExtContext): Promise<void> {
40+
export async function createNewServerlessLandProject(extContext: ExtContext, ctx: ExtensionContext): Promise<void> {
4041
let createResult: Result = 'Succeeded'
4142
let reason: string | undefined
4243
let metadataManager: MetadataManager
4344

4445
try {
4546
metadataManager = MetadataManager.getInstance()
4647
// Launch the project creation wizard
47-
const config = await launchProjectCreationWizard(extContext)
48+
const config = await launchProjectCreationWizard(extContext, ctx)
4849
if (!config) {
4950
createResult = 'Cancelled'
5051
reason = 'userCancelled'
@@ -83,13 +84,15 @@ export async function createNewServerlessLandProject(extContext: ExtContext): Pr
8384
}
8485

8586
async function launchProjectCreationWizard(
86-
extContext: ExtContext
87+
extContext: ExtContext,
88+
ctx: ExtensionContext
8789
): Promise<CreateServerlessLandWizardForm | undefined> {
8890
const awsContext = extContext.awsContext
8991
const credentials = await awsContext.getCredentials()
9092
const defaultRegion = awsContext.getCredentialDefaultRegion()
9193

9294
return new CreateServerlessLandWizard({
95+
ctx,
9396
credentials,
9497
defaultRegion,
9598
}).run()

packages/core/src/awsService/appBuilder/serverlessLand/wizard.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import * as nls from 'vscode-nls'
66
import * as AWS from '@aws-sdk/types'
77
import * as vscode from 'vscode'
8-
import { Wizard, WIZARD_BACK, WizardControl } from '../../../shared/wizards/wizard'
8+
import { Wizard } from '../../../shared/wizards/wizard'
99
import * as path from 'path'
1010
import { createInputBox } from '../../../shared/ui/inputPrompter'
1111
import { createCommonButtons } from '../../../shared/ui/buttons'
1212
import { createQuickPick } from '../../../shared/ui/pickerPrompter'
1313
import { createFolderPrompt } from '../../../shared/ui/common/location'
1414
import { createExitPrompter } from '../../../shared/ui/common/exitPrompter'
1515
import { MetadataManager } from './metadataManager'
16+
import type { ExtensionContext } from 'vscode'
1617
import { ToolkitError } from '../../../shared/errors'
1718

1819
const localize = nls.loadMessageBundle()
@@ -135,7 +136,7 @@ function promptName() {
135136
export class CreateServerlessLandWizard extends Wizard<CreateServerlessLandWizardForm> {
136137
private metadataManager: MetadataManager
137138

138-
public constructor(context: { defaultRegion?: string; credentials?: AWS.Credentials }) {
139+
public constructor(context: { ctx: ExtensionContext; defaultRegion?: string; credentials?: AWS.Credentials }) {
139140
super({
140141
exitPrompterProvider: createExitPrompter,
141142
})

packages/core/src/extensionNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export async function activate(context: vscode.ExtensionContext) {
200200

201201
await activateRedshift(extContext)
202202

203-
await activateAppBuilder(extContext)
203+
await activateAppBuilder(extContext, context)
204204

205205
await activateDocumentDb(extContext)
206206

packages/toolkit/scripts/build/copyFiles.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ const tasks: CopyTask[] = [
6969
destination: path.join('src', 'stepFunctions', 'asl', 'aslServer.js'),
7070
},
7171

72+
// Serverless Land
73+
{
74+
target: path.join(
75+
'../../node_modules/aws-core-vscode',
76+
'src',
77+
'awsService',
78+
'appBuilder',
79+
'serverlessLand',
80+
'metadata.json'
81+
),
82+
destination: path.join('src', 'serverlessLand', 'metadata.json'),
83+
},
84+
7285
// Vue
7386
{
7487
target: path.join('../core', 'resources', 'js', 'vscode.js'),

0 commit comments

Comments
 (0)