forked from webpro-nl/knip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
25 lines (18 loc) · 942 Bytes
/
Copy pathindex.ts
File metadata and controls
25 lines (18 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { timerify } from '../../util/Performance.js';
import { hasDependency, load } from '../../util/plugin.js';
import type { PluginConfig } from './types.js';
import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
// https://github.com/commitizen/cz-cli
export const NAME = 'Commitizen';
/** @public */
export const ENABLERS = ['commitizen'];
export const isEnabled: IsPluginEnabledCallback = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
export const CONFIG_FILE_PATTERNS = ['.czrc', 'package.json'];
const findPluginDependencies: GenericPluginCallback = async (configFilePath, { manifest }) => {
const config: PluginConfig = configFilePath.endsWith('package.json')
? manifest.config?.commitizen
: await load(configFilePath);
const path = config?.path;
return path === undefined ? [] : [path];
};
export const findDependencies = timerify(findPluginDependencies);