Skip to content

Commit

Permalink
feat(taobao-registry): 新增生成淘宝源npmrc文件命令
Browse files Browse the repository at this point in the history
  • Loading branch information
StreakingMan committed Dec 1, 2022
1 parent 9b64f1e commit 20a94cc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ yarn global add streakingman-cli
- [react-comp: 快速生成 react 组件相关文件](#react-comp)
- [jekyll-md: 生成带 front matter 的 markdown 文件](#jekyll-md)
- [type-it: 对文本文件重新进行逐字输入](#type-it)
- [taobao-registry: 生成淘宝源npmrc文件](#taobao-registry)

## 使用

Expand Down Expand Up @@ -171,6 +172,16 @@ Usage: skm type-it [options] [filePath] [speed] [breakBySpace]

https://user-images.githubusercontent.com/30397306/202643861-6f507cda-819b-40a0-9131-9883d9a9b978.mov

### taobao-registry

生成淘宝源npmrc文件

```shell
skm taobao-registry

.npmrc生成完毕
```

## TODO

- [ ] 测试用例
Expand Down
10 changes: 10 additions & 0 deletions actions/taobao-registry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { writeFileSync } from 'fs-extra';
import * as path from 'path';

export const taobaoRegistry = () => {
writeFileSync(
path.join(process.cwd(), '.npmrc'),
'registry=https://registry.npmmirror.com'
);
console.log('.npmrc生成完毕');
};
5 changes: 5 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { reactComp } from './actions/react-comp';
import { jekyllMD } from './actions/jekyll-md';
import { genReport } from './actions/gen-report';
import { typeIt } from './actions/type-it';
import { taobaoRegistry } from './actions/taobao-registry';
const CLINAME = 'skm';

program
Expand Down Expand Up @@ -43,6 +44,10 @@ program
.command('type-it [filePath] [speed] [mode]')
.description('对文本文件重新进行逐字输入')
.action(typeIt);
program
.command('taobao-registry')
.description('生成淘宝源npmrc文件')
.action(taobaoRegistry);

program.showHelpAfterError(`${CLINAME} -h 查看帮助`);
program.addHelpCommand(false);
Expand Down

0 comments on commit 20a94cc

Please sign in to comment.