Browse Source

bugfix: yarn仓库镜像,点击切换回原生时,原生按钮不亮的问题修复

pull/334/head
王良 3 months ago
parent
commit
5ece1b3612
  1. 2
      packages/core/src/modules/plugin/node/config.js
  2. 4
      packages/core/src/modules/plugin/node/index.js
  3. 2
      packages/core/src/utils/util.log.js
  4. 2
      packages/core/start/user_config.json5
  5. 4
      packages/gui/src/view/pages/plugin/node.vue

2
packages/core/src/modules/plugin/node/config.js

@ -11,7 +11,7 @@ module.exports = {
cafile: false,
NODE_EXTRA_CA_CERTS: false,
NODE_TLS_REJECT_UNAUTHORIZED: false,
yarnRegistry: undefined,
yarnRegistry: 'null',
registry: 'https://registry.npmjs.org'// 可以选择切换官方或者淘宝镜像
},
// intercepts: {

4
packages/core/src/modules/plugin/node/index.js

@ -44,7 +44,7 @@ const NodePlugin = function (context) {
const cmds = []
for (const item of list) {
if (item.value != null) {
if (item.value != null && item.value.length > 0 && item.value !== 'null') {
cmds.push(`${command} config set ${item.key} ${item.value}`)
} else {
cmds.push(`${command} config delete ${item.key}`)
@ -67,7 +67,7 @@ const NodePlugin = function (context) {
const cmds = []
log.debug('yarn set:', JSON.stringify(list))
for (const item of list) {
if (item.value != null) {
if (item.value != null && item.value.length > 0 && item.value !== 'null') {
cmds.push(`yarn config set ${item.key} ${item.value}`)
} else {
cmds.push(`yarn config delete ${item.key}`)

2
packages/core/src/utils/util.log.js

@ -7,7 +7,7 @@ const level = process.env.NODE_ENV === 'development' ? 'debug' : 'info'
const path = require('path')
const filename = path.join(getDefaultConfigBasePath(), '/logs/core.log')
log4js.configure({
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename} },
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename } },
categories: { default: { appenders: ['file', 'std'], level: level } }
})
const logger = log4js.getLogger('core')

2
packages/core/start/user_config.json5

@ -8,7 +8,7 @@
plugin: {
node: {
setting: {
yarnRegistry: null,
yarnRegistry: 'null',
},
},
git: {

4
packages/gui/src/view/pages/plugin/node.vue

@ -44,8 +44,8 @@
</a-form-item>
<a-form-item label="yarn仓库镜像" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-radio-group v-model="config.plugin.node.setting.yarnRegistry" :default-value="null" @change="onSwitchYarnRegistry" button-style="solid">
<a-radio-button :value="null">
<a-radio-group v-model="config.plugin.node.setting.yarnRegistry" :default-value="'null'" @change="onSwitchYarnRegistry" button-style="solid">
<a-radio-button :value="'null'">
yarn原生
</a-radio-button>
<a-radio-button value="https://registry.npmmirror.com">

Loading…
Cancel
Save