build(hololake): use runner config loading
This commit is contained in:
parent
dc1a32a52b
commit
1cde630864
4 changed files with 16 additions and 11 deletions
|
|
@ -8,9 +8,9 @@
|
||||||
"predev": "pnpm test:native-authority",
|
"predev": "pnpm test:native-authority",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"prebuild": "pnpm test:native-authority && pnpm test:native-core",
|
"prebuild": "pnpm test:native-authority && pnpm test:native-core",
|
||||||
"build": "tsc -b && vite build",
|
"build": "tsc -b && vite build --configLoader runner",
|
||||||
"build:team-foundation": "VITE_HOLOLAKE_DISTRIBUTION=team-foundation tsc -b && VITE_HOLOLAKE_DISTRIBUTION=team-foundation vite build && node scripts/finalize-team-foundation-build.mjs",
|
"build:team-foundation": "VITE_HOLOLAKE_DISTRIBUTION=team-foundation tsc -b && VITE_HOLOLAKE_DISTRIBUTION=team-foundation vite build --configLoader runner && node scripts/finalize-team-foundation-build.mjs",
|
||||||
"build:education": "tsc -b && vite build --base=/jd/education/",
|
"build:education": "tsc -b && vite build --configLoader runner --base=/jd/education/",
|
||||||
"agent-docs": "node scripts/build-agent-docs.mjs",
|
"agent-docs": "node scripts/build-agent-docs.mjs",
|
||||||
"bundle-mcp": "node scripts/bundle-mcp-server.mjs",
|
"bundle-mcp": "node scripts/bundle-mcp-server.mjs",
|
||||||
"docs:dev": "vitepress dev site --host 127.0.0.1",
|
"docs:dev": "vitepress dev site --host 127.0.0.1",
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tauri": "tauri",
|
"tauri": "tauri",
|
||||||
"pretest": "pnpm test:native-authority",
|
"pretest": "pnpm test:native-authority",
|
||||||
"test": "vitest run",
|
"test": "vitest run --configLoader runner",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest --configLoader runner",
|
||||||
"test:e2e": "playwright test",
|
"test:e2e": "playwright test",
|
||||||
"playwright:smoke": "playwright test --config playwright.smoke.config.ts tests/smoke/autosave-low-end-typing.spec.ts tests/smoke/create-note-backing-file.spec.ts tests/smoke/delete-note-nonblocking.spec.ts tests/smoke/example.spec.ts tests/smoke/fix-crash-create-note.spec.ts tests/smoke/quick-open-create-note.spec.ts tests/smoke/save-before-note-switch.spec.ts tests/smoke/h1-untitled-auto-rename.spec.ts tests/smoke/keyboard-command-routing.spec.ts tests/smoke/missing-string-metadata-open-note.spec.ts tests/smoke/multibyte-search-snippet.spec.ts tests/smoke/pull-refresh-open-note.spec.ts tests/smoke/wikilink-path-fix.spec.ts",
|
"playwright:smoke": "playwright test --config playwright.smoke.config.ts tests/smoke/autosave-low-end-typing.spec.ts tests/smoke/create-note-backing-file.spec.ts tests/smoke/delete-note-nonblocking.spec.ts tests/smoke/example.spec.ts tests/smoke/fix-crash-create-note.spec.ts tests/smoke/quick-open-create-note.spec.ts tests/smoke/save-before-note-switch.spec.ts tests/smoke/h1-untitled-auto-rename.spec.ts tests/smoke/keyboard-command-routing.spec.ts tests/smoke/missing-string-metadata-open-note.spec.ts tests/smoke/multibyte-search-snippet.spec.ts tests/smoke/pull-refresh-open-note.spec.ts tests/smoke/wikilink-path-fix.spec.ts",
|
||||||
"playwright:regression": "playwright test tests/smoke/",
|
"playwright:regression": "playwright test tests/smoke/",
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
"guard:deployment-source": "node scripts/deployment-source-guard.mjs",
|
"guard:deployment-source": "node scripts/deployment-source-guard.mjs",
|
||||||
"test:deployment-source": "node --test scripts/deployment-source-guard.test.mjs",
|
"test:deployment-source": "node --test scripts/deployment-source-guard.test.mjs",
|
||||||
"test:native-authority": "bash scripts/test-guanghu-native-authority.sh && node scripts/validate-guanghu-native-profile.mjs",
|
"test:native-authority": "bash scripts/test-guanghu-native-authority.sh && node scripts/validate-guanghu-native-profile.mjs",
|
||||||
"test:native-core": "vitest run --config vitest.guanghu-native.config.ts --coverage",
|
"test:native-core": "vitest run --config vitest.guanghu-native.config.ts --coverage --configLoader runner",
|
||||||
"package:internal:macos": "HOLOLAKE_DISTRIBUTION=personal HOLOLAKE_SOURCE_REPOSITORY_ID=REPO-008 HOLOLAKE_SOURCE_CHANNEL_ID=HLP-CHANNEL-0001 pnpm guard:deployment-source && ./scripts/build-internal-release.sh macos",
|
"package:internal:macos": "HOLOLAKE_DISTRIBUTION=personal HOLOLAKE_SOURCE_REPOSITORY_ID=REPO-008 HOLOLAKE_SOURCE_CHANNEL_ID=HLP-CHANNEL-0001 pnpm guard:deployment-source && ./scripts/build-internal-release.sh macos",
|
||||||
"package:local-candidate:macos": "HOLOLAKE_DISTRIBUTION=local-candidate HOLOLAKE_TAURI_CONFIG=src-tauri/tauri.local-candidate.conf.json HOLOLAKE_APP_NAME='HoloLake Era · 本地方向候选 0.4.6' HOLOLAKE_INSTALLER_BASENAME='HoloLake-Era-{version}-Local-Direction-Candidate-Mac-aarch64' ./scripts/build-internal-release.sh macos",
|
"package:local-candidate:macos": "HOLOLAKE_DISTRIBUTION=local-candidate HOLOLAKE_TAURI_CONFIG=src-tauri/tauri.local-candidate.conf.json HOLOLAKE_APP_NAME='HoloLake Era · 本地方向候选 0.4.6' HOLOLAKE_INSTALLER_BASENAME='HoloLake-Era-{version}-Local-Direction-Candidate-Mac-aarch64' ./scripts/build-internal-release.sh macos",
|
||||||
"package:internal:windows": "HOLOLAKE_DISTRIBUTION=personal HOLOLAKE_SOURCE_REPOSITORY_ID=REPO-008 HOLOLAKE_SOURCE_CHANNEL_ID=HLP-CHANNEL-0001 pnpm guard:deployment-source && ./scripts/build-internal-release.sh windows",
|
"package:internal:windows": "HOLOLAKE_DISTRIBUTION=personal HOLOLAKE_SOURCE_REPOSITORY_ID=REPO-008 HOLOLAKE_SOURCE_CHANNEL_ID=HLP-CHANNEL-0001 pnpm guard:deployment-source && ./scripts/build-internal-release.sh windows",
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,6 @@ test('local native candidate has an isolated macOS package identity', async () =
|
||||||
packageJson.scripts['package:local-candidate:macos'],
|
packageJson.scripts['package:local-candidate:macos'],
|
||||||
/tauri\.local-candidate\.conf\.json/,
|
/tauri\.local-candidate\.conf\.json/,
|
||||||
)
|
)
|
||||||
|
assert.match(packageJson.scripts.build, /--configLoader runner/)
|
||||||
|
assert.match(packageJson.scripts['test:native-core'], /--configLoader runner/)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ const packageManagerExec = process.env.npm_execpath
|
||||||
const isJsExecpath = packageManagerExec && /\.[mc]?js$/i.test(packageManagerExec)
|
const isJsExecpath = packageManagerExec && /\.[mc]?js$/i.test(packageManagerExec)
|
||||||
const command = isJsExecpath ? process.execPath : 'pnpm'
|
const command = isJsExecpath ? process.execPath : 'pnpm'
|
||||||
const baseCommandArgs = isJsExecpath
|
const baseCommandArgs = isJsExecpath
|
||||||
? [packageManagerExec, 'exec', 'vitest', 'run', '--coverage']
|
? [packageManagerExec, 'exec', 'vitest', 'run', '--coverage', '--configLoader', 'runner']
|
||||||
: ['exec', 'vitest', 'run', '--coverage']
|
: ['exec', 'vitest', 'run', '--coverage', '--configLoader', 'runner']
|
||||||
const clearCacheCommandArgs = isJsExecpath
|
const clearCacheCommandArgs = isJsExecpath
|
||||||
? [packageManagerExec, 'exec', 'vitest', '--clearCache']
|
? [packageManagerExec, 'exec', 'vitest', '--clearCache']
|
||||||
: ['exec', 'vitest', '--clearCache']
|
: ['exec', 'vitest', '--clearCache']
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,14 @@ import {
|
||||||
type Dirent,
|
type Dirent,
|
||||||
} from 'fs'
|
} from 'fs'
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
import { defineConfig, type Plugin } from 'vite'
|
import { defineConfig, type Plugin } from 'vite'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
import matter from 'gray-matter'
|
import matter from 'gray-matter'
|
||||||
|
|
||||||
|
const configDirectory = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
|
||||||
// --- Vault API middleware (dev only) ---
|
// --- Vault API middleware (dev only) ---
|
||||||
|
|
||||||
interface VaultEntry {
|
interface VaultEntry {
|
||||||
|
|
@ -962,7 +965,7 @@ export default defineConfig({
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.resolve(__dirname, './src'),
|
'@': path.resolve(configDirectory, './src'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -972,7 +975,7 @@ export default defineConfig({
|
||||||
define: {
|
define: {
|
||||||
...(process.env.CI || (process.env.TAURI_PLATFORM && !process.env.TAURI_DEBUG)
|
...(process.env.CI || (process.env.TAURI_PLATFORM && !process.env.TAURI_DEBUG)
|
||||||
? {}
|
? {}
|
||||||
: { __DEMO_VAULT_PATH__: JSON.stringify(path.resolve(__dirname, 'demo-vault-v2')) }),
|
: { __DEMO_VAULT_PATH__: JSON.stringify(path.resolve(configDirectory, 'demo-vault-v2')) }),
|
||||||
},
|
},
|
||||||
|
|
||||||
// Prevent vite from obscuring Rust errors
|
// Prevent vite from obscuring Rust errors
|
||||||
|
|
@ -993,7 +996,7 @@ export default defineConfig({
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: process.env.VITE_HOLOLAKE_DISTRIBUTION === 'team-foundation'
|
rollupOptions: process.env.VITE_HOLOLAKE_DISTRIBUTION === 'team-foundation'
|
||||||
? { input: path.resolve(__dirname, 'team-foundation.html') }
|
? { input: path.resolve(configDirectory, 'team-foundation.html') }
|
||||||
: undefined,
|
: undefined,
|
||||||
// Tauri uses Chromium on Windows and WebKit on macOS/Linux
|
// Tauri uses Chromium on Windows and WebKit on macOS/Linux
|
||||||
target: process.env.TAURI_PLATFORM === 'windows' ? 'chrome105' : 'safari13',
|
target: process.env.TAURI_PLATFORM === 'windows' ? 'chrome105' : 'safari13',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue