Skip to content

Commit f7125da

Browse files
author
Kartik Raj
authored
Use correct tsconfig.json when generating npm package (#21651)
For #21631 - Unset `removeComment` as that leads to declarations without docstrings - Set to generate declarations - Use updated typescript which results in cleaner declaration files
1 parent 2e8dc67 commit f7125da

File tree

6 files changed

+47
-6
lines changed

6 files changed

+47
-6
lines changed

pythonExtensionApi/.eslintrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"rules": {
3+
"padding-line-between-statements": [
4+
"error",
5+
{ "blankLine": "always", "prev": "export", "next": "*" }
6+
]
7+
}
8+
}

pythonExtensionApi/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ The actual source code to get the active environment to run some script could lo
2828
// Import the API
2929
import { PythonExtension } from '@vscode/python-extension';
3030

31+
...
32+
3133
// Load the Python extension API
3234
const pythonApi: PythonExtension = await PythonExtension.api();
3335

pythonExtensionApi/package-lock.json

+24-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pythonExtensionApi/package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@vscode/python-extension",
33
"description": "An API facade for the Python extension in VS Code",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"author": {
66
"name": "Microsoft Corporation"
77
},
@@ -28,13 +28,17 @@
2828
"dependencies": {
2929
"@types/vscode": "^1.78.0"
3030
},
31+
"devDependencies": {
32+
"typescript": "5.0.4"
33+
},
3134
"scripts": {
3235
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node ../build/fail",
3336
"prepack": "npm run all:publish",
34-
"compile": "node ../node_modules/typescript/lib/tsc.js -b ./tsconfig.json",
37+
"compile": "node ./node_modules/typescript/lib/tsc.js -b ./tsconfig.json",
3538
"clean": "node ../node_modules/rimraf/bin.js out",
3639
"lint": "node ../node_modules/eslint/bin/eslint.js --ext ts src",
3740
"all": "npm run clean && npm run compile",
38-
"all:publish": "git clean -xfd . && npm install && npm run compile"
41+
"formatTypings": "node ../node_modules/eslint/bin/eslint.js --fix ./out/main.d.ts",
42+
"all:publish": "git clean -xfd . && npm install && npm run compile && npm run formatTypings"
3943
}
4044
}

pythonExtensionApi/src/main.ts

+5
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ export type EnvironmentPath = {
316316
* was contributed.
317317
*/
318318
export type EnvironmentTools = KnownEnvironmentTools | string;
319+
319320
/**
320321
* Tools or plugins the Python extension currently has built-in support for. Note this list is expected to shrink
321322
* once tools have their own separate extensions.
@@ -334,6 +335,7 @@ export type KnownEnvironmentTools =
334335
* Type of the environment. It can be {@link KnownEnvironmentTypes} or custom string which was contributed.
335336
*/
336337
export type EnvironmentType = KnownEnvironmentTypes | string;
338+
337339
/**
338340
* Environment types the Python extension is aware of. Note this list is expected to shrink once tools have their
339341
* own separate extensions, in which case they're expected to provide the type themselves.
@@ -392,6 +394,9 @@ export const PVSC_EXTENSION_ID = 'ms-python.python';
392394

393395
// eslint-disable-next-line @typescript-eslint/no-namespace
394396
export namespace PythonExtension {
397+
/**
398+
* Returns the API exposed by the Python extension in VS Code.
399+
*/
395400
export async function api(): Promise<PythonExtension> {
396401
const extension = extensions.getExtension(PVSC_EXTENSION_ID);
397402
if (extension === undefined) {

pythonExtensionApi/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"noUnusedParameters": true,
2626
"noFallthroughCasesInSwitch": true,
2727
"resolveJsonModule": true,
28-
"removeComments": true
28+
"declaration": true
2929
},
3030
"exclude": [
3131
"node_modules",

0 commit comments

Comments
 (0)