ohayolibs
Version:
Ohayo is a set of essential modules for ohayojp.
23 lines (19 loc) • 559 B
text/typescript
import { Rule, Tree } from '@angular-devkit/schematics';
import { getJSON, overwritePackage } from '../utils/json';
import { PluginOptions } from './interface';
export function pluginCodeStyle(options: PluginOptions): Rule {
return (host: Tree) => {
const json = getJSON(host, 'package.json');
if (json == null) return;
if (options.type === 'add') {
json.husky = {
hooks: {
'pre-commit': 'pretty-quick --staged',
},
};
} else {
delete json.husky;
}
overwritePackage(host, json);
};
}