Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d96c62a
commit f9c3143
Showing
4 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Confirm from 'prompt-confirm' | ||
import chalk from 'chalk' | ||
import path from 'path' | ||
import fs from 'fs' | ||
import { execSync } from 'child_process' | ||
|
||
import { print } from '../util' | ||
import createModules from '../modules' | ||
|
||
module.exports = async version => { | ||
version = version || 'latest' | ||
|
||
const modulesManager = createModules(null, './', null) | ||
const packages = ['botpress', ...modulesManager.listInstalled()] | ||
|
||
let cmdRest = '' | ||
|
||
for (const pkg of packages) { | ||
const confirm = await new Confirm(chalk` | ||
Do you want to update {yellow "${pkg}"} to version {underline ${version}}?`).run() | ||
if (confirm) { | ||
cmdRest += `${pkg}@${version} ` | ||
} | ||
} | ||
|
||
if (cmdRest.length) { | ||
console.log(chalk`===> {underline Installing dependencies, please wait...}`) | ||
|
||
if (fs.existsSync(path.resolve('./yarn.lock'))) { | ||
execSync(`yarn add ${cmdRest}`) | ||
} else { | ||
execSync(`npm install --save ${cmdRest}`) | ||
} | ||
|
||
console.log(chalk`{green.bold Done!}`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters