Skip to content

Commit 860225b

Browse files
committed
Unify formatting
Also format json accordingly
1 parent 6a2e580 commit 860225b

28 files changed

+1150
-945
lines changed

.devcontainer/devcontainer.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "publish-extensions",
3-
"image": "mcr.microsoft.com/devcontainers/base",
4-
// Features to add to the dev container. More info: https://containers.dev/features.
5-
"features": {
6-
"ghcr.io/shyim/devcontainers-features/bun:0": {},
7-
"ghcr.io/devcontainers/features/node:1": {},
8-
"ghcr.io/devcontainers/features/python:1": {},
9-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
10-
"ghcr.io/devcontainers/features/java:1": {}
11-
}
12-
}
2+
"name": "publish-extensions",
3+
"image": "mcr.microsoft.com/devcontainers/base",
4+
// Features to add to the dev container. More info: https://containers.dev/features.
5+
"features": {
6+
"ghcr.io/shyim/devcontainers-features/bun:0": {},
7+
"ghcr.io/devcontainers/features/node:1": {},
8+
"ghcr.io/devcontainers/features/python:1": {},
9+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
10+
"ghcr.io/devcontainers/features/java:1": {}
11+
}
12+
}

.github/ISSUE_TEMPLATES/other.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
name: Other
33
about: Raise an issue about something not listed above
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---

.github/PULL_REQUEST_TEMPLATE.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further
2121
2222
-->
2323

24-
- [ ] I have read the note above about PRs contributing or fixing extensions
25-
- [ ] I have tried reaching out to the extension maintainers about publishing this extension to Open VSX (if not, please create an issue in the extension's repo using [this template](https://github.com/open-vsx/publish-extensions/blob/HEAD/docs/external_contribution_request.md)).
26-
- [ ] This extension has an [OSI-approved OSS license](https://opensource.org/licenses) (we don't accept proprietary extensions in this repository)
24+
- [ ] I have read the note above about PRs contributing or fixing extensions
25+
- [ ] I have tried reaching out to the extension maintainers about publishing this extension to Open VSX (if not, please create an issue in the extension's repo using [this template](https://github.com/open-vsx/publish-extensions/blob/HEAD/docs/external_contribution_request.md)).
26+
- [ ] This extension has an [OSI-approved OSS license](https://opensource.org/licenses) (we don't accept proprietary extensions in this repository)
2727

2828
## Description
2929

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package.json
2+
extensions.json
3+
4+
*.yml
5+
*.yaml

.theia/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"terminal.integrated.scrollback": 20000
3-
}
3+
}

.vscode/launch.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@
88
"type": "pwa-node",
99
"request": "launch",
1010
"name": "Launch Program",
11-
"skipFiles": [
12-
"<node_internals>/**"
13-
],
11+
"skipFiles": ["<node_internals>/**"],
1412
"program": "${file}",
15-
"outFiles": [
16-
"${workspaceFolder}/**/*.js"
17-
]
13+
"outFiles": ["${workspaceFolder}/**/*.js"]
1814
}
1915
]
20-
}
16+
}

CODE_OF_CONDUCT.md

+23-22
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@ This Community Code of Conduct ("Code") outlines our behavior expectations as me
1313

1414
Examples of behavior that contribute to creating a positive and professional environment include:
1515

16-
- Using welcoming and inclusive language;
17-
- Actively encouraging all voices;
18-
- Helping others bring their perspectives and listening actively. If you find yourself dominating a discussion, it is especially important to encourage other voices to join in;
19-
- Being respectful of differing viewpoints and experiences;
20-
- Gracefully accepting constructive criticism;
21-
- Focusing on what is best for the community;
22-
- Showing empathy towards other community members;
23-
- Being direct but professional; and
24-
- Leading by example by holding yourself and others accountable
16+
- Using welcoming and inclusive language;
17+
- Actively encouraging all voices;
18+
- Helping others bring their perspectives and listening actively. If you find yourself dominating a discussion, it is especially important to encourage other voices to join in;
19+
- Being respectful of differing viewpoints and experiences;
20+
- Gracefully accepting constructive criticism;
21+
- Focusing on what is best for the community;
22+
- Showing empathy towards other community members;
23+
- Being direct but professional; and
24+
- Leading by example by holding yourself and others accountable
2525

2626
Examples of unacceptable behavior by Contributors include:
2727

28-
- The use of sexualized language or imagery;
29-
- Unwelcome sexual attention or advances;
30-
- Trolling, insulting/derogatory comments, and personal or political attacks;
31-
- Public or private harassment, repeated harassment;
32-
- Publishing others' private information, such as a physical or electronic address, without explicit permission;
33-
- Violent threats or language directed against another person;
34-
- Sexist, racist, or otherwise discriminatory jokes and language;
35-
- Posting sexually explicit or violent material;
36-
- Sharing private content, such as emails sent privately or non-publicly, or unlogged forums such as IRC channel history;
37-
- Personal insults, especially those using racist or sexist terms;
38-
- Excessive or unnecessary profanity;
39-
- Advocating for, or encouraging, any of the above behavior; and
40-
- Other conduct which could reasonably be considered inappropriate in a professional setting
28+
- The use of sexualized language or imagery;
29+
- Unwelcome sexual attention or advances;
30+
- Trolling, insulting/derogatory comments, and personal or political attacks;
31+
- Public or private harassment, repeated harassment;
32+
- Publishing others' private information, such as a physical or electronic address, without explicit permission;
33+
- Violent threats or language directed against another person;
34+
- Sexist, racist, or otherwise discriminatory jokes and language;
35+
- Posting sexually explicit or violent material;
36+
- Sharing private content, such as emails sent privately or non-publicly, or unlogged forums such as IRC channel history;
37+
- Personal insults, especially those using racist or sexist terms;
38+
- Excessive or unnecessary profanity;
39+
- Advocating for, or encouraging, any of the above behavior; and
40+
- Other conduct which could reasonably be considered inappropriate in a professional setting
4141

4242
## Our Responsibilities
4343

@@ -68,6 +68,7 @@ Reports should be directed to <[email protected]>. It is the Conduc
6868
The Eclipse Foundation takes all reports of potential Code violations seriously and is committed to confidentiality and a full investigation of all allegations. The identity of the reporter will be omitted from the details of the report supplied to the accused. Contributors who are being investigated for a potential Code violation will have an opportunity to be heard prior to any final determination. Those found to have violated the Code can seek reconsideration of the violation and disciplinary action decisions. Every effort will be made to have all matters disposed of within 60 days of the receipt of the complaint.
6969

7070
## Actions
71+
7172
Contributors who do not follow this Code in good faith may face temporary or permanent repercussions as determined by the Conduct Committee.
7273

7374
This Code does not address all conduct. It works in conjunction with our [Communication Channel Guidelines](https://www.eclipse.org/org/documents/communication-channel-guidelines/), [Social Media Guidelines](https://www.eclipse.org/org/documents/social_media_guidelines.php), [Bylaws](https://www.eclipse.org/org/documents/eclipse-foundation-be-bylaws-en.pdf), and [Internal Rules](https://www.eclipse.org/org/documents/ef-be-internal-rules.pdf) which set out additional protections for, and obligations of, all contributors. The Foundation has additional policies that provide further guidance on other matters.

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ This project is governed by the [Eclipse Community Code of Conduct](CODE_OF_COND
1010

1111
The following communication channels are available:
1212

13-
* [publish-extensions issues](https://github.com/open-vsx/publish-extensions/issues) - for general issues (bug reports, feature requests, etc.)
14-
* [open-vsx.org issues](https://github.com/EclipseFdn/open-vsx.org/issues) - for issues related to [open-vsx.org](https://open-vsx.org/) (outage reports, requests about extensions and namespaces, etc.)
15-
* [Developer mailing list](https://accounts.eclipse.org/mailing-list/openvsx-dev) - for organizational issues (e.g. elections of new committers)
13+
- [publish-extensions issues](https://github.com/open-vsx/publish-extensions/issues) - for general issues (bug reports, feature requests, etc.)
14+
- [open-vsx.org issues](https://github.com/EclipseFdn/open-vsx.org/issues) - for issues related to [open-vsx.org](https://open-vsx.org/) (outage reports, requests about extensions and namespaces, etc.)
15+
- [Developer mailing list](https://accounts.eclipse.org/mailing-list/openvsx-dev) - for organizational issues (e.g. elections of new committers)
1616

1717
## How to Contribute
1818

DEVELOPMENT.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
### Prerequisites
44

5-
- [Node.js](https://nodejs.org/en/) (we use Node 18)
6-
- Ubuntu Linux (Windows and macOS work fine for adding extensions, but extensions are always tested on Ubuntu, so they only need to build correctly there)
5+
- [Node.js](https://nodejs.org/en/) (we use Node 18)
6+
- Ubuntu Linux (Windows and macOS work fine for adding extensions, but extensions are always tested on Ubuntu, so they only need to build correctly there)
77

88
To add an extension to this repo, clone the repo[^clone], install the dependencies[^deps], and use the following command:
99

@@ -79,12 +79,12 @@ in order to perform advanced tasks such as executing operations based on the ext
7979

8080
Following environment variables are available:
8181

82-
- `EXTENSION_ID`: the extension ID, e.g. `rebornix.ruby`
83-
- `EXTENSION_PUBLISHER`: the extension publisher, e.g. `rebornix`
84-
- `EXTENSION_NAME`: the extension name, e.g. `ruby`
85-
- `VERSION`: the version of the extension to publish, e.g. `0.1.0`
86-
- `MS_VERSION`: the latest version of the extension on the MS Marketplace[^ms], e.g. `0.1.0`
87-
- `OVSX_VERSION`: the latest version of the extension on Open VSX, e.g. `0.1.0`
82+
- `EXTENSION_ID`: the extension ID, e.g. `rebornix.ruby`
83+
- `EXTENSION_PUBLISHER`: the extension publisher, e.g. `rebornix`
84+
- `EXTENSION_NAME`: the extension name, e.g. `ruby`
85+
- `VERSION`: the version of the extension to publish, e.g. `0.1.0`
86+
- `MS_VERSION`: the latest version of the extension on the MS Marketplace[^ms], e.g. `0.1.0`
87+
- `OVSX_VERSION`: the latest version of the extension on Open VSX, e.g. `0.1.0`
8888

8989
[publish-extensions-job]: https://github.com/open-vsx/publish-extensions/blob/master/.github/workflows/publish-extensions.yml
9090

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
A CI script for publishing open-source VS Code extensions to [open-vsx.org](https://open-vsx.org).
66

7-
This repository is open for contributions, but before you contribute, please read our [Contribution guidelines](CONTRIBUTING.md).
7+
This repository is open for contributions, but before you contribute, please read our [Contribution guidelines](CONTRIBUTING.md).

add-extension.js

+60-42
Original file line numberDiff line numberDiff line change
@@ -16,59 +16,67 @@
1616
//
1717

1818
// @ts-check
19-
const fs = require('fs');
20-
const minimist = require('minimist');
21-
const util = require('util');
19+
const fs = require("fs");
20+
const minimist = require("minimist");
21+
const util = require("util");
2222
const exec = require("./lib/exec");
23-
const extensionsSchema = require('./extensions-schema.json');
24-
const fetch = require('node-fetch');
25-
const { getPublicGalleryAPI } = require('@vscode/vsce/out/util');
26-
const parseXmlManifest = require('@vscode/vsce/out/xml').parseXmlManifest;
27-
const { ExtensionQueryFlags, PublishedExtension } = require('azure-devops-node-api/interfaces/GalleryInterfaces');
23+
const extensionsSchema = require("./extensions-schema.json");
24+
const fetch = require("node-fetch");
25+
const { getPublicGalleryAPI } = require("@vscode/vsce/out/util");
26+
const parseXmlManifest = require("@vscode/vsce/out/xml").parseXmlManifest;
27+
const { ExtensionQueryFlags, PublishedExtension } = require("azure-devops-node-api/interfaces/GalleryInterfaces");
2828

2929
const flags = [
3030
ExtensionQueryFlags.IncludeMetadata,
3131
ExtensionQueryFlags.IncludeAssetUri,
3232
ExtensionQueryFlags.IncludeFiles,
33-
ExtensionQueryFlags.IncludeLatestVersionOnly
33+
ExtensionQueryFlags.IncludeLatestVersionOnly,
3434
];
3535

3636
const msGalleryApi = getPublicGalleryAPI();
37-
msGalleryApi.client['_allowRetries'] = true;
38-
msGalleryApi.client['_maxRetries'] = 5;
37+
msGalleryApi.client["_allowRetries"] = true;
38+
msGalleryApi.client["_maxRetries"] = 5;
3939

4040
const getRepositoryFromMarketplace = async (/** @type {string} */ id) => {
4141
/** @type {[PromiseSettledResult<PublishedExtension | undefined>]} */
4242
let [msExtension] = await Promise.allSettled([msGalleryApi.getExtension(id, flags)]);
43-
if (msExtension.status === 'fulfilled') {
44-
const vsixManifest = msExtension.value?.versions && msExtension.value?.versions[0].files?.find(file => file.assetType === "Microsoft.VisualStudio.Services.VsixManifest")?.source;
43+
if (msExtension.status === "fulfilled") {
44+
const vsixManifest =
45+
msExtension.value?.versions &&
46+
msExtension.value?.versions[0].files?.find(
47+
(file) => file.assetType === "Microsoft.VisualStudio.Services.VsixManifest",
48+
)?.source;
4549
const response = await fetch(vsixManifest);
4650
const data = await parseXmlManifest(await response.text());
47-
const url = new URL(data.PackageManifest.Metadata[0].Properties[0].Property.find(property => property.$.Id === "Microsoft.VisualStudio.Services.Links.Source").$.Value);
51+
const url = new URL(
52+
data.PackageManifest.Metadata[0].Properties[0].Property.find(
53+
(property) => property.$.Id === "Microsoft.VisualStudio.Services.Links.Source",
54+
).$.Value,
55+
);
4856

4957
if (url.host === "github.com") {
50-
return url.toString().replace('.git', '')
58+
return url.toString().replace(".git", "");
5159
}
5260

5361
return url.toString();
5462
}
55-
}
63+
};
5664

5765
(async () => {
5866
// Parse args
5967
const argv = minimist(process.argv.slice(2)); // without executable & script path
6068

6169
// Check positional args
6270
if (argv._.length === 0) {
63-
console.error('Need two positional arguments: ext-id, repo-url or a Microsoft Marketplace URL');
71+
console.error("Need two positional arguments: ext-id, repo-url or a Microsoft Marketplace URL");
6472
process.exit(1);
6573
}
6674

6775
let [extID, repoURL] = argv._;
6876
try {
6977
const urlObject = new URL(extID);
70-
if (urlObject.host === 'marketplace.visualstudio.com') {
71-
const id = urlObject.searchParams.get('itemName');
78+
if (urlObject.host === "marketplace.visualstudio.com") {
79+
const id = urlObject.searchParams.get("itemName");
7280
if (!id) {
7381
console.error(`Couldn\'t get the extension ID from ${extID}`);
7482
process.exit(1);
@@ -83,9 +91,12 @@ const getRepositoryFromMarketplace = async (/** @type {string} */ id) => {
8391
}
8492
}
8593
}
86-
} catch { } finally {
94+
} catch {
95+
} finally {
8796
if (argv._.length < 2 && !repoURL) {
88-
console.error('Need two positional arguments: ext-id, repo-url, since the provided argument is not a Marketplace URL');
97+
console.error(
98+
"Need two positional arguments: ext-id, repo-url, since the provided argument is not a Marketplace URL",
99+
);
89100
process.exit(1);
90101
}
91102
}
@@ -105,23 +116,29 @@ const getRepositoryFromMarketplace = async (/** @type {string} */ id) => {
105116
}
106117

107118
// parse & validate value
108-
if (propDef.type === 'string') {
109-
extDefinition[arg] = String(argv[arg]) // minimist might've assumed a different type (e.g. number)
110-
} else if (propDef.type === 'number') {
111-
if (typeof argv[arg] !== 'number') {
112-
console.error(`argument '${arg}' should be type '${propDef.type}' but yours seems to be '${typeof argv[arg]}'`);
119+
if (propDef.type === "string") {
120+
extDefinition[arg] = String(argv[arg]); // minimist might've assumed a different type (e.g. number)
121+
} else if (propDef.type === "number") {
122+
if (typeof argv[arg] !== "number") {
123+
console.error(
124+
`argument '${arg}' should be type '${propDef.type}' but yours seems to be '${typeof argv[arg]}'`,
125+
);
113126
process.exit(1);
114127
}
115-
extDefinition[arg] = argv[arg] // numbers are parsed by minimist already
128+
extDefinition[arg] = argv[arg]; // numbers are parsed by minimist already
116129
} else {
117-
console.error(`argument '${arg}' is of type '${propDef.type}' which is not implemented by this script, sorry`);
130+
console.error(
131+
`argument '${arg}' is of type '${propDef.type}' which is not implemented by this script, sorry`,
132+
);
118133
process.exit(1);
119134
}
120135
}
121-
console.info('Adding extension:', util.inspect(extDefinition, { colors: true, compact: false }));
136+
console.info("Adding extension:", util.inspect(extDefinition, { colors: true, compact: false }));
122137

123138
// Read current file
124-
const extensions = Object.entries(JSON.parse(await fs.promises.readFile('./extensions.json', { encoding: 'utf8' })));
139+
const extensions = Object.entries(
140+
JSON.parse(await fs.promises.readFile("./extensions.json", { encoding: "utf8" })),
141+
);
125142
// Sort extensions (most are, but not always)
126143
extensions.sort(([k1], [k2]) => k1.localeCompare(k2));
127144

@@ -131,9 +148,9 @@ const getRepositoryFromMarketplace = async (/** @type {string} */ id) => {
131148
for (let i = 0; i < extensions.length; i++) {
132149
const [currentID] = extensions[i];
133150
// console.debug(i, currentID)
134-
const diff = currentID.localeCompare(extID, undefined, { sensitivity: 'base' });
151+
const diff = currentID.localeCompare(extID, undefined, { sensitivity: "base" });
135152
if (diff === 0) {
136-
console.error('Extension already defined:', currentID);
153+
console.error("Extension already defined:", currentID);
137154
process.exit(1);
138155
}
139156
if (diff > 0) {
@@ -144,14 +161,14 @@ const getRepositoryFromMarketplace = async (/** @type {string} */ id) => {
144161

145162
// Persist changes
146163
await fs.promises.writeFile(
147-
'./extensions.json',
148-
JSON.stringify(Object.fromEntries(extensions), undefined, 2) + '\n', // add newline at EOF
149-
{ encoding: 'utf8' }
164+
"./extensions.json",
165+
JSON.stringify(Object.fromEntries(extensions), undefined, 2) + "\n", // add newline at EOF
166+
{ encoding: "utf8" },
150167
);
151168

152169
console.info(`Successfully added ${extID}`);
153170
if (process.env.TEST_EXTENSION === "false") {
154-
console.info("Skipping tests, TEST_EXTENSION was provided.")
171+
console.info("Skipping tests, TEST_EXTENSION was provided.");
155172
process.exit(0);
156173
}
157174

@@ -163,15 +180,16 @@ const getRepositoryFromMarketplace = async (/** @type {string} */ id) => {
163180

164181
const out = await exec("node publish-extensions", { quiet: true, ghtoken: true });
165182
if (out && out.stderr.includes("[FAIL] Could not process extension:")) {
166-
console.error(`There was an error while trying to build ${extID}. Reverting back to the previous state of extensions.json.`);
183+
console.error(
184+
`There was an error while trying to build ${extID}. Reverting back to the previous state of extensions.json.`,
185+
);
167186
await fs.promises.writeFile(
168-
'./extensions.json',
169-
originalList + '\n', // add newline at EOF
170-
{ encoding: 'utf8' }
187+
"./extensions.json",
188+
originalList + "\n", // add newline at EOF
189+
{ encoding: "utf8" },
171190
);
172191
} else {
173192
console.info("Built extension successfully");
174193
console.info(`Feel free to use the message below for your commit:\r\nAdded \`${extID}\``);
175194
}
176-
177-
})();
195+
})();

bin/publish-extensions

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env node
22

3-
require('../publish-extensions');
3+
require("../publish-extensions");

0 commit comments

Comments
 (0)