Skip to content

Commit

Permalink
package: increase minimum vscode to 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
ctlai95 committed Apr 23, 2024
1 parent e72d016 commit 288aa83
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Deprecation",
"description": "Minimum required VS Code version is now 1.83"
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "Apache-2.0",
"engines": {
"npm": "^10.1.0",
"vscode": "^1.68.0"
"vscode": "^1.83.0"
},
"activationEvents": [
"onStartupFinished",
Expand Down
29 changes: 12 additions & 17 deletions packages/core/src/lambda/commands/uploadLambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import AdmZip from 'adm-zip'
import * as path from 'path'
import { fsCommon } from '../../srcShared/fs'
import { showConfirmationMessage, showViewLogsMessage } from '../../shared/utilities/messages'
import { cloud9Findfile, makeTemporaryToolkitFolder, tryRemoveFolder } from '../../shared/filesystemUtilities'
import { makeTemporaryToolkitFolder, tryRemoveFolder } from '../../shared/filesystemUtilities'
import * as localizedText from '../../shared/localizedText'
import { getLogger } from '../../shared/logger'
import { SamCliBuildInvocation } from '../../shared/sam/cli/samCliBuild'
import { getSamCliContext } from '../../shared/sam/cli/samCliContext'
import { SamTemplateGenerator } from '../../shared/templates/sam/samTemplateGenerator'
import { addCodiconToString } from '../../shared/utilities/textUtilities'
import { getLambdaDetails, listLambdaFunctions } from '../utils'
import { getIdeProperties, isCloud9 } from '../../shared/extensionUtilities'
import { getIdeProperties } from '../../shared/extensionUtilities'
import { createQuickPick, DataQuickPickItem } from '../../shared/ui/pickerPrompter'
import { createCommonButtons } from '../../shared/ui/buttons'
import { StepEstimator, Wizard, WIZARD_BACK } from '../../shared/wizards/wizard'
Expand Down Expand Up @@ -478,10 +478,7 @@ async function uploadZipBuffer(
)
}

export async function findApplicationJsonFile(
startPath: vscode.Uri,
cloud9 = isCloud9()
): Promise<vscode.Uri | undefined> {
export async function findApplicationJsonFile(startPath: vscode.Uri): Promise<vscode.Uri | undefined> {
if (!(await fsCommon.exists(startPath.fsPath))) {
getLogger().error(
'findApplicationJsonFile() invalid path (not accessible or does not exist): "%s"',
Expand All @@ -491,17 +488,15 @@ export async function findApplicationJsonFile(
}
const isdir = await fsCommon.existsDir(startPath.fsPath)
const parentDir = isdir ? startPath.fsPath : path.dirname(startPath.fsPath)
const found = cloud9
? await cloud9Findfile(parentDir, '.application.json')
: await vscode.workspace.findFiles(
new vscode.RelativePattern(parentDir, '**/.application.json'),
// exclude:
// - null = NO excludes apply
// - undefined = default excludes apply (e.g. the `files.exclude` setting but not `search.exclude`).
// eslint-disable-next-line unicorn/no-null
null,
1
)
const found = await vscode.workspace.findFiles(
new vscode.RelativePattern(parentDir, '**/.application.json'),
// exclude:
// - null = NO excludes apply
// - undefined = default excludes apply (e.g. the `files.exclude` setting but not `search.exclude`).
// eslint-disable-next-line unicorn/no-null
null,
1
)
if (!found || found.length === 0) {
getLogger().debug('uploadLambda: .application.json not found in: "%s"', parentDir)
}
Expand Down
29 changes: 0 additions & 29 deletions packages/core/src/shared/filesystemUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,35 +231,6 @@ export async function hasFileWithSuffix(dir: string, suffix: string, exclude?: v
return matchedFiles.length > 0
}

/**
* TEMPORARY SHIM for vscode.workspace.findFiles() on Cloud9.
*
* @param dir Directory to search
* @param fileName Name of file to locate
* @returns List of one or zero Uris (for compat with vscode.workspace.findFiles())
*/
export async function cloud9Findfile(dir: string, fileName: string): Promise<vscode.Uri[]> {
getLogger().debug('cloud9Findfile: %s', dir)
const files = await fsCommon.readdir(dir)
const subDirs: vscode.Uri[] = []
for (const file of files) {
const [currentFileName] = file
const filePath = path.join(dir, currentFileName)
if (filePath === path.join(dir, fileName)) {
return [vscode.Uri.file(filePath)]
}
if (await fsCommon.existsDir(filePath)) {
subDirs.push(vscode.Uri.file(filePath))
}
}
for (const d of subDirs) {
const found = await cloud9Findfile(d.fsPath, fileName)
if (found.length > 0) {
return found
}
}
return []
}
/**
* @returns A string path to the last locally stored download location. If none, returns the users 'Downloads' directory path.
*/
Expand Down
9 changes: 0 additions & 9 deletions packages/core/src/test/lambda/commands/uploadLambda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ describe('uploadLambda', async function () {
(await findApplicationJsonFile(folderUri))?.fsPath ?? '',
path.join(tempFolder, '.application.json')
)
// Also test Cloud9 temporary workaround.
assertEqualPaths(
(await findApplicationJsonFile(folderUri, true))?.fsPath ?? '',
path.join(tempFolder, '.application.json')
)
})

it('finds application.json file from dir path - nested', async function () {
Expand All @@ -56,8 +51,6 @@ describe('uploadLambda', async function () {
await toFile('top secret data', appjsonPath)

assertEqualPaths((await findApplicationJsonFile(folderUri))?.fsPath ?? '', appjsonPath)
// Also test Cloud9 temporary workaround.
assertEqualPaths((await findApplicationJsonFile(folderUri, true))?.fsPath ?? '', appjsonPath)
})

it('finds application.json file from template file path', async function () {
Expand All @@ -67,8 +60,6 @@ describe('uploadLambda', async function () {
await toFile('top secret data', appjsonPath)

assertEqualPaths((await findApplicationJsonFile(templateUri))?.fsPath ?? '', appjsonPath)
// Also test Cloud9 temporary workaround.
assertEqualPaths((await findApplicationJsonFile(templateUri, true))?.fsPath ?? '', appjsonPath)
})

it('lists functions from .application.json', async function () {
Expand Down
7 changes: 1 addition & 6 deletions packages/core/src/test/techdebt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ describe('tech debt', function () {
const minVscode = env.getMinVscodeVersion()

assert.ok(
semver.lt(minVscode, '1.75.0'),
'remove filesystemUtilities.findFile(), use vscode.workspace.findFiles() instead (after Cloud9 VFS fixes bug)'
)

assert.ok(
semver.lt(minVscode, '1.75.0'),
semver.lt(minVscode, '1.84.0'),
'remove AsyncLocalStorage polyfill used in `spans.ts` if Cloud9 is on node 14+'
)
})
Expand Down

0 comments on commit 288aa83

Please sign in to comment.