You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -6,45 +6,39 @@ PaperMemory is pure JS+HTML with minimal dependencies: no framework, (almost) no
6
6
7
7
The only external deps. are [`select2.js`](https://select2.org/) which requires `JQuery` and some of the latter here and there (but I'm working on getting rid of it, replacing it with a simple set of helper functions in `src/shared/utils/miniquery.js`).
8
8
9
-
`npm` and `gulp` are here to make the dev+release lifecycle easier, if you don't want to set it up there still are a lot of things you can help with in the raw source code (just don't bother with the `min` files)
9
+
The project uses modern ES modules with Rollup for bundling to make development contributor-friendly.
2. Install dependencies: from the root of this repo `$ yarn install`
15
+
3. Start development: `$ npm run dev`
16
+
4. Edit files!
17
+
18
+
The build system uses Rollup to bundle ES modules for browser compatibility. In development mode, you get:
19
+
20
+
- Hot reloading when files change
21
+
- Source maps for debugging
22
+
- Unminified code for easier debugging
38
23
39
-
Those `@` commands are meant for `gulp` (using the `preprocess` package) to choose whether to use raw, un-minified files for development (`$ gulp watch`) or concatenated and minified ones for production (`$ gulp build`)
24
+
## Build Commands
40
25
41
-
Note: the file loaded in the popup is `src/popup/min/popup.min.html`, _not_`src/popup/popup.html` so you _have_ to use `gulp watch` to see changes you make to `popup.html` reflected in the actual popup.
26
+
```bash
27
+
npm run dev # Development build (one-time)
28
+
npm run dev:watch # Development build with file watching
29
+
npm run build # Production build
30
+
```
31
+
32
+
For active development, use `npm run dev:watch` which will automatically rebuild files when you save changes.
42
33
43
34
### Refreshing the extension
44
35
45
-
Once you load the local extension as an unpackaged extension, changes that affect the popup will directly take effect, no need to refresh anything.
36
+
**Chrome Extensions automatically reload** when you make changes to the source files:
37
+
38
+
-**Popup changes**: Take effect immediately, no refresh needed
39
+
-**Content script changes**: Require refreshing the extension in `chrome://extensions/` and then refreshing any web pages where you want to see the changes
46
40
47
-
**Content scripts** however, are loaded and not binded to the source so you _have to_ refresh the extension in the settings (and then any web page you want to see changes on) for those to be taken into account.
41
+
The `npm run dev:watch` command will automatically rebuild files when you save changes.
│ ├── sync.js ➤➤➤ GitHub sync functionality for data backup
116
+
│ ├── urls.js ➤➤➤ URL parsing and paper ID extraction
117
+
│ ├── files.js ➤➤➤ Local file detection and PDF management
118
+
│ ├── bibtexParser.js ➤➤➤ BibTeX parsing and formatting
119
+
│ ├── logTrace.js ➤➤➤ Development logging utilities
120
+
│ └── octokit.bundle.js ➤➤➤ [Generated] GitHub API client bundle
121
+
└── min/ ➤➤➤ [Generated] Shared build output
98
122
```
99
123
124
+
**Key Source Files for Contributors:**
125
+
126
+
**Core Logic** (`shared/js/utils/`):
127
+
128
+
-`config.js` - Global state and settings. Start here to understand data structures.
129
+
-`functions.js` - Utility functions used everywhere. Common operations like string parsing, clipboard access.
130
+
-`data.js` - How papers are stored, validated, and migrated between versions.
131
+
-`parsers.js` - Add new paper sources here. Contains website-specific parsing logic.
132
+
-`paper.js` - Paper object operations. How papers are created, updated, and linked.
133
+
134
+
**User Interface** (`popup/js/`):
135
+
136
+
-`popup.js` - Main popup logic. How the extension popup initializes and displays papers.
137
+
-`memory.js` - Memory table functionality. Search, sorting, and display of saved papers.
138
+
-`handlers.js` - User interactions. Button clicks, keyboard shortcuts, form handling.
139
+
140
+
**Background Processing**:
141
+
142
+
-`background/background.js` - Handles sync, notifications, and browser API calls.
143
+
-`content_scripts/content_script.js` - Automatically detects papers when browsing websites.
144
+
145
+
**Build System Features:**
146
+
147
+
-**ES modules**: All `.js` files use modern `import`/`export` syntax
148
+
-**Path aliases**: `@pm/*` and `@pmu/*` for clean, readable imports
149
+
-**Automatic bundling**: Rollup generates optimized `.bundle.js` files for browsers
150
+
-**Smart CSS processing**: Unminified CSS in development, minified in production
151
+
-**Direct file editing**: Edit source files directly, no preprocessing required
152
+
100
153
### Prettier
101
154
102
155
TODO
@@ -144,10 +197,10 @@ The following functions and constants should be updated:
144
197
1. Changes in the memory should be reflected in the popup and vice-versa
145
198
2. Document functions (docstrings & comments)
146
199
3. Bump version
147
-
4. Run `gulp build`
200
+
4. Run `npm run build`
148
201
5. Create a Github Release
149
202
1. At least use the auto-complete release feature from PRs
150
-
2. Add the Archive generated by `gulp build`
203
+
2. Add the Archive generated by `npm run build`
151
204
6. Upload the new package to Chrome & Firefox web stores 7. There's now a [Github action](https://github.com/vict0rsch/PaperMemory/actions/workflows/submit.yml) for that thanks to @louisgv in [#51](https://github.com/vict0rsch/PaperMemory/pull/51)
0 commit comments