mirror of
https://github.com/logseq/logseq.git
synced 2026-05-18 18:02:35 +00:00
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
import { existsSync, mkdirSync, writeFileSync } from 'node:fs'
|
|
import path from 'node:path'
|
|
|
|
const bridgeTargets = [
|
|
{
|
|
dir: 'target/app',
|
|
externals: 'target/app-externals.js',
|
|
},
|
|
{
|
|
dir: 'target/mobile',
|
|
externals: 'target/mobile-externals.js',
|
|
},
|
|
{
|
|
dir: 'target/publishing',
|
|
externals: 'target/publishing-externals.js',
|
|
},
|
|
]
|
|
|
|
for (const bridgeTarget of bridgeTargets) {
|
|
const shadowDir = path.resolve(bridgeTarget.dir)
|
|
const externalsEntry = path.resolve(bridgeTarget.externals)
|
|
|
|
mkdirSync(shadowDir, { recursive: true })
|
|
|
|
for (const entryFile of ['main.js', 'code-editor.js']) {
|
|
const entryPath = path.join(shadowDir, entryFile)
|
|
if (!existsSync(entryPath)) {
|
|
writeFileSync(entryPath, '')
|
|
}
|
|
}
|
|
|
|
if (!existsSync(externalsEntry)) {
|
|
writeFileSync(externalsEntry, 'export {}\n')
|
|
}
|
|
}
|
|
|
|
// Create placeholder for db-worker externals index
|
|
const workerExternals = path.resolve('target/db-worker.js')
|
|
if (!existsSync(workerExternals)) {
|
|
writeFileSync(workerExternals, 'export {}\n')
|
|
}
|