Merge pull request #1773 from TriliumNext/feature/nx_monorepo

Set up NX-based monorepo
This commit is contained in:
Elian Doran 2025-05-02 20:54:23 +03:00 committed by GitHub
commit cfccf29672
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2130 changed files with 30403 additions and 35353 deletions

10
.gitattributes vendored
View File

@ -1,7 +1,11 @@
package-lock.json linguist-generated=true package-lock.json linguist-generated=true
**/package-lock.json linguist-generated=true **/package-lock.json linguist-generated=true
src/public/app/doc_notes/en/User[[:space:]]Guide/** linguist-generated=true
src/public/app/doc_notes/en/User[[:space:]]Guide/**/*.md eol=lf apps/server/src/assets/doc_notes/en/User[[:space:]]Guide/** linguist-generated=true
apps/server/src/assets/doc_notes/en/User[[:space:]]Guide/**/*.html eol=lf
docs/**/*.md eol=lf
docs/**/*.json eol=lf
demo/**/*.html eol=lf demo/**/*.html eol=lf
demo/**/*.json eol=lf demo/**/*.json eol=lf
@ -10,4 +14,4 @@ demo/**/*.txt eol=lf
demo/**/*.js eol=lf demo/**/*.js eol=lf
demo/**/*.css eol=lf demo/**/*.css eol=lf
libraries/** linguist-vendored apps/client/src/libraries/** linguist-vendored

View File

@ -18,152 +18,147 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
# Certificate setup # Certificate setup
- name: Import Apple certificates - name: Import Apple certificates
if: inputs.os == 'macos' if: inputs.os == 'macos'
uses: apple-actions/import-codesign-certs@v5 uses: apple-actions/import-codesign-certs@v5
with: with:
p12-file-base64: ${{ env.APPLE_APP_CERTIFICATE_BASE64 }} p12-file-base64: ${{ env.APPLE_APP_CERTIFICATE_BASE64 }}
p12-password: ${{ env.APPLE_APP_CERTIFICATE_PASSWORD }} p12-password: ${{ env.APPLE_APP_CERTIFICATE_PASSWORD }}
keychain: build-app-${{ github.run_id }} keychain: build-app-${{ github.run_id }}
keychain-password: ${{ github.run_id }} keychain-password: ${{ github.run_id }}
- name: Install Installer certificate - name: Install Installer certificate
if: inputs.os == 'macos' if: inputs.os == 'macos'
uses: apple-actions/import-codesign-certs@v5 uses: apple-actions/import-codesign-certs@v5
with: with:
p12-file-base64: ${{ env.APPLE_INSTALLER_CERTIFICATE_BASE64 }} p12-file-base64: ${{ env.APPLE_INSTALLER_CERTIFICATE_BASE64 }}
p12-password: ${{ env.APPLE_INSTALLER_CERTIFICATE_PASSWORD }} p12-password: ${{ env.APPLE_INSTALLER_CERTIFICATE_PASSWORD }}
keychain: build-installer-${{ github.run_id }} keychain: build-installer-${{ github.run_id }}
keychain-password: ${{ github.run_id }} keychain-password: ${{ github.run_id }}
- name: Verify certificates - name: Verify certificates
if: inputs.os == 'macos' if: inputs.os == 'macos'
shell: ${{ inputs.shell }} shell: ${{ inputs.shell }}
run: | run: |
echo "Available signing identities in app keychain:" echo "Available signing identities in app keychain:"
security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain
echo "Available signing identities in installer keychain:" echo "Available signing identities in installer keychain:"
security find-identity -v -p codesigning build-installer-${{ github.run_id }}.keychain security find-identity -v -p codesigning build-installer-${{ github.run_id }}.keychain
# Make the keychains searchable # Make the keychains searchable
security list-keychains -d user -s build-app-${{ github.run_id }}.keychain build-installer-${{ github.run_id }}.keychain $(security list-keychains -d user | tr -d '"') security list-keychains -d user -s build-app-${{ github.run_id }}.keychain build-installer-${{ github.run_id }}.keychain $(security list-keychains -d user | tr -d '"')
security default-keychain -s build-app-${{ github.run_id }}.keychain security default-keychain -s build-app-${{ github.run_id }}.keychain
security unlock-keychain -p ${{ github.run_id }} build-app-${{ github.run_id }}.keychain security unlock-keychain -p ${{ github.run_id }} build-app-${{ github.run_id }}.keychain
security unlock-keychain -p ${{ github.run_id }} build-installer-${{ github.run_id }}.keychain security unlock-keychain -p ${{ github.run_id }} build-installer-${{ github.run_id }}.keychain
security set-keychain-settings -t 3600 -l build-app-${{ github.run_id }}.keychain security set-keychain-settings -t 3600 -l build-app-${{ github.run_id }}.keychain
security set-keychain-settings -t 3600 -l build-installer-${{ github.run_id }}.keychain security set-keychain-settings -t 3600 -l build-installer-${{ github.run_id }}.keychain
- name: Set up Python and other macOS dependencies - name: Set up Python and other macOS dependencies
if: ${{ inputs.os == 'macos' }} if: ${{ inputs.os == 'macos' }}
shell: ${{ inputs.shell }} shell: ${{ inputs.shell }}
run: | run: |
brew install python-setuptools brew install python-setuptools
brew install create-dmg brew install create-dmg
- name: Install dependencies for RPM and Flatpak package building - name: Install dependencies for RPM and Flatpak package building
if: ${{ inputs.os == 'linux' }} if: ${{ inputs.os == 'linux' }}
shell: ${{ inputs.shell }} shell: ${{ inputs.shell }}
run: | run: |
sudo apt-get update && sudo apt-get install rpm flatpak-builder elfutils sudo apt-get update && sudo apt-get install rpm flatpak-builder elfutils
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
FLATPAK_ARCH=$(if [[ ${{ inputs.arch }} = 'arm64' ]]; then echo 'aarch64'; else echo 'x86_64'; fi) FLATPAK_ARCH=$(if [[ ${{ inputs.arch }} = 'arm64' ]]; then echo 'aarch64'; else echo 'x86_64'; fi)
FLATPAK_VERSION='24.08' FLATPAK_VERSION='24.08'
flatpak install --user --no-deps --arch $FLATPAK_ARCH --assumeyes runtime/org.freedesktop.Platform/$FLATPAK_ARCH/$FLATPAK_VERSION runtime/org.freedesktop.Sdk/$FLATPAK_ARCH/$FLATPAK_VERSION org.electronjs.Electron2.BaseApp/$FLATPAK_ARCH/$FLATPAK_VERSION flatpak install --user --no-deps --arch $FLATPAK_ARCH --assumeyes runtime/org.freedesktop.Platform/$FLATPAK_ARCH/$FLATPAK_VERSION runtime/org.freedesktop.Sdk/$FLATPAK_ARCH/$FLATPAK_VERSION org.electronjs.Electron2.BaseApp/$FLATPAK_ARCH/$FLATPAK_VERSION
# Build setup - name: Update build info
- name: Install dependencies shell: ${{ inputs.shell }}
shell: ${{ inputs.shell }} run: npm run chore:update-build-info
run: npm ci
- name: Update build info # Critical debugging configuration
shell: ${{ inputs.shell }} - name: Run electron-forge build with enhanced logging
run: npm run chore:update-build-info shell: ${{ inputs.shell }}
env:
# Pass through required environment variables for signing and notarization
APPLE_TEAM_ID: ${{ env.APPLE_TEAM_ID }}
APPLE_ID: ${{ env.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ env.APPLE_ID_PASSWORD }}
WINDOWS_SIGN_EXECUTABLE: ${{ env.WINDOWS_SIGN_EXECUTABLE }}
TRILIUM_ARTIFACT_NAME_HINT: TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}
run: pnpm nx --project=desktop electron-forge:make -- --arch=${{ inputs.arch }} --platform=${{ inputs.forge_platform }}
# Critical debugging configuration # Add DMG signing step
- name: Run electron-forge build with enhanced logging - name: Sign DMG
shell: ${{ inputs.shell }} if: inputs.os == 'macos'
env: shell: ${{ inputs.shell }}
# Pass through required environment variables for signing and notarization run: |
APPLE_TEAM_ID: ${{ env.APPLE_TEAM_ID }} echo "Signing DMG file..."
APPLE_ID: ${{ env.APPLE_ID }} dmg_file=$(find ./apps/desktop/dist -name "*.dmg" -print -quit)
APPLE_ID_PASSWORD: ${{ env.APPLE_ID_PASSWORD }} if [ -n "$dmg_file" ]; then
WINDOWS_SIGN_EXECUTABLE: ${{ env.WINDOWS_SIGN_EXECUTABLE }} echo "Found DMG: $dmg_file"
TRILIUM_ARTIFACT_NAME_HINT: TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }} # Get the first valid signing identity from the keychain
run: npm run electron-forge:make -- --arch=${{ inputs.arch }} --platform=${{ inputs.forge_platform }} SIGNING_IDENTITY=$(security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$SIGNING_IDENTITY" ]; then
# Add DMG signing step echo "Error: No valid Developer ID Application certificate found in keychain"
- name: Sign DMG exit 1
if: inputs.os == 'macos'
shell: ${{ inputs.shell }}
run: |
echo "Signing DMG file..."
dmg_file=$(find ./dist -name "*.dmg" -print -quit)
if [ -n "$dmg_file" ]; then
echo "Found DMG: $dmg_file"
# Get the first valid signing identity from the keychain
SIGNING_IDENTITY=$(security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$SIGNING_IDENTITY" ]; then
echo "Error: No valid Developer ID Application certificate found in keychain"
exit 1
fi
echo "Using signing identity: $SIGNING_IDENTITY"
# Sign the DMG
codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
# Notarize the DMG
xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
# Staple the notarization ticket
xcrun stapler staple "$dmg_file"
else
echo "No DMG found to sign"
fi fi
echo "Using signing identity: $SIGNING_IDENTITY"
# Sign the DMG
codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
# Notarize the DMG
xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
# Staple the notarization ticket
xcrun stapler staple "$dmg_file"
else
echo "No DMG found to sign"
fi
- name: Verify code signing - name: Verify code signing
if: inputs.os == 'macos' if: inputs.os == 'macos'
shell: ${{ inputs.shell }} shell: ${{ inputs.shell }}
run: | run: |
echo "Verifying code signing for all artifacts..." echo "Verifying code signing for all artifacts..."
# First check the .app bundle # First check the .app bundle
echo "Looking for .app bundle..." echo "Looking for .app bundle..."
app_bundle=$(find ./dist -name "*.app" -print -quit) app_bundle=$(find ./apps/desktop/dist -name "*.app" -print -quit)
if [ -n "$app_bundle" ]; then if [ -n "$app_bundle" ]; then
echo "Found app bundle: $app_bundle" echo "Found app bundle: $app_bundle"
echo "Verifying app bundle signing..." echo "Verifying app bundle signing..."
codesign --verify --deep --strict --verbose=2 "$app_bundle" codesign --verify --deep --strict --verbose=2 "$app_bundle"
echo "Displaying app bundle signing info..." echo "Displaying app bundle signing info..."
codesign --display --verbose=2 "$app_bundle" codesign --display --verbose=2 "$app_bundle"
echo "Checking entitlements..." echo "Checking entitlements..."
codesign --display --entitlements :- "$app_bundle" codesign --display --entitlements :- "$app_bundle"
echo "Checking notarization status..." echo "Checking notarization status..."
xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet" xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet"
else else
echo "No .app bundle found to verify" echo "No .app bundle found to verify"
fi fi
# Then check DMG if it exists # Then check DMG if it exists
echo "Looking for DMG..." echo "Looking for DMG..."
dmg_file=$(find ./dist -name "*.dmg" -print -quit) dmg_file=$(find ./apps/desktop/dist -name "*.dmg" -print -quit)
if [ -n "$dmg_file" ]; then if [ -n "$dmg_file" ]; then
echo "Found DMG: $dmg_file" echo "Found DMG: $dmg_file"
echo "Verifying DMG signing..." echo "Verifying DMG signing..."
codesign --verify --deep --strict --verbose=2 "$dmg_file" codesign --verify --deep --strict --verbose=2 "$dmg_file"
echo "Displaying DMG signing info..." echo "Displaying DMG signing info..."
codesign --display --verbose=2 "$dmg_file" codesign --display --verbose=2 "$dmg_file"
echo "Checking DMG notarization..." echo "Checking DMG notarization..."
xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet" xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet"
else else
echo "No DMG found to verify" echo "No DMG found to verify"
fi fi
# Finally check ZIP if it exists # Finally check ZIP if it exists
echo "Looking for ZIP..." echo "Looking for ZIP..."
zip_file=$(find ./dist -name "*.zip" -print -quit) zip_file=$(find ./apps/desktop/dist -name "*.zip" -print -quit)
if [ -n "$zip_file" ]; then if [ -n "$zip_file" ]; then
echo "Found ZIP: $zip_file" echo "Found ZIP: $zip_file"
echo "Note: ZIP files are not code signed, but their contents should be" echo "Note: ZIP files are not code signed, but their contents should be"
fi fi

View File

@ -8,25 +8,26 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
- name: Set up node & dependencies - uses: pnpm/action-setup@v4
uses: actions/setup-node@v4 - name: Set up node & dependencies
with: uses: actions/setup-node@v4
node-version: 22 with:
cache: "npm" node-version: 22
- name: Install dependencies cache: "pnpm"
shell: bash - name: Install dependencies
run: npm ci shell: bash
- name: Run Linux server build run: pnpm install --frozen-lockfile
env: - name: Run Linux server build
MATRIX_ARCH: ${{ inputs.arch }} env:
shell: bash MATRIX_ARCH: ${{ inputs.arch }}
run: | shell: bash
npm run chore:update-build-info run: |
./bin/build-server.sh pnpm run chore:update-build-info
- name: Prepare artifacts pnpm nx --project=server package
shell: bash - name: Prepare artifacts
run: | shell: bash
mkdir -p upload run: |
file=$(find dist -name '*.tar.xz' -print -quit) mkdir -p upload
name=${{ github.ref_name }} file=$(find ./apps/server/out -name '*.tar.xz' -print -quit)
cp "$file" "upload/TriliumNextNotes-Server-${name//\//-}-${{ inputs.os }}-${{ inputs.arch }}.tar.xz" name=${{ github.ref_name }}
cp "$file" "upload/TriliumNextNotes-Server-${name//\//-}-${{ inputs.os }}-${{ inputs.arch }}.tar.xz"

View File

@ -26,13 +26,14 @@ jobs:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies - name: Set up node & dependencies
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: "npm" cache: 'pnpm'
- name: Install dependencies
- run: npm ci run: pnpm install --frozen-lockfile
- name: Run the build - name: Run the build
uses: ./.github/actions/build-electron uses: ./.github/actions/build-electron
@ -58,13 +59,14 @@ jobs:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies - name: Set up node & dependencies
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: "npm" cache: "pnpm"
- run: npm ci - run: pnpm install --frozen-lockfile
- name: Run the build - name: Run the build
uses: ./.github/actions/build-server uses: ./.github/actions/build-server
@ -89,19 +91,16 @@ jobs:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies - name: Set up node & dependencies
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: "npm" cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: npm ci
- name: Run the TypeScript build
run: npx tsc
- name: Run the unit tests - name: Run the unit tests
run: npm run test run: pnpm run test
build_docker: build_docker:
name: Build Docker image name: Build Docker image
@ -110,14 +109,17 @@ jobs:
- test_dev - test_dev
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Install dependencies - name: Install dependencies
run: npm ci run: pnpm install --frozen-lockfile
- name: Update build info - name: Update build info
run: npm run chore:update-build-info run: pnpm run chore:update-build-info
- name: Trigger build
run: pnpm nx run server:build
- uses: docker/setup-buildx-action@v3 - uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6 - uses: docker/build-push-action@v6
with: with:
context: . context: apps/server
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
test_docker: test_docker:
@ -134,11 +136,14 @@ jobs:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Install dependencies - name: Install dependencies
run: npm ci run: pnpm install --frozen-lockfile
- name: Update build info - name: Update build info
run: npm run chore:update-build-info run: pnpm run chore:update-build-info
- name: Trigger build
run: pnpm nx run server:build
- name: Set IMAGE_NAME to lowercase - name: Set IMAGE_NAME to lowercase
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> $GITHUB_ENV run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> $GITHUB_ENV
@ -151,8 +156,8 @@ jobs:
- name: Build and export to Docker - name: Build and export to Docker
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: apps/server
file: ${{ matrix.dockerfile }} file: apps/server/${{ matrix.dockerfile }}
load: true load: true
tags: ${{ env.TEST_TAG }} tags: ${{ env.TEST_TAG }}
cache-from: type=gha cache-from: type=gha
@ -174,5 +179,4 @@ jobs:
# Print the entire log of the container thus far, regardless if the healthcheck failed or succeeded # Print the entire log of the container thus far, regardless if the healthcheck failed or succeeded
- name: Print entire log - name: Print entire log
if: always() if: always()
run: | run: journalctl -u docker CONTAINER_NAME=trilium_local --no-pager
journalctl -u docker CONTAINER_NAME=trilium_local --no-pager

View File

@ -42,25 +42,26 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies - name: Set up node & dependencies
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: "npm" cache: "pnpm"
- name: Install npm dependencies - name: Install npm dependencies
run: npm ci run: pnpm install --frozen-lockfile
- name: Install Playwright Browsers - name: Install Playwright Browsers
run: npx playwright install --with-deps run: npx playwright install --with-deps
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npm nx run server:build
- name: Build and export to Docker - name: Build and export to Docker
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: apps/server
file: ${{ matrix.dockerfile }} file: ${{ matrix.dockerfile }}
load: true load: true
tags: ${{ env.TEST_TAG }} tags: ${{ env.TEST_TAG }}
@ -133,7 +134,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install dependencies - name: Install dependencies
run: npm ci run: pnpm install --frozen-lockfile
- name: Update build info - name: Update build info
run: npm run chore:update-build-info run: npm run chore:update-build-info

View File

@ -12,11 +12,18 @@ on:
paths: paths:
- .github/actions/build-electron/* - .github/actions/build-electron/*
- forge.config.cjs - forge.config.cjs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env: env:
GITHUB_UPLOAD_URL: https://uploads.github.com/repos/TriliumNext/Notes/releases/179589950/assets{?name,label} GITHUB_UPLOAD_URL: https://uploads.github.com/repos/TriliumNext/Notes/releases/179589950/assets{?name,label}
GITHUB_RELEASE_ID: 179589950 GITHUB_RELEASE_ID: 179589950
permissions: permissions:
contents: write contents: write
jobs: jobs:
nightly-electron: nightly-electron:
name: Deploy nightly name: Deploy nightly
@ -40,12 +47,15 @@ jobs:
runs-on: ${{ matrix.os.image }} runs-on: ${{ matrix.os.image }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies - name: Set up node & dependencies
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: 'pnpm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: pnpm install --frozen-lockfile
- uses: nrwl/nx-set-shas@v4
- name: Update nightly version - name: Update nightly version
run: npm run chore:ci-update-nightly-version run: npm run chore:ci-update-nightly-version
- name: Run the build - name: Run the build
@ -73,23 +83,16 @@ jobs:
prerelease: true prerelease: true
draft: false draft: false
fail_on_unmatched_files: true fail_on_unmatched_files: true
files: upload/*.* files: apps/desktop/upload/*.*
tag_name: nightly tag_name: nightly
name: Nightly Build name: Nightly Build
- name: Publish artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: signing ${{ matrix.os.name }} ${{ matrix.arch }}
path: build/bin/electron-forge/sign
- name: Publish artifacts - name: Publish artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
with: with:
name: TriliumNextNotes ${{ matrix.os.name }} ${{ matrix.arch }} name: TriliumNextNotes ${{ matrix.os.name }} ${{ matrix.arch }}
path: upload path: apps/desktop/upload
nightly-server: nightly-server:
name: Deploy server nightly name: Deploy server nightly

View File

@ -1,27 +1,43 @@
name: Playwright Tests name: playwright
on: on:
push: push:
branches: [ develop ] branches:
- master
pull_request: pull_request:
branches: [ develop ]
permissions:
actions: read
contents: read
jobs: jobs:
test: main:
timeout-minutes: 60
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 with:
with: filter: tree:0
node-version: lts/* fetch-depth: 0
- name: Install dependencies
run: npm ci # This enables task distribution via Nx Cloud
- name: Install Playwright Browsers # Run this command as early as possible, before dependencies are installed
run: npx playwright install --with-deps # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
- name: Run Playwright tests # Connect your workspace by running "nx connect" and uncomment this line to enable task distribution
run: npx playwright test # - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="e2e-ci"
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }} - uses: pnpm/action-setup@v4
with: - uses: actions/setup-node@v4
name: playwright-report with:
path: playwright-report/ node-version: 22
retention-days: 30 cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- run: npx playwright install --with-deps
- uses: nrwl/nx-set-shas@v4
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: npx nx-cloud record -- echo Hello World
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
# When you enable task distribution, run the e2e-ci task instead of e2e
- run: npx nx affected -t e2e

View File

@ -33,10 +33,15 @@ jobs:
runs-on: ${{ matrix.os.image }} runs-on: ${{ matrix.os.image }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies - name: Set up node & dependencies
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- uses: nrwl/nx-set-shas@v4
- name: Run the build - name: Run the build
uses: ./.github/actions/build-electron uses: ./.github/actions/build-electron
with: with:
@ -58,7 +63,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: release-desktop-${{ matrix.os.name }}-${{ matrix.arch }} name: release-desktop-${{ matrix.os.name }}-${{ matrix.arch }}
path: upload/*.* path: apps/desktop/upload/*.*
build_server: build_server:
name: Build Linux Server name: Build Linux Server

81
.gitignore vendored
View File

@ -1,50 +1,43 @@
.cache # See https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
.DS_Store
node_modules/ # compiled output
dist/ dist
upload/ tmp
build/ out-tsc
coverage/
src/public/app-dist/ # dependencies
node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
po-*/ testem.log
.flatpak-builder/ /typings
*.db # System Files
!test/**/*.db .DS_Store
!integration-tests/db/document.db Thumbs.db
!integration-tests/db/config.ini
integration-tests/db/log
integration-tests/db/sessions
integration-tests/db/backup
integration-tests/db/session_secret.txt
cert.key .nx/cache
cert.crt .nx/workspace-data
server-package.json
.idea/httpRequests/
.idea/shelf/
data/
data-test/
data-demo/
tmp/
.eslintcache
out/ vite.config.*.timestamp*
vitest.config.*.timestamp*
test-output
images/app-icons/mac/*.png apps/*/data
/test-results/ apps/*/out
/playwright-report/ upload
/blob-report/
/playwright/.cache/
/playwright/.auth/
data-docs/backup
data-docs/log
data-docs/session
data-docs/session_secret.txt
data-docs/document.*
# Webpack
webpack-stats.json

View File

@ -1,15 +0,0 @@
FROM gitpod/workspace-full
RUN sudo apt-get update \
&& sudo apt-get install -yq --no-install-recommends \
libpng16-16 \
libpng-dev \
pkg-config \
autoconf \
libtool \
build-essential \
nasm \
libx11-dev \
libxkbfile-dev \
&& sudo rm -rf /var/lib/apt/lists/*

View File

@ -1,11 +0,0 @@
image:
file: .gitpod.dockerfile
tasks:
- before: nvm install 20.15.1 && nvm use 20.15.1
init: npm install
command: npm run server:start
ports:
- port: 8080
onOpen: open-preview

2
.nxignore Normal file
View File

@ -0,0 +1,2 @@
_regroup
_regroup_monorepo

View File

@ -1,11 +1,14 @@
{ {
"recommendations": [ "recommendations": [
"lokalise.i18n-ally",
"editorconfig.editorconfig",
"vitest.explorer",
"ms-playwright.playwright",
"tobermory.es6-string-html",
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"lokalise.i18n-ally",
"ms-azuretools.vscode-docker",
"ms-playwright.playwright",
"nrwl.angular-console",
"redhat.vscode-yaml",
"tobermory.es6-string-html",
"vitest.explorer",
"yzhang.markdown-all-in-one" "yzhang.markdown-all-in-one"
] ]
} }

View File

@ -1,20 +0,0 @@
# Review comments generated by i18n-ally. Please commit this file.
reviews:
help.inPageSearch:
description: >-
Describes the shortcut which triggers a search within the current
page/note only
add_label.to_value:
locales:
fr:
comments:
- user:
name: Potjoe-97
email: giann@LAPTOPT490-GF
id: QXec0JUoxfGmMlpch-B1S
comment: ''
suggestion: vers la valeur
type: request_change
time: '2024-10-15T16:57:06.188Z'
resolved: true

22
.vscode/launch.json vendored
View File

@ -1,22 +0,0 @@
{
"version": "0.2.0",
"configurations": [
// nodemon should be installed globally, use npm i -g nodemon
{
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"name": "nodemon start-server",
"program": "${workspaceFolder}/src/www",
"request": "launch",
"restart": true,
"runtimeExecutable": "nodemon",
"env": {
"TRILIUM_ENV": "dev",
"TRILIUM_DATA_DIR": "./data"
},
"skipFiles": ["<node_internals>/**"],
"type": "node",
"outputCapture": "std"
}
]
}

34
.vscode/settings.json vendored
View File

@ -1,30 +1,6 @@
{ {
"editor.formatOnSave": false, "i18n-ally.localesPaths": [
"editor.defaultFormatter": "esbenp.prettier-vscode", "apps/server/src/assets/translations",
"files.eol": "\n", "apps/client/src/translations"
"typescript.tsdk": "node_modules/typescript/lib", ]
"i18n-ally.sourceLanguage": "en", }
"i18n-ally.keystyle": "nested",
"i18n-ally.localesPaths": ["./src/public/translations", "./translations"],
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"github-actions.workflows.pinned.workflows": [".github/workflows/nightly.yml"],
"[css]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
"npm.exclude": [
"**/build",
"**/dist",
"**/out/**"
],
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
}
}

199
README.md
View File

@ -1,122 +1,109 @@
# TriliumNext Notes # Trilium
![GitHub Sponsors](https://img.shields.io/github/sponsors/eliandoran) ![Docker Pulls](https://img.shields.io/docker/pulls/triliumnext/notes) ![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/triliumnext/notes/total) <a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
[English](./README.md) | [Chinese](./README-ZH_CN.md) | [Russian](./README.ru.md) | [Japanese](./README.ja.md) | [Italian](./README.it.md) | [Spanish](./README.es.md) ✨ Your new, shiny [Nx workspace](https://nx.dev) is ready ✨.
TriliumNext Notes is an open-source, cross-platform hierarchical note taking application with focus on building large personal knowledge bases. [Learn more about this workspace setup and its capabilities](https://nx.dev/nx-api/js?utm_source=nx_project&amp;utm_medium=readme&amp;utm_campaign=nx_projects) or run `npx nx graph` to visually explore what was created. Now, let's get you up to speed!
See [screenshots](https://triliumnext.github.io/Docs/Wiki/screenshot-tour) for quick overview: ## Generate a library
<a href="https://triliumnext.github.io/Docs/Wiki/screenshot-tour"><img src="https://github.com/TriliumNext/Notes/blob/develop/images/screenshots/app.png?raw=true" alt="Trilium Screenshot" width="1000"></a> ```sh
npx nx g @nx/js:lib packages/pkg1 --publishable --importPath=@my-org/pkg1
## ⚠️ Why TriliumNext?
[The original Trilium project is in maintenance mode](https://github.com/zadam/trilium/issues/4620)
### Migrating from Trilium?
There are no special migration steps to migrate from a zadam/Trilium instance to a TriliumNext/Notes instance. Simply [install TriliumNext/Notes](#-installation) as usual and it will use your existing database.
Versions up to and including [v0.90.4](https://github.com/TriliumNext/Notes/releases/tag/v0.90.4) are compatible with the latest zadam/trilium version of [v0.63.7](https://github.com/zadam/trilium/releases/tag/v0.63.7). Any later versions of TriliumNext have their sync versions incremented.
## 💬 Discuss with us
Feel free to join our official conversations. We would love to hear what features, suggestions, or issues you may have!
- [Matrix](https://matrix.to/#/#triliumnext:matrix.org) (For synchronous discussions)
- The `General` Matrix room is also bridged to [XMPP](xmpp:discuss@trilium.thisgreat.party?join)
- [Github Discussions](https://github.com/TriliumNext/Notes/discussions) (For Asynchronous discussions)
- [Wiki](https://triliumnext.github.io/Docs/) (For common how-to questions and user guides)
## 🎁 Features
* Notes can be arranged into arbitrarily deep tree. Single note can be placed into multiple places in the tree (see [cloning](https://triliumnext.github.io/Docs/Wiki/cloning-notes))
* Rich WYSIWYG note editing including e.g. tables, images and [math](https://triliumnext.github.io/Docs/Wiki/text-notes) with markdown [autoformat](https://triliumnext.github.io/Docs/Wiki/text-notes#autoformat)
* Support for editing [notes with source code](https://triliumnext.github.io/Docs/Wiki/code-notes), including syntax highlighting
* Fast and easy [navigation between notes](https://triliumnext.github.io/Docs/Wiki/note-navigation), full text search and [note hoisting](https://triliumnext.github.io/Docs/Wiki/note-hoisting)
* Seamless [note versioning](https://triliumnext.github.io/Docs/Wiki/note-revisions)
* Note [attributes](https://triliumnext.github.io/Docs/Wiki/attributes) can be used for note organization, querying and advanced [scripting](https://triliumnext.github.io/Docs/Wiki/scripts)
* Direct OpenID and TOTP integration for more secure login
* [Synchronization](https://triliumnext.github.io/Docs/Wiki/synchronization) with self-hosted sync server
* there's a [3rd party service for hosting synchronisation server](https://trilium.cc/paid-hosting)
* [Sharing](https://triliumnext.github.io/Docs/Wiki/sharing) (publishing) notes to public internet
* Strong [note encryption](https://triliumnext.github.io/Docs/Wiki/protected-notes) with per-note granularity
* Sketching diagrams with built-in Excalidraw (note type "canvas")
* [Relation maps](https://triliumnext.github.io/Docs/Wiki/relation-map) and [link maps](https://triliumnext.github.io/Docs/Wiki/link-map) for visualizing notes and their relations
* [Scripting](https://triliumnext.github.io/Docs/Wiki/scripts) - see [Advanced showcases](https://triliumnext.github.io/Docs/Wiki/advanced-showcases)
* [REST API](https://triliumnext.github.io/Docs/Wiki/etapi) for automation
* Scales well in both usability and performance upwards of 100 000 notes
* Touch optimized [mobile frontend](https://triliumnext.github.io/Docs/Wiki/mobile-frontend) for smartphones and tablets
* [Night theme](https://triliumnext.github.io/Docs/Wiki/themes)
* [Evernote](https://triliumnext.github.io/Docs/Wiki/evernote-import) and [Markdown import & export](https://triliumnext.github.io/Docs/Wiki/markdown)
* [Web Clipper](https://triliumnext.github.io/Docs/Wiki/web-clipper) for easy saving of web content
✨ Check out the following third-party resources/communities for more TriliumNext related goodies:
- [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party themes, scripts, plugins and more.
- [TriliumRocks!](https://trilium.rocks/) for tutorials, guides, and much more.
## 🏗 Installation
### Desktop
To use TriliumNext on your desktop machine (Linux, MacOS, and Windows) you have a few options:
* Download the binary release for your platform from the [latest release page](https://github.com/TriliumNext/Notes/releases/latest), unzip the package and run the ```trilium``` executable.
* Access TriliumNext via the web interface of a server installation (see below)
* Currently only the latest versions of Chrome & Firefox are supported (and tested).
* TriliumNext is also provided as a Flatpak, but not yet published on FlatHub.
### Mobile
To use TriliumNext on a mobile device, you can use a mobile web browser to access the mobile interface of a server installation (see below).
If you prefer a native Android app, you can use [TriliumDroid](https://apt.izzysoft.de/fdroid/index/apk/eu.fliegendewurst.triliumdroid). Report bugs and missing features at [their repository](https://github.com/FliegendeWurst/TriliumDroid).
See issue https://github.com/TriliumNext/Notes/issues/72 for more information on mobile app support.
### Server
To install TriliumNext on your own server (including via Docker from [Dockerhub](https://hub.docker.com/r/triliumnext/notes)) follow [the server installation docs](https://triliumnext.github.io/Docs/Wiki/server-installation).
## 📝 Documentation
[See wiki for complete list of documentation pages.](https://triliumnext.github.io/Docs)
You can also read [Patterns of personal knowledge base](https://triliumnext.github.io/Docs/Wiki/patterns-of-personal-knowledge) to get some inspiration on how you might use TriliumNext.
## 💻 Contribute
### Code
```shell
git clone https://github.com/TriliumNext/Notes.git
cd Notes
npm install
npm run server:start
``` ```
For more details, see the [development docs](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Building%20and%20deployment/Running%20a%20development%20build.md). ## Run tasks
### Documentation To build the library use:
See the [documentation guide](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Documentation.md) for details. ```sh
npx nx build pkg1
```
## 👏 Shoutouts To run any task with Nx use:
* [CKEditor 5](https://github.com/ckeditor/ckeditor5) - best WYSIWYG editor on the market, very interactive and listening team ```sh
* [FancyTree](https://github.com/mar10/fancytree) - very feature rich tree library without real competition. TriliumNext Notes would not be the same without it. npx nx <target> <project-name>
* [CodeMirror](https://github.com/codemirror/CodeMirror) - code editor with support for huge amount of languages ```
* [jsPlumb](https://github.com/jsplumb/jsplumb) - visual connectivity library without competition. Used in [relation maps](https://triliumnext.github.io/Docs/Wiki/relation-map.html) and [link maps](https://triliumnext.github.io/Docs/Wiki/note-map.html#link-map)
## 🤝 Support These targets are either [inferred automatically](https://nx.dev/concepts/inferred-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) or defined in the `project.json` or `package.json` files.
Support for the TriliumNext organization will be possible in the near future. For now, you can: [More about running tasks in the docs &raquo;](https://nx.dev/features/run-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
- Support continued development on TriliumNext by supporting our developers: [eliandoran](https://github.com/sponsors/eliandoran) (See the [repository insights]([developers]([url](https://github.com/TriliumNext/Notes/graphs/contributors))) for a full list)
- Show a token of gratitude to the original Trilium developer ([zadam](https://github.com/sponsors/zadam)) via [PayPal](https://paypal.me/za4am) or Bitcoin (bitcoin:bc1qv3svjn40v89mnkre5vyvs2xw6y8phaltl385d2).
## Versioning and releasing
## 🔑 License To version and release the library use
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ```
npx nx release
```
Pass `--dry-run` to see what would happen without actually releasing the library.
[Learn more about Nx release &raquo;](hhttps://nx.dev/features/manage-releases?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
## Keep TypeScript project references up to date
Nx automatically updates TypeScript [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) in `tsconfig.json` files to ensure they remain accurate based on your project dependencies (`import` or `require` statements). This sync is automatically done when running tasks such as `build` or `typecheck`, which require updated references to function correctly.
To manually trigger the process to sync the project graph dependencies information to the TypeScript project references, run the following command:
```sh
npx nx sync
```
You can enforce that the TypeScript project references are always in the correct state when running in CI by adding a step to your CI job configuration that runs the following command:
```sh
npx nx sync:check
```
[Learn more about nx sync](https://nx.dev/reference/nx-commands#sync)
## Set up CI!
### Step 1
To connect to Nx Cloud, run the following command:
```sh
npx nx connect
```
Connecting to Nx Cloud ensures a [fast and scalable CI](https://nx.dev/ci/intro/why-nx-cloud?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) pipeline. It includes features such as:
- [Remote caching](https://nx.dev/ci/features/remote-cache?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
- [Task distribution across multiple machines](https://nx.dev/ci/features/distribute-task-execution?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
- [Automated e2e test splitting](https://nx.dev/ci/features/split-e2e-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
- [Task flakiness detection and rerunning](https://nx.dev/ci/features/flaky-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
### Step 2
Use the following command to configure a CI workflow for your workspace:
```sh
npx nx g ci-workflow
```
[Learn more about Nx on CI](https://nx.dev/ci/intro/ci-with-nx#ready-get-started-with-your-provider?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
## Install Nx Console
Nx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.
[Install Nx Console &raquo;](https://nx.dev/getting-started/editor-setup?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
## Useful links
Learn more:
- [Learn more about this workspace setup](https://nx.dev/nx-api/js?utm_source=nx_project&amp;utm_medium=readme&amp;utm_campaign=nx_projects)
- [Learn about Nx on CI](https://nx.dev/ci/intro/ci-with-nx?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
- [Releasing Packages with Nx release](https://nx.dev/features/manage-releases?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
- [What are Nx plugins?](https://nx.dev/concepts/nx-plugins?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
And join the Nx community:
- [Discord](https://go.nx.dev/community)
- [Follow us on X](https://twitter.com/nxdevtools) or [LinkedIn](https://www.linkedin.com/company/nrwl)
- [Our Youtube channel](https://www.youtube.com/@nxdevtools)
- [Our blog](https://nx.dev/blog?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)

30
_regroup/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,30 @@
{
"editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.eol": "\n",
"typescript.tsdk": "node_modules/typescript/lib",
"i18n-ally.sourceLanguage": "en",
"i18n-ally.keystyle": "nested",
"i18n-ally.localesPaths": ["./src/public/translations", "./translations"],
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"github-actions.workflows.pinned.workflows": [".github/workflows/nightly.yml"],
"[css]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
"npm.exclude": [
"**/build",
"**/dist",
"**/out/**"
],
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
}
}

0
bin/build-docker.sh → _regroup/bin/build-docker.sh Executable file → Normal file
View File

0
bin/create-icons.sh → _regroup/bin/create-icons.sh Executable file → Normal file
View File

0
bin/export-schema.sh → _regroup/bin/export-schema.sh Executable file → Normal file
View File

0
bin/generate-cert.sh → _regroup/bin/generate-cert.sh Executable file → Normal file
View File

View File

View File

0
bin/release.sh → _regroup/bin/release.sh Executable file → Normal file
View File

0
bin/translation.sh → _regroup/bin/translation.sh Executable file → Normal file
View File

View File

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 383 B

View File

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 356 B

View File

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 357 B

View File

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 387 B

View File

Before

Width:  |  Height:  |  Size: 734 B

After

Width:  |  Height:  |  Size: 734 B

Some files were not shown because too many files have changed in this diff Show More