Skip to content

Commit

Permalink
npm-binary
Browse files Browse the repository at this point in the history
  • Loading branch information
biqing.hu committed Feb 14, 2022
1 parent d2b2b9b commit 9133944
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "publishx-cli",
"version": "1.6.43",
"version": "1.6.44",
"description": "publishx-cli 方便提交git库的命令 多功能合一命令,辅助多项目开发",
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
39 changes: 39 additions & 0 deletions src/commands/npm-binary.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// npm config set sass-binary-path D:/node-binaries/node-sass-win32-x64-57_binding.node

// yarn config set sass-binary-path D:/node-binaries/node-sass-win32-x64-57_binding.node
//https://npm.taobao.org/mirrors/node-sass/v4.5.3/win32-x64-57_binding.node


import { _, exec, getCurrentBranchName, cwd, consoleColor, io, checkOS } from '../lib'
/**
* 配置sass
*/
export default {
/**
* 启动
*/
async start(data) {
const binarySite = `http://npm.taobao.org/mirrors${data.package}`
const npmCmdStr = `npm config set ${data.package}-binary-site ${binarySite}`
const yarnCmdStr = `yarn config set ${data.package}-binary-site ${binarySite}`

try {
consoleColor.start(npmCmdStr)
await exec(npmCmdStr)
} catch (e) {
consoleColor.error(e)
}
try {
consoleColor.start(yarnCmdStr)
await exec(yarnCmdStr)
} catch (e) {
}
},
command: [
'<package>',
'操作系统设置 npm|yarn config set xxx-binary-site 为 taobaonpm 解决 xxx 安装缓慢问题',
{

}
]
}

0 comments on commit 9133944

Please sign in to comment.