Commit bae6146

Anton Medvedev <anton@medv.io>
2022-09-25 12:34:13
Show better install prompt
1 parent e727feb
Changed files (2)
src/cli.ts
@@ -174,7 +174,6 @@ async function importPath(filepath: string, origin = filepath) {
   }
   if (argv.install) {
     const deps = parseDeps(await fs.readFile(filepath))
-    console.log('Installing dependencies...', deps)
     await installDeps(deps, dirname(filepath))
   }
   const __filename = resolve(origin)
src/deps.ts
@@ -13,6 +13,7 @@
 // limitations under the License.
 
 import { $ } from './core.js'
+import { spinner } from './experimental.js'
 
 export async function installDeps(
   dependencies: Record<string, string>,
@@ -25,7 +26,9 @@ export async function installDeps(
   if (packages.length === 0) {
     return
   }
-  await $`npm install --no-save --no-audit --no-fund ${flags} ${packages}`
+  await spinner(`npm i ${packages.join(' ')}`, () =>
+    $`npm install --no-save --no-audit --no-fund ${flags} ${packages}`.nothrow()
+  )
 }
 
 const builtins = new Set([