refactor: move welcome.html to src/, simplify vite build config, cleanup cli.ts formatting
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
"permissions": ["debugger", "tabGroups", "contextMenus", "tabs"],
|
"permissions": ["debugger", "tabGroups", "contextMenus", "tabs"],
|
||||||
"host_permissions": ["<all_urls>"],
|
"host_permissions": ["<all_urls>"],
|
||||||
"background": {
|
"background": {
|
||||||
"service_worker": "lib/background.mjs",
|
"service_worker": "background.js",
|
||||||
"type": "module"
|
"type": "module"
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
|
|||||||
@@ -1163,7 +1163,7 @@ function updateContextMenuVisibility(): void {
|
|||||||
chrome.runtime.onInstalled.addListener((details) => {
|
chrome.runtime.onInstalled.addListener((details) => {
|
||||||
if (import.meta.env.TESTING) return
|
if (import.meta.env.TESTING) return
|
||||||
if (details.reason === 'install') {
|
if (details.reason === 'install') {
|
||||||
void chrome.tabs.create({ url: 'welcome.html' })
|
void chrome.tabs.create({ url: 'src/welcome.html' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -38,23 +38,23 @@ export default defineConfig({
|
|||||||
return JSON.stringify(manifest, null, 2);
|
return JSON.stringify(manifest, null, 2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
src: resolve(__dirname, 'welcome.html'),
|
|
||||||
dest: '.'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
|
||||||
entry: resolve(__dirname, 'src/background.ts'),
|
|
||||||
fileName: 'lib/background',
|
|
||||||
formats: ['es']
|
|
||||||
},
|
|
||||||
outDir: 'dist',
|
outDir: 'dist',
|
||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
minify: false
|
minify: false,
|
||||||
|
rollupOptions: {
|
||||||
|
input: {
|
||||||
|
background: resolve(__dirname, 'src/background.ts'),
|
||||||
|
welcome: resolve(__dirname, 'src/welcome.html'),
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
entryFileNames: '[name].js',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
define: defineEnv
|
define: defineEnv
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import { ensureRelayServer, RELAY_PORT } from './relay-client.js'
|
|||||||
const cli = cac('playwriter')
|
const cli = cac('playwriter')
|
||||||
|
|
||||||
cli
|
cli
|
||||||
.command('', 'Start the MCP server. See https://playwriter.dev/prompt.md for usage')
|
.command('', 'Start the MCP server or controls the browser with -e')
|
||||||
.option('--host <host>', 'Remote relay server host to connect to (or use PLAYWRITER_HOST env var)')
|
.option('--host <host>', 'Remote relay server host to connect to (or use PLAYWRITER_HOST env var)')
|
||||||
.option('--token <token>', 'Authentication token (or use PLAYWRITER_TOKEN env var)')
|
.option('--token <token>', 'Authentication token (or use PLAYWRITER_TOKEN env var)')
|
||||||
.option('-e, --eval <code>', 'Execute JavaScript code and exit')
|
.option('-e, --eval <code>', 'Execute JavaScript code and exit, read https://playwriter.dev/prompt.md for usage')
|
||||||
.option('--timeout <ms>', 'Execution timeout in milliseconds', { default: 5000 })
|
.option('--timeout <ms>', 'Execution timeout in milliseconds', { default: 5000 })
|
||||||
.option('-s, --session <name>', 'Session name (required for -e)')
|
.option('-s, --session <name>', 'Session name (required for -e)')
|
||||||
.action(async (options: { host?: string; token?: string; eval?: string; timeout?: number; session?: string }) => {
|
.action(async (options: { host?: string; token?: string; eval?: string; timeout?: number; session?: string }) => {
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ node_modules
|
|||||||
.env
|
.env
|
||||||
.react-router
|
.react-router
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
public/prompt.md
|
||||||
|
|||||||
Reference in New Issue
Block a user