add log messages, remove unused function

This commit is contained in:
weboko 2022-12-06 22:34:24 +01:00 committed by weboko
parent 4126f416ff
commit f08d49542b
No known key found for this signature in database
1 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@ const execSync = require("child_process").execSync;
const { Command } = require("commander");
const validateProjectName = require("validate-npm-package-name");
const supportedExamplesDir = path.resolve("./examples");
const supportedExamplesDir = path.resolve(__dirname, "./examples");
const init = (name, description, version, supportedExamples) => {
let appName;
@ -52,15 +52,15 @@ function createApp(name, template) {
console.log(`Initializing ${appName} from ${template} template.`);
fs.ensureDirSync(appName);
fs.copySync(templateDir, appRoot);
moveToDir(appRoot);
runNpmInApp(appRoot);
runGitInit(appRoot);
}
function runNpmInApp(root) {
console.log("Installing npm packages.");
try {
execSync(`npm install --prefix ${root}`, { stdio: "ignore" });
console.log("Successfully installed npm dependencies.");
@ -74,6 +74,7 @@ function runGitInit(root) {
return;
}
console.log("Initiating git repository.");
try {
execSync(`git init ${root}`, { stdio: "ignore" });
console.log("Successfully initialized git repo.");