Skip to content

Commit

Permalink
fix(app-vite): reinstall AE on "add" without prompting user, otherwis…
Browse files Browse the repository at this point in the history
…e node will cache the pkg as unavailable
  • Loading branch information
rstoenescu committed Apr 25, 2024
1 parent 4f88967 commit d2fd727
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
22 changes: 3 additions & 19 deletions app-vite/lib/app-extension/AppExtensionInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,28 +191,12 @@ export class AppExtensionInstance {
log(`${ skipPkgInstall ? 'Invoking' : 'Installing' } "${ this.extId }" Quasar App Extension`)
log()

// verify if already installed
if (skipPkgInstall === true) {
if (!this.isInstalled) {
fatal(`Tried to invoke App Extension "${ this.extId }" but its npm package is not installed`)
}
}
else if (this.isInstalled) {
const answer = await inquirer.prompt([ {
name: 'reinstall',
type: 'confirm',
message: 'Already installed. Reinstall?',
default: false
} ])

if (!answer.reinstall) {
return
}
}

if (skipPkgInstall !== true) {
await this.#installPackage()
}
else if (!this.isInstalled) {
fatal(`Tried to invoke App Extension "${ this.extId }" but its npm package is not installed`)
}

const prompts = await this.#getScriptPrompts()

Expand Down
2 changes: 1 addition & 1 deletion app-vite/lib/cache/module.nodePackager.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class Pnpm extends PackageManager {
getInstallPackageParams (names, isDevDependency) {
return [
'add',
isDevDependency ? '-D' : '',
isDevDependency ? '--save-dev' : '',
...names
]
}
Expand Down
2 changes: 1 addition & 1 deletion app-webpack/lib/cache/module.nodePackager.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class Pnpm extends PackageManager {
getInstallPackageParams (names, isDevDependency) {
return [
'add',
isDevDependency ? '-D' : '',
isDevDependency ? '--save-dev' : '',
...names
]
}
Expand Down

2 comments on commit d2fd727

@yusufkandemir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rstoenescu this commit seems to revert the changes in the previous two commits accidentally.

@rstoenescu
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know. Both ways are legit. Got a bit confused reading pnpm docs.
Thanks for pinging me though!

Please sign in to comment.