Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
icepeng committed Feb 8, 2017
1 parent 14c44ac commit fa056e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
16 changes: 9 additions & 7 deletions generators/api/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ const rewrite = (args) => {
};

exports.rewrite = (args) => {
fs.readFile(args.file, 'utf8', (err, data) => {
if (err) {
return;
}
const body = rewrite(Object.assign({ haystack: data }, args));
fs.writeFile(args.file, body);
});
const input = args;
try {
input.haystack = fs.readFileSync(args.file, 'utf8');
} catch (err) {
console.log(`${args.file} not exists`);
return;
}
const body = rewrite(input);
fs.writeFileSync(args.file, body);
};
2 changes: 1 addition & 1 deletion generators/app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"start": "tsc && node dist/index.js",
"test": "mocha --reporter spec --compilers ts:ts-node/register test/**/*.spec.ts"
"test": "mocha --reporter spec --compilers ts:ts-node/register **/*.spec.ts"
},
"dependencies": {
"bcrypt": "^1.0.2",
Expand Down
6 changes: 5 additions & 1 deletion generators/app/templates/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
"types": ["node"]
},
"filesGlob": [
"src/**/*.ts"
"src/**/*.ts",
"!src/**/*.spec.ts"
],
"include": [
"src/**/*.ts"
],
"exclude": [
"src/**/*.spec.ts"
]
}

0 comments on commit fa056e1

Please sign in to comment.