mirror of
https://github.com/alex8088/electron-vite.git
synced 2026-07-13 10:21:08 +08:00
Compare commits
3 Commits
4cea38e22d
...
711f99aba8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
711f99aba8 | ||
|
|
a9197f5cc9 | ||
|
|
03936a31f8 |
@ -25,12 +25,29 @@ export default tseslint.config(
|
||||
rules: {
|
||||
'prettier/prettier': 'warn',
|
||||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
|
||||
'@typescript-eslint/explicit-function-return-type': 'error',
|
||||
'@typescript-eslint/explicit-function-return-type': [
|
||||
'error',
|
||||
{
|
||||
allowExpressions: true,
|
||||
allowTypedFunctionExpressions: true,
|
||||
allowHigherOrderFunctions: true,
|
||||
allowIIFEs: true
|
||||
}
|
||||
],
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],
|
||||
'@typescript-eslint/no-empty-object-type': ['error', { allowInterfaces: 'always' }],
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off'
|
||||
'@typescript-eslint/no-require-imports': 'error',
|
||||
'@typescript-eslint/no-unused-expressions': [
|
||||
'error',
|
||||
{
|
||||
allowShortCircuit: true,
|
||||
allowTaggedTemplates: true,
|
||||
allowTernary: true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -32,6 +32,7 @@ interface DevCLIOptions {
|
||||
inspect?: boolean | string
|
||||
inspectBrk?: boolean | string
|
||||
remoteDebuggingPort?: string
|
||||
noElectronStart?: boolean
|
||||
noSandbox?: boolean
|
||||
rendererOnly?: boolean
|
||||
}
|
||||
@ -78,6 +79,7 @@ cli
|
||||
.option('--inspect [port]', `[boolean | number] enable V8 inspector on the specified port`)
|
||||
.option('--inspectBrk [port]', `[boolean | number] enable V8 inspector on the specified port`)
|
||||
.option('--remoteDebuggingPort <port>', `[string] port for remote debugging`)
|
||||
.option('--noElectronStart', `[boolean] run dev servers without starting the Electron app`)
|
||||
.option('--noSandbox', `[boolean] forces renderer process to run un-sandboxed`)
|
||||
.option('--rendererOnly', `[boolean] only dev server for the renderer`)
|
||||
.action(async (root: string, options: DevCLIOptions & GlobalCLIOptions) => {
|
||||
@ -109,7 +111,7 @@ cli
|
||||
const inlineConfig = createInlineConfig(root, options)
|
||||
|
||||
try {
|
||||
await createServer(inlineConfig, { rendererOnly: options.rendererOnly })
|
||||
await createServer(inlineConfig, { rendererOnly: options.rendererOnly, noElectronStart: options.noElectronStart })
|
||||
} catch (e) {
|
||||
const error = e as Error
|
||||
createLogger(options.logLevel).error(
|
||||
|
||||
@ -14,7 +14,7 @@ import { startElectron } from './electron'
|
||||
|
||||
export async function createServer(
|
||||
inlineConfig: InlineConfig = {},
|
||||
options: { rendererOnly?: boolean }
|
||||
options: { rendererOnly?: boolean; noElectronStart?: boolean }
|
||||
): Promise<void> {
|
||||
process.env.NODE_ENV_ELECTRON_VITE = 'development'
|
||||
const config = await resolveConfig(inlineConfig, 'serve', 'development')
|
||||
@ -104,9 +104,11 @@ export async function createServer(
|
||||
server.printUrls()
|
||||
}
|
||||
|
||||
ps = startElectron(inlineConfig.root)
|
||||
if(!options.noElectronStart) {
|
||||
ps = startElectron(inlineConfig.root)
|
||||
|
||||
logger.info(colors.green(`\nstart electron app...\n`))
|
||||
logger.info(colors.green(`\nstart electron app...\n`))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user