From 4c12f7857e4c8b108d9c590d0b4a0c23ad6cd5ec Mon Sep 17 00:00:00 2001 From: gconnect Date: Wed, 27 Mar 2024 21:12:14 +0100 Subject: [PATCH] fix issue with directory modified template directory --- bin/create.js | 3 +-- bin/index.js | 2 +- helper/copy-template-files.js | 3 +-- package-lock.json | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/create.js b/bin/create.js index dc2d227..44df369 100644 --- a/bin/create.js +++ b/bin/create.js @@ -10,10 +10,9 @@ const { figletText } = require( "../utils/ascii-image"); const { copyGitTemplateFiles } = require("../helper/fetch-git-repo") const { installDependencies } = require("../helper/install-dependencies") -let inquirer async function createProject(projectName) { - inquirer = await import('inquirer'); + const inquirer = await import('inquirer'); const templates = { frontend: ['react-app', 'next-app', 'angular-app', 'vue-app'], diff --git a/bin/index.js b/bin/index.js index 0b1af30..01cead5 100755 --- a/bin/index.js +++ b/bin/index.js @@ -2,7 +2,7 @@ const { Command } = require('commander'); const packageJson = require('../package.json'); -const { createProject } = require('./create.js') +const { createProject } = require('./create') const program = new Command(); diff --git a/helper/copy-template-files.js b/helper/copy-template-files.js index cba6660..b5dfa78 100644 --- a/helper/copy-template-files.js +++ b/helper/copy-template-files.js @@ -8,8 +8,7 @@ const { fileURLToPath } = require('url'); // For Node.js 14+ // Function to copy template files to the project directory async function copyTemplateFiles(templateName, destinationDir, templateDirectory) { try { - - const templateDir = path.resolve(process.cwd(), templateDirectory, templateName); + const templateDir = path.resolve(__dirname,'..', templateDirectory, templateName); const destDir = path.resolve(process.cwd(), destinationDir); console.log('Template directory:', templateDir); diff --git a/package-lock.json b/package-lock.json index e56f9d3..f230881 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cartesikit", - "version": "1.0.4", + "version": "1.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cartesikit", - "version": "1.0.4", + "version": "1.0.5", "license": "Apache-2.0", "dependencies": { "chalk": "^5.3.0",