diff --git a/.changeset/beige-schools-yawn.md b/.changeset/beige-schools-yawn.md new file mode 100644 index 00000000..ef329b08 --- /dev/null +++ b/.changeset/beige-schools-yawn.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/webpack-plugin": patch +--- + +Fix mkdir issue diff --git a/packages/webpack-plugin/src/__tests__/plugin.test.ts b/packages/webpack-plugin/src/__tests__/plugin.test.ts index 47b498d8..5b3658ad 100644 --- a/packages/webpack-plugin/src/__tests__/plugin.test.ts +++ b/packages/webpack-plugin/src/__tests__/plugin.test.ts @@ -74,7 +74,6 @@ describe('devupUIPlugin', () => { 'DevupThemeTypography', 'DevupTheme', ) - expect(mkdirSync).toHaveBeenCalledWith('.df') expect(writeFileSync).toHaveBeenCalledWith( join('.df', 'theme.d.ts'), 'interfaceCode', diff --git a/packages/webpack-plugin/src/plugin.ts b/packages/webpack-plugin/src/plugin.ts index ea56eff6..fa1fe8d9 100644 --- a/packages/webpack-plugin/src/plugin.ts +++ b/packages/webpack-plugin/src/plugin.ts @@ -53,9 +53,8 @@ export class DevupUIWebpackPlugin { 'DevupThemeTypography', 'DevupTheme', ) + if (interfaceCode) { - if (!existsSync(this.options.interfacePath)) - mkdirSync(this.options.interfacePath) writeFileSync( join(this.options.interfacePath, 'theme.d.ts'), interfaceCode, @@ -75,6 +74,9 @@ export class DevupUIWebpackPlugin { // read devup.json const existsDevup = existsSync(this.options.devupPath) + if (!existsSync(this.options.interfacePath)) + mkdirSync(this.options.interfacePath) + const sheetFile = join(this.options.interfacePath, 'sheet.json') const classMapFile = join(this.options.interfacePath, 'classMap.json') if (this.options.watch) {