Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
14 changes: 8 additions & 6 deletions .depcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ ignores:
- "vscode"
- "webpack-cli"
- "@mongodb-js/oidc-plugin"
- node-loader
- ts-loader
- mongodb-runner
- tabbable # Mocha register testing workaround stub.
- focus-trap # Mocha register testing workaround stub.
- ejson-shell-parser # Used by the connection-form.
- "node-loader"
- "ts-loader"
- "mongodb-runner"
- "tabbable" # Mocha register testing workaround stub.
- "focus-trap" # Mocha register testing workaround stub.
- "ejson-shell-parser" # Used by the connection-form.
- "rimraf" # Used in 'clean' script to remove previous build artifacts
- "snyk" # Used in 'snyk-test' script to create sbom
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ module.exports = {
allowHigherOrderFunctions: true,
},
],
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
},
],
},
parserOptions: {
project: ['./tsconfig.json'], // Specify it only for TypeScript files.
Expand Down
78 changes: 43 additions & 35 deletions .github/workflows/actions/test-and-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ runs:
- name: Install Dependencies
shell: bash
run: |
npm ci --omit=optional
pnpm install --frozen-lockfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does pnpm by default omit optional? I faintly recall there were some transitive optional dependencies that were problematic for the install here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we omit the optional dependencies when installing, we're getting build errors: https://github.com/mongodb-js/vscode/actions/runs/19892320307/job/57013930209?pr=1191 - i.e. the atlas-local optional dependencies are missing when we try to webpack.

Copy link
Contributor

@himanshusinghs himanshusinghs Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting - then I'd be worried about snyk output as well. We might need to double check if snyk is even evaluating the correct packages or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checked it locally and it works as expected.


- name: Run Checks
run: npm run check
run: pnpm run check
# the glob here just fails
if: ${{ runner.os != 'Windows' }}
shell: bash
Expand All @@ -70,19 +70,19 @@ runs:
NODE_OPTIONS: "--max_old_space_size=4096"
MDB_IS_TEST: "true"
run: |
npm run test
pnpm run test
shell: bash

- name: Build .vsix
env:
NODE_OPTIONS: "--require ./scripts/no-npm-list-fail.js --max_old_space_size=4096"
# NOTE: --githubBranch is "The GitHub branch used to infer relative links in README.md."
run: |
npx vsce package --githubBranch main
pnpm exec vsce package --githubBranch main
shell: bash

- name: Check .vsix filesize
run: npm run check-vsix-size
run: pnpm run check-vsix-size
shell: bash

- name: Sign .vsix
Expand Down Expand Up @@ -117,33 +117,41 @@ runs:
env:
SNYK_TOKEN: ${{ inputs.SNYK_TOKEN }}
run: |
npm run snyk-test > /dev/null 2>&1

# TODO(VSCODE-706): Fix Snyk vuln ticket generation
# - name: Create Jira Tickets
# if: >
# runner.os == 'Linux' &&
# (
# github.event_name == 'push' && github.ref == 'refs/heads/main' ||
# github.event_name == 'workflow_dispatch' ||
# github.event_name == 'schedule'
# )
# shell: bash
# env:
# JIRA_API_TOKEN: ${{ inputs.JIRA_API_TOKEN }}
# JIRA_BASE_URL: "https://jira.mongodb.org"
# JIRA_PROJECT: "VSCODE"
# JIRA_VULNERABILITY_BUILD_INFO: "- [GitHub Run|https://github.com/mongodb-js/vscode/actions/runs/${{github.run_id}}/jobs/${{github.job}}]"
# run: |
# npm run create-vulnerability-tickets > /dev/null

# - name: Generate Vulnerability Report (Fail on >= High)
# if: runner.os == 'Linux'
# continue-on-error: ${{ github.event_name == 'pull_request' }}
# shell: bash
# run: |
# # The standard output is suppressed since Github Actions logs are
# # available for everyone with read access to the repo, which is everyone that is
# # logged in for public repos.
# # This command is only here to fail on failures for `main` and tags.
# npm run generate-vulnerability-report > /dev/null
pnpm run snyk-test > /dev/null 2>&1

- name: Upload Snyk Report
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Snyk Report - ${{ github.run_id }}
path: |
.sbom/snyk-test-result.html
.sbom/snyk-test-result.json

- name: Create Jira Tickets
if: >
runner.os == 'Linux' &&
(
github.event_name == 'push' && github.ref == 'refs/heads/main' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'schedule'
)
shell: bash
env:
JIRA_API_TOKEN: ${{ inputs.JIRA_API_TOKEN }}
JIRA_BASE_URL: "https://jira.mongodb.org"
JIRA_PROJECT: "VSCODE"
JIRA_VULNERABILITY_BUILD_INFO: "- [GitHub Run|https://github.com/mongodb-js/vscode/actions/runs/${{github.run_id}}/jobs/${{github.job}}]"
run: |
npm run create-vulnerability-tickets > /dev/null

- name: Generate Vulnerability Report (Fail on >= High)
if: runner.os == 'Linux'
continue-on-error: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
# The standard output is suppressed since Github Actions logs are
# available for everyone with read access to the repo, which is everyone that is
# logged in for public repos.
# This command is only here to fail on failures for `main` and tags.
npm run generate-vulnerability-report > /dev/null
26 changes: 14 additions & 12 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
workflow_dispatch:
inputs:
versionBump:
description: 'Version bump'
description: Version bump
type: choice
required: true
default: 'patch'
default: patch
options:
- patch
- minor
- major
- exact-version
- patch
- minor
- major
- exact-version

exactVersion:
description: 'Exact version: (Only effective selecting "exact-version" as version bump)'
Expand All @@ -37,11 +37,14 @@ jobs:
# and check if tags are already present
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: 22.15.1
cache: npm
cache: pnpm

- name: Determine Next Version
shell: bash
Expand All @@ -54,9 +57,9 @@ jobs:

if [[ "$VERSION_BUMP" == "major" || "$VERSION_BUMP" == "minor" || "$VERSION_BUMP" == "patch" ]]; then
PREV_VERSION_TAG=$(gh api repos/:owner/:repo/releases --jq '. | map(select(.draft == false)) | .[0] | .tag_name')
PREV_VERSION=$(npx semver --coerce ${PREV_VERSION_TAG})
PREV_VERSION=$(pnpm exec semver --coerce ${PREV_VERSION_TAG})

NEXT_VERSION=$(npx semver -i $VERSION_BUMP $PREV_VERSION)
NEXT_VERSION=$(pnpm exec semver -i $VERSION_BUMP $PREV_VERSION)
else
NEXT_VERSION=${{ github.event.inputs.exactVersion }}
fi
Expand All @@ -65,9 +68,9 @@ jobs:
NEXT_VERSION="${NEXT_VERSION#v}"

# Validates the version before using it
npx semver v"${NEXT_VERSION}"
pnpm exec semver v"${NEXT_VERSION}"

npm version "${NEXT_VERSION}" --no-git-tag-version
pnpm version "${NEXT_VERSION}" --no-git-tag-version
echo "RELEASE_TAG=v${NEXT_VERSION}" >> "$GITHUB_ENV"

- name: Validate release tag
Expand Down Expand Up @@ -115,4 +118,3 @@ jobs:
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

8 changes: 6 additions & 2 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ jobs:
name: Publish Release
runs-on: ubuntu-latest
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: 22.15.1
cache: pnpm

- name: Run node-gyp bug workaround script
run: |
curl -sSfLO https://raw.githubusercontent.com/mongodb-js/compass/42e6142ae08be6fec944b80ff6289e6bcd11badf/.evergreen/node-gyp-bug-workaround.sh && bash node-gyp-bug-workaround.sh

- name: Install VSCode publishing dependencies
run: npm install -g vsce
run: pnpm add -g vsce

- name: Download release assets
run: |
Expand All @@ -43,6 +47,6 @@ jobs:
- name: Publish to marketplace
run: |
echo "Publishing ${VSIX_PATH} to marketplace"
npx vsce publish --packagePath "${VSIX_PATH}" --githubBranch main
pnpm exec vsce publish --packagePath "${VSIX_PATH}" --githubBranch main
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
13 changes: 8 additions & 5 deletions .github/workflows/test-and-build-from-fork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: 22.15.1
cache: npm
cache: pnpm

- name: Install Dependencies
run: npm ci --omit=optional
run: pnpm install --frozen-lockfile

- name: Run Checks
run: npm run check
run: pnpm run check
# the glob here just fails
if: ${{ runner.os != 'Windows' }}

- name: Run Tests
env:
NODE_OPTIONS: "--max_old_space_size=4096"
SEGMENT_KEY: "test-segment-key"
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY_DEV }}
MDB_IS_TEST: "true"
run: npm run test
run: pnpm run test
5 changes: 4 additions & 1 deletion .github/workflows/test-and-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ jobs:
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: 22.15.1
cache: npm
cache: pnpm

- name: Run tests and build
uses: ./.github/workflows/actions/test-and-build
Expand Down
7 changes: 7 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Hoist peer dependencies to reduce nested installations
# This makes pnpm behave more like npm/yarn in terms of hoisting
public-hoist-pattern[]=*@cfworker/json-schema*
public-hoist-pattern[]=*mongodb-client-encryption*
public-hoist-pattern[]=*socks*


1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ CHANGELOG.md
README.md
constants.json
.sbom
pnpm-lock.yaml
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MongoDB welcomes community contributions! If you’re interested in making a con
1. Create a branch with a name that briefly describes your feature
1. Implement your feature or bug fix
1. Add new cases to `./src/test` that verify your bug fix or make sure no one
unintentionally breaks your feature in the future and run them with `npm test`
unintentionally breaks your feature in the future and run them with `pnpm test`
1. Add comments around your new code that explain what's happening
1. Commit and push your changes to your branch then submit a pull request

Expand All @@ -24,13 +24,13 @@ Please include as much information as possible about your environment.
We recommend familiarizing yourself with the VSCode extension documentation:
[code.visualstudio.com/api](https://code.visualstudio.com/api).

Running the MongoDB VSCode plugin requires [Node.js](https://nodejs.org) and npm.
Running the MongoDB VSCode plugin requires [Node.js](https://nodejs.org) and pnpm.

1. Clone this project, navigate to the folder, then run:

```shell
npm install
npm run watch
pnpm install
pnpm run watch
```

2. Inside of [VS Code Insiders](https://code.visualstudio.com/insiders/) open this directory and press `F5` to begin debugging the extension. This should launch a new VSCode window which is running the extension.
Expand All @@ -46,14 +46,14 @@ You can launch a debugging task for tests inside VSCode with the **"Run Tests"**
You can run tests using command line along with an optional `MOCHA_GREP` environment variable to apply a grep filter on tests to run.

```shell
MOCHA_GREP="Participant .* prompt builders" npm test
MOCHA_GREP="Participant .* prompt builders" pnpm test
```

It may be quicker to be more specific and use `npm run test-extension` or `npm run test-webview` after compiling.
It may be quicker to be more specific and use `pnpm run test-extension` or `pnpm run test-webview` after compiling.

### Using Proposed API

The vscode extension will occasionally need to use [proposed API](https://code.visualstudio.com/api/advanced-topics/using-proposed-api) that haven't been promoted to stable yet. To enable an API proposal, add it to the `enabledApiProposals` section in `package.json`, then run `cd src/vscode-dts && npx @vscode/dts dev` to install the type definitions for the API you want to enable.
The vscode extension will occasionally need to use [proposed API](https://code.visualstudio.com/api/advanced-topics/using-proposed-api) that haven't been promoted to stable yet. To enable an API proposal, add it to the `enabledApiProposals` section in `package.json`, then run `cd src/vscode-dts && pnpm exec @vscode/dts dev` to install the type definitions for the API you want to enable.

**Note**: Using proposed API is only possible during local development and will prevent publishing the extension.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,16 @@ Is there anything else you’d like to see in MongoDB for VS Code? Let us know b
You can clone this [repository](https://github.com/mongodb-js/vscode) and install the extension in your VS Code with:

```shell
npm install
npm run local-install
pnpm install
pnpm run local-install
```

This will compile and package MongoDB for VS Code into a `.vsix` file and add the extension to your VS Code.

To install this locally on Windows:

```shell
npm install
pnpm install
.\node_modules\.bin\vsce.cmd package
code --install-extension ./mongodb-vscode-*.vsix
```
Expand Down
Loading
Loading