From 2868428165d0dda2963caf133c5f972b407a4183 Mon Sep 17 00:00:00 2001 From: Kabir Shah Date: Tue, 17 Jul 2018 15:10:50 -0700 Subject: [PATCH] compile created files --- packages/moon-cli/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/moon-cli/index.js b/packages/moon-cli/index.js index 6831d84c..e2e74e96 100644 --- a/packages/moon-cli/index.js +++ b/packages/moon-cli/index.js @@ -16,6 +16,8 @@ const archive = { } }; +const MoonNameRE = /{# MoonName #}/g; + const log = (type, message) => { console.log(`\x1b[34m${type}\x1b[0m ${message}`); }; @@ -68,6 +70,7 @@ const create = (currentPath, targetPath) => { if (fs.statSync(nextPath).isDirectory()) { create(nextPath, targetPath); } else { + fs.writeFileSync(nextPath, fs.readFileSync(nextPath).toString().replace(MoonNameRE, name)); log("create", path.relative(targetPath, nextPath)); } }