Skip to content

Commit

Permalink
fix: catch missing template directory
Browse files Browse the repository at this point in the history
  • Loading branch information
pnarielwala committed Nov 8, 2021
1 parent 7cb0424 commit 9f33314
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
"scripts": {
"build": "rollup -c",
"commit": "git add . && git commit",
"link-global": "yarn global add $PWD",
"template-files-generator": "ts-node src/index.ts",
"tfg": "ts-node src/index.ts",
"dev:link": "yarn global add $PWD",
"dev:tfg": "ts-node src/index.ts",
"test": "jest",
"prepare": "husky install",
"semantic-release": "semantic-release"
Expand Down
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ const recordTemplateValues = async (template: Template) => {
})),
);

console.log('variables', variables);
return variables;
};

Expand All @@ -279,6 +278,16 @@ const generateFiles = (data: {
);
const destinationDirectory = path.join(process.cwd(), data.location);

if (!fs.existsSync(templateDirectory)) {
console.error(
'\n',
chalk.red(`Template directory "${templateDirectory}" does not exist.`),
'\n',
'Check your configuration.',
);
process.exit(1);
}

copy(
templateDirectory,
destinationDirectory,
Expand Down

0 comments on commit 9f33314

Please sign in to comment.