@mpxjs/cli 3.4.8 → 3.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/create.js CHANGED
@@ -7,8 +7,11 @@ const {
7
7
  exit,
8
8
  error,
9
9
  log,
10
- stopSpinner
10
+ stopSpinner,
11
+ hasYarn,
12
+ hasPnpm3OrLater
11
13
  } = require('@vue/cli-shared-utils')
14
+ const { loadOptions } = require('@vue/cli/lib/options')
12
15
  const Creator = require('@vue/cli/lib/Creator')
13
16
  const loadRemotePreset = require('@vue/cli/lib/util/loadRemotePreset')
14
17
  const loadLocalPreset = require('@vue/cli/lib/util/loadLocalPreset')
@@ -176,6 +179,35 @@ async function create (projectName, options, preset = null) {
176
179
 
177
180
  const creator = new Creator(name, targetDir, getPromptModules())
178
181
 
182
+ const packageManager =
183
+ options.packageManager ||
184
+ loadOptions().packageManager ||
185
+ (hasYarn() ? 'yarn' : null) ||
186
+ (hasPnpm3OrLater() ? 'pnpm' : 'npm')
187
+
188
+ // @achrinza/node-ipc与node23不兼容,需要映射到修复包node-ipc-compat@1.0.0
189
+ creator.on('creation', ({ event }) => {
190
+ if (event === 'plugins-install' || event === 'deps-install') {
191
+ try {
192
+ const pkgPath = path.resolve(targetDir, 'package.json')
193
+ const pkg = fs.readJsonSync(pkgPath)
194
+ // 根据包管理器类型写入对应的 overrides 配置,yarn无需处理
195
+ if (packageManager === 'pnpm') {
196
+ pkg.pnpm = {
197
+ overrides: {
198
+ '@achrinza/node-ipc': 'npm:node-ipc-compat@1.0.0'
199
+ }
200
+ }
201
+ } else if (packageManager === 'npm') {
202
+ pkg.overrides = {
203
+ '@achrinza/node-ipc': 'npm:node-ipc-compat@1.0.0'
204
+ }
205
+ }
206
+ fs.writeJsonSync(pkgPath, pkg, { spaces: 2 })
207
+ } catch (e) {}
208
+ }
209
+ })
210
+
179
211
  if (process.env.VUE_CLI_TEST || process.env.VUE_CLI_DEBUG) {
180
212
  // 单测下,link bin文件到源码
181
213
  const { linkBin } = require('@vue/cli/lib/util/linkBin')
package/lib/createRn.js CHANGED
@@ -23,9 +23,6 @@ const RN_DEP = {
23
23
  'react-native-screens': '^4.8.0',
24
24
  'react-native-webview': '^13.13.2',
25
25
  'react-native-safe-area-context': '^4.10.9',
26
- expo: '^51.0.32',
27
- 'expo-brightness': '~12.0.1',
28
- 'expo-clipboard': '~6.0.3',
29
26
  react: '18.3.1',
30
27
  'react-native': '0.77.2'
31
28
  }
@@ -68,10 +65,6 @@ async function createRnProject (targetDir, options) {
68
65
  })
69
66
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2))
70
67
  await pm.install()
71
- await execa('npx', ['install-expo-modules'], {
72
- stdio: 'inherit',
73
- cwd: rnProjectPath
74
- })
75
68
  }
76
69
 
77
70
  module.exports.createRnProject = createRnProject
package/package.json CHANGED
@@ -30,5 +30,5 @@
30
30
  "access": "public",
31
31
  "registry": "https://registry.npmjs.org"
32
32
  },
33
- "version": "3.4.8"
33
+ "version": "3.4.10"
34
34
  }