forked from external/vscode-xml
		
	Fix Manifest Reader
This commit is contained in:
		
							parent
							
								
									a26f829399
								
							
						
					
					
						commit
						e24a560066
					
				
					 2 changed files with 10 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -19,24 +19,16 @@ export class ExtensionManifestReader {
 | 
			
		|||
	keywords: string[];
 | 
			
		||||
	icon: string;
 | 
			
		||||
	
 | 
			
		||||
	private _checkPropertyExists(propertyName: string) {
 | 
			
		||||
		for (let property in this) {
 | 
			
		||||
			if (property === propertyName) return true;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	refresh(): void {
 | 
			
		||||
		let manifest = this._extension.packageJSON;
 | 
			
		||||
		
 | 
			
		||||
		for (let property in manifest)
 | 
			
		||||
		{
 | 
			
		||||
			if (this._checkPropertyExists(property)) {
 | 
			
		||||
				this[property] = manifest[property];
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		this.name = manifest.name;
 | 
			
		||||
		this.version = manifest.version;
 | 
			
		||||
		this.publisher = manifest.publisher;
 | 
			
		||||
		this.displayName = manifest.displayName;
 | 
			
		||||
		this.description = manifest.description;
 | 
			
		||||
		this.categories = manifest.categories;
 | 
			
		||||
		this.keywords = manifest.keywords;
 | 
			
		||||
		this.icon = manifest.icon;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ let semver = require('semver');
 | 
			
		|||
 | 
			
		||||
export function checkForUpdates() {	
 | 
			
		||||
	let manifestReader: ExtensionManifestReader = new ExtensionManifestReader('DotJoshJohnson.xml');
 | 
			
		||||
	let currentVersion = '0.0.0';//manifestReader.version;
 | 
			
		||||
	let currentVersion = manifestReader.version;
 | 
			
		||||
	
 | 
			
		||||
	// use the GitHub api to determine the latest released version
 | 
			
		||||
	let url = 'https://api.github.com/repos/DotJoshJohnson/vscode-xml/releases/latest';
 | 
			
		||||
| 
						 | 
				
			
			@ -27,10 +27,10 @@ export function checkForUpdates() {
 | 
			
		|||
			let latestVersion = release.name.substring(1); // the release/tag is prefixed with a "v"
 | 
			
		||||
			
 | 
			
		||||
			if (!release.draft && semver.gt(latestVersion, currentVersion)) {
 | 
			
		||||
				let updateNowLabel = 'Update Now';
 | 
			
		||||
				let updateNowLabel = 'Open Extension Manager';
 | 
			
		||||
				window.showInformationMessage(`Version ${latestVersion} of the ${manifestReader.displayName} extension is available.`, updateNowLabel).then((clicked) => {
 | 
			
		||||
					if (clicked == updateNowLabel) {
 | 
			
		||||
						commands.executeCommand('workbench.extensions.action.installExtension', manifestReader.displayName);
 | 
			
		||||
						commands.executeCommand('workbench.extensions.action.listExtensions', manifestReader.displayName);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue