@jayrdeaton/scripts 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,10 @@ import { execSync } from 'node:child_process'
2
2
  import { readFileSync } from 'node:fs'
3
3
  import { resolve } from 'node:path'
4
4
 
5
- import cosmetic from 'cosmetic'
6
- import { command as createCommand } from 'termkit'
5
+ import { Color, command as createCommand, log } from 'termkit'
7
6
 
8
7
  function exec(cmd) {
9
- console.log(cosmetic.faint(`$ ${cmd}`))
8
+ console.log(Color.faint(`$ ${cmd}`))
10
9
  execSync(cmd, { stdio: 'inherit' })
11
10
  }
12
11
 
@@ -26,7 +25,7 @@ export const command = createCommand('update-deps')
26
25
  try {
27
26
  pkg = JSON.parse(readFileSync(pkgPath, 'utf8'))
28
27
  } catch {
29
- console.error(cosmetic.red('No package.json found in current directory.'))
28
+ log.fail('No package.json found in current directory.')
30
29
  process.exit(1)
31
30
  }
32
31
 
@@ -35,21 +34,24 @@ export const command = createCommand('update-deps')
35
34
  const legacyFlag = options.legacy ? ' --legacy-peer-deps' : ''
36
35
 
37
36
  if (!options.dev && prodDeps.length) {
38
- console.log(cosmetic.bold.cyan('\nUpdating dependencies...'))
37
+ log.info('Updating dependencies...')
39
38
  exec(`npm install${legacyFlag} ${prodDeps.join(' ')}`)
40
39
  }
41
40
 
42
41
  if (!options.prod && devDeps.length) {
43
- console.log(cosmetic.bold.cyan('\nUpdating devDependencies...'))
42
+ log.info('Updating devDependencies...')
44
43
  exec(`npm install --save-dev${legacyFlag} ${devDeps.join(' ')}`)
45
44
  }
46
45
 
47
46
  const hasExpo = pkg.dependencies?.expo !== undefined || pkg.devDependencies?.expo !== undefined
48
47
 
49
48
  if (hasExpo) {
50
- console.log(cosmetic.bold.cyan('\nFixing Expo managed versions...'))
49
+ log.info('Fixing Expo managed versions...')
51
50
  exec(`npx expo install --fix${options.legacy ? ' -- --legacy-peer-deps' : ''}`)
52
51
  }
53
52
 
54
- console.log(cosmetic.bold.green('\nDone.'))
53
+ log.info('Auditing and fixing vulnerabilities...')
54
+ exec('npm audit --fix')
55
+
56
+ log.succeed('Done.')
55
57
  })