-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathmigrateWithOptions.ts
48 lines (43 loc) · 1.59 KB
/
migrateWithOptions.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
import { withSpinner } from "../shared/cli/spinners.js";
import { OctokitAndOptions } from "../shared/options/readOptions.js";
import { clearUnnecessaryFiles } from "../steps/clearUnnecessaryFiles.js";
import { detectExistingContributors } from "../steps/detectExistingContributors.js";
import { finalizeDependencies } from "../steps/finalizeDependencies.js";
import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/index.js";
import { runCommands } from "../steps/runCommands.js";
import { updateAllContributorsTable } from "../steps/updateAllContributorsTable.js";
import { updateLocalFiles } from "../steps/updateLocalFiles.js";
import { writeReadme } from "../steps/writeReadme.js";
import { writeStructure } from "../steps/writing/writeStructure.js";
export async function migrateWithOptions({
octokit,
options,
}: OctokitAndOptions) {
await withSpinner("Migrating repository structure", async () => {
await clearUnnecessaryFiles();
await writeStructure(options);
await writeReadme(options);
await updateLocalFiles(options);
await updateAllContributorsTable(options);
});
if (octokit) {
await withSpinner("Initializing GitHub repository", async () => {
await initializeGitHubRepository(octokit, options);
});
}
if (!options.excludeContributors) {
await withSpinner(
"Detecting existing contributors",
detectExistingContributors,
);
}
if (!options.skipInstall) {
await withSpinner("Installing packages", async () =>
finalizeDependencies(options),
);
}
await runCommands("Cleaning up files", [
"pnpm lint --fix",
"pnpm format --write",
]);
}