From e6fdddcccb3c483fb7cd5c8f7e58b827488b0848 Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Sat, 1 Feb 2025 22:13:14 +0900 Subject: [PATCH] Fix mkdir issue --- .changeset/beige-schools-yawn.md | 5 +++++ packages/webpack-plugin/src/__tests__/plugin.test.ts | 1 - packages/webpack-plugin/src/plugin.ts | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changeset/beige-schools-yawn.md 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) {