diff --git a/packages/feflow-cli/src/core/index.ts b/packages/feflow-cli/src/core/index.ts index 5a876f13..f49fffa2 100644 --- a/packages/feflow-cli/src/core/index.ts +++ b/packages/feflow-cli/src/core/index.ts @@ -158,7 +158,9 @@ export default class Feflow { const pkg: any = JSON.parse(content); const localVersion = pkg.version; const registryUrl = await getRegistryUrl(packageManager); - const latestVersion = await packageJson(name, 'latest', registryUrl); + const latestVersion = await packageJson(name, 'latest', registryUrl).catch((err) => { + logger.debug('Check plugin update error', err); + }); if (latestVersion !== localVersion) { table.cell('Name', name); diff --git a/packages/feflow-cli/src/core/native/install.ts b/packages/feflow-cli/src/core/native/install.ts index 5fda1357..617ebbac 100644 --- a/packages/feflow-cli/src/core/native/install.ts +++ b/packages/feflow-cli/src/core/native/install.ts @@ -1,9 +1,25 @@ -import { install } from '../../shared/npm'; +import { + getRegistryUrl, + install +} from '../../shared/npm'; +import packageJson from '../../shared/packageJson'; module.exports = (ctx: any) => { const packageManager = ctx.config && ctx.config.packageManager; - ctx.commander.register('install', 'Install a devkit or plugin', () => { + ctx.commander.register('install', 'Install a devkit or plugin', async () => { + const registryUrl = await getRegistryUrl(packageManager); const dependencies = ctx.args['_']; + + await Promise.all( + dependencies.map((dependency: string) => { + return packageJson(dependency, 'latest', registryUrl) + .catch(() => { + ctx.logger.error(`${ dependency } not found on ${ packageManager }`); + process.exit(2); + }); + }) + ); + ctx.logger.info('Installing packages. This might take a couple of minutes.'); return install( diff --git a/packages/feflow-cli/src/shared/packageJson.ts b/packages/feflow-cli/src/shared/packageJson.ts index b688f1fe..657ab2cc 100644 --- a/packages/feflow-cli/src/shared/packageJson.ts +++ b/packages/feflow-cli/src/shared/packageJson.ts @@ -13,7 +13,7 @@ export default function packageJson(name: string, version: string, registry: str resolve(response.version); }) .catch((err: object) => { - resolve(err); + reject(err); }); }); } \ No newline at end of file