diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8439225a..831ffc50 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -6,7 +6,7 @@ on: - develop env: - NODE_VERSION: '14.16.0' + NODE_VERSION: '16.13.0' jobs: # We really only need to run lint on one job so we'll do it here diff --git a/.github/workflows/pr-build-and-test.yml b/.github/workflows/pr-build-and-test.yml index 9ab5b884..8ddc14ee 100644 --- a/.github/workflows/pr-build-and-test.yml +++ b/.github/workflows/pr-build-and-test.yml @@ -6,7 +6,7 @@ on: - develop env: - NODE_VERSION: '14.16.0' + NODE_VERSION: '16.13.0' jobs: pr-build: diff --git a/.nvmrc b/.nvmrc index 158c0064..ff650592 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v14.16.0 +v16.13.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92b9895d..dc82c4dd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,10 +10,10 @@ Familiarize yourself with the codebase and by reading the various [contributing Then, -1. Fork and/or clone this repository. +1. Fork or clone this repository. 1. Create a _topic_ branch in your fork based on the correct branch (usually the **develop** branch, see [Branches section](#branches) below). Note, this step is recommended but technically not required if contributing using a fork. -1. Edit the code in your fork. -1. Create a pull request when you are done. +1. Edit the code. +1. Push your branch and create a pull request when you are done. ## Branches diff --git a/contributing/developing.md b/contributing/developing.md index ea29c15a..a46a0e2e 100644 --- a/contributing/developing.md +++ b/contributing/developing.md @@ -2,7 +2,8 @@ ## Pre-requisites -1. We are using the same version of Node that the current release of VSCode uses (currently 14.16.0). +1. We are using the same version of Node that the supported release of VSCode uses (see `engines.vscode` in the + extensions' `package.json`'s, currently 16.13.0). If you need to work with multiple versions of Node (e.g. for other projects), you might consider using [nvm](https://github.com/creationix/nvm). 1. It is suggested, though not required, that you use the Insiders version of VS @@ -11,6 +12,9 @@ .vscode/extensions.json. The first time you open VS Code on this workspace, it will ask you to install them. **Please do so since this includes the linters and formatters**. +1. Additionally, VS Code should prompt to set the Typescript version of the same as the project. If it does not, + open any `.ts` file, then open the command palette and select **Typescript: Select TypeScript Version...**, then + select **Use Workspace Version**. ## Structure @@ -92,7 +96,7 @@ subchapters. In general, when dealing with files in vscode, you should try to use [`vscode.workspace.fs`](https://code.visualstudio.com/api/references/vscode-api#workspace.fs) instead of -the regular node `fs` package.This is so your code can support any remote fileystems configured in VSCode. +the regular node `fs` package. This is so your code can support any remote fileystems configured in VSCode. Similarly, when dealing with file paths, you should try to use [`vscode.Uri`](https://code.visualstudio.com/api/references/vscode-api#Uri)'s, and only use `path.posix` when diff --git a/extensions/analyticsdx-vscode-core/package.json b/extensions/analyticsdx-vscode-core/package.json index e27e1d86..89eb11ba 100644 --- a/extensions/analyticsdx-vscode-core/package.json +++ b/extensions/analyticsdx-vscode-core/package.json @@ -20,7 +20,7 @@ }, "license": "BSD-3-Clause", "engines": { - "vscode": "^1.60.0" + "vscode": "^1.67.0" }, "categories": [ "Other" @@ -28,32 +28,32 @@ "dependencies": { "@salesforce/salesforcedx-utils-vscode": "file:../../lib/salesforcedx-utils-vscode.tgz", "@salesforce/templates": "54.7.0", - "glob": "7.2.0", - "semver": "7.3.5", + "glob": "8.0.3", + "semver": "7.3.7", "tmp": "0.2.1", "which": "2.0.2" }, "devDependencies": { "@salesforce/analyticsdx-test-utils-vscode": "0.8.2", - "@types/chai": "4.2.22", + "@types/chai": "4.3.1", "@types/glob": "7.2.0", - "@types/mocha": "9.0.0", - "@types/node": "14.17.27", + "@types/mocha": "9.1.1", + "@types/node": "16.11.36", "@types/semver": "7.3.9", - "@types/sinon": "10.0.5", + "@types/sinon": "10.0.11", "@types/tmp": "0.2.2", - "@types/vscode": "1.60.0", + "@types/vscode": "1.67.0", "@types/which": "1.3.2", - "chai": "4.3.4", + "chai": "4.3.6", "cross-env": "7.0.3", - "mocha": "9.1.3", + "mocha": "10.0.0", "mocha-junit-reporter": "2.0.2", "mocha-multi-reporters": "1.5.1", "mock-spawn": "0.2.6", "nyc": "15.1.0", - "shx": "0.3.3", - "sinon": "11.1.2", - "typescript": "4.4.3" + "shx": "0.3.4", + "sinon": "14.0.0", + "typescript": "4.6.3" }, "scripts": { "vscode:prepublish": "npm prune --production", diff --git a/extensions/analyticsdx-vscode-templates/package.json b/extensions/analyticsdx-vscode-templates/package.json index 6db9f3d6..38cf44d0 100644 --- a/extensions/analyticsdx-vscode-templates/package.json +++ b/extensions/analyticsdx-vscode-templates/package.json @@ -20,7 +20,7 @@ }, "license": "BSD-3-Clause", "engines": { - "vscode": "^1.60.0" + "vscode": "^1.67.0" }, "categories": [ "Other" @@ -30,30 +30,30 @@ "analyticsdx-template-lint": "0.8.2", "jsonc-parser": "3.0.0", "lodash.isequal": "4.5.0", - "request-light": "0.5.4", + "request-light": "0.5.8", "vscode-json-languageserver": "1.3.4", "vscode-languageclient": "7.0.0" }, "devDependencies": { "@salesforce/analyticsdx-test-utils-vscode": "0.8.2", - "@types/chai": "4.2.22", + "@types/chai": "4.3.1", "@types/lodash.isequal": "4.5.5", - "@types/mocha": "9.0.0", - "@types/node": "14.17.27", - "@types/sinon": "10.0.5", + "@types/mocha": "9.1.1", + "@types/node": "16.11.36", + "@types/sinon": "10.0.11", "@types/tmp": "0.2.2", - "@types/vscode": "1.60.0", - "chai": "4.3.4", + "@types/vscode": "1.67.0", + "chai": "4.3.6", "cross-env": "7.0.3", - "mocha": "9.1.3", + "mocha": "10.0.0", "mocha-junit-reporter": "2.0.2", "mocha-multi-reporters": "1.5.1", "nyc": "15.1.0", "readdirp": "3.6.0", - "shx": "0.3.3", - "sinon": "11.1.2", + "shx": "0.3.4", + "sinon": "14.0.0", "tmp": "0.2.1", - "typescript": "4.4.3" + "typescript": "4.6.3" }, "scripts": { "vscode:prepublish": "npm prune --production", diff --git a/extensions/analyticsdx-vscode-templates/src/util/logger.ts b/extensions/analyticsdx-vscode-templates/src/util/logger.ts index 31cdd052..c1bbca6f 100644 --- a/extensions/analyticsdx-vscode-templates/src/util/logger.ts +++ b/extensions/analyticsdx-vscode-templates/src/util/logger.ts @@ -33,6 +33,10 @@ export class PrefixingOutputChannel implements vscode.OutputChannel { this.output?.clear(); } + public replace(value: string): void { + this.output?.replace(value); + } + public show(preserveFocus?: boolean | undefined): void; public show(column?: vscode.ViewColumn | undefined, preserveFocus?: boolean | undefined): void; public show(column?: any, preserveFocus?: any) { diff --git a/extensions/analyticsdx-vscode-templates/test/vscode-integration/utils/completions.test.ts b/extensions/analyticsdx-vscode-templates/test/vscode-integration/utils/completions.test.ts index 4e309620..59ec19d8 100644 --- a/extensions/analyticsdx-vscode-templates/test/vscode-integration/utils/completions.test.ts +++ b/extensions/analyticsdx-vscode-templates/test/vscode-integration/utils/completions.test.ts @@ -16,6 +16,11 @@ import { } from '../../../src/util/completions'; import { closeAllEditors, findPositionByJsonPath, openTemplateInfo } from '../vscodeTestUtils'; +const INVOKE_COMPLETION_CONTEXT: vscode.CompletionContext = { + triggerKind: vscode.CompletionTriggerKind.Invoke, + triggerCharacter: undefined +}; + // tslint:disable:no-unused-expression describe('JsonCompletionItemProvider', () => { let cancellationTokenSource: vscode.CancellationTokenSource; @@ -44,9 +49,12 @@ describe('JsonCompletionItemProvider', () => { }) ); - const list = await provider.provideCompletionItems(doc, position!, cancellationTokenSource.token, { - triggerKind: vscode.CompletionTriggerKind.Invoke - }); + const list = await provider.provideCompletionItems( + doc, + position!, + cancellationTokenSource.token, + INVOKE_COMPLETION_CONTEXT + ); expect(list, 'items list').to.not.be.undefined.and.not.be.null; const items = list!.items; expect(items, 'items').to.not.be.undefined.and.not.be.null; @@ -73,9 +81,12 @@ describe('JsonCompletionItemProvider', () => { }) ); - const list = await provider.provideCompletionItems(doc, position!, cancellationTokenSource.token, { - triggerKind: vscode.CompletionTriggerKind.Invoke - }); + const list = await provider.provideCompletionItems( + doc, + position!, + cancellationTokenSource.token, + INVOKE_COMPLETION_CONTEXT + ); expect(list, 'items list').to.be.undefined; }); @@ -91,9 +102,12 @@ describe('JsonCompletionItemProvider', () => { }) ); - const list = await provider.provideCompletionItems(doc, position!, cancellationTokenSource.token, { - triggerKind: vscode.CompletionTriggerKind.Invoke - }); + const list = await provider.provideCompletionItems( + doc, + position!, + cancellationTokenSource.token, + INVOKE_COMPLETION_CONTEXT + ); expect(list, 'items list').to.not.be.undefined.and.not.be.null; const items = list!.items; expect(items, 'items').to.not.be.undefined.and.not.be.null; @@ -121,9 +135,12 @@ describe('JsonCompletionItemProvider', () => { const provider = new JsonCompletionItemProvider(delegate1, delegate2); const items = ( - await provider.provideCompletionItems(doc, new vscode.Position(0, 0), cancellationTokenSource.token, { - triggerKind: vscode.CompletionTriggerKind.Invoke - }) + await provider.provideCompletionItems( + doc, + new vscode.Position(0, 0), + cancellationTokenSource.token, + INVOKE_COMPLETION_CONTEXT + ) )?.items; expect(items, 'items').to.not.be.undefined; if (items!.length !== 1) { @@ -153,9 +170,12 @@ describe('JsonCompletionItemProvider', () => { const provider = new JsonCompletionItemProvider(delegate1, delegate2); const items = ( - await provider.provideCompletionItems(doc, new vscode.Position(0, 0), cancellationTokenSource.token, { - triggerKind: vscode.CompletionTriggerKind.Invoke - }) + await provider.provideCompletionItems( + doc, + new vscode.Position(0, 0), + cancellationTokenSource.token, + INVOKE_COMPLETION_CONTEXT + ) )?.items; expect(items, 'items').to.not.be.undefined; if (items!.length !== 1) { diff --git a/extensions/analyticsdx-vscode/README.md b/extensions/analyticsdx-vscode/README.md index 118d6ddd..b766b1cf 100644 --- a/extensions/analyticsdx-vscode/README.md +++ b/extensions/analyticsdx-vscode/README.md @@ -18,7 +18,7 @@ Before you set up Salesforce Analytics Extensions for VS Code, make sure that yo Before you use Salesforce Extensions for VS Code, [set up Salesforce CLI](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup). - **Analytics Plugin for Salesforce CLI** Be sure to [install the Analytics Plugin for the Salesforce CLI](https://help.salesforce.com/articleView?id=bi_cli_analytics_plugin_install.htm&type=5). -- **[Visual Studio Code](https://code.visualstudio.com/download) v1.60 or later** +- **[Visual Studio Code](https://code.visualstudio.com/download) v1.67 or later** - **Salesforce Extension Pack** Install the [Salesforce Extension Pack](https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode) from the VS Code Extensions Marketplace. - **A Salesforce DX project** diff --git a/extensions/analyticsdx-vscode/package.json b/extensions/analyticsdx-vscode/package.json index bfdc64f4..6de34baf 100644 --- a/extensions/analyticsdx-vscode/package.json +++ b/extensions/analyticsdx-vscode/package.json @@ -19,10 +19,10 @@ }, "license": "BSD-3-Clause", "engines": { - "vscode": "^1.60.0" + "vscode": "^1.67.0" }, "devDependencies": { - "shx": "0.3.3" + "shx": "0.3.4" }, "scripts": { "clean": "shx rm -f analyticsdx-vscode-*.vsix", diff --git a/package.json b/package.json index afffb96a..4beb52b8 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,36 @@ { + "name": "analyticsdx-vscode", + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "git+https://github.com/forcedotcom/analyticsdx-vscode.git" + }, + "engines": { + "node": ">=16.13.0" + }, + "dependencies": { + "node": "^16.13.0", + "npm": "^6" + }, "devDependencies": { "@salesforce/dev-config": "1.5.0", "@types/lerna-alias": "3.0.0", "@types/mkdirp": "1.0.2", "@types/shelljs": "0.8.11", - "@vscode/test-electron": "1.6.2", + "@vscode/test-electron": "2.1.3", "eslint": "6.7.2", "eslint-config-prettier": "2.9.0", "lerna": "4.0.0", "lerna-alias": "3.0.2", "mkdirp": "1.0.4", "nlf": "2.1.1", - "prettier": "2.4.1", + "prettier": "2.6.2", "shelljs": "0.8.5", - "shx": "0.3.3", + "shx": "0.3.4", "tslint": "6.1.3", "tslint-no-focused-test": "0.5.0", - "typescript": "4.4.3", - "vsce": "1.100.1" + "typescript": "4.6.3", + "vsce": "1.103.1" }, "scripts": { "postinstall": "lerna bootstrap --no-ci -- --no-package-lock && node scripts/reformat-with-prettier", @@ -42,10 +55,5 @@ "build-all-vsixs": "node scripts/build-all-vsixs.js", "update-sha256": "node scripts/update-sha256.js", "publish-all-vsixs": "node scripts/publish-all-vsixs.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/forcedotcom/analyticsdx-vscode.git" - }, - "license": "BSD-3-Clause" + } } diff --git a/packages/analyticsdx-template-lint/package.json b/packages/analyticsdx-template-lint/package.json index 7c4b9de2..6b82ad51 100644 --- a/packages/analyticsdx-template-lint/package.json +++ b/packages/analyticsdx-template-lint/package.json @@ -10,18 +10,18 @@ "jsonc-parser": "3.0.0" }, "devDependencies": { - "@types/chai": "4.2.22", - "@types/mocha": "9.0.0", - "@types/node": "14.17.27", + "@types/chai": "4.3.1", + "@types/mocha": "9.1.1", + "@types/node": "16.11.36", "ajv": "8.6.3", - "better-ajv-errors": "0.7.0", - "chai": "4.3.4", - "mocha": "9.1.3", + "better-ajv-errors": "1.2.0", + "chai": "4.3.6", + "mocha": "10.0.0", "mocha-junit-reporter": "2.0.2", "mocha-multi-reporters": "1.5.1", "nyc": "15.1.0", - "shx": "0.3.3", - "typescript": "4.4.3" + "shx": "0.3.4", + "typescript": "4.6.3" }, "optionalDependencies": { "vscode-json-languageservice": "^4.1.8" diff --git a/packages/analyticsdx-template-lint/test/testutils.ts b/packages/analyticsdx-template-lint/test/testutils.ts index aebd183c..9b83ed4b 100644 --- a/packages/analyticsdx-template-lint/test/testutils.ts +++ b/packages/analyticsdx-template-lint/test/testutils.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import Ajv, { ErrorObject as AjvErrorObject, Options as AjvOptions } from 'ajv'; -import betterAjvErrors = require('better-ajv-errors'); +import betterAjvErrors from 'better-ajv-errors'; import { expect } from 'chai'; import * as fs from 'fs'; import { parse, ParseError, printParseErrorCode } from 'jsonc-parser'; @@ -128,7 +128,7 @@ export function generateJsonSchemaValidFilesTestSuite( const json = await readFile(entry.fullPath, { encoding: 'utf-8' }).then(jsoncParse); const result = validator(json); if (!result || (validator.errors && validator.errors.length > 0)) { - const errorsText = betterAjvErrors(schema, json, validator.errors, { indent: 2 }); + const errorsText = betterAjvErrors(schema, json, validator.errors || [], { indent: 2 }); expect.fail('schema validation failed with errors:\n' + errorsText); } }); diff --git a/packages/analyticsdx-test-utils-vscode/package.json b/packages/analyticsdx-test-utils-vscode/package.json index 58326b56..2a7f607a 100644 --- a/packages/analyticsdx-test-utils-vscode/package.json +++ b/packages/analyticsdx-test-utils-vscode/package.json @@ -6,26 +6,26 @@ "description": "Provides test utilities to run mocha tests", "license": "BSD-3-Clause", "devDependencies": { - "@types/chai": "4.2.22", + "@types/chai": "4.3.1", "@types/glob": "7.2.0", - "@types/mocha": "9.0.0", - "@types/node": "14.17.27", - "chai": "4.3.4", + "@types/mocha": "9.1.1", + "@types/node": "16.11.36", + "chai": "4.3.6", "decache": "4.6.0", - "glob": "7.2.0", + "glob": "8.0.3", "istanbul-lib-coverage": "3.0.2", "istanbul-lib-hook": "3.0.0", "istanbul-lib-instrument": "5.0.3", "istanbul-lib-report": "3.0.0", "istanbul-lib-source-maps": "4.0.1", "istanbul-reports": "3.0.5", - "mocha": "9.1.3", + "mocha": "10.0.0", "mocha-junit-reporter": "2.0.2", "mocha-multi-reporters": "1.5.1", "mock-spawn": "0.2.6", - "shx": "0.3.3", + "shx": "0.3.4", "source-map-support": "0.5.20", - "typescript": "4.4.3" + "typescript": "4.6.3" }, "scripts": { "compile": "tsc -p ./", diff --git a/scripts/run-vscode-integration-tests.js b/scripts/run-vscode-integration-tests.js index 0fc8b3d9..162b24a7 100755 --- a/scripts/run-vscode-integration-tests.js +++ b/scripts/run-vscode-integration-tests.js @@ -12,7 +12,8 @@ const cwd = process.cwd(); const { runTests } = require('@vscode/test-electron'); const { downloadDirToExecutablePath, - insidersDownloadDirToExecutablePath + insidersDownloadDirToExecutablePath, + systemDefaultPlatform } = require('@vscode/test-electron/out/util.js'); // Run vscode tests under your out/test/vscode-integration folder. @@ -22,8 +23,8 @@ const { const isInsiders = process.env.CODE_VERSION === 'insiders'; const installDir = path.join(cwd, '.vscode-test', isInsiders ? 'insiders' : 'stable'); const execPath = isInsiders - ? insidersDownloadDirToExecutablePath(installDir) - : downloadDirToExecutablePath(installDir); + ? insidersDownloadDirToExecutablePath(installDir, systemDefaultPlatform) + : downloadDirToExecutablePath(installDir, systemDefaultPlatform); const opts = { vscodeExecutablePath: execPath,