Skip to content

Commit f5b9772

Browse files
feat: introduce cli update command (#25)
1 parent 31b637e commit f5b9772

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ fng help
4141

4242
### Updating Fusing Angular CLI
4343

44+
```bash
45+
fng update
46+
```
47+
48+
or
49+
4450
```bash
4551
npm i -g fusing-angular-cli@latest
4652
```

src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import './build'
33
import './serve'
44
import './favicon'
55
import './config'
6+
import './update'
67
import { argv } from 'yargs'
78

89
argv

src/commands/update.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { command } from 'yargs'
2+
import { logInfo, logError } from '../utilities/log'
3+
import { load, commands } from 'npm'
4+
5+
command(
6+
'update',
7+
'update the CLI to the latest version',
8+
args => {
9+
return args
10+
},
11+
args => {
12+
update()
13+
}
14+
)
15+
16+
function update() {
17+
logInfo('Updating the CLI')
18+
load({ global: true }, () => {
19+
commands.install(['fusing-angular-cli@latest'], err => {
20+
err && logError(err)
21+
})
22+
})
23+
}

0 commit comments

Comments
 (0)