Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prettier to template #45

Merged
merged 2 commits into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
}
},
"lint-staged": {
"lib/*.js": [
"src/*.js": [
"prettier --trailing-comma es5 --single-quote --write",
"git add"
]
Expand All @@ -92,4 +92,4 @@
"singleQuote": true,
"trailingComma": "es5"
}
}
}
29 changes: 28 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,26 @@ prog
prepare: 'npm run build',
test: 'tsdx test',
},
husky: {
hooks: {
'pre-commit': 'lint-staged',
},
},
'lint-staged': {
linters: {
'*.{ts,tsx,js,jsx,css,scss,md}': [
'prettier --trailing-comma es5 --single-quote --write',
'git add',
],
ignore: ['**/dist/*, **/node_modules/*'],
},
},
prettier: {
printWidth: 80,
semi: true,
singleQuote: true,
trailingComma: 'es5',
},
};
await fs.outputJSON(path.resolve(projectPath, 'package.json'), pkgJson);
bootSpinner.succeed(`Created ${chalk.bold.green(pkg)}`);
Expand All @@ -148,7 +168,14 @@ prog
logError(error);
process.exit(1);
}
const deps = ['@types/jest', 'tsdx', 'typescript'];
const deps = [
'@types/jest',
'husky',
'lint-staged',
'prettier',
'tsdx',
'typescript',
];

const installSpinner = ora(Messages.installing(deps)).start();
try {
Expand Down