Skip to content

Commit

Permalink
promise-worker
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Mar 2, 2025
1 parent f051910 commit d0ba8fa
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
11 changes: 5 additions & 6 deletions content/ErrorReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type Wizard = HTMLElement & {
rewind: () => void
}

import { version as running } from '../gen/version.json'

type Report = {
context: string
errors: string
Expand Down Expand Up @@ -77,8 +79,6 @@ export class ErrorReport {
wizard.getButton('cancel').disabled = true
wizard.canRewind = false

const version = require('../gen/version.js')

try {
await Zotero.HTTP.request('PUT', `${ this.bucket }/${ this.zipfile() }`, {
noCache: true,
Expand All @@ -96,7 +96,7 @@ export class ErrorReport {
wizard.advance();

// eslint-disable-next-line no-magic-numbers
(<HTMLInputElement> this.document.getElementById('better-bibtex-report-id')).value = `${ this.name() }/${version}`
(<HTMLInputElement> this.document.getElementById('better-bibtex-report-id')).value = `${ this.name() }/${running}`
this.document.getElementById('better-bibtex-report-result').hidden = false
}
catch (err) {
Expand Down Expand Up @@ -359,14 +359,13 @@ export class ErrorReport {

await this.reload()

const current = require('../gen/version.js')
this.setValue('better-bibtex-report-current', l10n.localize('better-bibtex_error-report_better-bibtex_current', { version: current }))
this.setValue('better-bibtex-report-current', l10n.localize('better-bibtex_error-report_better-bibtex_current', { version: running }))

try {
const latest = await this.latest()

const show_latest = <HTMLInputElement> this.document.getElementById('better-bibtex-report-latest')
if (current === latest) {
if (running === latest) {
show_latest.hidden = true
}
else {
Expand Down
2 changes: 1 addition & 1 deletion content/aux-scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { findBinary } from './path-search'
import { log } from './logger'
import { alert } from './prompt'

const version = require('../gen/version.js')
import { version } from '../gen/version.json'

type Source = 'MarkDown' | 'BibTeX AUX'

Expand Down
2 changes: 1 addition & 1 deletion content/db/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (!worker && typeof IDBKeyRange === 'undefined') IDBKeyRange = Components.clas

import type { Serialized, Serializer } from '../item-export-format'
import { bySlug } from '../../gen/translators'
import version from '../../gen/version'
import { version } from '../../gen/version.json'
// import { main as probe } from './cache-test'

import type { Translators as Translator } from '../../typings/translators'
Expand Down
4 changes: 3 additions & 1 deletion content/json-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Preference } from './prefs'
import { orchestrator } from './orchestrator'
import { Server } from './server'

import { version as BBTVersion } from '../gen/version.json'

import { methods } from '../gen/api/json-rpc'

const OK = 200
Expand Down Expand Up @@ -621,7 +623,7 @@ export class NSAPI {
* Returns the Zotero and BetterBibTeX version to show the JSON-RPC API is ready.
*/
public async ready(): Promise<{ zotero: string; betterbibtex: string }> {
return { zotero: Zotero.version, betterbibtex: require('../gen/version.js') }
return { zotero: Zotero.version, betterbibtex: BBTVersion }
}
}

Expand Down
2 changes: 1 addition & 1 deletion content/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare const Zotero: any

import * as client from './client'
const version = require('./../gen/version.js')
import { version } from './../gen/version.json'
export const run = `<${version} ${client.run}>`

declare const dump: (msg: string) => void
Expand Down
2 changes: 1 addition & 1 deletion translators/lib/bbtjson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Library } from './normalize'
import { log } from '../../content/logger'
import { Translation } from './translator'
import { simplifyForExport, simplifyForImport } from '../../gen/items/simplify'
const version = require('../../gen/version.js')
import { version } from '../../gen/version.json'

// import { validItem } from '../content/ajv'
// import { stringify } from '../content/stringify'
Expand Down

0 comments on commit d0ba8fa

Please sign in to comment.