Skip to content

Commit

Permalink
merge 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
daeh committed Dec 28, 2023
1 parent 124e887 commit 9c81423
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 11 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[![GitHub release (with filter)](https://img.shields.io/github/v/release/daeh/zotero-markdb-connect?style=for-the-badge&filter=*v0.1.0*)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.0-rc.6)
[![GitHub release (with filter)](https://img.shields.io/github/v/release/daeh/zotero-markdb-connect?style=for-the-badge&filter=*v0.1.0*)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.0-rc.6) [![GitHub all releases](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/total?style=for-the-badge&color=forestgreen)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.0-rc.6)

[![GitHub release (latest by SemVer including pre-releases)](https://img.shields.io/github/downloads-pre/daeh/zotero-markdb-connect/latest/total?style=for-the-badge&label=downloads@prerelease)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.0-rc.6) [![GitHub release (by tag)](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/v0.0.25/total?style=for-the-badge)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.0.27)

<!-- [![GitHub release (latest by date)](https://img.shields.io/github/v/release/daeh/zotero-markdb-connect?style=for-the-badge)](https://github.com/daeh/zotero-markdb-connect/releases/latest) [![GitHub all releases](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/total?style=for-the-badge&color=forestgreen)](https://github.com/daeh/zotero-markdb-connect/releases/latest) -->

Expand All @@ -9,7 +11,7 @@
- **_Scans your Markdown database and adds a colored tag to associated Zotero items._**
- **_Jump to Markdown notes from the contextual menu of Zotero items._**
- **_Supports various Markdown databases, including [Obsidian](https://obsidian.md), [logseq](https://logseq.com), and [Zettlr](https://www.zettlr.com)_**
- **_[Zotero 7](https://forums.zotero.org/discussion/105094/announcing-the-zotero-7-beta) compatible_**
- **_[Zotero 7](https://www.zotero.org/support/beta_builds) compatible_**

![MarkDBConnectScreenshot](MarkDBConnectScreenshot.png)

Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"lint": "export ESLINT_USE_FLAT_CONFIG=true && export NODE_ENV=production && prettier --config prettier.config.mjs --write . && eslint --config eslint.config.mjs --fix .",
"lint-dry": "export ESLINT_USE_FLAT_CONFIG=true && export NODE_ENV=production && prettier --config prettier.config.mjs --check . ; eslint --config eslint.config.mjs .",
"test": "echo \"Error: no test specified\" && exit 1",
"release": "DEBUG=release-it:* release-it",
"release": "release-it --only-version --preReleaseId=beta",
"update-deps": "npm update --save && npm update --save-dev && npm outdated --depth=0",
"postinstall": "node ./scripts/linkconfig.mjs"
},
Expand Down Expand Up @@ -69,7 +69,12 @@
"release": true,
"assets": [
"build/*.xpi"
]
],
"comments": {
"submit": true,
"issue": ":rocket: _This issue has been resolved in v${version}. See [${releaseName}](${releaseUrl}) for release notes._",
"pr": ":rocket: _This pull request is included in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"
}
},
"hooks": {
"before:init": "npm run lint",
Expand Down
2 changes: 2 additions & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function replaceString(buildTime) {
const replaceResult = replaceInFileSync({
files: [
`${buildDir}/addon/**/*.xhtml`,
`${buildDir}/addon/**/*.html`,
`${buildDir}/addon/**/*.css`,
`${buildDir}/addon/**/*.json`,
`${buildDir}/addon/prefs.js`,
`${buildDir}/addon/manifest.json`,
Expand Down
5 changes: 1 addition & 4 deletions scripts/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ async function main() {
await build()

// start Zotero
startZotero()
setTimeout(() => {
openDevTool()
}, 2000)
startZotero(openDevTool)

// watch
await watch()
Expand Down
18 changes: 16 additions & 2 deletions scripts/start.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import details from '../package.json' assert { type: 'json' }
import { Logger } from './utils.mjs'
import cmd from './zotero-cmd.json' assert { type: 'json' }
import { spawn } from 'child_process'
import { existsSync, readFileSync, writeFileSync } from 'fs'
import { existsSync, readFileSync, writeFileSync, rmSync } from 'fs'
import { clearFolder } from './utils.mjs'
import path from 'path'
import { exit } from 'process'

const { addonID } = details.config
const { zoteroBinPath, profilePath, dataDir } = cmd.exec

// Keep in sync with the addon's onStartup
const loadDevToolWhen = `Plugin ${addonID} startup`

const logPath = 'logs'
const logFilePath = path.join(logPath, 'zotero.log')

Expand Down Expand Up @@ -42,6 +45,11 @@ function prepareDevEnv() {
writeAddonProxyFile()
}

const addonXpiFilePath = path.join(profilePath, `extensions/${addonID}.xpi`)
if (existsSync(addonXpiFilePath)) {
rmSync(addonXpiFilePath)
}

const prefsPath = path.join(profilePath, 'prefs.js')
if (existsSync(prefsPath)) {
const PrefsLines = readFileSync(prefsPath, 'utf-8').split('\n')
Expand All @@ -65,14 +73,20 @@ function prepareLog() {
writeFileSync(logFilePath, '')
}

export function main() {
export function main(callback) {
let isZoteroReady = false

prepareDevEnv()

prepareLog()

const zoteroProcess = spawn(zoteroBinPath, ['--debugger', '--purgecaches', '-profile', profilePath])

zoteroProcess.stdout.on('data', (data) => {
if (!isZoteroReady && data.toString().includes(loadDevToolWhen)) {
isZoteroReady = true
callback()
}
writeFileSync(logFilePath, data, {
flag: 'a',
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"usage": "Copy and rename this file to zotero-cmd.json. Edit the cmd.",
"killZoteroWindows": "taskkill /f /im zotero.exe",
"killZoteroUnix": "kill -9 $(ps -x | grep '[z]otero' | awk '{print $1}')", // DAEMOD
"killZoteroUnix": "kill -9 $(ps -x | grep '[z]otero' | awk '{print $1}')",
"exec": {
"@comment-zoteroBinPath": "Please input the path of the Zotero binary file in `zoteroBinPath`.",
"@comment-zoteroBinPath-tip": "The path delimiter should be escaped as `\\` for win32. The path is `*/Zotero.app/Contents/MacOS/zotero` for MacOS.",
Expand Down

0 comments on commit 9c81423

Please sign in to comment.