Skip to content

Commit 6a33e55

Browse files
committed
publish npm
1 parent 0ab87b1 commit 6a33e55

File tree

12 files changed

+1576
-1
lines changed

12 files changed

+1576
-1
lines changed

build/azure-pipeline.npm.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: $(Date:yyyyMMdd)$(Rev:.r)
2+
3+
trigger: none
4+
pr: none
5+
6+
resources:
7+
repositories:
8+
- repository: templates
9+
type: github
10+
name: microsoft/vscode-engineering
11+
ref: main
12+
endpoint: Monaco
13+
14+
parameters:
15+
- name: quality
16+
displayName: Quality
17+
type: string
18+
default: latest
19+
values:
20+
- latest
21+
- next
22+
- name: publishPythonEnvsApi
23+
displayName: 🚀 Publish @vscode/python-environments
24+
type: boolean
25+
default: false
26+
27+
extends:
28+
template: azure-pipelines/npm-package/pipeline.yml@templates
29+
parameters:
30+
npmPackages:
31+
- name: pythonEnvironmentsApi
32+
testPlatforms:
33+
- name: Linux
34+
nodeVersions:
35+
- 22.21.1
36+
- name: MacOS
37+
nodeVersions:
38+
- 22.21.1
39+
- name: Windows
40+
nodeVersions:
41+
- 22.21.1
42+
testSteps:
43+
- template: /build/templates/test-steps.yml@self
44+
parameters:
45+
package: pythonEnvironmentsApi
46+
buildSteps:
47+
- template: /build/templates/pack-steps.yml@self
48+
parameters:
49+
package: pythonEnvironmentsApi
50+
ghTagPrefix: release/pythonEnvironmentsApi/
51+
tag: ${{ parameters.quality }}
52+
publishPackage: ${{ parameters.publishPythonEnvsApi }}
53+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi

build/templates/pack-steps.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
- name: package
3+
4+
steps:
5+
- script: npm install
6+
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.package }}
7+
displayName: Install package dependencies

build/templates/test-steps.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
parameters:
2+
- name: package
3+
type: string
4+
- name: script
5+
type: string
6+
default: 'all:publish'
7+
8+
steps:
9+
- script: npm install
10+
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.package }}
11+
displayName: Install package dependencies
12+
- bash: |
13+
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
14+
echo ">>> Started xvfb"
15+
displayName: Start xvfb
16+
condition: eq(variables['Agent.OS'], 'Linux')
17+
- script: npm run ${{ parameters.script }}
18+
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.package }}
19+
displayName: Verify package

pythonEnvironmentsApi/.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src/
2+
out/**/*.map
3+
out/**/*.tsbuildinfo
4+
tsconfig*.json

pythonEnvironmentsApi/LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation. All rights reserved.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

pythonEnvironmentsApi/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# @vscode/python-environments
2+
3+
This package provides type declarations and a helper to access the API exposed by the [Python Environments](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-python-envs) extension for VS Code.
4+
5+
## Usage
6+
7+
1. Install the package and add an `extensionDependencies` entry in your extension's `package.json`:
8+
9+
```jsonc
10+
// package.json
11+
{
12+
"extensionDependencies": ["ms-python.vscode-python-envs"]
13+
}
14+
```
15+
16+
2. Install the npm package:
17+
18+
```
19+
npm install @vscode/python-environments
20+
```
21+
22+
3. Import and use the API in your extension:
23+
24+
```typescript
25+
import { PythonEnvironments } from '@vscode/python-environments';
26+
27+
export async function activate() {
28+
const api = await PythonEnvironments.api();
29+
30+
// Get all discovered environments
31+
const envs = await api.getEnvironments('all');
32+
for (const env of envs) {
33+
console.log(env.displayName, env.version);
34+
}
35+
}
36+
```
37+
38+
## API
39+
40+
The full API surface is exported from the package. Key interfaces include:
41+
42+
- **`PythonEnvironmentApi`** – the top-level composite interface returned by `PythonEnvironments.api()`.
43+
- **`PythonEnvironment`** – represents a single Python environment.
44+
- **`EnvironmentManager`** – register and manage environment managers.
45+
- **`PackageManager`** – register and manage package managers.
46+
- **`PythonProject`** – represents a Python project.
47+
48+
See the [API reference](https://github.com/microsoft/vscode-python-environments/blob/main/docs/projects-api-reference.md) for complete documentation.
49+
50+
## License
51+
52+
MIT

pythonEnvironmentsApi/SECURITY.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK -->
2+
3+
## Security
4+
5+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6+
7+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](<https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)>) of a security vulnerability, please report it to us as described below.
8+
9+
## Reporting Security Issues
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
14+
15+
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
16+
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
18+
19+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20+
21+
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
- Full paths of source file(s) related to the manifestation of the issue
23+
- The location of the affected source code (tag/branch/commit or direct URL)
24+
- Any special configuration required to reproduce the issue
25+
- Step-by-step instructions to reproduce the issue
26+
- Proof-of-concept or exploit code (if possible)
27+
- Impact of the issue, including how an attacker might exploit the issue
28+
29+
This information will help us triage your report more quickly.
30+
31+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
32+
33+
## Preferred Languages
34+
35+
We prefer all communications to be in English.
36+
37+
## Policy
38+
39+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
40+
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

pythonEnvironmentsApi/package-lock.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pythonEnvironmentsApi/package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "@vscode/python-environments",
3+
"version": "1.0.0",
4+
"description": "An API facade for the Python Environments extension API in VS Code",
5+
"author": {
6+
"name": "Microsoft Corporation"
7+
},
8+
"main": "./out/main.js",
9+
"types": "./out/main.d.ts",
10+
"license": "MIT",
11+
"publisher": "Microsoft",
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/microsoft/vscode-python-environments"
15+
},
16+
"scripts": {
17+
"prepublishOnly": "echo \"Please use the CI pipeline to publish this package.\" && exit 1",
18+
"prepack": "npm run all:publish",
19+
"all:publish": "npm run clean && npm run compile",
20+
"compile": "tsc -p tsconfig.json",
21+
"clean": "node -e \"const fs = require('fs'); fs.rmSync('./out', { recursive: true, force: true });\""
22+
},
23+
"devDependencies": {
24+
"@types/vscode": "^1.99.0",
25+
"typescript": "^5.1.3"
26+
}
27+
}

0 commit comments

Comments
 (0)