|
1 | 1 | import options from '../core/utils/react/options'; |
2 | | -import { remove } from 'fs-extra'; |
| 2 | +import fs from 'fs-extra'; |
3 | 3 |
|
4 | 4 | export function getFilterFile() { |
5 | 5 | async function reactFilterFileActions() { |
6 | 6 | if (!options.useRouter) { |
7 | | - remove(`${options.dest}/src/pages`) |
| 7 | + fs.remove(`${options.dest}/src/pages`) |
8 | 8 | } |
9 | 9 |
|
10 | 10 | if (!options.useTailwind) { |
11 | | - remove(`${options.dest}/tailwind.config.js`); |
12 | | - remove(`${options.dest}/postcss.config.js`); |
13 | | - remove(`${options.dest}/src/assets/css/tailwind.css`); |
| 11 | + fs.remove(`${options.dest}/tailwind.config.js`); |
| 12 | + fs.remove(`${options.dest}/postcss.config.js`); |
| 13 | + fs.remove(`${options.dest}/src/assets/css/tailwind.css`); |
14 | 14 | }; |
15 | 15 |
|
16 | 16 | if (options.useTailwind) { |
17 | | - remove(`${options.dest}/src/assets/css/base.css`); |
| 17 | + fs.remove(`${options.dest}/src/assets/css/base.css`); |
18 | 18 | } |
19 | 19 |
|
20 | 20 | if (options.deploy === 'none') { |
21 | | - remove(`${options.dest}/netlify.toml`); |
22 | | - remove(`${options.dest}/vercel.json`); |
| 21 | + fs.remove(`${options.dest}/netlify.toml`); |
| 22 | + fs.remove(`${options.dest}/vercel.json`); |
23 | 23 | } |
24 | 24 |
|
25 | 25 | if (options.deploy === "netlify") { |
26 | | - remove(`${options.dest}/vercel.json`); |
| 26 | + fs.remove(`${options.dest}/vercel.json`); |
27 | 27 | } |
28 | 28 |
|
29 | 29 | if (options.deploy === "vercel") { |
30 | | - remove(`${options.dest}/netlify.toml`); |
| 30 | + fs.remove(`${options.dest}/netlify.toml`); |
31 | 31 | } |
32 | 32 |
|
33 | 33 |
|
34 | 34 | if (options.useTailwind === false) { |
35 | | - remove(`${options.dest}/src/assets/css/tailwind.css`); |
| 35 | + fs.remove(`${options.dest}/src/assets/css/tailwind.css`); |
36 | 36 | } |
37 | 37 |
|
38 | 38 | if (options.useJavaScript) { |
39 | | - remove(`${options.dest}/src/main.tsx`); |
| 39 | + fs.remove(`${options.dest}/src/main.tsx`); |
40 | 40 | } |
41 | 41 |
|
42 | 42 | if (!options.useVitest) { |
43 | | - remove(`${options.dest}/vitest.config.ts`); |
44 | | - remove(`${options.dest}/vitest.config.js`); |
45 | | - remove(`${options.dest}/tests`); |
| 43 | + fs.remove(`${options.dest}/vitest.config.ts`); |
| 44 | + fs.remove(`${options.dest}/vitest.config.js`); |
| 45 | + fs.remove(`${options.dest}/tests`); |
46 | 46 | } |
47 | 47 |
|
48 | 48 | if (options.stateManagement === 'none') { |
49 | | - remove(`${options.dest}/src/store`) |
50 | | - remove(`${options.dest}/src/app`) |
51 | | - remove(`${options.dest}/src/features`) |
| 49 | + fs.remove(`${options.dest}/src/store`) |
| 50 | + fs.remove(`${options.dest}/src/app`) |
| 51 | + fs.remove(`${options.dest}/src/features`) |
52 | 52 | } |
53 | 53 |
|
54 | 54 | if (options.stateManagement === 'jotai') { |
55 | | - remove(`${options.dest}/src/app`) |
56 | | - remove(`${options.dest}/src/store`) |
57 | | - remove(`${options.dest}/src/features`) |
| 55 | + fs.remove(`${options.dest}/src/app`) |
| 56 | + fs.remove(`${options.dest}/src/store`) |
| 57 | + fs.remove(`${options.dest}/src/features`) |
58 | 58 | } |
59 | 59 |
|
60 | 60 |
|
61 | 61 | if (options.stateManagement === 'zustand') { |
62 | | - remove(`${options.dest}/src/app`) |
63 | | - remove(`${options.dest}/src/store/appStore.ts`) |
64 | | - remove(`${options.dest}/src/store/appStore.js`) |
65 | | - remove(`${options.dest}/src/features`) |
| 62 | + fs.remove(`${options.dest}/src/app`) |
| 63 | + fs.remove(`${options.dest}/src/store/appStore.ts`) |
| 64 | + fs.remove(`${options.dest}/src/store/appStore.js`) |
| 65 | + fs.remove(`${options.dest}/src/features`) |
66 | 66 | } |
67 | 67 |
|
68 | 68 | if (options.stateManagement === 'redux') { |
69 | | - remove(`${options.dest}/src/store/store.ts`) |
70 | | - remove(`${options.dest}/src/store/store.js`) |
| 69 | + fs.remove(`${options.dest}/src/store/store.ts`) |
| 70 | + fs.remove(`${options.dest}/src/store/store.js`) |
71 | 71 | } |
72 | 72 |
|
73 | 73 | if (!options.useEslint) { |
74 | | - remove(`${options.dest}/.eslintrc.cjs`) |
| 74 | + fs.remove(`${options.dest}/.eslintrc.cjs`) |
75 | 75 | } |
76 | 76 | return true |
77 | 77 | } |
|
0 commit comments