Skip to content

Commit

Permalink
cli: Switch from import json to fs.readFile.
Browse files Browse the repository at this point in the history
@trivago/prettier-plugin-sort-imports does not yet support import assertions.

See: trivago/prettier-plugin-sort-imports#270
  • Loading branch information
raineorshine committed Dec 18, 2023
1 parent 5d8da49 commit 5ef47d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bin/cli.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
#!/usr/bin/env node
import { Help, Option, program } from 'commander'
import fs from 'fs/promises'
import { cloneDeep, pickBy } from 'lodash-es'
import path from 'path'
import semver from 'semver'
import pkg from '../../package.json' assert { type: "json" }
import cliOptions, { renderExtendedHelp } from '../cli-options.js'
import ncu from '../index.js'
import { chalkInit } from '../lib/chalk.js'
// async global contexts are only available in esm modules -> function
import getNcuRc from '../lib/getNcuRc.js'

const __dirname = path.dirname(new URL(import.meta.url).pathname)

/** Removes inline code ticks. */
const uncode = (s: string) => s.replace(/`/g, '')

;(async () => {
// importing update-notifier dynamically as esm modules are only allowed to be dynamically imported inside of cjs modules
const { default: updateNotifier } = await import('update-notifier')

const pkg = JSON.parse(await fs.readFile(path.join(__dirname, '../../package.json'), 'utf-8'))

// check if a new version of ncu is available and print an update notification
//
// For testing from specific versions, use:
Expand Down

0 comments on commit 5ef47d4

Please sign in to comment.