From 6421e8b24c13f33b84cf2d8e91a8e36e96d35d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Saccoccio?= Date: Thu, 23 Jan 2020 23:12:23 +0100 Subject: [PATCH] automatically set manifest version when missing --- src/ManifestAsset.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ManifestAsset.js b/src/ManifestAsset.js index 8f24619..5a0e212 100644 --- a/src/ManifestAsset.js +++ b/src/ManifestAsset.js @@ -294,7 +294,7 @@ class ManifestAsset extends Asset { } hasWebExtensionManifestKeys() { - const requiredKeys = ['manifest_version', 'name', 'version'] + const requiredKeys = ['manifest_version', 'name'] return requiredKeys.every(key => !!this.ast[key]) } @@ -311,6 +311,12 @@ class ManifestAsset extends Asset { } } + transform() { + if (this.kind === 'webext-manifest' && this.ast.version === undefined) { + this.ast.version = require(path.resolve(process.env.INIT_CWD, 'package.json')).version + } + } + generate() { if (this.isAstDirty) { return JSON.stringify(this.ast)