diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 3cd311d501..cc2d710782 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -1,8 +1,15 @@ name: Install description: Set up Node.js, Corepack, and install dependencies with yarn cache +# The Blacksmith condition must match the runner selection in workflows/ci.yml. runs: using: composite steps: + - name: Mount Node.js toolcache + if: ${{ github.repository_owner == 'outline' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} + uses: useblacksmith/stickydisk@94697d49e77d0dd78b77deb85ad3de63a28b4b8a # v1.7.1 + with: + key: ${{ github.repository }}-node-toolcache + path: /opt/hostedtoolcache/node - name: Enable Corepack shell: bash run: corepack enable @@ -10,7 +17,20 @@ runs: uses: actions/setup-node@v5 with: node-version: 26.x - cache: "yarn" + # Blacksmith jobs persist the yarn cache on a sticky disk instead. + package-manager-cache: ${{ !(github.repository_owner == 'outline' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) }} + - name: Mount yarn cache + if: ${{ github.repository_owner == 'outline' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} + uses: useblacksmith/stickydisk@94697d49e77d0dd78b77deb85ad3de63a28b4b8a # v1.7.1 + with: + key: ${{ github.repository }}-yarn-cache + path: ~/.yarn/berry/cache + - name: Mount node_modules + if: ${{ github.repository_owner == 'outline' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} + uses: useblacksmith/stickydisk@94697d49e77d0dd78b77deb85ad3de63a28b4b8a # v1.7.1 + with: + key: ${{ github.repository }}-node-modules + path: ./node_modules - name: Install dependencies shell: bash run: yarn install --immutable diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba95754024..d763a546ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,12 @@ env: jobs: changes: - runs-on: ubuntu-latest + # Blacksmith runners are only available to the outline organization, and are + # not used for pull requests from forks so that fork-controlled code cannot + # write to the shared sticky disks. Keep in sync with actions/install. + runs-on: ${{ (github.repository_owner == 'outline' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }} outputs: + runner: ${{ (github.repository_owner == 'outline' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }} code: ${{ steps.filter.outputs.code }} config: ${{ steps.filter.outputs.config }} server: ${{ steps.filter.outputs.server }} @@ -60,7 +64,7 @@ jobs: lint: needs: changes if: ${{ needs.changes.outputs.code == 'true' }} - runs-on: ubuntu-latest + runs-on: ${{ needs.changes.outputs.runner }} steps: - uses: actions/checkout@v5 - uses: ./.github/actions/install @@ -79,7 +83,7 @@ jobs: types: needs: changes if: ${{ needs.changes.outputs.code == 'true' }} - runs-on: ubuntu-latest + runs-on: ${{ needs.changes.outputs.runner }} steps: - uses: actions/checkout@v5 - uses: ./.github/actions/install @@ -88,7 +92,7 @@ jobs: audit: needs: changes if: ${{ needs.changes.outputs.deps == 'true' }} - runs-on: ubuntu-latest + runs-on: ${{ needs.changes.outputs.runner }} steps: - uses: actions/checkout@v5 - uses: ./.github/actions/install @@ -97,7 +101,7 @@ jobs: test: needs: changes if: ${{ needs.changes.outputs.app == 'true' || needs.changes.outputs.config == 'true' }} - runs-on: ubuntu-latest + runs-on: ${{ needs.changes.outputs.runner }} strategy: matrix: test-group: [app, shared] @@ -109,37 +113,30 @@ jobs: test-server: needs: changes if: ${{ needs.changes.outputs.server == 'true' || needs.changes.outputs.config == 'true' }} - runs-on: ubuntu-latest - services: - postgres: - image: postgres:14.2 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - POSTGRES_DB: outline_test - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - + runs-on: ${{ needs.changes.outputs.runner }} strategy: matrix: - shard: [1, 2, 3, 4] + shard: [1, 2, 3, 4, 5, 6] steps: - uses: actions/checkout@v5 + # The runner image ships with PostgreSQL preinstalled, starting it is much + # faster than pulling and initializing a service container. + - name: Start PostgreSQL + run: | + sudo systemctl start postgresql.service + until pg_isready -h localhost; do sleep 1; done + sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'password';" + sudo -u postgres createdb outline_test - uses: ./.github/actions/install - run: yarn sequelize db:migrate - name: Run server tests - run: yarn test:server --maxWorkers=2 --shard=${{ matrix.shard }}/4 + run: yarn test:server --maxWorkers=4 --shard=${{ matrix.shard }}/6 bundle-size: needs: changes if: ${{ (needs.changes.outputs.app == 'true' || needs.changes.outputs.config == 'true') && github.repository == 'outline/outline' }} - runs-on: ubuntu-latest + runs-on: ${{ needs.changes.outputs.runner }} steps: - uses: actions/checkout@v5 - uses: ./.github/actions/install diff --git a/app/components/Sidebar/components/DraggableCollectionLink.tsx b/app/components/Sidebar/components/DraggableCollectionLink.tsx index 192a3e7046..d2caac6c30 100644 --- a/app/components/Sidebar/components/DraggableCollectionLink.tsx +++ b/app/components/Sidebar/components/DraggableCollectionLink.tsx @@ -2,7 +2,6 @@ import fractionalIndex from "fractional-index"; import { observer } from "mobx-react"; import type * as React from "react"; import { useState, useEffect, useCallback } from "react"; -import type { DropTargetMonitor } from "react-dnd"; import { useDrop, useDrag } from "react-dnd"; import { getEmptyImage } from "react-dnd-html5-backend"; import styled from "styled-components"; @@ -11,7 +10,6 @@ import type Document from "~/models/Document"; import CollectionIcon from "~/components/Icons/CollectionIcon"; import { useActiveSidebarContext } from "~/hooks/useActiveSidebarContext"; import useStores from "~/hooks/useStores"; -import type { DragObject } from "../hooks/useDragAndDrop"; import CollectionLink from "./CollectionLink"; import DropCursor from "./DropCursor"; import SidebarDisclosureContext, { @@ -26,6 +24,12 @@ type Props = { belowCollection: Collection | void; }; +interface CollectionDragItem { + id: string; + title: string; + icon: React.ReactNode; +} + function DraggableCollectionLink({ collection, activeDocument, @@ -48,9 +52,13 @@ function DraggableCollectionLink({ const [ { isCollectionDropping, isDraggingAnyCollection }, dropToReorderCollection, - ] = useDrop({ + ] = useDrop< + CollectionDragItem, + void, + { isCollectionDropping: boolean; isDraggingAnyCollection: boolean } + >({ accept: "collection", - drop: (item: DragObject) => { + drop: (item) => { void collections.move( item.id, fractionalIndex(collection.index, belowCollectionIndex) @@ -60,7 +68,7 @@ function DraggableCollectionLink({ collection.id !== item.id && (!belowCollection || item.id !== belowCollection.id) && !!policies.abilities(item.id).move, - collect: (monitor: DropTargetMonitor) => ({ + collect: (monitor) => ({ isCollectionDropping: monitor.isOver(), isDraggingAnyCollection: monitor.canDrop(), }), diff --git a/app/stores/base/Store.ts b/app/stores/base/Store.ts index 1409157e3e..73c6f47990 100644 --- a/app/stores/base/Store.ts +++ b/app/stores/base/Store.ts @@ -249,7 +249,7 @@ export default abstract class Store { } // @ts-expect-error TS thinks that we're instantiating an abstract class here - const newModel = new ModelClass(item, this); + const newModel: T = new ModelClass(item, this); this.data.set(newModel.id, newModel); this.persistence?.persist(newModel.id); return newModel; diff --git a/package.json b/package.json index 472c59d779..7574742858 100644 --- a/package.json +++ b/package.json @@ -367,7 +367,7 @@ "rimraf": "^6.1.3", "rollup-plugin-webpack-stats": "^3.1.3", "terser": "^5.49.0", - "typescript": "^6.0.3", + "typescript": "^7.0.2", "unplugin-swc": "^1.5.11", "vite-tsconfig-paths": "^6.1.1", "vitest": "^4.1.11" @@ -388,5 +388,5 @@ "i18next-parser/i18next": "^23.16.8" }, "version": "1.10.1", - "packageManager": "yarn@4.11.0" + "packageManager": "yarn@4.18.0" } diff --git a/yarn.lock b/yarn.lock index 734baa469c..777e291791 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # Manual changes might be lost - proceed with caution! __metadata: - version: 8 + version: 10 cacheKey: 10c0 "@antfu/install-pkg@npm:^1.1.0": @@ -7524,6 +7524,146 @@ __metadata: languageName: node linkType: hard +"@typescript/typescript-aix-ppc64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-aix-ppc64@npm:7.0.2" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + +"@typescript/typescript-darwin-arm64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-darwin-arm64@npm:7.0.2" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/typescript-darwin-x64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-darwin-x64@npm:7.0.2" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@typescript/typescript-freebsd-arm64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-freebsd-arm64@npm:7.0.2" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/typescript-freebsd-x64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-freebsd-x64@npm:7.0.2" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@typescript/typescript-linux-arm64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-linux-arm64@npm:7.0.2" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/typescript-linux-arm@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-linux-arm@npm:7.0.2" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@typescript/typescript-linux-loong64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-linux-loong64@npm:7.0.2" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + +"@typescript/typescript-linux-mips64el@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-linux-mips64el@npm:7.0.2" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@typescript/typescript-linux-ppc64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-linux-ppc64@npm:7.0.2" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@typescript/typescript-linux-riscv64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-linux-riscv64@npm:7.0.2" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@typescript/typescript-linux-s390x@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-linux-s390x@npm:7.0.2" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@typescript/typescript-linux-x64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-linux-x64@npm:7.0.2" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@typescript/typescript-netbsd-arm64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-netbsd-arm64@npm:7.0.2" + conditions: os=netbsd & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/typescript-netbsd-x64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-netbsd-x64@npm:7.0.2" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@typescript/typescript-openbsd-arm64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-openbsd-arm64@npm:7.0.2" + conditions: os=openbsd & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/typescript-openbsd-x64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-openbsd-x64@npm:7.0.2" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@typescript/typescript-sunos-x64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-sunos-x64@npm:7.0.2" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@typescript/typescript-win32-arm64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-win32-arm64@npm:7.0.2" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/typescript-win32-x64@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript/typescript-win32-x64@npm:7.0.2" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@upsetjs/venn.js@npm:^2.0.0": version: 2.0.0 resolution: "@upsetjs/venn.js@npm:2.0.0" @@ -15774,7 +15914,7 @@ __metadata: tiny-cookie: "npm:^2.5.1" tmp: "npm:^0.2.6" tunnel-agent: "npm:^0.6.0" - typescript: "npm:^6.0.3" + typescript: "npm:^7.0.2" ukkonen: "npm:^2.2.0" umzug: "npm:^3.8.3" unplugin-swc: "npm:^1.5.11" @@ -17874,7 +18014,7 @@ __metadata: "resolve@patch:resolve@npm%3A^1.22.1#optional!builtin, resolve@patch:resolve@npm%3A^1.22.11#optional!builtin, resolve@patch:resolve@npm%3A~1.22.1#optional!builtin": version: 1.22.12 - resolution: "resolve@patch:resolve@npm%3A1.22.12#optional!builtin::version=1.22.12&hash=c3c19d" + resolution: "resolve@patch:resolve@npm%3A1.22.12#optional!builtin::version=1.22.12&hash=9bd1a5" dependencies: es-errors: "npm:^1.3.0" is-core-module: "npm:^2.16.1" @@ -17882,7 +18022,7 @@ __metadata: supports-preserve-symlinks-flag: "npm:^1.0.0" bin: resolve: bin/resolve - checksum: 10c0/fc6519984ae1f894d877c0060ba8b1f5ba3bc0e85a02f74e141929c118c23d74d9735619a9cc2965397387e514884245c65d72a40731dcb6cfc84c7bcdc8321e + checksum: 10c0/e12af106e16e652bd83060e8afacece4ee3dcbd0f4cf028e3d9ad178e6ced9ecb1c87ee60158b239582313902a717f8adc57a9b76ea54b1994141ba15f420c65 languageName: node linkType: hard @@ -20034,13 +20174,74 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^6.0.3": - version: 6.0.3 - resolution: "typescript@npm:6.0.3" +"typescript@npm:^7.0.2": + version: 7.0.2 + resolution: "typescript@npm:7.0.2" + dependencies: + "@typescript/typescript-aix-ppc64": "npm:7.0.2" + "@typescript/typescript-darwin-arm64": "npm:7.0.2" + "@typescript/typescript-darwin-x64": "npm:7.0.2" + "@typescript/typescript-freebsd-arm64": "npm:7.0.2" + "@typescript/typescript-freebsd-x64": "npm:7.0.2" + "@typescript/typescript-linux-arm": "npm:7.0.2" + "@typescript/typescript-linux-arm64": "npm:7.0.2" + "@typescript/typescript-linux-loong64": "npm:7.0.2" + "@typescript/typescript-linux-mips64el": "npm:7.0.2" + "@typescript/typescript-linux-ppc64": "npm:7.0.2" + "@typescript/typescript-linux-riscv64": "npm:7.0.2" + "@typescript/typescript-linux-s390x": "npm:7.0.2" + "@typescript/typescript-linux-x64": "npm:7.0.2" + "@typescript/typescript-netbsd-arm64": "npm:7.0.2" + "@typescript/typescript-netbsd-x64": "npm:7.0.2" + "@typescript/typescript-openbsd-arm64": "npm:7.0.2" + "@typescript/typescript-openbsd-x64": "npm:7.0.2" + "@typescript/typescript-sunos-x64": "npm:7.0.2" + "@typescript/typescript-win32-arm64": "npm:7.0.2" + "@typescript/typescript-win32-x64": "npm:7.0.2" + dependenciesMeta: + "@typescript/typescript-aix-ppc64": + optional: true + "@typescript/typescript-darwin-arm64": + optional: true + "@typescript/typescript-darwin-x64": + optional: true + "@typescript/typescript-freebsd-arm64": + optional: true + "@typescript/typescript-freebsd-x64": + optional: true + "@typescript/typescript-linux-arm": + optional: true + "@typescript/typescript-linux-arm64": + optional: true + "@typescript/typescript-linux-loong64": + optional: true + "@typescript/typescript-linux-mips64el": + optional: true + "@typescript/typescript-linux-ppc64": + optional: true + "@typescript/typescript-linux-riscv64": + optional: true + "@typescript/typescript-linux-s390x": + optional: true + "@typescript/typescript-linux-x64": + optional: true + "@typescript/typescript-netbsd-arm64": + optional: true + "@typescript/typescript-netbsd-x64": + optional: true + "@typescript/typescript-openbsd-arm64": + optional: true + "@typescript/typescript-openbsd-x64": + optional: true + "@typescript/typescript-sunos-x64": + optional: true + "@typescript/typescript-win32-arm64": + optional: true + "@typescript/typescript-win32-x64": + optional: true bin: tsc: bin/tsc - tsserver: bin/tsserver - checksum: 10c0/4a25ff5045b984370f48f196b3a0120779b1b343d40b9a68d114ea5e5fff099809b2bb777576991a63a5cd59cf7bffd96ff6fe10afcefbcb8bd6fb96ad4b6606 + checksum: 10c0/3dcee51ec8c332492325bcdbf7df48b66668751f127e622ae7d41b6c716eb19184424a45e14f7750f50f340232388b69e6287859155f06a5ce2df76f12cb31cf languageName: node linkType: hard @@ -20054,13 +20255,74 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^6.0.3#optional!builtin": - version: 6.0.3 - resolution: "typescript@patch:typescript@npm%3A6.0.3#optional!builtin::version=6.0.3&hash=5786d5" +"typescript@patch:typescript@npm%3A^7.0.2#optional!builtin": + version: 7.0.2 + resolution: "typescript@patch:typescript@npm%3A7.0.2#optional!builtin::version=7.0.2&hash=3bafbf" + dependencies: + "@typescript/typescript-aix-ppc64": "npm:7.0.2" + "@typescript/typescript-darwin-arm64": "npm:7.0.2" + "@typescript/typescript-darwin-x64": "npm:7.0.2" + "@typescript/typescript-freebsd-arm64": "npm:7.0.2" + "@typescript/typescript-freebsd-x64": "npm:7.0.2" + "@typescript/typescript-linux-arm": "npm:7.0.2" + "@typescript/typescript-linux-arm64": "npm:7.0.2" + "@typescript/typescript-linux-loong64": "npm:7.0.2" + "@typescript/typescript-linux-mips64el": "npm:7.0.2" + "@typescript/typescript-linux-ppc64": "npm:7.0.2" + "@typescript/typescript-linux-riscv64": "npm:7.0.2" + "@typescript/typescript-linux-s390x": "npm:7.0.2" + "@typescript/typescript-linux-x64": "npm:7.0.2" + "@typescript/typescript-netbsd-arm64": "npm:7.0.2" + "@typescript/typescript-netbsd-x64": "npm:7.0.2" + "@typescript/typescript-openbsd-arm64": "npm:7.0.2" + "@typescript/typescript-openbsd-x64": "npm:7.0.2" + "@typescript/typescript-sunos-x64": "npm:7.0.2" + "@typescript/typescript-win32-arm64": "npm:7.0.2" + "@typescript/typescript-win32-x64": "npm:7.0.2" + dependenciesMeta: + "@typescript/typescript-aix-ppc64": + optional: true + "@typescript/typescript-darwin-arm64": + optional: true + "@typescript/typescript-darwin-x64": + optional: true + "@typescript/typescript-freebsd-arm64": + optional: true + "@typescript/typescript-freebsd-x64": + optional: true + "@typescript/typescript-linux-arm": + optional: true + "@typescript/typescript-linux-arm64": + optional: true + "@typescript/typescript-linux-loong64": + optional: true + "@typescript/typescript-linux-mips64el": + optional: true + "@typescript/typescript-linux-ppc64": + optional: true + "@typescript/typescript-linux-riscv64": + optional: true + "@typescript/typescript-linux-s390x": + optional: true + "@typescript/typescript-linux-x64": + optional: true + "@typescript/typescript-netbsd-arm64": + optional: true + "@typescript/typescript-netbsd-x64": + optional: true + "@typescript/typescript-openbsd-arm64": + optional: true + "@typescript/typescript-openbsd-x64": + optional: true + "@typescript/typescript-sunos-x64": + optional: true + "@typescript/typescript-win32-arm64": + optional: true + "@typescript/typescript-win32-x64": + optional: true bin: tsc: bin/tsc - tsserver: bin/tsserver - checksum: 10c0/2f25c74e65663c248fa1ade2b8459d9ce5372ff9dad07067310f132966ebec1d93f6c42f0baf77a6b6a7a91460463f708e6887013aaade22111037457c6b25df + checksum: 10c0/6b3cdc369cd829d46e00734ea64233ee84419c2825ad8fe408915adde77abced4b7a2401f7eed517d54a7a4f5d1c1869753cb99018df1c2159c761d9f33483a6 languageName: node linkType: hard