Skip to content
This repository was archived by the owner on Aug 22, 2019. It is now read-only.

Commit feaf733

Browse files
author
Benjamin Van Renterghem
committed
Change zip script to make version-specific file names
1 parent 4ec6835 commit feaf733

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/makeChromeZip.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@ import fs from "fs";
22
import path from "path";
33
import archiver from "archiver";
44

5-
const zipPath = path.join(__dirname, "../dist/extension.zip");
5+
const extensionManifestPath = path.join(__dirname, "../build/manifest.json");
6+
if (!fs.existsSync(extensionManifestPath)) {
7+
throw "No manifest.json found in the build directory.";
8+
}
9+
let extensionVersion: string;
10+
try {
11+
extensionVersion = JSON.parse(fs.readFileSync(extensionManifestPath, { encoding: "utf-8" })).version;
12+
} catch {
13+
throw "Could not get the version from the manifest.json in the build directory.";
14+
}
15+
if (extensionVersion === undefined || extensionVersion === null || extensionVersion === "") {
16+
throw "Version from the manifest.json in the build directory should not be empty.";
17+
}
18+
19+
const zipPath = path.join(__dirname, `../dist/SharepointDirectInvoke_v${extensionVersion}.zip`);
620
const zipDirPath = path.dirname(zipPath);
721

822
if (!fs.existsSync(zipDirPath)) {

0 commit comments

Comments
 (0)