From 0e980961fc666d5f9aeaa628a6b8211351f5f330 Mon Sep 17 00:00:00 2001 From: koustov Date: Sat, 26 Nov 2022 13:57:31 +0530 Subject: [PATCH] fixed template path issue --- .../services/template/_templates}/Readme_md.tmpl | 0 .../services/template/_templates}/component_js.tmpl | 0 .../services/template/_templates}/component_ts.tmpl | 0 .../services/template/_templates}/styles_css.tmpl | 0 .../services/template/_templates}/styles_scss.tmpl | 0 lib/services/template/play_content.js | 7 +++++-- package.json | 2 +- 7 files changed, 6 insertions(+), 3 deletions(-) rename {_templates => lib/services/template/_templates}/Readme_md.tmpl (100%) rename {_templates => lib/services/template/_templates}/component_js.tmpl (100%) rename {_templates => lib/services/template/_templates}/component_ts.tmpl (100%) rename {_templates => lib/services/template/_templates}/styles_css.tmpl (100%) rename {_templates => lib/services/template/_templates}/styles_scss.tmpl (100%) diff --git a/_templates/Readme_md.tmpl b/lib/services/template/_templates/Readme_md.tmpl similarity index 100% rename from _templates/Readme_md.tmpl rename to lib/services/template/_templates/Readme_md.tmpl diff --git a/_templates/component_js.tmpl b/lib/services/template/_templates/component_js.tmpl similarity index 100% rename from _templates/component_js.tmpl rename to lib/services/template/_templates/component_js.tmpl diff --git a/_templates/component_ts.tmpl b/lib/services/template/_templates/component_ts.tmpl similarity index 100% rename from _templates/component_ts.tmpl rename to lib/services/template/_templates/component_ts.tmpl diff --git a/_templates/styles_css.tmpl b/lib/services/template/_templates/styles_css.tmpl similarity index 100% rename from _templates/styles_css.tmpl rename to lib/services/template/_templates/styles_css.tmpl diff --git a/_templates/styles_scss.tmpl b/lib/services/template/_templates/styles_scss.tmpl similarity index 100% rename from _templates/styles_scss.tmpl rename to lib/services/template/_templates/styles_scss.tmpl diff --git a/lib/services/template/play_content.js b/lib/services/template/play_content.js index bd91b85..75b38a1 100644 --- a/lib/services/template/play_content.js +++ b/lib/services/template/play_content.js @@ -3,11 +3,14 @@ import * as path from "path"; import { replaceAll, toSanitized, toSlug } from "../../../util/string.js"; import { fileURLToPath } from "url"; import { Log } from "../../../log/index.js"; +import { dirname } from "path"; const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + const PLAY_LIST_DIRECTORY = "./src/plays"; -const TEMPLATE_DIRECTORY = "../../../../_templates"; +const TEMPLATE_DIRECTORY = "_templates"; const TEMPLATE_MAP = { common: ["Readme_md"], @@ -83,7 +86,7 @@ const processTemplate = (play, template_type, play_path) => { toSanitized(play.title_name) ); } - const file_path = `${__filename}/${TEMPLATE_DIRECTORY}/${file_name}`; + const file_path = path.resolve(__dirname, TEMPLATE_DIRECTORY, file_name); const target_path = `${play_path}/${getTargetFileName( target_template_name )}`; diff --git a/package.json b/package.json index 72ae832..7ea7e00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-react-play", - "version": "0.0.11", + "version": "0.0.13", "description": "Boiler plate for creating a play within reactplay system", "main": "index.js", "bin": {