Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(highlightjs): create separate project
Elian Dorand4fab87ed98c
diff --git a/packages/highlightjs/README.md b/packages/highlightjs/README.mdnew file mode 100644index 0000000000..706753a317--- /dev/null+++ b/packages/highlightjs/README.md@@ -0,0 +1,7 @@+# highlightjs++This library was generated with [Nx](https://nx.dev).++## Building++Run `nx build highlightjs` to build the library.diff --git a/packages/highlightjs/eslint.config.mjs b/packages/highlightjs/eslint.config.mjsnew file mode 100644index 0000000000..9ee1191ff6--- /dev/null+++ b/packages/highlightjs/eslint.config.mjs@@ -0,0 +1,24 @@+import baseConfig from "../../eslint.config.mjs";++export default [+ ...baseConfig,+ {+ "files": [+ "**/*.json"+ ],+ "rules": {+ "@nx/dependency-checks": [+ "error",+ {+ "ignoredFiles": [+ "{projectRoot}/eslint.config.{js,cjs,mjs}",+ "{projectRoot}/vite.config.{js,ts,mjs,mts}"+ ]+ }+ ]+ },+ "languageOptions": {+ "parser": (await import('jsonc-eslint-parser'))+ }+ }+];diff --git a/packages/highlightjs/package.json b/packages/highlightjs/package.jsonnew file mode 100644index 0000000000..f474df9451--- /dev/null+++ b/packages/highlightjs/package.json@@ -0,0 +1,22 @@+{+ "name": "@triliumnext/highlightjs",+ "version": "0.0.1",+ "private": true,+ "type": "module",+ "main": "./dist/index.js",+ "module": "./dist/index.js",+ "types": "./dist/index.d.ts",+ "exports": {+ "./package.json": "./package.json",+ ".": {+ "development": "./src/index.ts",+ "types": "./dist/index.d.ts",+ "import": "./dist/index.js",+ "default": "./dist/index.js"+ }+ },+ "nx": {+ "name": "highlightjs"+ },+ "dependencies": {}+}diff --git a/packages/highlightjs/src/index.ts b/packages/highlightjs/src/index.tsnew file mode 100644index 0000000000..b6cb49673c--- /dev/null+++ b/packages/highlightjs/src/index.ts@@ -0,0 +1 @@+export * from './lib/highlightjs.js';diff --git a/packages/highlightjs/src/lib/highlightjs.ts b/packages/highlightjs/src/lib/highlightjs.tsnew file mode 100644index 0000000000..3a05e1c989--- /dev/null+++ b/packages/highlightjs/src/lib/highlightjs.ts@@ -0,0 +1,3 @@+export function highlightjs(): string {+ return 'highlightjs';+}diff --git a/packages/highlightjs/tsconfig.json b/packages/highlightjs/tsconfig.jsonnew file mode 100644index 0000000000..c23e61c800--- /dev/null+++ b/packages/highlightjs/tsconfig.json@@ -0,0 +1,10 @@+{+ "extends": "../../tsconfig.base.json",+ "files": [],+ "include": [],+ "references": [+ {+ "path": "./tsconfig.lib.json"+ }+ ]+}diff --git a/packages/highlightjs/tsconfig.lib.json b/packages/highlightjs/tsconfig.lib.jsonnew file mode 100644index 0000000000..89ba670c34--- /dev/null+++ b/packages/highlightjs/tsconfig.lib.json@@ -0,0 +1,21 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "baseUrl": ".",+ "rootDir": "src",+ "outDir": "dist",+ "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",+ "emitDeclarationOnly": true,+ "forceConsistentCasingInFileNames": true,+ "noImplicitOverride": true,+ "noImplicitReturns": true,+ "types": [+ "node",+ "vite/client"+ ]+ },+ "include": [+ "src/**/*.ts"+ ],+ "references": []+}diff --git a/packages/highlightjs/vite.config.ts b/packages/highlightjs/vite.config.tsnew file mode 100644index 0000000000..4ca8b8341f--- /dev/null+++ b/packages/highlightjs/vite.config.ts@@ -0,0 +1,37 @@+/// <reference types='vitest' />+import { defineConfig } from 'vite';+import dts from 'vite-plugin-dts';+import * as path from 'path';++export default defineConfig(() => ({+ root: __dirname,+ cacheDir: '../../node_modules/.vite/packages/highlightjs',+ plugins: [dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })],+ // Uncomment this if you are using workers.+ // worker: {+ // plugins: [ nxViteTsPaths() ],+ // },+ // Configuration for building your library.+ // See: https://vitejs.dev/guide/build.html#library-mode+ build: {+ outDir: './dist',+ emptyOutDir: true,+ reportCompressedSize: true,+ commonjsOptions: {+ transformMixedEsModules: true,+ },+ lib: {+ // Could also be a dictionary or array of multiple entry points.+ entry: 'src/index.ts',+ name: 'highlightjs',+ fileName: 'index',+ // Change this to the formats you want to support.+ // Don't forget to update your package.json as well.+ formats: ['es' as const]+ },+ rollupOptions: {+ // External packages that should not be bundled into your library.+ external: []+ },+ },+}));diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex ee31587ece..eb47a07820 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1287,6 +1287,8 @@ importers:specifier: ^2.3.0version: 2.8.1+ packages/highlightjs: {}+packages/turndown-plugin-gfm:dependencies:'@swc/helpers':diff --git a/tsconfig.json b/tsconfig.jsonindex 60831037b0..487e76f3e6 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -53,6 +53,9 @@},{"path": "./packages/codemirror"+ },+ {+ "path": "./packages/highlightjs"}]}