Skip to content

Commit

Permalink
feat(shell): always load bundled engine
Browse files Browse the repository at this point in the history
  • Loading branch information
ilharp committed Mar 8, 2024
1 parent 32e8060 commit 1205dc7
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions packages/shell/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,38 +101,38 @@ export const chronocat = async () => {
)
.forEach((x) => engines.push(x))

if (!engines.length)
readdirSync(__dirname)
.map((filename) => {
let valid = false
let name = filename
let type = 'js'

if (name.endsWith('.engine.jsc')) {
valid = true
name = name.slice(0, name.length - 11)
type = 'jsc'
}

if (name.endsWith('.engine.js')) {
valid = true
name = name.slice(0, name.length - 10)
}

if (!valid) return undefined

return {
name,
filename,
type,
path: join(__dirname, filename),
hidden: true,
}
})
.filter(
Boolean as unknown as (x: EngineInfo | undefined) => x is EngineInfo,
)
.forEach((x) => engines.push(x))
// if (!engines.length)
readdirSync(__dirname)
.map((filename) => {
let valid = false
let name = filename
let type = 'js'

if (name.endsWith('.engine.jsc')) {
valid = true
name = name.slice(0, name.length - 11)
type = 'jsc'
}

if (name.endsWith('.engine.js')) {
valid = true
name = name.slice(0, name.length - 10)
}

if (!valid) return undefined

return {
name,
filename,
type,
path: join(__dirname, filename),
hidden: true,
}
})
.filter(
Boolean as unknown as (x: EngineInfo | undefined) => x is EngineInfo,
)
.forEach((x) => engines.push(x))

if (!engines.length)
l.warn('没有找到任何引擎。Chronocat 服务仍将启动。', { code: 2156 })
Expand Down

0 comments on commit 1205dc7

Please sign in to comment.