File tree Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Original file line number Diff line number Diff line change 1
1
import { isPackageExists } from 'local-pkg'
2
2
import { ensurePackages , interopDefault , toArray } from '../shared'
3
3
import { GLOB_JS , GLOB_JSX , GLOB_TS , GLOB_TSX } from '../constants/glob'
4
+ import { isUsingNext , isUsingRemix } from '../env'
4
5
import type {
5
6
OptionsFiles ,
6
7
OptionsOverrides ,
@@ -10,13 +11,6 @@ import type {
10
11
11
12
// react refresh
12
13
const ReactRefreshAllowConstantExportPackages = [ 'vite' ]
13
- const RemixPackages = [
14
- '@remix-run/node' ,
15
- '@remix-run/react' ,
16
- '@remix-run/serve' ,
17
- '@remix-run/dev' ,
18
- ]
19
- const NextJsPackages = [ 'next' ]
20
14
21
15
export async function react (
22
16
options : OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles = { } ,
@@ -45,8 +39,6 @@ export async function react(
45
39
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages . some (
46
40
i => isPackageExists ( i ) ,
47
41
)
48
- const isUsingRemix = RemixPackages . some ( i => isPackageExists ( i ) )
49
- const isUsingNext = NextJsPackages . some ( i => isPackageExists ( i ) )
50
42
51
43
const plugins = pluginReact . configs . all . plugins
52
44
Original file line number Diff line number Diff line change @@ -9,14 +9,29 @@ export const isInEditor = !!(
9
9
&& ! process . env . CI
10
10
)
11
11
export const hasTypeScript = isPackageExists ( 'typescript' )
12
- // export const hasReact = isPackageExists('react') || isPackageExists('next')
13
- export const hasVue
14
- = isPackageExists ( 'vue' )
15
- || isPackageExists ( 'nuxt' )
16
- || isPackageExists ( 'vitepress' )
17
- || isPackageExists ( '@slidev/cli' )
18
- export const hasUnocss
19
- = isPackageExists ( 'unocss' )
20
- || isPackageExists ( '@unocss/webpack' )
21
- || isPackageExists ( '@unocss/nuxt' )
22
- export const hasTailwindCSS = isPackageExists ( 'tailwindcss' ) && ! hasUnocss
12
+
13
+ const VueJsPackages = [
14
+ 'vue' ,
15
+ 'nuxt' ,
16
+ 'vitepress' ,
17
+ '@slidev/cli' ,
18
+ ]
19
+
20
+ export const hasVue = hasPackages ( VueJsPackages )
21
+
22
+ const RemixPackages = [
23
+ '@remix-run/node' ,
24
+ '@remix-run/react' ,
25
+ '@remix-run/serve' ,
26
+ '@remix-run/dev' ,
27
+ ]
28
+
29
+ const NextJsPackages = [ 'next' ]
30
+
31
+ // export const hasReact = hasPackages(['react', ...RemixPackages, ...NextJsPackages])
32
+ export const isUsingRemix = hasPackages ( RemixPackages )
33
+ export const isUsingNext = hasPackages ( NextJsPackages )
34
+
35
+ function hasPackages ( packages : string [ ] ) {
36
+ return packages . some ( name => isPackageExists ( name ) )
37
+ }
You can’t perform that action at this time.
0 commit comments