Skip to content

Commit d58f83d

Browse files
Merge pull request #46 from johannrichard/readwise-mirror-ng
This is a comprehensive patch that implements several features as well as some “housekeeping” related to building, testing, and releasing the plugin itself. Specifically, in terms of plugin features, it - switches to the “export” API, which makes the `document` and `summary` available, adds additional metadata (created, updated, and (last) highlighted date across the board) - /issues/39, - adds documentation to the different templates within the plugin options in Obsidian, - implements two additional `nunjucks` filters (`is_qa`, `qa`) which can be used to parse and reassemble “Q & A” blocks defined with the `.qa` action tag in a note, - includes improvements for `title` and `author` as well as `sanitized_title` and `authorStr` when used in the frontmatter template - adds a feature to deduplicate items (locally and remotely), using the unique Readwise URL in frontmatter - implements features to parse, keep, and protect frontmatter on updates (needed for deduplication, but useful to keep additional fields around when updating), - driven by the needs of these two features, validates the frontmatter template in the settings UI to make sure we can use it when the plugin is run, - implements a feature to *slugify* - #27 - uses `filenamify` to create valid filenames and limit them to 255 characters - #37 - adds the relevant additional documentation In terms of housekeeping, this patch - implements a `semantic-release` workflow, using the [`brianrodri/semantic-release-obsidian-plugin`](https://github.com/brianrodri/semantic-release-obsidian-plugin), which can be used to deploy semantic versions, including `beta` releases [^1] - adds local deploy and release actions, as well as a GitHub workflow that automatically runs a release on the `master` resp. `main` branches (Since incorporating this, I've moved the `semantic-release` config into a separate `.realeaserc.yaml` to stop polluting `package.json` and I also removed committing `manifest.json`, `versions.json` and `package[-lock].json` as this (not suprisingly) created quite a bit of issues when merging branches). [^2] - restructures the code to make it more modular (separating settings from the main class), It does **not** - implement the `retry-fetch` (due to incompatibilities with Obsidian on Mobile, which I haven't yet figure out) - implement the cache / diff and other ideas I have kept around for a while [^1]: By using this, and Obsidian BRAT, it would e.g. be possible to easily and semi-automatically create beta releases. It would also more easily allow to work on new features while keeping a slower pace with major releases. [^2]: The local deploy facilitates easy testing during development whereas the local release action allows creating releases outside of GitHub, which I think is particularly interesting for `beta` or `alpha` pre-releases.
2 parents 994cfbb + f6e5de2 commit d58f83d

23 files changed

+3448
-999
lines changed

.github/workflows/release.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release plugin version
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [master, main, beta]
6+
7+
permissions:
8+
contents: read # for checkout
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write # to be able to publish a GitHub release
16+
issues: write # to be able to comment on released issues
17+
pull-requests: write # to be able to comment on released pull requests
18+
id-token: write # to enable use of OIDC for npm provenance
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: latest
26+
- name: Install dependencies
27+
run: npm clean-install
28+
env:
29+
HUSKY: 0
30+
# TODO: Re-enable after https://github.com/blacksmithgu/obsidian-dataview/issues/2288
31+
# - name: Audit dependencies
32+
# run: npm audit && npm audit signatures
33+
# - name: Audit code coverage
34+
# run: npm run coverage
35+
- name: Build plugin
36+
run: npm run build
37+
- name: Release update
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: npx -p github:brianrodri/semantic-release-obsidian-plugin semantic-release

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
# npm
66
node_modules
7-
package-lock.json
87

98
# build
109
main.js
1110
*.js.map
11+
.env
1212

1313
# obsidian
1414
data.json

.releaserc.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# A semantic-release configuration for an Obsidian plugin
2+
# By using `npx`, we avoid the need to install `semantic-release`
3+
# and `semantic-release-obsidian-plugin` globally.
4+
# This configuration is set up to run in dry-run mode by default and
5+
# uses the standard branches for Obsidian plugins (`master`, `main`, `beta` etc.)
6+
# run semantic-release as follows to release a new version of your plugin:
7+
# dry-run (default): npx -p github:brianrodri/semantic-release-obsidian-plugin semantic-release
8+
# for real: npx -p github:brianrodri/semantic-release-obsidian-plugin semantic-release --dry-run false
9+
plugins:
10+
- '@semantic-release/commit-analyzer'
11+
- '@semantic-release/release-notes-generator'
12+
- semantic-release-obsidian-plugin
13+
- - '@semantic-release/github'
14+
- assets:
15+
- path: main.js
16+
- path: manifest.json
17+
- path: src/ui/styles/styles.css
18+
# Uncomment the following block if semantic release *should* commit the
19+
# updated `manifest.json`, `versions.json` and `package.json` files with the new version number.
20+
#
21+
# - - '@semantic-release/git'
22+
# - assets:
23+
# - manifest.json
24+
# - versions.json
25+
# - package.json
26+
# - package-lock.json
27+
# message: >-
28+
# chore(release): set `package.json`, `manifest.json`,`versions.json` and
29+
# `package-lock.json` to ${nextRelease.version} [skip ci]
30+
#
31+
#
32+
# ${nextRelease.notes}
33+
tagFormat: '${version}'

0 commit comments

Comments
 (0)