From 5a88c65b39833230b296f5bb2125fd8bc75a25ed Mon Sep 17 00:00:00 2001 From: Leo Hanisch Date: Fri, 2 Feb 2024 17:40:59 +0100 Subject: [PATCH] fix: revert build target to es6 --- CHANGELOG.md | 10 ++- dist/index.js | 163 ++++++++++++++++++++++++++++------------------ package-lock.json | 4 +- package.json | 2 +- tsconfig.json | 2 +- 5 files changed, 112 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a28c7c7..eb394fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -[All Changes](https://github.com/HaaLeo/publish-vscode-extension/compare/v1.6.0...master) +[All Changes](https://github.com/HaaLeo/publish-vscode-extension/compare/v1.6.1...master) + +## [1.6.1](https://github.com/HaaLeo/publish-vscode-extension/tree/1.6.1) 2024-02-02 + +### Changed + +* Reverted build target back to `es6` ([#51](https://github.com/HaaLeo/publish-vscode-extension/issues/51)) + +[All Changes](https://github.com/HaaLeo/publish-vscode-extension/compare/v1.6.0...v1.6.1) ## [1.6.0](https://github.com/HaaLeo/publish-vscode-extension/tree/1.6.0) 2024-02-01 diff --git a/dist/index.js b/dist/index.js index adf861f..a56c61a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -134803,80 +134803,104 @@ function bufferIncludes(buffer, content) { /***/ }), /***/ 85325: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createPackage = void 0; const fs = __nccwpck_require__(57147); const path = __nccwpck_require__(71017); const core = __nccwpck_require__(42186); const vsce_1 = __nccwpck_require__(79295); -async function createPackage(ovsxOptions) { - let vsixPath; - if (ovsxOptions.extensionFile) { - vsixPath = ovsxOptions.extensionFile; - core.info('The extension was already packaged. Skip packaging.'); - } - else if (ovsxOptions.packagePath) { - const packageName = await _getPackageName(ovsxOptions.packagePath); - vsixPath = path.join(ovsxOptions.packagePath, packageName); - const options = _convertToVSCECreateVSIXOptions(ovsxOptions, vsixPath); - core.info('Start packaging the extension.'); - await (0, vsce_1.createVSIX)(options); - } - else { - throw new Error('Either option "packagePath" or "extensionFile" must be set.'); - } - return vsixPath; +function createPackage(ovsxOptions) { + return __awaiter(this, void 0, void 0, function* () { + let vsixPath; + if (ovsxOptions.extensionFile) { + vsixPath = ovsxOptions.extensionFile; + core.info('The extension was already packaged. Skip packaging.'); + } + else if (ovsxOptions.packagePath) { + const packageName = yield _getPackageName(ovsxOptions.packagePath); + vsixPath = path.join(ovsxOptions.packagePath, packageName); + const options = _convertToVSCECreateVSIXOptions(ovsxOptions, vsixPath); + core.info('Start packaging the extension.'); + yield (0, vsce_1.createVSIX)(options); + } + else { + throw new Error('Either option "packagePath" or "extensionFile" must be set.'); + } + return vsixPath; + }); } exports.createPackage = createPackage; function _convertToVSCECreateVSIXOptions(options, targetVSIXPath) { // Shallow copy of options - const { baseContentUrl, baseImagesUrl, yarn: useYarn, packagePath: cwd, preRelease, dependencies } = { ...options }; + const { baseContentUrl, baseImagesUrl, yarn: useYarn, packagePath: cwd, preRelease, dependencies } = Object.assign({}, options); const result = { baseContentUrl, useYarn, baseImagesUrl, cwd, packagePath: targetVSIXPath, preRelease, dependencies }; return result; } -async function _getPackageName(packagePath) { - const rawJson = await fs.promises.readFile(path.join(packagePath, 'package.json'), 'utf8'); - const json = JSON.parse(rawJson); - if (!json.name || !json.version) { - throw new Error('The extension\'s package.json must contain a "name" and "version" field.'); - } - return `${json.name}-${json.version}.vsix`; +function _getPackageName(packagePath) { + return __awaiter(this, void 0, void 0, function* () { + const rawJson = yield fs.promises.readFile(path.join(packagePath, 'package.json'), 'utf8'); + const json = JSON.parse(rawJson); + if (!json.name || !json.version) { + throw new Error('The extension\'s package.json must contain a "name" and "version" field.'); + } + return `${json.name}-${json.version}.vsix`; + }); } /***/ }), /***/ 70399: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.main = void 0; const core = __nccwpck_require__(42186); const packageJSON = __nccwpck_require__(4147); const createPackage_1 = __nccwpck_require__(85325); const publish_1 = __nccwpck_require__(19334); -async function main() { - process.on('uncaughtException', _errorHandler); - process.on('unhandledRejection', _errorHandler); - const actionInfo = packageJSON; - core.info(`Specifically, running GitHub Action ${typeof actionInfo.author === 'string' ? actionInfo.author : actionInfo.author.name}/${actionInfo.name}@v${actionInfo.version}.`); - const options = _getInputs(); - core.debug(`Start action with options="${JSON.stringify(options)}".`); - const vsixPath = await core.group('Package the Extension', () => (0, createPackage_1.createPackage)(options)); - core.setOutput('vsixPath', vsixPath); - if (options.dryRun) { - core.info('"dryRun" option is set. Skip publishing.'); - } - else { - options.extensionFile = vsixPath; - await core.group('Publish the Extension', () => (0, publish_1.publish)(options)); - } +function main() { + return __awaiter(this, void 0, void 0, function* () { + process.on('uncaughtException', _errorHandler); + process.on('unhandledRejection', _errorHandler); + const actionInfo = packageJSON; + core.info(`Specifically, running GitHub Action ${typeof actionInfo.author === 'string' ? actionInfo.author : actionInfo.author.name}/${actionInfo.name}@v${actionInfo.version}.`); + const options = _getInputs(); + core.debug(`Start action with options="${JSON.stringify(options)}".`); + const vsixPath = yield core.group('Package the Extension', () => (0, createPackage_1.createPackage)(options)); + core.setOutput('vsixPath', vsixPath); + if (options.dryRun) { + core.info('"dryRun" option is set. Skip publishing.'); + } + else { + options.extensionFile = vsixPath; + yield core.group('Publish the Extension', () => (0, publish_1.publish)(options)); + } + }); } exports.main = main; function _errorHandler(error) { @@ -134911,40 +134935,51 @@ function _getInputs() { /***/ }), /***/ 19334: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.publish = void 0; const ovsx_1 = __nccwpck_require__(69333); const vsce_1 = __nccwpck_require__(79295); -async function publish(ovsxOptions) { - if (ovsxOptions.registryUrl === 'https://marketplace.visualstudio.com') { - const vsceOptions = _convertToVSCEPublishOptions(ovsxOptions); - await (0, vsce_1.publishVSIX)(ovsxOptions.extensionFile, vsceOptions); - } - else { - let options; - if (ovsxOptions.target) { - const targets = ovsxOptions.target.split(' '); - options = { ...ovsxOptions, targets, packagePath: [ovsxOptions.packagePath] }; +function publish(ovsxOptions) { + return __awaiter(this, void 0, void 0, function* () { + if (ovsxOptions.registryUrl === 'https://marketplace.visualstudio.com') { + const vsceOptions = _convertToVSCEPublishOptions(ovsxOptions); + yield (0, vsce_1.publishVSIX)(ovsxOptions.extensionFile, vsceOptions); } else { - options = { ...ovsxOptions, packagePath: [ovsxOptions.packagePath] }; - } - const results = await (0, ovsx_1.publish)(options); - results?.forEach(result => { - if (result.status === 'rejected') { - throw result.reason; + let options; + if (ovsxOptions.target) { + const targets = ovsxOptions.target.split(' '); + options = Object.assign(Object.assign({}, ovsxOptions), { targets, packagePath: [ovsxOptions.packagePath] }); } - }); - } + else { + options = Object.assign(Object.assign({}, ovsxOptions), { packagePath: [ovsxOptions.packagePath] }); + } + const results = yield (0, ovsx_1.publish)(options); + results === null || results === void 0 ? void 0 : results.forEach(result => { + if (result.status === 'rejected') { + throw result.reason; + } + }); + } + }); } exports.publish = publish; function _convertToVSCEPublishOptions(options) { // Shallow copy of options - const { baseContentUrl, baseImagesUrl, pat, yarn: useYarn, noVerify, dependencies, skipDuplicate, preRelease, target } = { ...options }; + const { baseContentUrl, baseImagesUrl, pat, yarn: useYarn, noVerify, dependencies, skipDuplicate, preRelease, target } = Object.assign({}, options); const result = { baseContentUrl, useYarn, @@ -147548,7 +147583,7 @@ module.exports = JSON.parse('{"application/andrew-inset":["ez"],"application/app /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"publish-vscode-extension","version":"1.5.0","description":"GitHub action to publish your VS Code Extension to the Open VSX Registry.","main":"dist/index.js","scripts":{"test":"nyc mocha \'out/test/**/*.test.js\'","coverage":"nyc report --reporter=lcov","build":"npm run build:ncc && npm run build:test","build:ncc":"ncc build src/index.ts --source-map --no-source-map-register","build:test":"tsc -p tsconfig.json","lint":"eslint . --ext .ts"},"repository":{"type":"git","url":"git+https://github.com/HaaLeo/publish-vscode-extension.git"},"keywords":["github","action","open","vsx","vscode","publish","Visual Studio Code"],"author":{"name":"HaaLeo","url":"https://github.com/HaaLeo"},"license":"SEE LICENSE IN LICENSE.txt","bugs":{"url":"https://github.com/HaaLeo/publish-vscode-extension/issues"},"homepage":"https://github.com/HaaLeo/publish-vscode-extension#readme","dependencies":{"@actions/core":"^1.10.0","@vscode/vsce":"^2.19.0","ovsx":"^0.8.3"},"devDependencies":{"@types/chai":"^4.3.0","@types/chai-as-promised":"^7.1.4","@types/mocha":"^10.0.0","@types/node":"^16.11.26","@types/sinon":"^10.0.6","@types/sinon-chai":"^3.2.6","@typescript-eslint/eslint-plugin":"^5.7.0","@typescript-eslint/parser":"^5.7.0","@vercel/ncc":"^0.38.0","chai":"^4.3.4","chai-as-promised":"^7.1.1","eslint":"^8.4.1","eslint-plugin-import":"^2.25.3","eslint-plugin-prefer-arrow":"^1.2.3","mocha":"^10.2.0","nyc":"^15.1.0","sinon":"^16.0.0","sinon-chai":"^3.7.0","typescript":"^5.0.3"}}'); +module.exports = JSON.parse('{"name":"publish-vscode-extension","version":"1.6.1","description":"GitHub action to publish your VS Code Extension to the Open VSX Registry.","main":"dist/index.js","scripts":{"test":"nyc mocha \'out/test/**/*.test.js\'","coverage":"nyc report --reporter=lcov","build":"npm run build:ncc && npm run build:test","build:ncc":"ncc build src/index.ts --source-map --no-source-map-register","build:test":"tsc -p tsconfig.json","lint":"eslint . --ext .ts"},"repository":{"type":"git","url":"git+https://github.com/HaaLeo/publish-vscode-extension.git"},"keywords":["github","action","open","vsx","vscode","publish","Visual Studio Code"],"author":{"name":"HaaLeo","url":"https://github.com/HaaLeo"},"license":"SEE LICENSE IN LICENSE.txt","bugs":{"url":"https://github.com/HaaLeo/publish-vscode-extension/issues"},"homepage":"https://github.com/HaaLeo/publish-vscode-extension#readme","dependencies":{"@actions/core":"^1.10.0","@vscode/vsce":"^2.19.0","ovsx":"^0.8.3"},"devDependencies":{"@types/chai":"^4.3.0","@types/chai-as-promised":"^7.1.4","@types/mocha":"^10.0.0","@types/node":"^16.11.26","@types/sinon":"^10.0.6","@types/sinon-chai":"^3.2.6","@typescript-eslint/eslint-plugin":"^5.7.0","@typescript-eslint/parser":"^5.7.0","@vercel/ncc":"^0.38.0","chai":"^4.3.4","chai-as-promised":"^7.1.1","eslint":"^8.4.1","eslint-plugin-import":"^2.25.3","eslint-plugin-prefer-arrow":"^1.2.3","mocha":"^10.2.0","nyc":"^15.1.0","sinon":"^16.0.0","sinon-chai":"^3.7.0","typescript":"^5.0.3"}}'); /***/ }) diff --git a/package-lock.json b/package-lock.json index 51b9dc4..67fdd3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "publish-vscode-extension", - "version": "1.6.0", + "version": "1.6.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "publish-vscode-extension", - "version": "1.6.0", + "version": "1.6.1", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@actions/core": "^1.10.0", diff --git a/package.json b/package.json index 69842e0..9bff5db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "publish-vscode-extension", - "version": "1.6.0", + "version": "1.6.1", "description": "GitHub action to publish your VS Code Extension to the Open VSX Registry.", "main": "dist/index.js", "scripts": { diff --git a/tsconfig.json b/tsconfig.json index 14a020c..84be37d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "ES2022", + "target": "es6", "sourceMap": true, "strictPropertyInitialization": false, "noUnusedLocals": true,