Skip to content

Commit

Permalink
fix: file templates creation location
Browse files Browse the repository at this point in the history
  • Loading branch information
adhamfarrag committed Nov 16, 2023
1 parent 5594aae commit 93244b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/commands/FileTemplates.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { window } from 'vscode'
import { existsSync, mkdirSync } from 'node:fs'

import { projectSrcDirectory, createFile, createSubFolders, showSubFolderQuickPick, createVueTemplate, generateVueFileTemplate, generateVueFileBasicTemplate } from '../utils'
import { projectSrcDirectory, createFile, createSubFolders, showSubFolderQuickPick, createVueTemplate, generateVueFileTemplate, generateVueFileBasicTemplate, projectRootDirectory } from '../utils'


function createPageTemplate() {
Expand Down Expand Up @@ -103,7 +103,7 @@ const createFileTemplate = (type: string) => {
.then((name) => {
if (!name) { return }

let filePath = `${projectSrcDirectory()}/.vscode/${name}.${type}-template`
let filePath = `${projectRootDirectory()}/.vscode/${name}.${type}-template`

createFile({
fileName: `${name}.${type}-template`,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFileSync } from 'fs'
import { getConfiguration, projectSrcDirectory } from '.'
import { getConfiguration, projectRootDirectory, projectSrcDirectory } from '.'
import { generateStyleTag, generateScriptTag, templateTag, piniaOptionsContent, piniaSetupContent } from '../templates'

let vueFilesConfig = getConfiguration().vueFiles
Expand All @@ -10,7 +10,7 @@ export function generateVueFileTemplate(type: string, template?: string) {
? vueFilesConfig.pages.defaultTemplate
: vueFilesConfig.layouts.defaultTemplate);

const templatePath = `${projectSrcDirectory()}/.vscode/${userDefaultTemplate}`;
const templatePath = `${projectRootDirectory()}/.vscode/${userDefaultTemplate}`;
try {
return readFileSync(templatePath).toString();
} catch (error) {
Expand Down

0 comments on commit 93244b6

Please sign in to comment.