Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion .github/workflows/test-and-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ jobs:
with:
fetch-depth: 0

- name: Get Node.js version from VS Code
id: get-node-version
shell: bash
run: |
NODE_VERSION=$(curl -fsSL https://raw.githubusercontent.com/microsoft/vscode/refs/heads/main/.nvmrc | tr -d '[:space:]')
echo "node-version=$NODE_VERSION" >> $GITHUB_OUTPUT
echo "Using Node.js version: $NODE_VERSION"
- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: 22.15.1
node-version: ${{ steps.get-node-version.outputs.node-version }}
cache: npm

- name: Run tests and build
Expand Down
82 changes: 45 additions & 37 deletions package-lock.json

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

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"scripts": {
"clean": "rimraf ./out/* ./dist/* ",
"lint": "eslint . && prettier --check .",
"update-grammar": "ts-node ./scripts/update-grammar.ts",
"update-grammar": "node ./scripts/update-grammar.ts",
"precompile": "npm run clean",
"compile": "npm-run-all compile:*",
"compile:constants": "ts-node ./scripts/generate-constants.ts",
"compile:constants": "node ./scripts/generate-constants.ts",
"compile:resources": "npm run update-grammar",
"compile:extension": "tsc -p ./",
"compile:extension-bundles": "webpack --mode development",
Expand All @@ -53,25 +53,25 @@
"pretest": "npm run compile",
"test": "npm run test-webview && npm run test-extension",
"test-extension": "cross-env NODE_OPTIONS=--no-force-async-hooks-checks xvfb-maybe node ./out/test/runTest.js",
"test-webview": "mocha -r ts-node/register --grep=\"${MOCHA_GREP}\" --file ./src/test/setup-webview.ts src/test/suite/views/webview-app/**/*.test.tsx",
"ai-accuracy-tests": "env TS_NODE_FILES=true mocha -r ts-node/register --grep=\"${MOCHA_GREP}\" --file ./src/test/ai-accuracy-tests/test-setup.ts ./src/test/ai-accuracy-tests/ai-accuracy-tests.ts",
"test-webview": "cross-env NODE_OPTIONS='--no-experimental-strip-types' mocha -r ts-node/register --grep=\"${MOCHA_GREP}\" --file ./src/test/setup-webview.ts src/test/suite/views/webview-app/**/*.test.tsx",
"ai-accuracy-tests": "cross-env NODE_OPTIONS='--no-experimental-strip-types' mocha -r ts-node/register --grep=\"${MOCHA_GREP}\" --file ./src/test/ai-accuracy-tests/test-setup.ts ./src/test/ai-accuracy-tests/ai-accuracy-tests.ts",
"analyze-bundle": "webpack --mode production --analyze",
"vscode:prepublish": "npm run clean && npm run compile:constants && npm run compile:resources && webpack --mode production",
"check": "npm run lint && npm run depcheck",
"depcheck": "depcheck",
"package": "cross-env NODE_OPTIONS='--require ./scripts/no-npm-list-fail.js' vsce package --githubBranch main",
"local-install": "npm run package && code --install-extension ./mongodb-vscode-*.vsix",
"check-vsix-size": "ts-node ./scripts/check-vsix-size.ts",
"check-vsix-size": "node ./scripts/check-vsix-size.ts",
"release-draft": "node ./scripts/release-draft.js",
"reformat": "prettier --write .",
"presnyk-test": "echo \"Creating backup for package-lock.json.\"; cp package-lock.json original-package-lock.json",
"snyk-test": "node scripts/snyk-test.js",
"postsnyk-test": "echo \"Restoring original package-lock.json.\"; mv original-package-lock.json package-lock.json",
"generate-icon-font": "ts-node ./scripts/generate-icon-font.ts",
"generate-icon-font": "node ./scripts/generate-icon-font.ts",
"generate-vulnerability-report": "mongodb-sbom-tools generate-vulnerability-report --snyk-reports=.sbom/snyk-test-result.json --dependencies=.sbom/dependencies.json --fail-on=high",
"create-vulnerability-tickets": "mongodb-sbom-tools generate-vulnerability-report --snyk-reports=.sbom/snyk-test-result.json --dependencies=.sbom/dependencies.json --create-jira-issues",
"prepare": "husky",
"precommit": "ts-node ./scripts/precommit.ts"
"precommit": "node ./scripts/precommit.ts"
},
"engines": {
"vscode": "^1.101.1",
Expand Down Expand Up @@ -1407,7 +1407,7 @@
"@mongodb-js/connection-form": "^1.52.3",
"@mongodb-js/connection-info": "^0.21.0",
"@mongodb-js/device-id": "^0.3.2",
"@mongodb-js/mongodb-constants": "^0.16.0",
"@mongodb-js/mongodb-constants": "^0.16.1",
"@mongosh/browser-runtime-electron": "^3.24.0",
"@mongosh/i18n": "^2.16.0",
"@mongosh/service-provider-node-driver": "^3.17.1",
Expand Down Expand Up @@ -1446,7 +1446,7 @@
"@mongodb-js/oidc-mock-provider": "^0.11.5",
"@mongodb-js/oidc-plugin": "^2.0.5",
"@mongodb-js/prettier-config-devtools": "^1.0.2",
"@mongodb-js/sbom-tools": "^0.8.1",
"@mongodb-js/sbom-tools": "^0.8.5",
"@mongodb-js/signing-utils": "^0.4.4",
"@mongosh/service-provider-core": "^3.6.0",
"@testing-library/react": "^14.3.1",
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-vsix-size.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import fs from 'fs';
import path from 'path';

const __dirname = path.dirname(new URL(import.meta.url).pathname);

const version = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '..', 'package.json')).toString(),
).version;
Expand Down
7 changes: 5 additions & 2 deletions scripts/generate-constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env ts-node
#! /usr/bin/env node

import ora from 'ora';
import fs from 'fs';
Expand All @@ -8,15 +8,18 @@ import { config } from 'dotenv';
import { promisify } from 'util';

const writeFile = promisify(fs.writeFile);
const __dirname = path.dirname(new URL(import.meta.url).pathname);
const ROOT_DIR = path.join(__dirname, '..');
const ui = ora('Generate constants file').start();

config({ path: resolve(__dirname, '../.env') });

const segmentKey = process.env.SEGMENT_KEY || 'test-segment-key';

(async () => {
await writeFile(
`${ROOT_DIR}/constants.json`,
JSON.stringify({ segmentKey: process.env.SEGMENT_KEY }, null, 2),
JSON.stringify({ segmentKey }, null, 2),
);
ui.succeed('The constants file has been generated');
})().catch((error) => {
Expand Down
8 changes: 4 additions & 4 deletions scripts/generate-icon-font.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import webfont from 'webfont';
import { webfont } from 'webfont';
import fs from 'fs/promises';
import { GlyphData } from 'webfont/dist/src/types';
import prettier from 'prettier';
import path from 'path';

/** Icons to include in the generated icon font */
const INCLUDED_ICONS = [
Expand Down Expand Up @@ -61,14 +61,14 @@ async function main(): Promise<void> {
const prettierConfig = await prettier.resolveConfig('./.prettierrc.json');
await fs.writeFile(
'./package.json',
prettier.format(JSON.stringify(currentConfiguration), {
await prettier.format(JSON.stringify(currentConfiguration), {
...prettierConfig,
parser: 'json-stringify',
}),
);
}

function getUnicodeHex(glyph: GlyphData): string {
function getUnicodeHex(glyph: any): string {
if (glyph.metadata?.unicode == undefined) {
throw new Error('No unicode defined');
}
Expand Down
8 changes: 6 additions & 2 deletions scripts/precommit.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#! /usr/bin/env ts-node
#! /usr/bin/env node
/* eslint-disable no-console */

import path from 'path';
import { promisify } from 'util';
import { execFile } from 'child_process';
import prettier from '@mongodb-js/prettier-config-devtools/.prettierrc.json' with { type: 'json' };
const execFileAsync = promisify(execFile);

import { createRequire } from 'module';
const require = createRequire(import.meta.url);

async function main(fileList: string[]) {
if (fileList.length === 0) {
console.log('No files to re-format. Skipping ...');
Expand All @@ -20,7 +24,7 @@ async function main(fileList: string[]) {
await execFileAsync('npx', [
'prettier',
'--config',
require.resolve('@mongodb-js/prettier-config-devtools/.prettierrc.json'),
require.resolve(prettier),
// Silently ignore files that are of format that is not supported by prettier.
'--ignore-unknown',
'--write',
Expand Down
2 changes: 2 additions & 0 deletions scripts/update-grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
STAGE_OPERATORS,
} from '@mongodb-js/mongodb-constants';

const __dirname = path.dirname(new URL(import.meta.url).pathname);

const writeFile = promisify(fs.writeFile);
const SYNTAXES_DIR = path.join(__dirname, '..', 'syntaxes');

Expand Down
Loading
Loading