Skip to content

Commit d8c9c2a

Browse files
authored
Merge pull request #9 from levz0r/develop
Develop
2 parents 8213a18 + 2cfc10d commit d8c9c2a

File tree

15 files changed

+1955
-654
lines changed

15 files changed

+1955
-654
lines changed

.github/workflows/auto-tag.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ jobs:
1515
contents: write
1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
with:
2020
fetch-depth: 0
21+
token: ${{ secrets.PAT_TOKEN }}
2122

2223
- name: Get version from package.json
2324
id: version

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ jobs:
1313
contents: write
1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
1717

1818
- name: Setup pnpm
1919
uses: pnpm/action-setup@v4
2020
with:
2121
version: 10
2222

2323
- name: Setup Node.js
24-
uses: actions/setup-node@v4
24+
uses: actions/setup-node@v6
2525
with:
26-
node-version: '20.x'
26+
node-version: '24.x'
2727
cache: 'pnpm'
2828

2929
- name: Install dependencies

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616

1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v6
2020

2121
- name: Setup pnpm
2222
uses: pnpm/action-setup@v4
2323
with:
2424
version: 10
2525

2626
- name: Setup Node.js ${{ matrix.node-version }}
27-
uses: actions/setup-node@v4
27+
uses: actions/setup-node@v6
2828
with:
2929
node-version: ${{ matrix.node-version }}
3030
cache: 'pnpm'
@@ -46,7 +46,7 @@ jobs:
4646

4747
- name: Upload coverage reports
4848
if: matrix.node-version == '20.x'
49-
uses: codecov/codecov-action@v4
49+
uses: codecov/codecov-action@v5
5050
with:
5151
files: ./coverage/lcov.info
5252
token: ${{ secrets.CODECOV_TOKEN }}

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ Example:
7878
**Source:** https://example.com/docs/getting-started
7979
**Saved:** 2025-10-01T12:00:00.000Z
8080

81+
_Generated with [markdown-printer](https://github.com/levz0r/markdown-printer) (v1.1.0) by [Lev Gelfenbuim](https://lev.engineer)_
82+
8183
---
8284

8385
[Your page content in Markdown format]
@@ -126,6 +128,26 @@ MIT License - see [LICENSE](LICENSE) file for details
126128

127129
Contributions welcome! Feel free to open issues or submit pull requests.
128130

131+
### Development
132+
133+
The extension uses a shared codebase for Chrome and Firefox:
134+
135+
```
136+
src/
137+
background.js # Source of truth - edit this file
138+
extension-chrome/
139+
background.js # Copied from src/ during build
140+
extension-firefox/
141+
background.js # Copied from src/ during build
142+
```
143+
144+
**Workflow:**
145+
146+
1. Edit `src/background.js`
147+
2. Run `pnpm run build` to copy to both extensions
148+
3. Load unpacked extension from `extension-chrome/` or `extension-firefox/`
149+
4. Run `pnpm run format && pnpm run test && pnpm run lint` before committing
150+
129151
## 🔗 Links
130152

131153
- [Chrome Web Store](https://chromewebstore.google.com/detail/markdown-printer/pfplfifdaaaalkefgnknfgoiabegcbmf) - Install for Chrome

build.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,8 @@ const args = process.argv.slice(2);
1515
const buildChrome = args.length === 0 || args.includes('chrome');
1616
const buildFirefox = args.length === 0 || args.includes('firefox');
1717

18-
// Common files to copy
19-
const commonFiles = [
20-
'background.js',
21-
'popup.html',
22-
'popup.js',
23-
'turndown.js',
24-
'icon16.png',
25-
'icon48.png',
26-
'icon128.png',
27-
];
18+
// Shared source files (copied from src/ to both extensions)
19+
const sharedSourceFiles = ['background.js'];
2820

2921
// Common directories to copy
3022
const commonDirs = ['_locales'];
@@ -137,11 +129,8 @@ if (buildChrome) {
137129
const chromeDir = 'extension-chrome';
138130
ensureDir(chromeDir);
139131

140-
// Use existing files or copy from a source
141-
const sourceDir = fs.existsSync(chromeDir) ? chromeDir : 'extension-firefox';
142-
if (sourceDir !== chromeDir) {
143-
copyFiles(sourceDir, chromeDir, commonFiles);
144-
}
132+
// Copy shared source files from src/
133+
copyFiles('src', chromeDir, sharedSourceFiles);
145134

146135
// Copy common directories (like _locales)
147136
commonDirs.forEach(dir => {
@@ -165,11 +154,8 @@ if (buildFirefox) {
165154
const firefoxDir = 'extension-firefox';
166155
ensureDir(firefoxDir);
167156

168-
// Use existing files or copy from a source
169-
const sourceDir = fs.existsSync(firefoxDir) ? firefoxDir : 'extension-chrome';
170-
if (sourceDir !== firefoxDir) {
171-
copyFiles(sourceDir, firefoxDir, commonFiles);
172-
}
157+
// Copy shared source files from src/
158+
copyFiles('src', firefoxDir, sharedSourceFiles);
173159

174160
// Copy common directories (like _locales)
175161
commonDirs.forEach(dir => {

0 commit comments

Comments
 (0)