diff --git a/README.md b/README.md
index 13cbb16..f9f5925 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@ Scripts use a small metadata block followed by ordinary JavaScript. OpenScript s
```javascript
// ==UserScript==
// @name GitHub Repo Stats
+// @version 1.0.0
// @description Logs repository metadata
// @match https://github.com/*
// @run-at document_idle
@@ -41,6 +42,7 @@ console.log(await response.json());
| Directive | Description | Required |
| :--- | :--- | :--- |
| `@name` | Name displayed in the popup | Yes |
+| `@version` | Version displayed beside the script name | No |
| `@match` | Chrome match pattern; repeat for multiple patterns | Yes |
| `@description` | Short summary displayed in the popup | No |
| `@run-at` | `document_idle`, `document_start`, or `document_end` | No |
diff --git a/src/popup.js b/src/popup.js
index a0b2f85..f37ab83 100644
--- a/src/popup.js
+++ b/src/popup.js
@@ -40,7 +40,10 @@ const init = async () => {
await syncScripts(false);
const [scripts, secrets] = await Promise.all([getScripts(), getSecrets()]);
await garbageCollectScriptStorage(scripts.map(s => s.id));
- state.scripts = scripts;
+ state.scripts = scripts.map(s => ({
+ ...s,
+ version: parseMeta(s.code || '').version,
+ }));
state.secrets = secrets;
render();
};
@@ -82,6 +85,7 @@ const saveCurrentScript = async () => {
const scriptObj = {
id: state.editingId || `script_${Date.now()}`,
name: meta.name,
+ version: meta.version,
description: meta.description,
matches: meta.matches,
requires: meta.requires,
@@ -204,6 +208,7 @@ const renderScriptList = () => {
${s.name}
+ ${s.version ? `v${s.version}` : ''}