Skip to content

Commit

Permalink
fix: issue Allen-1998#7
Browse files Browse the repository at this point in the history
  • Loading branch information
zhida-Chan committed Mar 19, 2024
1 parent 458d8f5 commit 7e22cda
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { promises as fs } from 'fs'
import { resolve } from 'path'
import { parse, resolve, } from 'path'
import chokidar from 'chokidar'

type Options = Partial<{
storeDir: string
excludes: string[]
outputDir: string,
outputFile: string
isDev: boolean;
}>

const defaultOptions: Options = {
storeDir: 'src/store',
excludes: ['index'],
outputFile: 'src/helper/pinia-auto-refs.ts',
outputDir: 'src/helper',
outputFile: 'pinia-auto-refs.ts',
isDev: false,
}

Expand All @@ -21,7 +23,9 @@ export default function (options: Options = {}) {

const { storeDir, excludes, outputFile,isDev } = options as Required<Options>
const storePath = resolve(process.cwd(), storeDir)
const outputDir = outputFile.replace(/(\/[^/]*).ts/, '')
const outputFileInfo = parse(outputFile)
const outputDir = outputFileInfo.dir || './'
// const outputDir = outputFile.replace(/(\/[^/]*).ts/, '')
fs.readdir(outputDir).catch(() => fs.mkdir(outputDir))

async function generateConfigFiles() {
Expand Down

0 comments on commit 7e22cda

Please sign in to comment.