Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
02095f9
♻ refactor: Main source files as ES Modules
vict0rsch Jul 20, 2025
7e321da
🏗 build: Use Rollup to bundle modules to `iife`
vict0rsch Jul 20, 2025
df0dc0d
♻ refactor: Use bundled entry points in html files & manifest
vict0rsch Jul 20, 2025
1154222
✨ feat: New function to analyse the contents of `.js` files
vict0rsch Jul 20, 2025
1f01530
🧪 test: Tests as ES Modules too
vict0rsch Jul 20, 2025
7d6fc5b
🏗 build: Gulp uses Rollup
vict0rsch Jul 20, 2025
99a5f32
♻ refactor: Simplify map_functions.py
vict0rsch Jul 20, 2025
f9d933d
♻ refactor: Use `.bundle.js` pattern
vict0rsch Jul 20, 2025
d394409
🐛 fix: Remove legacy assignments to window and module.exports
vict0rsch Jul 20, 2025
36494cc
🐛 fix: Map HTML & Manifest to `.bundle.js`
vict0rsch Jul 20, 2025
ccf28cc
♻ refactor: Remove gulp altogether and replace with Rollup
vict0rsch Jul 31, 2025
840bc79
✨ feat: Debug utility in DEV mode (`PMDebug`)
vict0rsch Jul 31, 2025
a745340
♻ refactor: Use `octokit` natively
vict0rsch Jul 31, 2025
b43ef4f
🐛 fix: Prevent double popup main script run
vict0rsch Jul 31, 2025
caf21f8
✨ feat: Enable debuging on all HTML pages
vict0rsch Aug 1, 2025
167a750
🧪 test: Fix tests module & data paths
vict0rsch Aug 1, 2025
3d127b2
🏗 build: Dev mode debug imports
vict0rsch Aug 1, 2025
c6a95d9
🐛 fix: Fix variable definitions and config url match return types
vict0rsch Aug 1, 2025
a8f711b
🧪 test: Fix test sources truncation & chrome discovery
vict0rsch Aug 1, 2025
77b3e6a
🧪 test: Add test to make sure the extension is loaded
vict0rsch Aug 1, 2025
98e46c2
🐛 fix: Delete all __keys when migrating
vict0rsch Aug 2, 2025
248ec94
♻ refactor: Catch PWC error of discontinued API
vict0rsch Aug 2, 2025
f8dc5d4
🐛 fix: Missing import
vict0rsch Aug 2, 2025
0b5c1f4
🧪 test: Work on sync test
vict0rsch Aug 2, 2025
f91aec8
🏗 build: Dev Bundle
vict0rsch Aug 2, 2025
7ebe90b
🧪 test: First UI tests
vict0rsch Aug 2, 2025
5abdcb0
🐛 fix: Prevent content script exec on non-abs. Arxiv pages
vict0rsch Aug 8, 2025
39b4977
🐛 fix: Disable PWC API Calls
vict0rsch Aug 8, 2025
0b44ea6
✨ feat: Add getPapers debug util
vict0rsch Aug 8, 2025
d126b52
♻ refactor: Rename button to `done-` instead of legacy `cancel`
vict0rsch Aug 8, 2025
717f918
🧪 test: Add Memory Items UI tests
vict0rsch Aug 8, 2025
154c7f0
🐛 fix: Adapt `loadPaperMemoryUtils`
vict0rsch Aug 8, 2025
4e44ee5
♻ refactor: Move `setPreferencesAndReload` to `browser.js`
vict0rsch Aug 8, 2025
44bf71c
♻ refactor: Use directly the util functions (`miniHash`)
vict0rsch Aug 8, 2025
5a576e9
🐛 fix: Placeholder error using `findEl`
vict0rsch Aug 8, 2025
636bebd
🧪 test: v0 popup search
vict0rsch Aug 8, 2025
d050aab
🧪 test: Passing search tests
vict0rsch Aug 11, 2025
232fc4b
🧪 test: Faster tests
vict0rsch Aug 11, 2025
7e22051
♻ refactor: Refactor popup main execution + `getCurrentUserTab`
vict0rsch Oct 17, 2025
4ac950d
🐛 fix: Close window after website url click
vict0rsch Oct 17, 2025
7020e91
🧪 test: Improve existing tests
vict0rsch Oct 17, 2025
f781d67
🧪 test: New test-menu
vict0rsch Oct 17, 2025
841c4ec
🧪 test: New test-popup-paper-ui
vict0rsch Oct 17, 2025
a743dd8
🧪 test: Fix broken test imports & PM utils usage
vict0rsch Oct 17, 2025
df7d483
🐛 fix: Fix indents
vict0rsch Oct 17, 2025
ee1a38f
🏗 build: Dev bundle
vict0rsch Oct 17, 2025
e32e098
Fix ACM paper parsing & Tests in CI (#333)
vict0rsch Oct 18, 2025
565478a
🐛 fix: Improve BioRxiv parsing
vict0rsch Oct 19, 2025
fb2d7a6
🧹 chore: Remove hidenotif warning
vict0rsch Oct 19, 2025
14edd99
🐛 fix: NeurIPS parsing
vict0rsch Oct 19, 2025
003ea1b
🐛 fix: Fix PubMed Central parsing
vict0rsch Oct 19, 2025
33962c4
🐛 fix: Fix PMLR parsing
vict0rsch Oct 19, 2025
9642320
🐛 fix: More robust PMC parsing
vict0rsch Oct 19, 2025
3c2af70
🧪 test: Set botPrevention for APS
vict0rsch Oct 19, 2025
57dca26
🧪 test: Improve logging for papers ignored
vict0rsch Oct 19, 2025
d9960bb
🐛 fix: Fix ChemRxiv parsing
vict0rsch Oct 20, 2025
7294355
🐛 fix: Fix Frontiers parsing
vict0rsch Oct 20, 2025
6a557c7
🧪 test: Add missing sources test urls
vict0rsch Oct 20, 2025
33a78bd
🧪 test: Test all known sources have at least 1 test url
vict0rsch Oct 20, 2025
d6d30f7
🧪 test: Milestone: all test-storage pass ✨
vict0rsch Oct 20, 2025
39d42f1
🔄 ci: Add test-storage
vict0rsch Oct 20, 2025
6760278
🐛 fix: Fix HAL PDF parsing
vict0rsch Oct 21, 2025
647d95c
✨ feat: Handle multiple possible venues to match
vict0rsch Oct 21, 2025
2a87b57
✨ feat: `tmpBrowser.js` node script to debug interactively
vict0rsch Oct 21, 2025
f8aed8a
🧪 test: Slightly larger (200) `pageTimeout`
vict0rsch Oct 21, 2025
84ec0cd
🔄 ci: Add retries with `nick-fields/retry@v3` action
vict0rsch Oct 21, 2025
6e5fb28
🧪 test: Better test venues parsed
vict0rsch Oct 22, 2025
e987c8c
🐛 fix: Add env variable to control tmpBrowser.js
vict0rsch Oct 23, 2025
0ee68b5
🧪 test: Working local test-storage.js
vict0rsch Oct 23, 2025
11aae65
🏗 build: Dev bundle
vict0rsch Oct 23, 2025
c5fad39
🔄 ci: Log screenshots on failed paper parsings
vict0rsch Oct 23, 2025
ef12603
🔄 ci: Longer test timeout
vict0rsch Oct 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ jobs:
with:
node-version: "22.x"

- name: Install Yarn
run: npm install --global yarn
- name: Install dependencies
run: yarn install
run: npm install
- name: Build
run: gulp build
run: npm run build
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: test-ci
on: push

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
- uses: nick-fields/retry@v3
with:
timeout_minutes: 20
max_attempts: 2
retry_on: error
command: npm install &&npm run test-ci

test-storage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
- uses: nick-fields/retry@v3
with:
timeout_minutes: 20
max_attempts: 2
retry_on: error
command: npm install &&npm run test-storage
- uses: actions/upload-artifact@v4
with:
name: test-storage-screenshots
path: ./tmp/*.jpg
if-no-files-found: ignore
retention-days: 7
compression-level: 3



2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ coverage
.cache
.todo
site/
__pycache__
tmp/
273 changes: 203 additions & 70 deletions contributing.md

Large diffs are not rendered by default.

96 changes: 42 additions & 54 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,24 @@ import fs from "fs";
import zip from "gulp-zip";
import { v4 as uuidv4 } from "uuid";
import include from "gulp-include";
import { spawn } from "child_process";
// import debug from "gulp-debug";

function popupJS() {
return (
src([
"src/popup/js/handlers.js",
"src/popup/js/templates.js",
"src/popup/js/memory.js",
"src/popup/js/popup.js",
])
.pipe(concat("popup.js"))
// .pipe(
// minifyJSTemplate({
// minifyOptions: { minifyCSS: false, collapseWhitespace: true },
// shouldMinify: (template) => true,
// })
// )
.pipe(uglify({ mangle: true }))
.pipe(rename({ suffix: ".min" }))
.pipe(dest("src/popup/min/"))
);
// Helper function to build ES modules using Rollup
function buildESModules() {
return new Promise((resolve, reject) => {
const rollup = spawn("npx", ["rollup", "-c"], { stdio: "inherit" });
rollup.on("close", (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(`Rollup build failed with code ${code}`));
}
});
});
}

function utilsJS() {
return (
src([
"src/shared/js/utils/octokit.bundle.js",
"src/shared/js/utils/miniquery.js",
"src/shared/js/utils/config.js",
"src/shared/js/utils/bibtexParser.js",
"src/shared/js/utils/functions.js",
"src/shared/js/utils/sync.js",
"src/shared/js/utils/data.js",
"src/shared/js/utils/paper.js",
"src/shared/js/utils/state.js",
"src/shared/js/utils/parsers.js",
])
// .pipe(debug())
.pipe(concat("utils.js"))
// .pipe(
// minifyJSTemplate({
// minifyOptions: { minifyCSS: false, collapseWhitespace: true },
// shouldMinify: (template) => true,
// })
// )
.pipe(uglify({ mangle: true }))
.pipe(rename({ suffix: ".min" }))
.pipe(dest("src/shared/min"))
);
}
// Note: popupJS() and utilsJS() tasks removed - now handled by Rollup

function themeJS() {
return src(["src/shared/js/theme.js"])
Expand Down Expand Up @@ -101,6 +69,7 @@ function popupCSS() {
.pipe(rename({ suffix: ".min" }))
.pipe(dest("src/popup/min/"));
}

function popupDarkCSS() {
return src(["src/popup/css/dark.css"])
.pipe(cleanCss())
Expand All @@ -109,16 +78,34 @@ function popupDarkCSS() {
}

function watchFiles() {
gwatch("src/popup/js/*.js", popupJS);
// Watch theme.js (still processed by Gulp)
gwatch("src/shared/js/theme.js", themeJS);

// Watch CSS files
gwatch(
["src/popup/css/*.css", "src/shared/css/*.css"],
parallel(popupCSS, popupDarkCSS)
);

// Watch HTML files
gwatch("src/popup/*.html", popupHTMLDev);
gwatch("src/popup/html/modals/*.html", popupHTMLDev);
gwatch("src/popup/html/svgs/*.html", popupHTMLDev);
gwatch("src/shared/js/utils/*", utilsJS);

// Watch for ES module changes (handled by Rollup)
gwatch(
[
"src/shared/js/utils/*",
"src/popup/js/*.js",
"src/content_scripts/*.js",
"src/background/*.js",
"src/options/*.js",
"src/bibMatcher/*.js",
"src/fullMemory/*.js",
"!**/*.bundle.js",
],
buildESModules
);
}

function createArchive(cb) {
Expand Down Expand Up @@ -157,26 +144,27 @@ function createArchive(cb) {
.pipe(dest(archiveFolder));
}

// Updated build tasks - removed redundant JS bundling
export const build = parallel(
popupJS,
themeJS,
utilsJS,
popupCSS,
popupDarkCSS,
popupHTML
popupHTML,
buildESModules
);

export const dev = parallel(
popupJS,
themeJS,
utilsJS,
popupCSS,
popupDarkCSS,
popupHTMLDev
popupHTMLDev,
buildESModules
);

export const watch = series(dev, watchFiles);

export const archive = series(build, createArchive);

export const html = series(popupHTMLDev);

export const modules = buildESModules;
16 changes: 14 additions & 2 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6"
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"paths": {
"@pm/*": ["src/*"],
"@pmu/*": ["src/shared/js/utils/*"]
}
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"dist",
"build"
]
}
29 changes: 29 additions & 0 deletions loader.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { resolve as pathResolve } from "path";
import { fileURLToPath, pathToFileURL } from "url";

const baseURL = pathToFileURL(process.cwd() + "/").href;

export async function resolve(specifier, context, defaultResolve) {
// Handle @pmu/* imports
if (specifier.startsWith("@pmu/")) {
const relativePath = specifier.replace("@pmu/", "src/shared/js/utils/");
const resolved = new URL(relativePath, baseURL).href;
return {
url: resolved,
shortCircuit: true,
};
}

// Handle @pm/* imports
if (specifier.startsWith("@pm/")) {
const relativePath = specifier.replace("@pm/", "src/");
const resolved = new URL(relativePath, baseURL).href;
return {
url: resolved,
shortCircuit: true,
};
}

// Fall back to the default resolver for all other imports
return defaultResolve(specifier, context);
}
17 changes: 2 additions & 15 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"extension_pages": "script-src 'self'; object-src 'self'"
},
"background": {
"service_worker": "src/background/background.js"
"service_worker": "src/background/background.bundle.js"
},
"action": {
"default_icon": "icons/favicon-192x192.png",
Expand Down Expand Up @@ -64,20 +64,7 @@
"run_at": "document_start",
"js": [
"src/shared/min/jquery.min.js",
"src/shared/js/utils/logTrace.js",
"src/shared/js/utils/miniquery.js",
"src/shared/js/utils/config.js",
"src/shared/js/utils/functions.js",
"src/shared/js/utils/octokit.bundle.js",
"src/shared/js/utils/sync.js",
"src/shared/js/utils/data.js",
"src/shared/js/utils/paper.js",
"src/shared/js/utils/state.js",
"src/shared/js/utils/bibtexParser.js",
"src/shared/js/utils/parsers.js",
"src/popup/js/handlers.js",
"src/popup/js/memory.js",
"src/content_scripts/content_script.js"
"src/content_scripts/content.bundle.js"
],
"css": [
"src/shared/css/loader.css",
Expand Down
58 changes: 28 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@
"name": "papermemory",
"version": "1.1.0",
"description": "N/A",
"type": "module",
"main": "gulpfile.js",
"moduleDirectories": [
"node_modules",
"src"
],
"scripts": {
"pretest": "echo 'Make sure to be in dev mode ($gulp dev)'",
"test": "./node_modules/.bin/mocha test/test-*.js",
"pretest-cov": "echo 'Make sure to be in dev mode ($gulp dev)'",
"test-cov": "./node_modules/.bin/nyc --reporter=text ./node_modules/.bin/mocha test/test-*.js",
"pretest-storage": "echo 'Make sure to be in dev mode ($gulp dev)'",
"test-storage": "./node_modules/.bin/mocha test/test-storage.js",
"pretest-duplicates": "echo 'Make sure to be in dev mode ($gulp dev)'",
"test-duplicates": "./node_modules/.bin/mocha test/test-duplicates.js",
"pretest-sync": "echo 'Make sure to be in dev mode ($gulp dev)'",
"test-sync": "./node_modules/.bin/mocha test/test-sync.js",
"pretest-no-browser": "echo 'Make sure to be in dev mode ($gulp dev)'",
"test-no-browser": "./node_modules/.bin/mocha 'test/test-!(storage|duplicates|sync)*.js'",
"pretest-no-browser-cov": "echo 'Make sure to be in dev mode ($gulp dev)'",
"test-no-browser-cov": "./node_modules/.bin/nyc --reporter=text ./node_modules/.bin/mocha 'test/test-!(storage|duplicates|sync)*.js'",
"prescreenshots": "echo 'Make sure to be in dev mode ($gulp dev)'",
"screenshots": "./node_modules/.bin/mocha test/screenshots.js"
"pretest": "echo 'Make sure to be in dev mode (npm run dev)'",
"test": "node --import ./register.mjs ./node_modules/.bin/mocha test/test-*.js",
"pretest-ci": "npm run dev",
"test-ci": "node --import ./register.mjs ./node_modules/.bin/mocha test/test-*.js --exclude test/test-storage.js --exclude test/test-duplicates.js --exclude test/test-sync.js --exit",
"pretest-storage": "npm run dev",
"test-storage": "node --import ./register.mjs ./node_modules/.bin/mocha test/test-storage.js --exit",
"pretest-cov": "echo 'Make sure to be in dev mode (npm run dev)'",
"test-cov": "node --import ./register.mjs ./node_modules/.bin/nyc --reporter=text ./node_modules/.bin/mocha test/test-*.js",
"dev": "rollup -c",
"dev:watch": "rollup -c -w",
"build": "NODE_ENV=production rollup -c"
},
"repository": {
"type": "git",
Expand All @@ -35,29 +31,31 @@
"url": "https://github.com/vict0rsch/PaperMemory/issues"
},
"homepage": "https://github.com/vict0rsch/PaperMemory",
"dependencies": {
"@octokit/request": "^8.1.6"
},
"devDependencies": {
"@octokit/request": "^8.1.6",
"browserify": "^17.0.0",
"esmify": "^2.1.1",
"@babel/core": "^7.0.0",
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.6",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-replace": "^6.0.2",
"@rollup/plugin-terser": "^0.4.4",
"expect": "^29.7.0",
"glob": "^10.3.10",
"gulp": "^4.0.0",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.6.1",
"gulp-debug": "^5.0.1",
"gulp-html-minifier-terser": "^7.1.0",
"gulp-include": "^2.4.1",
"gulp-preprocess": "^4.0.2",
"gulp-rename": "^2.0.0",
"gulp-uglify": "^3.0.2",
"gulp-zip": "^6.0.0",
"heap": "^0.2.7",
"jsdom": "^23.0.1",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"ora": "^5.4.1",
"puppeteer": "^18.2.1",
"postcss": "^8.5.6",
"puppeteer": "^24.16.0",
"readline-sync": "^1.4.10",
"rollup": "^4.45.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-delete": "^3.0.1",
"rollup-plugin-postcss": "^4.0.2",
"uuid": "^9.0.1",
"yaml": "^2.3.4"
}
Expand Down
4 changes: 4 additions & 0 deletions register.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { register } from "node:module";
import { pathToFileURL } from "node:url";

register("./loader.mjs", pathToFileURL("./"));
Loading
Loading