From 0f5133d526c9ab094b297b3284db859d32f47de6 Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Tue, 13 Jun 2023 15:38:15 +0000 Subject: [PATCH 1/3] Use resolved inputDir and outDir --- src/module.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/module.ts b/src/module.ts index f3b1eac7..21a9ca32 100644 --- a/src/module.ts +++ b/src/module.ts @@ -128,14 +128,14 @@ export default defineNuxtModule({ } nuxt.hook('nitro:init', async (nitro) => { - const input = options.input.replace(/~|\.\//, 'root').replace(/\//g, ':') - const output = options.output.replace(/~\/|\.\//, '') + const input = `root/${inputDir.replace(nuxt.options.rootDir, "")}`.replace(/\//g, ':') + const output = outDir.replace(nuxt.options.rootDir, "~") // Make sure output directory exists and contains .gitignore to ignore sprite files if (!await nitro.storage.hasItem(`${output}:.gitignore`)) { // await nitro.storage.setItem(`${output}:.gitignore`, '*') - await fsp.mkdir(`${nuxt.options.rootDir}/${output}`, { recursive: true }) - await fsp.writeFile(`${nuxt.options.rootDir}/${output}/.gitignore`, '*') + await fsp.mkdir(`${outDir}`, { recursive: true }) + await fsp.writeFile(`${outDir}/.gitignore`, '*') } const svgsFiles = await nitro.storage.getKeys(input) @@ -153,7 +153,7 @@ export default defineNuxtModule({ ) const writeSprite = async (sprite: string) => { - await fsp.writeFile(`${nuxt.options.rootDir}/${output}/${sprite}.svg`, generateSprite(sprite)) + await fsp.writeFile(`${outDir}/${sprite}.svg`, generateSprite(sprite)) // return nitro.storage.setItem(`${output}:${sprite}.svg`, generateSprite(sprite)) } await Promise.all(Object.keys(sprites).map(writeSprite)) From 30fe5a58f5ec3b790dbd67c1f022cd84b5249cce Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Thu, 27 Jul 2023 18:27:48 +0300 Subject: [PATCH 2/3] Update src/module.ts --- src/module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.ts b/src/module.ts index 21a9ca32..ca284088 100644 --- a/src/module.ts +++ b/src/module.ts @@ -128,7 +128,7 @@ export default defineNuxtModule({ } nuxt.hook('nitro:init', async (nitro) => { - const input = `root/${inputDir.replace(nuxt.options.rootDir, "")}`.replace(/\//g, ':') + const input = `root/${inputDir.replace(nuxt.options.rootDir, '')}`.replace(/\//g, ':') const output = outDir.replace(nuxt.options.rootDir, "~") // Make sure output directory exists and contains .gitignore to ignore sprite files From 336a1cb27da7e899ddd69552934dcddac7df6acb Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Thu, 27 Jul 2023 18:28:07 +0300 Subject: [PATCH 3/3] Update src/module.ts --- src/module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.ts b/src/module.ts index ca284088..796ce4b8 100644 --- a/src/module.ts +++ b/src/module.ts @@ -129,7 +129,7 @@ export default defineNuxtModule({ nuxt.hook('nitro:init', async (nitro) => { const input = `root/${inputDir.replace(nuxt.options.rootDir, '')}`.replace(/\//g, ':') - const output = outDir.replace(nuxt.options.rootDir, "~") + const output = outDir.replace(nuxt.options.rootDir, '~') // Make sure output directory exists and contains .gitignore to ignore sprite files if (!await nitro.storage.hasItem(`${output}:.gitignore`)) {