refactor(cli): file destination
This commit is contained in:
parent
427a75f2dd
commit
515f5d940e
|
@ -3,6 +3,7 @@
|
||||||
/* eslint-disable no-void */
|
/* eslint-disable no-void */
|
||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
import { fetchMscz, MSCZ_URL_SYM } from './mscz'
|
import { fetchMscz, MSCZ_URL_SYM } from './mscz'
|
||||||
import { loadMscore, INDV_DOWNLOADS, WebMscore } from './mscore'
|
import { loadMscore, INDV_DOWNLOADS, WebMscore } from './mscore'
|
||||||
import { ScoreInfoHtml } from './scoreinfo'
|
import { ScoreInfoHtml } from './scoreinfo'
|
||||||
|
@ -120,15 +121,14 @@ void (async () => {
|
||||||
},
|
},
|
||||||
default: process.cwd(),
|
default: process.cwd(),
|
||||||
})
|
})
|
||||||
// change working directory
|
|
||||||
process.chdir(dest)
|
|
||||||
|
|
||||||
// export files
|
// export files
|
||||||
spinner.start()
|
spinner.start()
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
filetypes.map(async (d) => {
|
filetypes.map(async (d) => {
|
||||||
const data = await d.action(score)
|
const data = await d.action(score)
|
||||||
const f = `${fileName} - ${escapeFilename(partName)}.${d.fileExt}`
|
const n = `${fileName} - ${escapeFilename(partName)}.${d.fileExt}`
|
||||||
|
const f = path.join(dest, n)
|
||||||
await fs.promises.writeFile(f, data)
|
await fs.promises.writeFile(f, data)
|
||||||
spinner.info(`Saved ${chalk.underline(f)}`)
|
spinner.info(`Saved ${chalk.underline(f)}`)
|
||||||
spinner.start()
|
spinner.start()
|
||||||
|
|
Loading…
Reference in New Issue