-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathindex.ts
41 lines (37 loc) · 1.06 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
37
38
39
40
41
import { ModeRunner } from "../bin/mode.js";
import { outro } from "../shared/cli/outro.js";
import { StatusCodes } from "../shared/codes.js";
import { ensureGitRepository } from "../shared/ensureGitRepository.js";
import { readOptions } from "../shared/options/readOptions.js";
import { runOrRestore } from "../shared/runOrRestore.js";
import { migrateWithOptions } from "./migrateWithOptions.js";
export const migrate: ModeRunner = async (args) => {
const inputs = await readOptions(args, "migrate");
if (inputs.cancelled) {
return {
code: StatusCodes.Cancelled,
error: inputs.error,
options: inputs.options,
};
}
await ensureGitRepository();
return {
code: await runOrRestore({
run: async () => {
await migrateWithOptions(inputs);
outro([
{
label: "You may consider committing these changes:",
lines: [
`git add -A`,
`git commit -m "migrated repo to create-typescript-app ✨`,
`git push`,
],
},
]);
},
skipRestore: inputs.options.skipRestore,
}),
options: inputs.options,
};
};