Skip to content

Commit

Permalink
chore: update dev dependencies, fix code style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ahwayakchih committed Feb 2, 2025
1 parent 9b26b56 commit c84142b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
6 changes: 2 additions & 4 deletions lib/writeCRX3File.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,13 @@ function writeFromListOfFiles (crxStream, files) {
.then(resolve)
.catch(reject);

const zipOptions = {
compressionLevel: 9
};
const zipOptions = {compressionLevel: 9}; // eslint-disable-line no-magic-numbers

if (crxStream.crx.cfg.forceDateTime > 0) {
zipOptions.mtime = new Date(crxStream.crx.cfg.forceDateTime);
}

files.forEach(file => zip.addFile(file, file.replace(rootPath, ''), zipOptions)); // eslint-disable-line no-magic-numbers
files.forEach(file => zip.addFile(file, file.replace(rootPath, ''), zipOptions));

zip.end();
});
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crx3",
"version": "1.1.4",
"version": "2.0.0",
"description": "Package web extension into CRX file (version 3) for Google Chrome and Chromium browsers",
"main": "index.js",
"homepage": "https://github.com/ahwayakchih/crx3",
Expand All @@ -22,8 +22,8 @@
"devDependencies": {
"c8": "^10.1.3",
"docdash": "^2.0.1",
"eslint": "^9.18.0",
"eslint-plugin-jsdoc": "^50.6.1",
"eslint": "^9.19.0",
"eslint-plugin-jsdoc": "^50.6.3",
"jsdoc": "^4.0.2",
"tap-diff": "^0.1.1",
"tape": "^5.6.3",
Expand Down
16 changes: 10 additions & 6 deletions test/lib/writeCRX3File.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ function testWriteCRX3FileWithFilesAndOptions (t) {
};

const manifestPath = path.join(CWD, 'example', 'example-extension', 'manifest.json');
// Use the same date and time for source files as those already in example ZIP and CRX files, that we will compare new ones to.
const filesTimestamp = 1553470140000; // '2019-03-24T23:29:00.000Z'
const p = writeCRX3File([manifestPath], {
crxPath : temp.crx,
zipPath : temp.zip,
xmlPath : temp.xml,
keyPath : path.join(CWD, 'example', 'example-extension.pem'),
crxURL : `http://127.0.0.1:8080/${path.basename(temp.crx)}`,
forceDateTime: 1553470140000 // '2019-03-24T23:29:00.000Z'
forceDateTime: filesTimestamp
});

t.strictEqual(typeof p, 'object', 'Should return object when called with files and options');
Expand Down Expand Up @@ -217,10 +219,12 @@ async function doesItWorkInChrome (t, cfg) {

const margin = ' '.padStart(t._objectPrintDepth || 0, '.'); // eslint-disable-line no-underscore-dangle

// Since v112, Chrome/Chromium has "new" headless mode, which supports extensions and does not need XVFB.
// But there are problems running it by GitHub Actions (inside a rootful container),
// so allow to force using "full mode" by setting `CHROME_DISABLE_SANDBOX` in environment.
/* eslint-disable array-element-newline, array-bracket-newline, multiline-comment-style */
/*
* Since v112, Chrome/Chromium has "new" headless mode, which supports extensions and does not need XVFB.
* But there are problems running it by GitHub Actions (inside a rootful container),
* so allow to force using "full mode" by setting `CHROME_DISABLE_SANDBOX` in environment.
*/
/* eslint-disable array-element-newline, multiline-comment-style */
const runFullModeMode = process.env.CHROME_DISABLE_SANDBOX || !testVersion(chromeVersion.trim(), '112.0.5614.0');
const browserIgnoreDefaultArgs = [
'--disable-extensions', // Do not disable extensions when we want to test them ;P
Expand Down Expand Up @@ -253,7 +257,7 @@ async function doesItWorkInChrome (t, cfg) {
else {
t.comment(`${margin}Running browser using "new" headless mode, XVFB is not needed`);
}
/* eslint-enable array-element-newline, array-bracket-newline, multiline-comment-style */
/* eslint-enable array-element-newline, multiline-comment-style */

const browser = await puppeteer.launch({
headless : false, // This has to be false, even when we're passing `headless=new` option
Expand Down

0 comments on commit c84142b

Please sign in to comment.