Skip to content

Commit

Permalink
fixed react server
Browse files Browse the repository at this point in the history
  • Loading branch information
LiveDuo committed Mar 17, 2024
1 parent 1f1543b commit ce99f10
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/server/react.bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ const copyDirectory = async (src, dest) => {
for (let entry of entries) {
const srcPath = path.join(src, entry.name)
const destPath = path.join(dest, entry.name)
entry.isDirectory()
? await copyDirectory(srcPath, destPath)
: await fs.promises.copyFile(srcPath, destPath)
entry.isDirectory() ? await copyDirectory(srcPath, destPath) : await fs.promises.copyFile(srcPath, destPath)
}
}

Expand All @@ -37,8 +35,7 @@ const { argv } = yargs(hideBin(process.argv))
? '"node ./node_modules/destack/build/custom/react.js"'
: '"ts-node-dev -O ""{""""module"""": """"commonjs""""}"" ../../lib/server/react.ts"'

const startServerCommand =
process.platform === 'win32' ? startServerCommandWindows : startServerCommandUnix
const startServerCommand = process.platform === 'win32' ? startServerCommandWindows : startServerCommandUnix
const spawnArgs = [startServerCommand, `\"${argv.d}\"`]

const spawnOptions = process.platform === 'win32' ? { shell: true } : {}
Expand All @@ -50,7 +47,7 @@ const { argv } = yargs(hideBin(process.argv))
process.stdout.write(data.toString())
})
} else if (argv.build || argv.b) {
const projectPath = isImported ? '.' : path.join('dev', 'react-project')
const projectPath = isImported ? '..' : path.join('dev', 'react-project')
const pathFrom = path.join(__dirname, '..', '..', projectPath, 'data')
const pathTo = path.join(__dirname, '..', '..', projectPath, 'public', 'data')
await copyDirectory(pathFrom, pathTo)
Expand Down

0 comments on commit ce99f10

Please sign in to comment.