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

Commit

Permalink
Change zip script to make version-specific file names
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Van Renterghem committed Apr 28, 2019
1 parent 4ec6835 commit feaf733
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion scripts/makeChromeZip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ import fs from "fs";
import path from "path";
import archiver from "archiver";

const zipPath = path.join(__dirname, "../dist/extension.zip");
const extensionManifestPath = path.join(__dirname, "../build/manifest.json");
if (!fs.existsSync(extensionManifestPath)) {
throw "No manifest.json found in the build directory.";
}
let extensionVersion: string;
try {
extensionVersion = JSON.parse(fs.readFileSync(extensionManifestPath, { encoding: "utf-8" })).version;
} catch {
throw "Could not get the version from the manifest.json in the build directory.";
}
if (extensionVersion === undefined || extensionVersion === null || extensionVersion === "") {
throw "Version from the manifest.json in the build directory should not be empty.";
}

const zipPath = path.join(__dirname, `../dist/SharepointDirectInvoke_v${extensionVersion}.zip`);
const zipDirPath = path.dirname(zipPath);

if (!fs.existsSync(zipDirPath)) {
Expand Down

0 comments on commit feaf733

Please sign in to comment.