-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathcreateMetadata.ts
More file actions
33 lines (29 loc) · 837 Bytes
/
createMetadata.ts
File metadata and controls
33 lines (29 loc) · 837 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
26
27
28
29
30
31
32
33
import pack from '../../package.json' with { type: 'json' };
import type { Answers } from '../prompt.ts';
export function createMetadata(answers: Partial<Answers>) {
// Some of the passed args can already be derived from the generated package.json file.
const ignoredAnswers: (keyof Answers)[] = [
'name',
'directory',
'slug',
'description',
'authorName',
'authorEmail',
'authorUrl',
'repoUrl',
'example',
'reactNativeVersion',
'local',
];
const libraryMetadata = Object.fromEntries(
Object.entries(answers).filter(
([answer]) =>
!ignoredAnswers.includes(
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
answer as keyof Answers
)
)
);
libraryMetadata.version = pack.version;
return libraryMetadata;
}