diff --git a/packages/extension/package.json b/packages/extension/package.json index 877b28c96..4a93c285b 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -18,6 +18,7 @@ "build": "yarn build:vite && yarn test:build", "build:dev": "yarn build:vite --mode development", "build:watch": "yarn build:dev --watch", + "build:browser": "OPEN_BROWSER=true yarn build:dev --watch", "build:vite": "vite build --configLoader runner --config vite.config.ts", "changelog:validate": "../../scripts/validate-changelog.sh @ocap/extension", "clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo", diff --git a/packages/extension/scripts/start.sh b/packages/extension/scripts/start.sh index 9cbc2e272..644845168 100755 --- a/packages/extension/scripts/start.sh +++ b/packages/extension/scripts/start.sh @@ -23,4 +23,4 @@ function cleanup() { # Ensure we always close the ocap cli trap cleanup EXIT -yarn build:watch +yarn build:browser diff --git a/packages/extension/vite.config.ts b/packages/extension/vite.config.ts index 7ec408917..fc7482636 100644 --- a/packages/extension/vite.config.ts +++ b/packages/extension/vite.config.ts @@ -44,6 +44,7 @@ const staticCopyTargets: readonly (string | Target)[] = [ export default defineConfig(({ mode }) => { const isDev = mode === 'development'; const isWatching = process.argv.includes('--watch'); + const shouldOpenBrowser = process.env.OPEN_BROWSER === 'true'; if (isWatching && !isDev) { throw new Error('Cannot watch in non-development mode'); } @@ -111,8 +112,8 @@ export default defineConfig(({ mode }) => { }), moveHtmlFilesToRoot(), watchInternalPackages({ rootDir, packages: ['kernel-ui'] }), - // Open the extension in the browser when watching - isWatching && extensionDev({ extensionPath: outDir }), + // Open the extension in the browser when --browser flag is passed + shouldOpenBrowser && extensionDev({ extensionPath: outDir }), ], }; }); diff --git a/packages/omnium-gatherum/package.json b/packages/omnium-gatherum/package.json index 42ab27861..fca01cab9 100644 --- a/packages/omnium-gatherum/package.json +++ b/packages/omnium-gatherum/package.json @@ -19,6 +19,7 @@ "build": "yarn build:vite && yarn test:build", "build:dev": "yarn build:vite --mode development", "build:watch": "yarn build:dev --watch", + "build:browser": "OPEN_BROWSER=true yarn build:dev --watch", "build:vite": "vite build --configLoader runner --config vite.config.ts", "changelog:validate": "../../scripts/validate-changelog.sh @ocap/omnium-gatherum", "clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo", diff --git a/packages/omnium-gatherum/scripts/start.sh b/packages/omnium-gatherum/scripts/start.sh index 9cbc2e272..644845168 100755 --- a/packages/omnium-gatherum/scripts/start.sh +++ b/packages/omnium-gatherum/scripts/start.sh @@ -23,4 +23,4 @@ function cleanup() { # Ensure we always close the ocap cli trap cleanup EXIT -yarn build:watch +yarn build:browser diff --git a/packages/omnium-gatherum/vite.config.ts b/packages/omnium-gatherum/vite.config.ts index 2313eae62..1caf51ceb 100644 --- a/packages/omnium-gatherum/vite.config.ts +++ b/packages/omnium-gatherum/vite.config.ts @@ -52,6 +52,7 @@ const trustedPreludes: PreludeRecord = { export default defineConfig(({ mode }) => { const isDev = mode === 'development'; const isWatching = process.argv.includes('--watch'); + const shouldOpenBrowser = process.env.OPEN_BROWSER === 'true'; if (isWatching && !isDev) { throw new Error('Cannot watch in non-development mode'); } @@ -121,8 +122,8 @@ export default defineConfig(({ mode }) => { }), moveHtmlFilesToRoot(), watchInternalPackages({ rootDir, packages: ['kernel-ui'] }), - // Open the extension in the browser when watching - isWatching && extensionDev({ extensionPath: outDir }), + // Open the extension in the browser when --browser flag is passed + shouldOpenBrowser && extensionDev({ extensionPath: outDir }), ], }; }); diff --git a/packages/repo-tools/src/vite-plugins/extension-dev.ts b/packages/repo-tools/src/vite-plugins/extension-dev.ts index a4cb7c3e1..de10ef4c8 100644 --- a/packages/repo-tools/src/vite-plugins/extension-dev.ts +++ b/packages/repo-tools/src/vite-plugins/extension-dev.ts @@ -62,6 +62,7 @@ export function extensionDev({ args: [ `--disable-extensions-except=${extensionPath}`, `--load-extension=${extensionPath}`, + '--start-maximized', ], }); @@ -89,7 +90,6 @@ export function extensionDev({ // Open the extensions page for our extension const extensionsPage = await browserContext.newPage(); - await extensionsPage.setViewportSize({ width: 1300, height: 700 }); await extensionsPage.goto(`chrome://extensions/?id=${extensionId}`); // Update state after all checks