Skip to content

Commit

Permalink
feat: remove fbi add version logic
Browse files Browse the repository at this point in the history
  • Loading branch information
taomas committed Feb 25, 2021
1 parent 0a502c8 commit c54aedc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ export default class CommandAdd extends Command {
this.debug('Save to store:', data)
this.store.set(data.id, data)

const { version, global } = await this.getVersionInfo(factory)
if (version) {
this.store.set(`${factory.id}.version`, version)
}
if (global) {
this.store.set(`${factory.id}.global`, global)
// const { version, global } = await this.getVersionInfo(factory)
// if (version) {
// this.store.set(`${factory.id}.version`, version)
// }
if (factory.isGlobal) {
this.store.set(`${factory.id}.global`, factory.isGlobal)
}

return factory
Expand All @@ -269,13 +269,14 @@ export default class CommandAdd extends Command {
}

private async installProdDeps (flags: Record<string, any>, targetDir: string) {
const spinner = this.createSpinner('Installing dependencies...').start()
let spinner = this.createSpinner()
try {
process.env.NODE_ENV = 'production'
const env = this.context.get('env')
const pm =
flags.packageManager ||
(env.hasYarn ? 'yarn' : this.context.get('config').packageManager)
const config = this.context.get('config')
const pm = flags.packageManager || (env.hasYarn ? 'yarn' : config.packageManager)
console.log(`fbi start install dependencies in ${this.style.cyan(targetDir)}`)
spinner.start(`${this.style.cyan(`${pm} install`)}`)
await this.exec.command(`${pm} install`, {
cwd: targetDir,
stdout: 'ignore',
Expand All @@ -286,9 +287,7 @@ export default class CommandAdd extends Command {
})
spinner.succeed('Installed dependencies')
} catch (err) {
spinner.fail(
'Failed to install dependencies. You can install them manually.'
)
spinner.fail(`Failed to install dependencies, You can install them manually, install dependencies path: ${targetDir}`)
this.error(err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export abstract class BaseClass {
return config
}

createSpinner (str: string) {
createSpinner (str?: string) {
return (str && ora(str)) || ora()
}

Expand Down

0 comments on commit c54aedc

Please sign in to comment.