Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct tsconfig.json when generating npm package #21651

Merged
merged 5 commits into from
Jul 17, 2023
Merged
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
8 changes: 8 additions & 0 deletions pythonExtensionApi/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rules": {
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "export", "next": "*" }
]
}
}
2 changes: 2 additions & 0 deletions pythonExtensionApi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ The actual source code to get the active environment to run some script could lo
// Import the API
import { PythonExtension } from '@vscode/python-extension';

...

// Load the Python extension API
const pythonApi: PythonExtension = await PythonExtension.api();

Expand Down
26 changes: 24 additions & 2 deletions pythonExtensionApi/package-lock.json

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

10 changes: 7 additions & 3 deletions pythonExtensionApi/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vscode/python-extension",
"description": "An API facade for the Python extension in VS Code",
"version": "1.0.0",
"version": "1.0.1",
"author": {
"name": "Microsoft Corporation"
},
Expand All @@ -28,13 +28,17 @@
"dependencies": {
"@types/vscode": "^1.78.0"
},
"devDependencies": {
"typescript": "5.0.4"
},
"scripts": {
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node ../build/fail",
"prepack": "npm run all:publish",
"compile": "node ../node_modules/typescript/lib/tsc.js -b ./tsconfig.json",
"compile": "node ./node_modules/typescript/lib/tsc.js -b ./tsconfig.json",
"clean": "node ../node_modules/rimraf/bin.js out",
"lint": "node ../node_modules/eslint/bin/eslint.js --ext ts src",
"all": "npm run clean && npm run compile",
"all:publish": "git clean -xfd . && npm install && npm run compile"
"formatTypings": "node ../node_modules/eslint/bin/eslint.js --fix ./out/main.d.ts",
"all:publish": "git clean -xfd . && npm install && npm run compile && npm run formatTypings"
}
}
5 changes: 5 additions & 0 deletions pythonExtensionApi/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export type EnvironmentPath = {
* was contributed.
*/
export type EnvironmentTools = KnownEnvironmentTools | string;

/**
* Tools or plugins the Python extension currently has built-in support for. Note this list is expected to shrink
* once tools have their own separate extensions.
Expand All @@ -334,6 +335,7 @@ export type KnownEnvironmentTools =
* Type of the environment. It can be {@link KnownEnvironmentTypes} or custom string which was contributed.
*/
export type EnvironmentType = KnownEnvironmentTypes | string;

/**
* Environment types the Python extension is aware of. Note this list is expected to shrink once tools have their
* own separate extensions, in which case they're expected to provide the type themselves.
Expand Down Expand Up @@ -392,6 +394,9 @@ export const PVSC_EXTENSION_ID = 'ms-python.python';

// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace PythonExtension {
/**
* Returns the API exposed by the Python extension in VS Code.
*/
export async function api(): Promise<PythonExtension> {
const extension = extensions.getExtension(PVSC_EXTENSION_ID);
if (extension === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion pythonExtensionApi/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true,
"removeComments": true
"declaration": true
},
"exclude": [
"node_modules",
Expand Down