From 49f6e882819dfb6cfc1a45c39ba3cfb89eab5a35 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 7 Oct 2026 15:02:04 +0800 Subject: [PATCH 1/2] Rename fs to core --- .../workflows/{fs_build.yaml => core_build.yaml} | 16 ++++++++-------- .github/workflows/desktop_build.yaml | 4 ++-- apps/desktop/package.json | 2 +- apps/desktop/scripts/dev.mjs | 4 ++-- apps/desktop/src/main/index.ts | 2 +- apps/desktop/src/main/plugins.test.ts | 6 +++--- apps/desktop/src/main/plugins.ts | 2 +- apps/desktop/src/main/protocol.electron.test.ts | 2 +- apps/desktop/src/main/protocol.test.ts | 2 +- apps/desktop/src/main/protocol.ts | 2 +- apps/desktop/src/main/settings.test.ts | 6 +++--- apps/desktop/src/main/settings.ts | 2 +- apps/desktop/src/main/window.test.ts | 4 ++-- apps/desktop/src/main/window.ts | 2 +- packages/README.md | 4 ++-- packages/{fs => core}/AGENTS.md | 4 ++-- packages/{fs => core}/CLAUDE.md | 0 packages/{fs => core}/biome.json | 0 packages/{fs => core}/package.json | 4 ++-- packages/{fs => core}/src/index.ts | 0 packages/{fs => core}/tsconfig.json | 0 pnpm-lock.yaml | 6 +++--- 22 files changed, 37 insertions(+), 37 deletions(-) rename .github/workflows/{fs_build.yaml => core_build.yaml} (68%) rename packages/{fs => core}/AGENTS.md (88%) rename packages/{fs => core}/CLAUDE.md (100%) rename packages/{fs => core}/biome.json (100%) rename packages/{fs => core}/package.json (80%) rename packages/{fs => core}/src/index.ts (100%) rename packages/{fs => core}/tsconfig.json (100%) diff --git a/.github/workflows/fs_build.yaml b/.github/workflows/core_build.yaml similarity index 68% rename from .github/workflows/fs_build.yaml rename to .github/workflows/core_build.yaml index 8952292..82b36d1 100644 --- a/.github/workflows/fs_build.yaml +++ b/.github/workflows/core_build.yaml @@ -1,18 +1,18 @@ -name: Fs Build +name: Core Build on: workflow_dispatch: {} push: paths: - - .github/workflows/fs_build.yaml - - packages/fs/** + - .github/workflows/core_build.yaml + - packages/core/** - package.json - pnpm-lock.yaml - pnpm-workspace.yaml pull_request: paths: - - .github/workflows/fs_build.yaml - - packages/fs/** + - .github/workflows/core_build.yaml + - packages/core/** - package.json - pnpm-lock.yaml - pnpm-workspace.yaml @@ -22,7 +22,7 @@ permissions: jobs: build: - name: Build Fs + name: Build Core runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -35,5 +35,5 @@ jobs: cache: pnpm cache-dependency-path: pnpm-lock.yaml - run: pnpm install --frozen-lockfile - - run: pnpm --filter @elsewise/fs check - - run: pnpm --filter @elsewise/fs typecheck + - run: pnpm --filter @elsewise/core check + - run: pnpm --filter @elsewise/core typecheck diff --git a/.github/workflows/desktop_build.yaml b/.github/workflows/desktop_build.yaml index 5286ebe..8eaf7e0 100644 --- a/.github/workflows/desktop_build.yaml +++ b/.github/workflows/desktop_build.yaml @@ -9,7 +9,7 @@ on: - apps/web/** - packages/bridge/** - packages/components/** - - packages/fs/** + - packages/core/** - packages/plugin/** - package.json - pnpm-lock.yaml @@ -21,7 +21,7 @@ on: - apps/web/** - packages/bridge/** - packages/components/** - - packages/fs/** + - packages/core/** - packages/plugin/** - package.json - pnpm-lock.yaml diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 2b33591..0c673dd 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -34,7 +34,7 @@ "@biomejs/biome": "^2.5.14", "@electron/fuses": "^2.1.3", "@elsewise/bridge": "workspace:*", - "@elsewise/fs": "workspace:*", + "@elsewise/core": "workspace:*", "@elsewise/web": "workspace:*", "@types/node": "^26.4.1", "electron": "44.5.1", diff --git a/apps/desktop/scripts/dev.mjs b/apps/desktop/scripts/dev.mjs index 7d58237..79e4fa0 100644 --- a/apps/desktop/scripts/dev.mjs +++ b/apps/desktop/scripts/dev.mjs @@ -72,10 +72,10 @@ console.log(`[dev] waiting for renderer at ${RENDERER_URL} ...`); await waitForUrl(RENDERER_URL); startElectron(); -// Rebuild + restart Electron on main/preload changes, and on changes to the bridge and fs bundled into them +// Rebuild + restart Electron on main/preload changes, and on changes to the bridge and core bundled into them // (debounced). let timer; -for (const folder of ['src', '../../packages/bridge/src', '../../packages/fs/src']) { +for (const folder of ['src', '../../packages/bridge/src', '../../packages/core/src']) { watch(folder, { recursive: true }, () => { clearTimeout(timer); timer = setTimeout(async () => { diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.ts index 8e92287..8fca3e2 100644 --- a/apps/desktop/src/main/index.ts +++ b/apps/desktop/src/main/index.ts @@ -1,6 +1,6 @@ import path from 'node:path'; import type { Brightness } from '@elsewise/bridge'; -import { dataLocalDir } from '@elsewise/fs'; +import { dataLocalDir } from '@elsewise/core'; import { app, BrowserWindow, nativeTheme, protocol, shell } from 'electron'; import { installMenu } from './menu'; import { handlePlugins } from './plugins'; diff --git a/apps/desktop/src/main/plugins.test.ts b/apps/desktop/src/main/plugins.test.ts index 8838d60..149d843 100644 --- a/apps/desktop/src/main/plugins.test.ts +++ b/apps/desktop/src/main/plugins.test.ts @@ -1,18 +1,18 @@ import fs from 'node:fs'; import path from 'node:path'; -import { dataLocalDir } from '@elsewise/fs'; +import { dataLocalDir } from '@elsewise/core'; import { ipcMain } from 'electron'; import { afterAll, afterEach, describe, expect, test, vi } from 'vitest'; import { handlePlugins } from './plugins'; vi.mock('electron', () => ({ ipcMain: { handle: vi.fn() } })); // The real `writeJsonSync`, but in a temporary folder rather than the user's data folder. -vi.mock('@elsewise/fs', async (importOriginal) => { +vi.mock('@elsewise/core', async (importOriginal) => { const { mkdtempSync } = await import('node:fs'); const { tmpdir } = await import('node:os'); const { join } = await import('node:path'); const data = mkdtempSync(join(tmpdir(), 'elsewise-')); - return { ...(await importOriginal()), dataLocalDir: () => data }; + return { ...(await importOriginal()), dataLocalDir: () => data }; }); const FILE = path.join(dataLocalDir(), 'plugins.json'); diff --git a/apps/desktop/src/main/plugins.ts b/apps/desktop/src/main/plugins.ts index eb9fc21..2e0274c 100644 --- a/apps/desktop/src/main/plugins.ts +++ b/apps/desktop/src/main/plugins.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { InstalledPlugin } from '@elsewise/bridge'; -import { dataLocalDir, writeJsonSync } from '@elsewise/fs'; +import { dataLocalDir, writeJsonSync } from '@elsewise/core'; import { ipcMain } from 'electron'; const FILE = path.join(dataLocalDir(), 'plugins.json'); diff --git a/apps/desktop/src/main/protocol.electron.test.ts b/apps/desktop/src/main/protocol.electron.test.ts index 5ab85ef..a9cc462 100644 --- a/apps/desktop/src/main/protocol.electron.test.ts +++ b/apps/desktop/src/main/protocol.electron.test.ts @@ -4,7 +4,7 @@ import http from 'node:http'; import type { AddressInfo } from 'node:net'; import os from 'node:os'; import path from 'node:path'; -import { dataLocalDir } from '@elsewise/fs'; +import { dataLocalDir } from '@elsewise/core'; import electron from 'electron'; import { _electron, type ElectronApplication } from 'playwright'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'; diff --git a/apps/desktop/src/main/protocol.test.ts b/apps/desktop/src/main/protocol.test.ts index a17ded8..44106b5 100644 --- a/apps/desktop/src/main/protocol.test.ts +++ b/apps/desktop/src/main/protocol.test.ts @@ -26,7 +26,7 @@ vi.mock('electron', () => ({ }, session: { defaultSession: { protocol: { handle: vi.fn() } } }, })); -vi.mock('@elsewise/fs', () => ({ dataLocalDir: () => DATA })); +vi.mock('@elsewise/core', () => ({ dataLocalDir: () => DATA })); beforeEach(() => { files.clear(); diff --git a/apps/desktop/src/main/protocol.ts b/apps/desktop/src/main/protocol.ts index 27e662c..a903348 100644 --- a/apps/desktop/src/main/protocol.ts +++ b/apps/desktop/src/main/protocol.ts @@ -1,6 +1,6 @@ import path from 'node:path'; import { pathToFileURL } from 'node:url'; -import { dataLocalDir } from '@elsewise/fs'; +import { dataLocalDir } from '@elsewise/core'; import { net, session } from 'electron'; const MIME_TYPES: Record = { diff --git a/apps/desktop/src/main/settings.test.ts b/apps/desktop/src/main/settings.test.ts index a5aeeaf..e628c2b 100644 --- a/apps/desktop/src/main/settings.test.ts +++ b/apps/desktop/src/main/settings.test.ts @@ -1,20 +1,20 @@ import fs from 'node:fs'; import path from 'node:path'; import { DEFAULT_SETTINGS, type Settings } from '@elsewise/bridge'; -import { configLocalDir, dataLocalDir } from '@elsewise/fs'; +import { configLocalDir, dataLocalDir } from '@elsewise/core'; import { ipcMain } from 'electron'; import { afterAll, afterEach, describe, expect, test, vi } from 'vitest'; import { handleSettings } from './settings'; vi.mock('electron', () => ({ ipcMain: { handle: vi.fn() } })); // The real `writeJsonSync`, but in a temporary folder rather than the user's config and data folders. -vi.mock('@elsewise/fs', async (importOriginal) => { +vi.mock('@elsewise/core', async (importOriginal) => { const { mkdtempSync } = await import('node:fs'); const { tmpdir } = await import('node:os'); const { join } = await import('node:path'); const home = mkdtempSync(join(tmpdir(), 'elsewise-')); return { - ...(await importOriginal()), + ...(await importOriginal()), configLocalDir: () => join(home, 'config'), dataLocalDir: () => join(home, 'data'), }; diff --git a/apps/desktop/src/main/settings.ts b/apps/desktop/src/main/settings.ts index 8e59e59..fd70d17 100644 --- a/apps/desktop/src/main/settings.ts +++ b/apps/desktop/src/main/settings.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { DEFAULT_SETTINGS, PluginId, Settings } from '@elsewise/bridge'; -import { configLocalDir, dataLocalDir, writeJsonSync } from '@elsewise/fs'; +import { configLocalDir, dataLocalDir, writeJsonSync } from '@elsewise/core'; import { ipcMain } from 'electron'; /** diff --git a/apps/desktop/src/main/window.test.ts b/apps/desktop/src/main/window.test.ts index d05f132..115856a 100644 --- a/apps/desktop/src/main/window.test.ts +++ b/apps/desktop/src/main/window.test.ts @@ -43,8 +43,8 @@ vi.mock('electron', () => ({ }, }, })); -vi.mock('@elsewise/fs', async (original) => ({ - ...(await original()), +vi.mock('@elsewise/core', async (original) => ({ + ...(await original()), dataLocalDir: () => state.dir, })); diff --git a/apps/desktop/src/main/window.ts b/apps/desktop/src/main/window.ts index 514163e..2bcb722 100644 --- a/apps/desktop/src/main/window.ts +++ b/apps/desktop/src/main/window.ts @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import { dataLocalDir, writeJsonSync } from '@elsewise/fs'; +import { dataLocalDir, writeJsonSync } from '@elsewise/core'; import { type BrowserWindow, type Rectangle, screen } from 'electron'; interface Window extends Rectangle { diff --git a/packages/README.md b/packages/README.md index 792db2b..3360310 100644 --- a/packages/README.md +++ b/packages/README.md @@ -6,7 +6,7 @@ Shared Elsewise libraries. |-----------------------------------------|-----------------|-----------------------------------------------------| | [`@elsewise/bridge`](./bridge) | `bridge/` | The contract between the UI and its embedder | | [`@elsewise/components`](./components) | `components/` | Primitive UI components and design system | -| [`@elsewise/fs`](./fs) | `fs/` | Where Elsewise keeps its files on disk | +| [`@elsewise/core`](./core) | `core/` | Where Elsewise keeps its files on disk | | [`@elsewise/plugin`](./plugin) | `plugin/` | The contract between Elsewise and its plugins | | [`@elsewise/transport`](./transport/ts) | `transport/ts/` | The transport protocol implementation in TypeScript | @@ -17,7 +17,7 @@ Run pnpm from the repo root, filtered to the package: ```bash pnpm --filter @elsewise/bridge typecheck # also: check pnpm --filter @elsewise/components test # also: typecheck, check, test:browser, test:visual -pnpm --filter @elsewise/fs typecheck # also: check +pnpm --filter @elsewise/core typecheck # also: check pnpm --filter @elsewise/plugin typecheck # also: check pnpm --filter @elsewise/transport test # also: typecheck, check, generate ``` diff --git a/packages/fs/AGENTS.md b/packages/core/AGENTS.md similarity index 88% rename from packages/fs/AGENTS.md rename to packages/core/AGENTS.md index 529b39a..5ac212b 100644 --- a/packages/fs/AGENTS.md +++ b/packages/core/AGENTS.md @@ -1,9 +1,9 @@ -# Fs +# Core Where Elsewise keeps its files on disk, and how it writes them. Shared by every Node process that touches those files, today the desktop app and the daemon, so they agree on one location. -Run pnpm from the **repo root**: `pnpm --filter @elsewise/fs