Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ jobs:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}

- name: Get version from package.json
id: version
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '20.x'
node-version: '24.x'
cache: 'pnpm'

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand All @@ -46,7 +46,7 @@ jobs:

- name: Upload coverage reports
if: matrix.node-version == '20.x'
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
files: ./coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ Example:
**Source:** https://example.com/docs/getting-started
**Saved:** 2025-10-01T12:00:00.000Z

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

---

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

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

### Development

The extension uses a shared codebase for Chrome and Firefox:

```
src/
background.js # Source of truth - edit this file
extension-chrome/
background.js # Copied from src/ during build
extension-firefox/
background.js # Copied from src/ during build
```

**Workflow:**

1. Edit `src/background.js`
2. Run `pnpm run build` to copy to both extensions
3. Load unpacked extension from `extension-chrome/` or `extension-firefox/`
4. Run `pnpm run format && pnpm run test && pnpm run lint` before committing

## 🔗 Links

- [Chrome Web Store](https://chromewebstore.google.com/detail/markdown-printer/pfplfifdaaaalkefgnknfgoiabegcbmf) - Install for Chrome
Expand Down
26 changes: 6 additions & 20 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,8 @@ const args = process.argv.slice(2);
const buildChrome = args.length === 0 || args.includes('chrome');
const buildFirefox = args.length === 0 || args.includes('firefox');

// Common files to copy
const commonFiles = [
'background.js',
'popup.html',
'popup.js',
'turndown.js',
'icon16.png',
'icon48.png',
'icon128.png',
];
// Shared source files (copied from src/ to both extensions)
const sharedSourceFiles = ['background.js'];

// Common directories to copy
const commonDirs = ['_locales'];
Expand Down Expand Up @@ -137,11 +129,8 @@ if (buildChrome) {
const chromeDir = 'extension-chrome';
ensureDir(chromeDir);

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

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

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

// Copy common directories (like _locales)
commonDirs.forEach(dir => {
Expand Down
Loading