diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 5721174e95..31dd6dad84 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -626,7 +626,7 @@ extends: displayName: "Set version suffix" - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 displayName: "Get Kiota's version-number from .csproj" - - pwsh: $(Build.SourcesDirectory)/scripts/update-vscode-releases.ps1 -version $(artifactVersion)$(versionSuffix) -packageJsonFilePath $(Build.SourcesDirectory)/vscode/packages/microsoft-kiota/package.json -runtimeFilePath $(Build.SourcesDirectory)/vscode/packages/npm-package/runtime.json -binaryFolderPath $(Build.ArtifactStagingDirectory)/Binaries + - pwsh: $(Build.SourcesDirectory)/scripts/update-vscode-releases.ps1 -version $(artifactVersion)$(versionSuffix) -packageJsonFilePath $(Build.SourcesDirectory)/vscode/packages/microsoft-kiota/package.json -runtimeFilePath $(Build.SourcesDirectory)/vscode/packages/npm-package/lib/runtime.json -binaryFolderPath $(Build.ArtifactStagingDirectory)/Binaries displayName: "Update VSCode extension version-number" - script: npm i -g @vscode/vsce rimraf displayName: "Install Global dependencies" @@ -745,7 +745,7 @@ extends: displayName: "Set version suffix" - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 displayName: "Get Kiota's version-number from .csproj" - - pwsh: $(Build.SourcesDirectory)/scripts/update-vscode-releases.ps1 -version $(artifactVersion)$(versionSuffix) -packageJsonFilePath $(Build.SourcesDirectory)/vscode/packages/microsoft-kiota/package.json -runtimeFilePath $(Build.SourcesDirectory)/vscode/packages/npm-package/runtime.json -binaryFolderPath $(Build.ArtifactStagingDirectory)/Binaries + - pwsh: $(Build.SourcesDirectory)/scripts/update-vscode-releases.ps1 -version $(artifactVersion)$(versionSuffix) -packageJsonFilePath $(Build.SourcesDirectory)/vscode/packages/microsoft-kiota/package.json -runtimeFilePath $(Build.SourcesDirectory)/vscode/packages/npm-package/lib/runtime.json -binaryFolderPath $(Build.ArtifactStagingDirectory)/Binaries displayName: "Update NPM package version-number" - script: | npm i -g rimraf diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 4671affc2a..f0ae20f27a 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -60,7 +60,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: scripts/update-vscode-releases.ps1 -version "v${{ steps.last_release.outputs.RELEASE_VERSION }}" -packageJsonFilePath "./vscode/packages/microsoft-kiota/package.json" -runtimeFilePath "./vscode/packages/npm-package/runtime.json" -online + - run: scripts/update-vscode-releases.ps1 -version "v${{ steps.last_release.outputs.RELEASE_VERSION }}" -packageJsonFilePath "./vscode/packages/microsoft-kiota/package.json" -runtimeFilePath "./vscode/packages/npm-package/lib/runtime.json" -online shell: pwsh - name: Install dependencies @@ -142,7 +142,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: scripts/update-vscode-releases.ps1 -version "${{ steps.last_release.outputs.RELEASE_VERSION }}" -packageJsonFilePath "./vscode/packages/microsoft-kiota/package.json" -runtimeFilePath "./vscode/packages/npm-package/runtime.json" -online + - run: scripts/update-vscode-releases.ps1 -version "${{ steps.last_release.outputs.RELEASE_VERSION }}" -packageJsonFilePath "./vscode/packages/microsoft-kiota/package.json" -runtimeFilePath "./vscode/packages/npm-package/lib/runtime.json" -online shell: pwsh - name: Install dependencies diff --git a/vscode/package-lock.json b/vscode/package-lock.json index 87beb69adb..d28fb5d15d 100644 --- a/vscode/package-lock.json +++ b/vscode/package-lock.json @@ -93,6 +93,7 @@ "integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", @@ -2918,6 +2919,7 @@ "integrity": "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", @@ -4009,6 +4011,7 @@ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -4364,6 +4367,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -4888,6 +4892,7 @@ "integrity": "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -9286,6 +9291,7 @@ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -9916,6 +9922,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -10055,7 +10062,8 @@ "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "peer": true }, "node_modules/type-check": { "version": "0.4.0", @@ -10113,6 +10121,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -10251,15 +10260,6 @@ "node": ">=10.12.0" } }, - "node_modules/vscode-jsonrpc": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", - "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -10290,6 +10290,7 @@ "integrity": "sha512-jTywjboN9aHxFlToqb0K0Zs9SbBoW4zRUlGzI2tYNxVYcEi/IPpn+Xi4ye5jTLvX2YeLuic/IvxNot+Q1jMoOw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -10790,7 +10791,7 @@ }, "packages/npm-package": { "name": "@microsoft/kiota", - "version": "1.25.1", + "version": "1.30.0", "license": "MIT", "dependencies": { "adm-zip": "^0.5.16", @@ -10805,7 +10806,19 @@ "jest": "^30.2.0", "rimraf": "^6.1.3", "ts-jest": "^29.4.6", - "ts-loader": "^9.5.4" + "ts-loader": "^9.5.4", + "typescript": "^5.9.3", + "webpack": "^5.105.4", + "webpack-cli": "^6.0.1" + } + }, + "packages/npm-package/node_modules/vscode-jsonrpc": { + "version": "9.0.0-next.11", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-9.0.0-next.11.tgz", + "integrity": "sha512-u6LElQNbSiE9OugEEmrUKwH6+8BpPz2S5MDHvQUqHL//I4Q8GPikKLOUf856UnbLkZdhxaPrExac1lA3XwpIPA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" } } } diff --git a/vscode/packages/npm-package/index.ts b/vscode/packages/npm-package/index.ts deleted file mode 100644 index 5f3c228955..0000000000 --- a/vscode/packages/npm-package/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -export * from './config'; -export * from './lib/generateClient'; -export * from './lib/generatePlugin'; -export * from './lib/getKiotaTree'; -export * from './lib/getKiotaVersion'; -export * from './lib/getManifestDetails'; -export * from './lib/languageInformation'; -export * from './lib/migrateFromLockFile'; -export * from './lib/removeItem'; -export * from './lib/searchDescription'; -export * from './lib/updateClients'; -export * from './types'; -export * from './utils'; diff --git a/vscode/packages/npm-package/config.ts b/vscode/packages/npm-package/lib/config.ts similarity index 100% rename from vscode/packages/npm-package/config.ts rename to vscode/packages/npm-package/lib/config.ts diff --git a/vscode/packages/npm-package/connect.ts b/vscode/packages/npm-package/lib/connect.ts similarity index 94% rename from vscode/packages/npm-package/connect.ts rename to vscode/packages/npm-package/lib/connect.ts index c36fc72b22..4625fa9c74 100644 --- a/vscode/packages/npm-package/connect.ts +++ b/vscode/packages/npm-package/lib/connect.ts @@ -1,6 +1,6 @@ import * as cp from 'child_process'; import * as rpc from 'vscode-jsonrpc/node'; -import { ensureKiotaIsPresent, getKiotaPath } from './install'; +import { ensureKiotaIsPresent, getKiotaPath } from './install.js'; export default async function connectToKiota(callback: (connection: rpc.MessageConnection) => Promise, workingDirectory: string = process.cwd()): Promise { diff --git a/vscode/packages/npm-package/lib/generateClient.ts b/vscode/packages/npm-package/lib/generateClient.ts index f4f68c4f79..919888d19a 100644 --- a/vscode/packages/npm-package/lib/generateClient.ts +++ b/vscode/packages/npm-package/lib/generateClient.ts @@ -1,8 +1,8 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { checkForSuccess } from "../utils"; -import { ConsumerOperation, GenerationConfiguration, KiotaGenerationLanguage, KiotaLogEntry, KiotaResult } from "../types"; +import connectToKiota from "./connect.js"; +import { checkForSuccess } from "./utils.js"; +import { ConsumerOperation, GenerationConfiguration, KiotaGenerationLanguage, KiotaLogEntry, KiotaResult } from "./types.js"; export interface ClientGenerationOptions { openAPIFilePath: string; diff --git a/vscode/packages/npm-package/lib/generatePlugin.ts b/vscode/packages/npm-package/lib/generatePlugin.ts index bd52364e1a..10f7137e69 100644 --- a/vscode/packages/npm-package/lib/generatePlugin.ts +++ b/vscode/packages/npm-package/lib/generatePlugin.ts @@ -1,9 +1,9 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { KiotaPluginType, GeneratePluginResult, ConsumerOperation, GenerationConfiguration, KiotaLogEntry, PluginAuthType } from "../types"; +import connectToKiota from "./connect.js"; +import { KiotaPluginType, GeneratePluginResult, ConsumerOperation, GenerationConfiguration, KiotaLogEntry, PluginAuthType } from "./types.js"; import * as path from "path"; -import { checkForSuccess } from "../utils"; +import { checkForSuccess } from "./utils.js"; export interface PluginGenerationOptions { descriptionPath: string; diff --git a/vscode/packages/npm-package/lib/getKiotaTree.ts b/vscode/packages/npm-package/lib/getKiotaTree.ts index 8d68a2230b..7073eb17f0 100644 --- a/vscode/packages/npm-package/lib/getKiotaTree.ts +++ b/vscode/packages/npm-package/lib/getKiotaTree.ts @@ -1,7 +1,7 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { KiotaTreeResult, KiotaShowConfiguration } from "../types"; +import connectToKiota from "./connect.js"; +import { KiotaTreeResult, KiotaShowConfiguration } from "./types.js"; export interface KiotaResultOptions { descriptionPath: string; diff --git a/vscode/packages/npm-package/lib/getKiotaVersion.ts b/vscode/packages/npm-package/lib/getKiotaVersion.ts index 1c578af2aa..d2c28a11f4 100644 --- a/vscode/packages/npm-package/lib/getKiotaVersion.ts +++ b/vscode/packages/npm-package/lib/getKiotaVersion.ts @@ -1,6 +1,6 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from '../connect'; +import connectToKiota from './connect.js'; /** * Retrieves the version of Kiota by connecting to the Kiota service. diff --git a/vscode/packages/npm-package/lib/getManifestDetails.ts b/vscode/packages/npm-package/lib/getManifestDetails.ts index a27ace6113..abcaefbedd 100644 --- a/vscode/packages/npm-package/lib/getManifestDetails.ts +++ b/vscode/packages/npm-package/lib/getManifestDetails.ts @@ -1,7 +1,7 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { KiotaManifestResult, KiotaGetManifestDetailsConfiguration } from "../types"; +import connectToKiota from "./connect.js"; +import { KiotaManifestResult, KiotaGetManifestDetailsConfiguration } from "./types.js"; export interface ManifestOptions { manifestPath: string; diff --git a/vscode/packages/npm-package/lib/getPluginManifest.ts b/vscode/packages/npm-package/lib/getPluginManifest.ts index 09b55d67bc..4a10dd2429 100644 --- a/vscode/packages/npm-package/lib/getPluginManifest.ts +++ b/vscode/packages/npm-package/lib/getPluginManifest.ts @@ -1,7 +1,7 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { PluginManifestResult } from "../types"; +import connectToKiota from "./connect.js"; +import { PluginManifestResult } from "./types.js"; export interface GetPluginManifestOptions { descriptionPath: string; diff --git a/vscode/packages/npm-package/lib/index.ts b/vscode/packages/npm-package/lib/index.ts new file mode 100644 index 0000000000..670e4204b9 --- /dev/null +++ b/vscode/packages/npm-package/lib/index.ts @@ -0,0 +1,13 @@ +export * from './config.js'; +export * from './generateClient.js'; +export * from './generatePlugin.js'; +export * from './getKiotaTree.js'; +export * from './getKiotaVersion.js'; +export * from './getManifestDetails.js'; +export * from './languageInformation.js'; +export * from './migrateFromLockFile.js'; +export * from './removeItem.js'; +export * from './searchDescription.js'; +export * from './updateClients.js'; +export * from './types.js'; +export * from './utils.js'; diff --git a/vscode/packages/npm-package/install.ts b/vscode/packages/npm-package/lib/install.ts similarity index 98% rename from vscode/packages/npm-package/install.ts rename to vscode/packages/npm-package/lib/install.ts index 58e0011274..4b77c2d4aa 100644 --- a/vscode/packages/npm-package/install.ts +++ b/vscode/packages/npm-package/lib/install.ts @@ -3,9 +3,9 @@ import { createHash } from 'crypto'; import * as https from 'https'; import * as fs from 'fs'; import * as path from 'path'; -import { getKiotaConfig } from './config'; +import { getKiotaConfig } from './config.js'; -import runtimeJson from './runtime.json'; +import runtimeJson from './runtime.json' with { type: 'json' }; const kiotaInstallStatusKey = "kiotaInstallStatus"; const installDelayInMs = 30000; // 30 seconds diff --git a/vscode/packages/npm-package/lib/languageInformation.ts b/vscode/packages/npm-package/lib/languageInformation.ts index c599fb8857..44865d96db 100644 --- a/vscode/packages/npm-package/lib/languageInformation.ts +++ b/vscode/packages/npm-package/lib/languageInformation.ts @@ -1,7 +1,7 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { LanguagesInformation } from "../types"; +import connectToKiota from "./connect.js"; +import { LanguagesInformation } from "./types.js"; export interface LanguageInformationConfiguration { descriptionUrl: string; clearCache: boolean; diff --git a/vscode/packages/npm-package/lib/migrateFromLockFile.ts b/vscode/packages/npm-package/lib/migrateFromLockFile.ts index 065e8b8c53..c9ca9d35f1 100644 --- a/vscode/packages/npm-package/lib/migrateFromLockFile.ts +++ b/vscode/packages/npm-package/lib/migrateFromLockFile.ts @@ -1,7 +1,7 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { KiotaLogEntry } from "../types"; +import connectToKiota from "./connect.js"; +import { KiotaLogEntry } from "./types.js"; /** * Migrates data from a lock file located in the specified directory. diff --git a/vscode/packages/npm-package/lib/removeItem.ts b/vscode/packages/npm-package/lib/removeItem.ts index 97cd791ac4..f701ba02bd 100644 --- a/vscode/packages/npm-package/lib/removeItem.ts +++ b/vscode/packages/npm-package/lib/removeItem.ts @@ -1,7 +1,7 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { KiotaResult, KiotaLogEntry } from "../types"; +import connectToKiota from "./connect.js"; +import { KiotaResult, KiotaLogEntry } from "./types.js"; export interface RemoveItemConfiguration { cleanOutput: boolean; diff --git a/vscode/packages/npm-package/runtime.json b/vscode/packages/npm-package/lib/runtime.json similarity index 100% rename from vscode/packages/npm-package/runtime.json rename to vscode/packages/npm-package/lib/runtime.json diff --git a/vscode/packages/npm-package/lib/searchDescription.ts b/vscode/packages/npm-package/lib/searchDescription.ts index 405fa09bef..ad4b19fd98 100644 --- a/vscode/packages/npm-package/lib/searchDescription.ts +++ b/vscode/packages/npm-package/lib/searchDescription.ts @@ -1,7 +1,7 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from '../connect'; -import { KiotaSearchResultItem, KiotaSearchResult } from "../types"; +import connectToKiota from './connect.js'; +import { KiotaSearchResultItem, KiotaSearchResult } from "./types.js"; export interface SearchConfiguration { searchTerm: string; diff --git a/vscode/packages/npm-package/types.ts b/vscode/packages/npm-package/lib/types.ts similarity index 100% rename from vscode/packages/npm-package/types.ts rename to vscode/packages/npm-package/lib/types.ts diff --git a/vscode/packages/npm-package/lib/updateClients.ts b/vscode/packages/npm-package/lib/updateClients.ts index 1c5e8e97f8..c409da7eac 100644 --- a/vscode/packages/npm-package/lib/updateClients.ts +++ b/vscode/packages/npm-package/lib/updateClients.ts @@ -1,7 +1,7 @@ import * as rpc from "vscode-jsonrpc/node"; -import connectToKiota from "../connect"; -import { KiotaLogEntry } from "../types"; +import connectToKiota from "./connect.js"; +import { KiotaLogEntry } from "./types.js"; export interface UpdateClientsConfiguration { cleanOutput: boolean; diff --git a/vscode/packages/npm-package/utils.ts b/vscode/packages/npm-package/lib/utils.ts similarity index 98% rename from vscode/packages/npm-package/utils.ts rename to vscode/packages/npm-package/lib/utils.ts index f4b1216810..e84b2b5c4c 100644 --- a/vscode/packages/npm-package/utils.ts +++ b/vscode/packages/npm-package/lib/utils.ts @@ -1,4 +1,4 @@ -import { KiotaLogEntry, MaturityLevel, DependencyType, LogLevel } from "./types"; +import { KiotaLogEntry, MaturityLevel, DependencyType, LogLevel } from "./types.js"; export function getLogEntriesForLevel(logEntries: KiotaLogEntry[], ...levels: LogLevel[]): KiotaLogEntry[] { return logEntries.filter((entry) => levels.indexOf(entry.level) !== -1); diff --git a/vscode/packages/npm-package/package.json b/vscode/packages/npm-package/package.json index 4f3728f624..20c53ea9ae 100644 --- a/vscode/packages/npm-package/package.json +++ b/vscode/packages/npm-package/package.json @@ -1,6 +1,7 @@ { + "$schema": "https://www.schemastore.org/package.json", "name": "@microsoft/kiota", - "version": "1.25.1", + "version": "1.30.0", "description": "npm package exposing Kiota CLI functionality to TypeScript", "repository": { "url": "https://github.com/microsoft/kiota.git", @@ -10,43 +11,25 @@ "lib": "lib", "test": "tests" }, - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "main": "dist/index.js", "exports": { - "import": { - "types": "./dist/esm/types/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/cjs/types/index.d.ts", - "default": "./dist/cjs/index.js" - } - }, - "types": "dist/esm/types/index.d.ts", - "typesVersions": { - "*": { - "import": [ - "./dist/esm/types/index.d.ts" - ], - "require": [ - "./dist/cjs/types/index.d.ts" - ] + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" } }, + "type": "module", + "types": "./dist/index.d.ts", "files": [ - "dist", - "runtime.json" + "dist" ], "scripts": { "lint": "eslint", "test": "jest --runInBand", "test:unit": "jest --config=jest.config.unit.cjs", "test:integration": "jest --config=jest.config.integration.cjs --runInBand", - "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run copy-files", - "build:esm": "tsc --project tsconfig.esm.json", - "build:cjs": "tsc --project tsconfig.cjs.json", + "build": "npm run clean && tsc --project ./tsconfig.json", "clean": "rimraf dist", - "copy-files": "node scripts/copy-files.js", "generate-readme": "node scripts/generate-readme.js", "test:coverage": "jest --coverage --runInBand", "prepack": "npm run build", diff --git a/vscode/packages/npm-package/scripts/copy-files.js b/vscode/packages/npm-package/scripts/copy-files.js deleted file mode 100644 index 113d5c0dad..0000000000 --- a/vscode/packages/npm-package/scripts/copy-files.js +++ /dev/null @@ -1,30 +0,0 @@ -const fs = require('fs'); -const path = require('path'); - -const sourceFile = path.resolve(__dirname, '..', 'runtime.json'); // Move up one level from the `scripts` folder -const destDirs = [ - path.resolve(__dirname, '..', 'dist', 'esm'), - path.resolve(__dirname, '..', 'dist', 'cjs'), -]; - -try { - if (!fs.existsSync(sourceFile)) { - throw new Error(`Source file does not exist: ${sourceFile}`); - } - - destDirs.forEach((destDir) => { - try { - if (!fs.existsSync(destDir)) { - fs.mkdirSync(destDir, { recursive: true }); - } - - const destFile = path.join(destDir, 'runtime.json'); - fs.copyFileSync(sourceFile, destFile); - console.log(`Copied to ${destFile}`); - } catch (err) { - console.error(`Failed to copy to ${destDir}: ${err.message}`); - } - }); -} catch (err) { - console.error(`Error: ${err.message}`); -} \ No newline at end of file diff --git a/vscode/packages/npm-package/tests/assertUtils.ts b/vscode/packages/npm-package/tests/assertUtils.ts index 578a9e363a..750fbdba91 100644 --- a/vscode/packages/npm-package/tests/assertUtils.ts +++ b/vscode/packages/npm-package/tests/assertUtils.ts @@ -1,4 +1,4 @@ -import { KiotaLogEntry, LogLevel } from "../types"; +import { KiotaLogEntry, LogLevel } from "../lib/types"; export function existsEqualOrGreaterThanLevelLogs(logs: KiotaLogEntry[] | undefined, level: LogLevel): boolean { if (!logs) return false; diff --git a/vscode/packages/npm-package/tests/integration/integrationGeneratePlugin.spec.ts b/vscode/packages/npm-package/tests/integration/integrationGeneratePlugin.spec.ts index 7f3e336359..25d3f345fd 100644 --- a/vscode/packages/npm-package/tests/integration/integrationGeneratePlugin.spec.ts +++ b/vscode/packages/npm-package/tests/integration/integrationGeneratePlugin.spec.ts @@ -3,8 +3,8 @@ import path from 'path'; import { generatePlugin } from '../../lib/generatePlugin'; import { getKiotaTree } from '../../lib/getKiotaTree'; import { getPluginManifest } from '../../lib/getPluginManifest'; -import { KiotaPluginType, ConsumerOperation, LogLevel } from '../../types'; -import { PluginAuthType } from '../../types'; +import { KiotaPluginType, ConsumerOperation, LogLevel } from '../../lib/types'; +import { PluginAuthType } from '../../lib/types'; import { existsEqualOrGreaterThanLevelLogs } from '../assertUtils'; async function loadJSON(filename: string) { diff --git a/vscode/packages/npm-package/tests/integration/integrationGetKiotaTree.spec.ts b/vscode/packages/npm-package/tests/integration/integrationGetKiotaTree.spec.ts index cc76e0718d..60091f50bf 100644 --- a/vscode/packages/npm-package/tests/integration/integrationGetKiotaTree.spec.ts +++ b/vscode/packages/npm-package/tests/integration/integrationGetKiotaTree.spec.ts @@ -7,7 +7,7 @@ import { ApiKeySecurityScheme, OpenIdSecurityScheme, OpenApiSpecVersion, -} from "../../types"; +} from "../../lib/types"; import { getKiotaTree } from "../../lib/getKiotaTree"; import { existsEqualOrGreaterThanLevelLogs } from "../assertUtils"; diff --git a/vscode/packages/npm-package/tests/integration/integrationInstall.spec.ts b/vscode/packages/npm-package/tests/integration/integrationInstall.spec.ts index d672c1c1b0..267fa7b3e7 100644 --- a/vscode/packages/npm-package/tests/integration/integrationInstall.spec.ts +++ b/vscode/packages/npm-package/tests/integration/integrationInstall.spec.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; -import { setKiotaConfig } from '../../config'; -import { ensureKiotaIsPresentInPath, getCurrentPlatform, getKiotaPath, Package } from '../../install'; +import { setKiotaConfig } from '../../lib/config'; +import { ensureKiotaIsPresentInPath, getCurrentPlatform, getKiotaPath, Package } from '../../lib/install'; import testRuntimeJson from '../test_runtime.json'; import path from 'path'; diff --git a/vscode/packages/npm-package/tests/integration/setup.ts b/vscode/packages/npm-package/tests/integration/setup.ts index 3d71b1104a..a69e593cad 100644 --- a/vscode/packages/npm-package/tests/integration/setup.ts +++ b/vscode/packages/npm-package/tests/integration/setup.ts @@ -1,5 +1,5 @@ import { Config } from '@jest/types'; -import { ensureKiotaIsPresent } from '../../install'; +import { ensureKiotaIsPresent } from '../../lib/install'; export default async (globalConfig: Config.GlobalConfig, projectConfig: Config.ProjectConfig) => { // Ensure kiota binary to optimize integration tests diff --git a/vscode/packages/npm-package/tests/unit/generateClient.spec.ts b/vscode/packages/npm-package/tests/unit/generateClient.spec.ts index f4eb977775..c01c05c145 100644 --- a/vscode/packages/npm-package/tests/unit/generateClient.spec.ts +++ b/vscode/packages/npm-package/tests/unit/generateClient.spec.ts @@ -1,5 +1,5 @@ import { generateClient } from '../../lib/generateClient'; -import { KiotaLogEntry, KiotaGenerationLanguage } from '../../types'; +import { KiotaLogEntry, KiotaGenerationLanguage } from '../../lib/types'; import { setupKiotaStubs } from './stubs.util'; describe("generate client", () => { diff --git a/vscode/packages/npm-package/tests/unit/generatePlugin.spec.ts b/vscode/packages/npm-package/tests/unit/generatePlugin.spec.ts index 36588d957f..6ea1cefcea 100644 --- a/vscode/packages/npm-package/tests/unit/generatePlugin.spec.ts +++ b/vscode/packages/npm-package/tests/unit/generatePlugin.spec.ts @@ -1,6 +1,6 @@ import { generatePlugin } from '../../lib/generatePlugin'; -import { KiotaLogEntry } from '../../types'; -import { KiotaPluginType } from '../../types'; +import { KiotaLogEntry } from '../../lib/types'; +import { KiotaPluginType } from '../../lib/types'; import { setupKiotaStubs } from './stubs.util'; describe("generate plugin", () => { diff --git a/vscode/packages/npm-package/tests/unit/getKiotaTree.spec.ts b/vscode/packages/npm-package/tests/unit/getKiotaTree.spec.ts index 4d56cbd021..e18763f717 100644 --- a/vscode/packages/npm-package/tests/unit/getKiotaTree.spec.ts +++ b/vscode/packages/npm-package/tests/unit/getKiotaTree.spec.ts @@ -1,4 +1,4 @@ -import { KiotaTreeResult } from '../../types'; +import { KiotaTreeResult } from '../../lib/types'; import { getKiotaTree } from '../../lib/getKiotaTree'; import { setupKiotaStubs } from './stubs.util'; diff --git a/vscode/packages/npm-package/tests/unit/getManifestDetails.spec.ts b/vscode/packages/npm-package/tests/unit/getManifestDetails.spec.ts index 935da2cdce..ec423d6d6a 100644 --- a/vscode/packages/npm-package/tests/unit/getManifestDetails.spec.ts +++ b/vscode/packages/npm-package/tests/unit/getManifestDetails.spec.ts @@ -1,4 +1,4 @@ -import { KiotaManifestResult } from '../../types'; +import { KiotaManifestResult } from '../../lib/types'; import { getManifestDetails } from '../../lib/getManifestDetails'; import { setupKiotaStubs } from './stubs.util'; diff --git a/vscode/packages/npm-package/tests/unit/migrateFromLockFile.spec.ts b/vscode/packages/npm-package/tests/unit/migrateFromLockFile.spec.ts index 9f2bace64f..4b2cc7b6b8 100644 --- a/vscode/packages/npm-package/tests/unit/migrateFromLockFile.spec.ts +++ b/vscode/packages/npm-package/tests/unit/migrateFromLockFile.spec.ts @@ -1,4 +1,4 @@ -import { KiotaLogEntry } from '../../types'; +import { KiotaLogEntry } from '../../lib/types'; import { migrateFromLockFile } from '../../lib/migrateFromLockFile'; import { setupKiotaStubs } from './stubs.util'; diff --git a/vscode/packages/npm-package/tests/unit/removeItem.spec.ts b/vscode/packages/npm-package/tests/unit/removeItem.spec.ts index c692fed3b4..d0bc3afc6e 100644 --- a/vscode/packages/npm-package/tests/unit/removeItem.spec.ts +++ b/vscode/packages/npm-package/tests/unit/removeItem.spec.ts @@ -1,4 +1,4 @@ -import { KiotaLogEntry, KiotaResult } from '../../types'; +import { KiotaLogEntry, KiotaResult } from '../../lib/types'; import { removeClient, removePlugin } from '../../lib/removeItem'; import { setupKiotaStubs } from './stubs.util'; diff --git a/vscode/packages/npm-package/tests/unit/searchDescriptions.spec.ts b/vscode/packages/npm-package/tests/unit/searchDescriptions.spec.ts index 343a9bda10..a852d645e4 100644 --- a/vscode/packages/npm-package/tests/unit/searchDescriptions.spec.ts +++ b/vscode/packages/npm-package/tests/unit/searchDescriptions.spec.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { KiotaSearchResultItem } from '../../types'; +import { KiotaSearchResultItem } from '../../lib/types'; import { searchDescription } from '../../lib/searchDescription'; import { setupKiotaStubs } from './stubs.util'; diff --git a/vscode/packages/npm-package/tests/unit/stubs.util.ts b/vscode/packages/npm-package/tests/unit/stubs.util.ts index a4f6327a8a..bc847c98d0 100644 --- a/vscode/packages/npm-package/tests/unit/stubs.util.ts +++ b/vscode/packages/npm-package/tests/unit/stubs.util.ts @@ -1,5 +1,5 @@ import * as rpc from 'vscode-jsonrpc'; -import * as connectToKiota from '../../connect'; +import * as connectToKiota from '../../lib/connect'; export function setupKiotaStubs() { const connectionStub = jest.fn(); diff --git a/vscode/packages/npm-package/tests/unit/updateClients.spec.ts b/vscode/packages/npm-package/tests/unit/updateClients.spec.ts index 90695bf804..ef2f2866f9 100644 --- a/vscode/packages/npm-package/tests/unit/updateClients.spec.ts +++ b/vscode/packages/npm-package/tests/unit/updateClients.spec.ts @@ -1,4 +1,4 @@ -import { KiotaLogEntry } from '../../types'; +import { KiotaLogEntry } from '../../lib/types'; import { updateClients } from '../../lib/updateClients'; import { setupKiotaStubs } from './stubs.util'; diff --git a/vscode/packages/npm-package/tsconfig.cjs.json b/vscode/packages/npm-package/tsconfig.cjs.json deleted file mode 100644 index cc9752b01d..0000000000 --- a/vscode/packages/npm-package/tsconfig.cjs.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./dist/cjs", - "module": "CommonJS", - "declaration": true, - "declarationDir": "./dist/cjs/types" - } -} diff --git a/vscode/packages/npm-package/tsconfig.esm.json b/vscode/packages/npm-package/tsconfig.esm.json deleted file mode 100644 index 396bc45f90..0000000000 --- a/vscode/packages/npm-package/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./dist/esm", - "module": "ESNext", - "declaration": true, - "declarationDir": "./dist/esm/types" - } -} diff --git a/vscode/packages/npm-package/tsconfig.json b/vscode/packages/npm-package/tsconfig.json index 9f89f94649..3c47cc1365 100644 --- a/vscode/packages/npm-package/tsconfig.json +++ b/vscode/packages/npm-package/tsconfig.json @@ -1,16 +1,19 @@ { + "$schema": "https://www.schemastore.org/tsconfig.json", "compilerOptions": { + "declaration": true, + "declarationMap": true, "forceConsistentCasingInFileNames": true, - "module": "ESNext", - "rootDir": ".", - "outDir": "./dist", + "module": "nodenext", + "moduleResolution": "nodenext", + "rootDir": "./lib/", + "outDir": "./dist/", "strict": true, "types": [ "node", "jest" ], - "moduleResolution": "node", - "target": "ESNext", + "target": "esnext", "lib": [ "ESNext" ], @@ -20,9 +23,7 @@ "allowSyntheticDefaultImports": true, "skipLibCheck": true, }, - "exclude": [ - "dist", - "node_modules", - "tests" + "include": [ + "./lib/**/*.ts" ] }