-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathnoSkubaTemplateJs.ts
51 lines (43 loc) · 1.24 KB
/
noSkubaTemplateJs.ts
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import path from 'path';
import { pathExists } from 'fs-extra';
import type { Logger } from '../../../utils/logging';
import { getConsumerManifest } from '../../../utils/manifest';
import { detectPackageManager } from '../../../utils/packageManager';
import type { InternalLintResult } from '../internal';
export const noSkubaTemplateJs = async (
_mode: 'format' | 'lint',
logger: Logger,
): Promise<InternalLintResult> => {
const [manifest, packageManager] = await Promise.all([
getConsumerManifest(),
detectPackageManager(),
]);
if (!manifest) {
// This will throw elsewhere
return { ok: true, fixable: false };
}
const templateConfigPath = path.join(
path.dirname(manifest.path),
'skuba.template.js',
);
if (await pathExists(templateConfigPath)) {
logger.err(
`Template is incomplete; run ${logger.bold(
packageManager.exec,
'skuba',
'configure',
)}. ${logger.dim('no-skuba-template-js')}`,
);
return {
ok: false,
fixable: false,
annotations: [
{
path: 'skuba.template.js',
message: `Template is incomplete; run ${packageManager.exec} skuba configure.`,
},
],
};
}
return { ok: true, fixable: false };
};