-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
36 lines (29 loc) · 1.04 KB
/
index.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
#!/usr/bin/env bun
import { configurations } from './configuration'
import { findConfiguration, getWorkspaces, installLocalDependencies, writeFile, writeGitIgnore } from './helper'
import { log } from './log'
import { parse } from './parse'
import { reset, state } from './state'
import type { File } from './types'
async function configureProject() {
const ignores: string[] = []
await findConfiguration()
for (const { name, alias, configuration } of configurations) {
const value = state.options[name] ?? (alias && state.options[alias])
if (!value) continue
const files = await parse(value, configuration)
if (!files) continue
for (const file of files.filter((item) => item?.name)) {
await writeFile(file as File, ignores)
}
}
const gitUserConfigured = await writeGitIgnore(ignores)
if (!gitUserConfigured && ignores.length === 0) {
log('No configuration to add', 'warning')
}
installLocalDependencies()
}
for (const workspace of await getWorkspaces()) {
await reset(workspace)
await configureProject()
}