-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.js
25 lines (22 loc) · 773 Bytes
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* eslint-disable @typescript-eslint/no-var-requires */
import crx3 from 'crx3';
import { join } from 'path';
import { existsSync, rmSync } from 'fs';
import packageJson from './package.json' assert { type: 'json' };
let manifestPath = join('./dist', 'manifest.json');
const name = packageJson.name;
console.log(`Building '${name}' with manifest from ${manifestPath}`);
try {
const extensionPath = join('dist', name + '.crx');
if (existsSync(extensionPath)) {
rmSync(extensionPath);
}
crx3([manifestPath], {
keyPath: join('secrets', 'private-key.pem'),
crxPath: extensionPath,
}).then(function () {
console.log('Extension package written to ' + join('dist', name + '.crx'));
});
} catch (errorMsg) {
console.error(`Error: ${errorMsg}s`);
}