mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
chore(monorepo/client): set up some common dependencies
This commit is contained in:
parent
42744acbb3
commit
011c859cea
@ -143,7 +143,6 @@
|
||||
"@stylistic/eslint-plugin": "4.2.0",
|
||||
"@types/archiver": "6.0.3",
|
||||
"@types/better-sqlite3": "7.6.13",
|
||||
"@types/bootstrap": "5.2.10",
|
||||
"@types/cheerio": "0.22.35",
|
||||
"@types/cls-hooked": "4.3.9",
|
||||
"@types/compression": "1.7.5",
|
||||
@ -178,7 +177,6 @@
|
||||
"@types/xml2js": "0.4.14",
|
||||
"@types/yargs": "17.0.33",
|
||||
"@vitest/coverage-v8": "3.1.1",
|
||||
"bootstrap": "5.3.5",
|
||||
"cross-env": "7.0.3",
|
||||
"css-loader": "7.1.2",
|
||||
"electron": "35.1.5",
|
||||
|
@ -5,17 +5,7 @@ import sql_init from "./sql_init.js";
|
||||
import { join } from "path";
|
||||
import { getResourceDir } from "./utils.js";
|
||||
import hidden_subtree from "./hidden_subtree.js";
|
||||
|
||||
export interface Locale {
|
||||
id: string;
|
||||
name: string;
|
||||
/** `true` if the language is a right-to-left one, or `false` if it's left-to-right. */
|
||||
rtl?: boolean;
|
||||
/** `true` if the language is not supported by the application as a display language, but it is selectable by the user for the content. */
|
||||
contentOnly?: boolean;
|
||||
/** The value to pass to `--lang` for the Electron instance in order to set it as a locale. Not setting it will hide it from the list of supported locales. */
|
||||
electronLocale?: string;
|
||||
}
|
||||
import type { Locale } from "@triliumnext/commons";
|
||||
|
||||
const LOCALES: Locale[] = [
|
||||
{
|
||||
|
@ -67,6 +67,8 @@
|
||||
"electron": "35.1.5",
|
||||
"debounce": "2.2.0",
|
||||
"draggabilly": "3.0.0",
|
||||
"vitest": "3.1.1"
|
||||
"vitest": "3.1.1",
|
||||
"@types/bootstrap": "5.2.10",
|
||||
"bootstrap": "5.3.5"
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { TPL } from "./template.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionDefinitions, OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionDefinitions, OptionMap } from "@triliumnext/commons";
|
||||
import server from "../../../../services/server.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import type { EmbeddingStats, FailedEmbeddingNotes } from "./interfaces.js";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import library_loader from "../../../../services/library_loader.js";
|
||||
import server from "../../../../services/server.js";
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import utils from "../../../../services/utils.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import utils from "../../../../services/utils.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { FontFamily, OptionMap, OptionNames } from "../../../../../../services/options_interface.js";
|
||||
import type { FontFamily, OptionMap, OptionNames } from "@triliumnext/commons";
|
||||
|
||||
interface FontFamilyEntry {
|
||||
value: FontFamily;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import utils from "../../../../services/utils.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const MIN_VALUE = 640;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
|
||||
|
@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import utils from "../../../../services/utils.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -3,7 +3,7 @@ import { t } from "../../../services/i18n.js";
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
import server from "../../../services/server.js";
|
||||
import toastService from "../../../services/toast.js";
|
||||
import type { OptionMap } from "../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import mimeTypesService from "../../../../services/mime_types.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -2,8 +2,7 @@ import OptionsWidget from "../options_widget.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import utils from "../../../../services/utils.js";
|
||||
import { getAvailableLocales, t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { Locale } from "../../../../../../services/i18n.js";
|
||||
import type { OptionMap, Locale } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,5 +1,5 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
import { getAvailableLocales } from "../../../../services/i18n.js";
|
||||
import { t } from "i18next";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import server from "../../../services/server.js";
|
||||
import toastService from "../../../services/toast.js";
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
import type { OptionMap } from "../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
import { t } from "../../../services/i18n.js";
|
||||
import utils from "../../../services/utils.js";
|
||||
import dialogService from "../../../services/dialog.js";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { FilterOptionsByType, OptionMap, OptionNames } from "../../../../../services/options_interface.js";
|
||||
import type { FilterOptionsByType, OptionMap, OptionNames } from "@triliumnext/commons";
|
||||
import type { EventData, EventListener } from "../../../components/app_context.js";
|
||||
import type FNote from "../../../entities/fnote.js";
|
||||
import { t } from "../../../services/i18n.js";
|
||||
|
@ -1,6 +1,6 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
// TODO: Deduplicate with src/services/html_sanitizer once there is a commons project between client and server.
|
||||
export const DEFAULT_ALLOWED_TAGS = [
|
||||
|
@ -1,6 +1,6 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
import TimeSelector from "../time_selector.js";
|
||||
|
||||
const TPL = /*html*/`
|
||||
|
@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import utils from "../../../../services/utils.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import options from "../../../../services/options.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap, OptionNames } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap, OptionNames } from "@triliumnext/commons";
|
||||
import searchService from "../../../../services/search.js";
|
||||
|
||||
const TPL = /*html*/`
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import utils from "../../../../services/utils.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -3,7 +3,7 @@ import server from "../../../../services/server.js";
|
||||
import protectedSessionHolder from "../../../../services/protected_session_holder.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -3,8 +3,7 @@ import utils from "../../../services/utils.js";
|
||||
import dialogService from "../../../services/dialog.js";
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
import { t } from "../../../services/i18n.js";
|
||||
import type { KeyboardShortcut } from "../../../../../services/keyboard_actions_interface.js";
|
||||
import type { OptionNames } from "../../../../../services/options_interface.js";
|
||||
import type { OptionNames, KeyboardShortcut } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section shortcuts-options-section tn-no-card">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import utils from "../../../services/utils.js";
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
import { t } from "../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL_WEB = `
|
||||
<div class="options-section">
|
||||
|
@ -2,7 +2,7 @@ import server from "../../../services/server.js";
|
||||
import toastService from "../../../services/toast.js";
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
import { t } from "../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import utils from "../../../../services/utils.js";
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
|
@ -1,6 +1,6 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,6 +1,6 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,6 +1,6 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,6 +1,6 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
import toastService from "../../../services/toast.js";
|
||||
import { t } from "../../../services/i18n.js";
|
||||
import type { OptionDefinitions, OptionMap } from "../../../../../services/options_interface.js";
|
||||
import type { OptionDefinitions, OptionMap } from "@triliumnext/commons";
|
||||
import optionsService from "../../../services/options.js";
|
||||
|
||||
type TimeSelectorConstructor = {
|
||||
|
32
package-lock.json
generated
32
package-lock.json
generated
@ -6242,19 +6242,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"apps/client/node_modules/typescript": {
|
||||
"version": "5.8.3",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"apps/client/node_modules/ufo": {
|
||||
"version": "1.6.1",
|
||||
"dev": true,
|
||||
@ -6877,10 +6864,27 @@
|
||||
"resolved": "packages/commons",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
|
||||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"packages/commons": {
|
||||
"name": "@triliumnext/commons",
|
||||
"version": "0.0.1",
|
||||
"license": "AGPL-3.0-only"
|
||||
"license": "AGPL-3.0-only",
|
||||
"devDependencies": {
|
||||
"typescript": "5.8.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
packages/commons/.gitignore
vendored
Normal file
1
packages/commons/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
build
|
@ -17,8 +17,12 @@
|
||||
"url": "https://github.com/TriliumNext/Notes"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"build": "tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "5.8.3"
|
||||
}
|
||||
}
|
||||
|
10
packages/commons/src/i18n.ts
Normal file
10
packages/commons/src/i18n.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export interface Locale {
|
||||
id: string;
|
||||
name: string;
|
||||
/** `true` if the language is a right-to-left one, or `false` if it's left-to-right. */
|
||||
rtl?: boolean;
|
||||
/** `true` if the language is not supported by the application as a display language, but it is selectable by the user for the content. */
|
||||
contentOnly?: boolean;
|
||||
/** The value to pass to `--lang` for the Electron instance in order to set it as a locale. Not setting it will hide it from the list of supported locales. */
|
||||
electronLocale?: string;
|
||||
}
|
3
packages/commons/src/index.ts
Normal file
3
packages/commons/src/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from "./i18n.js";
|
||||
export * from "./options_interface.js";
|
||||
export * from "./keyboard_actions_interface.js";
|
8
packages/commons/tsconfig.json
Normal file
8
packages/commons/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"declaration": true,
|
||||
"outDir": "build",
|
||||
},
|
||||
"include": [ "./src/**/*.ts" ]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user