Skip to content

Commit

Permalink
Parse extension.vsixmanifest file
Browse files Browse the repository at this point in the history
Remove --web option for publishing web extension will be inferred from vsixmanifest
  • Loading branch information
jeanp413 committed Sep 8, 2021
1 parent 1e0948d commit 1c6a651
Show file tree
Hide file tree
Showing 22 changed files with 220 additions and 156 deletions.
8 changes: 6 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ tasks:
for pub in $PUBLISHERS; do cli/lib/ovsx create-namespace $pub; done
find server/build/test-extensions-builtin -name '*.vsix' -exec cli/lib/ovsx publish '{}' \;
find server/build/test-extensions -name '*.vsix' -exec cli/lib/ovsx publish '{}' \;
find server/build/test-extensions-web -name '*.vsix' -exec cli/lib/ovsx publish --web '{}' \;
find server/build/test-extensions-web -name '*.vsix' -exec cli/lib/ovsx publish '{}' \;
vscode:
extensions:
- dbaeumer.vscode-eslint@2.1.3:1NRvj3UKNTNwmYjptmUmIw==
- dbaeumer.vscode-eslint
- redhat.java
- vscjava.vscode-java-debug
- vscjava.vscode-java-test
- richardwillis.vscode-gradle
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@
},
"eslint.packageManager": "yarn",
"java.dependency.syncWithFolderExplorer": true,
"java.format.enabled": false
"java.format.enabled": false,
"gradle.nestedProjects": true,
"gradle.javaDebug": {
"tasks": [
"runServer"
]
}
}
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"is-ci": "^2.0.0",
"leven": "^3.1.0",
"tmp": "^0.2.1",
"vsce": "~1.93.0"
"vsce": "~1.97.0"
},
"devDependencies": {
"@types/follow-redirects": "^1.13.0",
Expand Down
5 changes: 2 additions & 3 deletions cli/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ module.exports = function (argv: string[]): void {
.option('--baseContentUrl <url>', 'Prepend all relative links in README.md with this URL.')
.option('--baseImagesUrl <url>', 'Prepend all relative image links in README.md with this URL.')
.option('--yarn', 'Use yarn instead of npm while packing extension files.')
.option('--web', 'Enables publishing of web extensions.')
.action((extensionFile: string, { packagePath, baseContentUrl, baseImagesUrl, yarn, web }) => {
.action((extensionFile: string, { packagePath, baseContentUrl, baseImagesUrl, yarn }) => {
if (extensionFile !== undefined && packagePath !== undefined) {
console.error('\u274c Please specify either a package file or a package path, but not both.\n');
publishCmd.help();
Expand All @@ -52,7 +51,7 @@ module.exports = function (argv: string[]): void {
if (extensionFile !== undefined && yarn !== undefined)
console.warn("Ignoring option '--yarn' for prepackaged extension.");
const { registryUrl, pat } = program.opts();
publish({ extensionFile, registryUrl, pat, packagePath, baseContentUrl, baseImagesUrl, yarn, web })
publish({ extensionFile, registryUrl, pat, packagePath, baseContentUrl, baseImagesUrl, yarn })
.catch(handleError(program.debug,
'See the documentation for more information:\n'
+ 'https://github.com/eclipse/openvsx/wiki/Publishing-Extensions'
Expand Down
17 changes: 4 additions & 13 deletions cli/src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function publish(options: PublishOptions = {}): Promise<void> {
console.log(); // new line
}

const extension = await registry.publish(options.extensionFile!, options.pat, options.web);
const extension = await registry.publish(options.extensionFile!, options.pat);
if (extension.error) {
throw new Error(extension.error);
}
Expand Down Expand Up @@ -57,10 +57,6 @@ export interface PublishOptions extends RegistryOptions {
* Should use `yarn` instead of `npm`. Only valid with `packagePath`.
*/
yarn?: boolean;
/**
* Enables publishing of web extensions.
*/
web?: boolean;
}

async function packageExtension(options: PublishOptions, registry: Registry): Promise<void> {
Expand All @@ -69,17 +65,12 @@ async function packageExtension(options: PublishOptions, registry: Registry): Pr
}

options.extensionFile = await createTempFile({ postfix: '.vsix' });
const createVSIXOptions: IPackageOptions = {
const createVSIXOptions: ICreateVSIXOptions = {
cwd: options.packagePath,
packagePath: options.extensionFile,
baseContentUrl: options.baseContentUrl,
baseImagesUrl: options.baseImagesUrl,
useYarn: options.yarn,
web: options.web
useYarn: options.yarn
};
await createVSIX(createVSIXOptions);
}

interface IPackageOptions extends ICreateVSIXOptions {
web?: boolean // experimental flag, not part of the public ICreateVSIXOptions api, yet
}
}
5 changes: 1 addition & 4 deletions cli/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ export class Registry {
}
}

publish(file: string, pat: string, web?: boolean): Promise<Extension> {
publish(file: string, pat: string): Promise<Extension> {
try {
const query: { [key: string]: string } = { token: pat };
if (web) {
query.web = 'true';
}
const url = this.getUrl('api/-/publish', query);
return this.postFile(file, url, {
'Content-Type': 'application/octet-stream'
Expand Down
27 changes: 11 additions & 16 deletions cli/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ astral-regex@^1.0.0:
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==

azure-devops-node-api@^10.2.2:
version "10.2.2"
resolved "https://registry.yarnpkg.com/azure-devops-node-api/-/azure-devops-node-api-10.2.2.tgz#9f557e622dd07bbaa9bd5e7e84e17c761e2151b2"
integrity sha512-4TVv2X7oNStT0vLaEfExmy3J4/CzfuXolEcQl/BRUmvGySqKStTG2O55/hUQ0kM7UJlZBLgniM0SBq4d/WkKow==
azure-devops-node-api@^11.0.1:
version "11.0.1"
resolved "https://registry.yarnpkg.com/azure-devops-node-api/-/azure-devops-node-api-11.0.1.tgz#b7ec4783230e1de8fc972b23effe7ed2ebac17ff"
integrity sha512-YMdjAw9l5p/6leiyIloxj3k7VIvYThKjvqgiQn88r3nhT93ENwsoDS3A83CyJ4uTWzCZ5f5jCi6c27rTU5Pz+A==
dependencies:
tunnel "0.0.6"
typed-rest-client "^1.8.4"
Expand Down Expand Up @@ -671,11 +671,6 @@ ignore@^4.0.6:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==

ignore@^5.1.8:
version "5.1.8"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==

import-fresh@^3.0.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66"
Expand Down Expand Up @@ -800,7 +795,7 @@ mime@^1.3.4:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==

minimatch@^3.0.4:
minimatch@^3.0.3, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
Expand Down Expand Up @@ -1161,22 +1156,22 @@ v8-compile-cache@^2.0.3:
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745"
integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==

vsce@~1.93.0:
version "1.93.0"
resolved "https://registry.yarnpkg.com/vsce/-/vsce-1.93.0.tgz#676395f24f27f850f63240b339ed551e2e1d80db"
integrity sha512-RgmxwybXenP6tTF0PLh97b/RRLp1RkzjAHNya3QAfv1EZVg+lfoBiAaXogpmOGjYr8OskkqP5tIa3D/Q6X9lrw==
vsce@~1.97.0:
version "1.97.0"
resolved "https://registry.yarnpkg.com/vsce/-/vsce-1.97.0.tgz#78490745c3ce4f18c390fc1319c0b1250095a153"
integrity sha512-5Rxj6qO0dN4FnzVS9G94osstx8R3r1OQP39G7WYERpoO9X+OSodVVkRhFDapPNjekfUNo+d5Qn7W1EtNQVoLCg==
dependencies:
azure-devops-node-api "^10.2.2"
azure-devops-node-api "^11.0.1"
chalk "^2.4.2"
cheerio "^1.0.0-rc.9"
commander "^6.1.0"
denodeify "^1.2.1"
glob "^7.0.6"
ignore "^5.1.8"
leven "^3.1.0"
lodash "^4.17.15"
markdown-it "^10.0.0"
mime "^1.3.4"
minimatch "^3.0.3"
osenv "^0.1.3"
parse-semver "^1.1.1"
read "^1.0.7"
Expand Down
6 changes: 6 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ dependencies {
implementation "com.azure:azure-storage-blob:${versions.azure}"
implementation "io.springfox:springfox-boot-starter:${versions.springfox}"
implementation "com.google.guava:guava:${versions.guava}"
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.5'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.5'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.5'
implementation 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.12.5'
implementation 'com.fasterxml.woodstox:woodstox-core:6.2.4'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.12.5'
implementation("org.spdx:spdx-tools:${versions.spdx}") {
exclude group: 'net.sf.saxon'
exclude group: 'org.antlr', module: 'antlr'
Expand Down
Loading

0 comments on commit 1c6a651

Please sign in to comment.