Skip to content

Commit

Permalink
feat!: update deps, require Node v18
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 27, 2024
1 parent 22b84e5 commit 771f943
Show file tree
Hide file tree
Showing 26 changed files with 431 additions and 403 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "taze",
"type": "module",
"version": "0.16.9",
"packageManager": "pnpm@9.10.0",
"packageManager": "pnpm@9.11.0",
"description": "A modern cli tool that keeps your deps fresh",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
Expand Down Expand Up @@ -36,20 +36,20 @@
"dependencies": {
"@antfu/ni": "^0.23.0",
"js-yaml": "^4.1.0",
"ofetch": "^1.3.4",
"ofetch": "^1.4.0",
"package-manager-detector": "^0.2.0",
"tinyexec": "^0.3.0",
"unconfig": "^0.5.5",
"yargs": "^17.7.2"
},
"devDependencies": {
"@antfu/eslint-config": "^3.5.1",
"@antfu/eslint-config": "^3.7.3",
"@antfu/utils": "^0.7.10",
"@npmcli/config": "^8.3.4",
"@types/cli-progress": "^3.11.6",
"@types/debug": "^4.1.12",
"@types/js-yaml": "^4.0.9",
"@types/node": "^22.5.4",
"@types/node": "^22.7.3",
"@types/npm-package-arg": "^6.1.4",
"@types/npm-registry-fetch": "^8.0.7",
"@types/prompts": "^2.4.9",
Expand All @@ -61,12 +61,12 @@
"debug": "^4.3.7",
"deepmerge": "^4.3.1",
"detect-indent": "^7.0.1",
"eslint": "^9.10.0",
"eslint": "^9.11.1",
"esno": "^4.7.0",
"fast-glob": "^3.3.2",
"fast-npm-meta": "^0.2.2",
"npm-package-arg": "^11.0.3",
"npm-registry-fetch": "^17.1.0",
"npm-package-arg": "^12.0.0",
"npm-registry-fetch": "^18.0.0",
"picocolors": "^1.1.0",
"prompts": "^2.4.2",
"restore-cursor": "^5.1.0",
Expand All @@ -76,6 +76,6 @@
"typescript": "^5.6.2",
"ufo": "^1.5.4",
"unbuild": "^2.0.0",
"vitest": "^2.0.5"
"vitest": "^2.1.1"
}
}
742 changes: 385 additions & 357 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/api/check.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CheckOptions, DependencyFilter, DependencyResolvedCallback, PackageMeta, RawDep } from '../types'
import { loadPackages, writePackage } from '../io/packages'
import { dumpCache, loadCache, resolvePackage } from '../io/resolves'
import type { CheckOptions, DependencyFilter, DependencyResolvedCallback, PackageMeta, RawDep } from '../types'

export interface CheckEventCallbacks {
afterPackagesLoaded?: (pkgs: PackageMeta[]) => void
Expand Down
2 changes: 1 addition & 1 deletion src/api/usage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DependencyResolvedCallback, PackageMeta, UsageOptions } from '../types'
import { loadPackages } from '../io/packages'
import { getPackageData } from '../io/resolves'
import type { DependencyResolvedCallback, PackageMeta, UsageOptions } from '../types'

export interface UsageEventCallbacks {
onLoaded?: (usages: UnresolvedUsage[]) => void
Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import type { Argv } from 'yargs'
import type { CommonOptions } from './types'
import process from 'node:process'
import c from 'picocolors'
import restoreCursor from 'restore-cursor'
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
import type { Argv } from 'yargs'
import pkgJson from '../package.json'
import { check } from './commands/check'
import { checkGlobal } from './commands/check/checkGlobal'
import { usage } from './commands/usage'
import { resolveConfig } from './config'
import { LOG_LEVELS, MODE_CHOICES } from './constants'
import { SORT_CHOICES } from './utils/sort'
import type { CommonOptions } from './types'

function commonOptions(args: Argv<object>): Argv<CommonOptions> {
return args
Expand Down
4 changes: 2 additions & 2 deletions src/commands/check/checkGlobal.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { Agent } from 'package-manager-detector'
import type { CheckOptions, PackageMeta, RawDep } from '../../types'
/* eslint-disable no-console */
import { getCommand } from '@antfu/ni'
import c from 'picocolors'
import prompts from 'prompts'
import { exec } from 'tinyexec'
import type { Agent } from 'package-manager-detector'
import { dumpDependencies } from '../../io/dependencies'
import { resolvePackage } from '../../io/resolves'
import { createMultiProgressBar } from '../../log'
import { createDependenciesFilter } from '../../utils/dependenciesFilter'
import { promptInteractive } from './interactive'
import { outputErr, renderPackages } from './render'
import type { CheckOptions, PackageMeta, RawDep } from '../../types'

interface NpmOut {
dependencies: {
Expand Down
10 changes: 5 additions & 5 deletions src/commands/check/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { SingleBar } from 'cli-progress'
import type {
CheckOptions,
PackageMeta,
} from '../../types'
/* eslint-disable no-console */
import { parseNi, parseNu, run } from '@antfu/ni'
import c from 'picocolors'
import prompts from 'prompts'
import type { SingleBar } from 'cli-progress'
import { builtinAddons } from '../../addons'
import { CheckPackages } from '../../api/check'
import { writePackage } from '../../io/packages'
import { createMultiProgressBar } from '../../log'
import { promptInteractive } from './interactive'
import { outputErr, renderPackages } from './render'
import type {
CheckOptions,
PackageMeta,
} from '../../types'

export async function check(options: CheckOptions) {
let exitCode = 0
Expand Down
2 changes: 1 addition & 1 deletion src/commands/check/interactive.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { CheckOptions, InteractiveContext, PackageMeta, ResolvedDepChange } from '../../types'
/* eslint-disable no-fallthrough */
import process from 'node:process'
/* eslint-disable no-console */
Expand All @@ -10,7 +11,6 @@ import { sortDepChanges } from '../../utils/sort'
import { timeDifference } from '../../utils/time'
import { getPrefixedVersion } from '../../utils/versions'
import { renderChanges } from './render'
import type { CheckOptions, InteractiveContext, PackageMeta, ResolvedDepChange } from '../../types'

export async function promptInteractive(pkgs: PackageMeta[], options: CheckOptions) {
const {
Expand Down
16 changes: 8 additions & 8 deletions src/commands/check/render.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import c from 'picocolors'
import semver from 'semver'
import { colorizeVersionDiff, FIG_CHECK, FIG_NO_POINTER, FIG_POINTER, FIG_UNCHECK, formatTable } from '../../render'
import { DependenciesTypeShortMap } from '../../types'
import { DiffColorMap } from '../../utils/diff'
import { sortDepChanges } from '../../utils/sort'
import { timeDifference } from '../../utils/time'

import type {
CheckOptions,
DiffType,
InteractiveContext,
PackageMeta,
ResolvedDepChange,
} from '../../types'
import c from 'picocolors'
import semver from 'semver'
import { colorizeVersionDiff, FIG_CHECK, FIG_NO_POINTER, FIG_POINTER, FIG_UNCHECK, formatTable } from '../../render'
import { DependenciesTypeShortMap } from '../../types'
import { DiffColorMap } from '../../utils/diff'
import { sortDepChanges } from '../../utils/sort'

import { timeDifference } from '../../utils/time'

export function renderChange(
change: ResolvedDepChange,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/usage.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import c from 'picocolors'
import type { SingleBar } from 'cli-progress'
import type { UsageOptions } from '../types'
import c from 'picocolors'
import { CheckUsages } from '../api/usage'
import { createMultiProgressBar, TableLogger, wrapJoin } from '../log'
import { colorizeVersionDiff, visualPadStart } from '../render'
import type { UsageOptions } from '../types'

export async function usage(options: UsageOptions) {
const bars = createMultiProgressBar()
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { CommonOptions } from './types'
import process from 'node:process'
import _debug from 'debug'
import deepmerge from 'deepmerge'
import { createConfigLoader } from 'unconfig'
import { DEFAULT_CHECK_OPTIONS, DEFAULT_USAGE_OPTIONS } from './constants'
import { toArray } from './utils/toArray'
import type { CommonOptions } from './types'

const debug = _debug('taze:config')

Expand Down
2 changes: 1 addition & 1 deletion src/filters/diff-sorter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DiffMap } from '../utils/diff'
import type { ResolvedDepChange } from '../types'
import { DiffMap } from '../utils/diff'

/**
* Sort based on the version diff (marjor, minor, etc.)
Expand Down
2 changes: 1 addition & 1 deletion src/io/packageJson.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { CommonOptions, PackageMeta, RawDep } from '../types'
import path from 'node:path'
import { builtinAddons } from '../addons'
import { dumpDependencies, getByPath, parseDependencies, parseDependency, setByPath } from './dependencies'
import { readJSON, writeJSON } from './packages'
import type { CommonOptions, PackageMeta, RawDep } from '../types'

const depsFields = [
'dependencies',
Expand Down
2 changes: 1 addition & 1 deletion src/io/packages.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { CommonOptions, PackageMeta } from '../types'
import { existsSync, promises as fs } from 'node:fs'
import path from 'node:path'
import detectIndent from 'detect-indent'
Expand All @@ -6,7 +7,6 @@ import { DEFAULT_IGNORE_PATHS } from '../constants'
import { createDependenciesFilter } from '../utils/dependenciesFilter'
import { loadPackageJSON, writePackageJSON } from './packageJson'
import { loadPnpmWorkspace, writePnpmWorkspace } from './pnpmWorkspaces'
import type { CommonOptions, PackageMeta } from '../types'

export async function readJSON(filepath: string) {
return JSON.parse(await fs.readFile(filepath, 'utf-8'))
Expand Down
2 changes: 1 addition & 1 deletion src/io/pnpmWorkspaces.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { CommonOptions, PackageMeta, RawDep } from '../types'
import fs from 'node:fs/promises'
import path from 'node:path'
import YAML from 'js-yaml'
import { dumpDependencies, parseDependency } from './dependencies'
import type { CommonOptions, PackageMeta, RawDep } from '../types'

export async function loadPnpmWorkspace(
relative: string,
Expand Down
2 changes: 1 addition & 1 deletion src/io/resolves.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { CheckOptions, DependencyFilter, DependencyResolvedCallback, DiffType, PackageData, PackageMeta, RangeMode, RawDep, ResolvedDepChange } from '../types'
import { existsSync, promises as fs, lstatSync } from 'node:fs'
import os from 'node:os'
import { resolve } from 'node:path'
Expand All @@ -9,7 +10,6 @@ import { getNpmConfig } from '../utils/npm'
import { parsePnpmPackagePath, parseYarnPackagePath } from '../utils/package'
import { fetchPackage } from '../utils/packument'
import { getMaxSatisfying, getPrefixedVersion } from '../utils/versions'
import type { CheckOptions, DependencyFilter, DependencyResolvedCallback, DiffType, PackageData, PackageMeta, RangeMode, RawDep, ResolvedDepChange } from '../types'

const debug = {
cache: _debug('taze:cache'),
Expand Down
2 changes: 1 addition & 1 deletion src/log.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { LogLevel } from './types'
import process from 'node:process'
import { MultiBar, Presets } from 'cli-progress'
import c from 'picocolors'
import { LOG_LEVELS } from './constants'
import { visualLength, visualPadEnd, visualPadStart } from './render'
import type { LogLevel } from './types'

interface Options {
columns: number
Expand Down
2 changes: 1 addition & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { filterToRegex } from './dependenciesFilter'
import type { CheckOptions } from '../types'
import { filterToRegex } from './dependenciesFilter'

export function getPackageMode(pkgName: string, options: CheckOptions) {
if (!options.packageMode)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/npm.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// ported from: https://github.com/raineorshine/npm-check-updates/blob/master/lib/package-managers/npm.js

import type { Recordable } from '@npmcli/config'
import path from 'node:path'
import process from 'node:process'
import type { Recordable } from '@npmcli/config'

async function _getNpmConfig() {
const { default: NpmCliConfig } = await import('@npmcli/config')
Expand Down
2 changes: 1 addition & 1 deletion src/utils/packument.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { PackageData } from '../types'
import process from 'node:process'
import { getVersions, pickRegistry } from 'fast-npm-meta'
import { fetch } from 'ofetch'
import { joinURL } from 'ufo'
import type { PackageData } from '../types'

// @types/pacote uses "import = require()" syntax which is not supported by unbuild
// So instead of using @types/pacote, we declare the type definition with only fields we need
Expand Down
2 changes: 1 addition & 1 deletion src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import semver from 'semver'
import type { RangeMode } from '../types'
import semver from 'semver'

export function getVersionRangePrefix(v: string) {
const leadings = ['>=', '<=', '>', '<', '~', '^']
Expand Down
2 changes: 1 addition & 1 deletion test/dumpDependencies.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ResolvedDepChange } from '../src/types'
import { describe, expect, it } from 'vitest'
import { dumpDependencies } from '../src/io/dependencies'
import type { ResolvedDepChange } from '../src/types'

describe('dumpDependencies', () => {
function makeDepChange(source: string, override: Partial<ResolvedDepChange> = {}) {
Expand Down
2 changes: 1 addition & 1 deletion test/packageConfig.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { CheckOptions, CommonOptions, ResolvedDepChange } from '../src'
import { join } from 'node:path'
import process from 'node:process'
import { describe, expect, it } from 'vitest'
import { CheckPackages } from '../src'
import { resolveConfig } from '../src/config'
import type { CheckOptions, CommonOptions, ResolvedDepChange } from '../src'

function getPkgInfo(name: string, result: ResolvedDepChange[]) {
return result.filter(r => r.name === name)[0]
Expand Down
2 changes: 1 addition & 1 deletion test/pnpmCatalog.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CheckOptions } from '../src'
import process from 'node:process'
import { expect, it } from 'vitest'
import { CheckPackages } from '../src'
import type { CheckOptions } from '../src'

it('pnpm catalog', async () => {
const options: CheckOptions = {
Expand Down
2 changes: 1 addition & 1 deletion test/resolves.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { CheckOptions, DependencyFilter, RawDep } from '../src'
import process from 'node:process'
import { SemVer } from 'semver'
import { expect, it } from 'vitest'
import { resolveDependency } from '../src'
import { getDiff } from '../src/io/resolves'
import type { CheckOptions, DependencyFilter, RawDep } from '../src'

const filter: DependencyFilter = () => true

Expand Down
2 changes: 1 addition & 1 deletion test/sort.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PackageData, ResolvedDepChange } from '../src'
import { describe, expect, it } from 'vitest'
import { parseSortOption, sortDepChanges } from '../src/utils/sort'
import type { PackageData, ResolvedDepChange } from '../src'

describe('sort resolvedDepChanges', () => {
const pkgData: PackageData = {
Expand Down

0 comments on commit 771f943

Please sign in to comment.