[READ-ONLY] Mirror of https://github.com/danielroe/cross-origin-storage. Load shared dependencies from Cross-Origin Storage (COS).
cross-origin-storage
experimental
nuxt
vite
vite-plugin
1import { execSync } from 'node:child_process'
2import { existsSync } from 'node:fs'
3import { fileURLToPath } from 'node:url'
4
5const COS_EXTENSION_REPO = 'https://github.com/web-ai-community/cross-origin-storage-extension'
6
7/**
8 * Clone the Cross-Origin Storage browser extension so the e2e suite can
9 * exercise the real COS cache path. A failed clone is fatal: the COS test
10 * must not silently skip just because setup couldn't fetch the extension.
11 */
12export default function setup(): void {
13 const extensionDir = fileURLToPath(new URL('./.cos-extension', import.meta.url))
14 if (existsSync(extensionDir)) {
15 return
16 }
17 execSync(`git clone --depth 1 ${COS_EXTENSION_REPO} ${extensionDir}`, { stdio: 'inherit' })
18}