Skip to content

Commit

Permalink
Use default export (#1410)
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine authored Jul 31, 2024
1 parent 0202566 commit 6a6ffed
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ npm-check-updates can be imported as a module:
```js
import ncu from 'npm-check-updates'

const upgraded = await ncu.run({
const upgraded = await ncu({
// Pass any cli option
packageFile: '../package.json',
upgrade: true,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ async function runUpgrades(options: Options, timeout?: NodeJS.Timeout): Promise<
* | void --global upgrade returns void.
* >
*/
export async function run(
async function run(
runOptions: RunOptions = {},
{ cli }: { cli?: boolean } = {},
): Promise<PackageFile | Index<VersionSpec> | void> {
Expand Down
15 changes: 15 additions & 0 deletions test/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,18 @@ npm i npm-check-updates@latest --registry $registry_local

echo Running test
REGISTRY=$registry_local node $temp_dir/e2e/esm/index.js

# Test: typescript
echo Test: typescript
cd $temp_dir/e2e/typescript

echo Installing
npm i npm-check-updates@latest --registry $registry_local
npm i typescript@5.4.5
echo 'import ncu from "npm-check-updates"
ncu({})' >index.ts

echo Running test
npx tsc index.ts
REGISTRY=$registry_local node $temp_dir/e2e/typescript/index.js
2 changes: 1 addition & 1 deletion test/e2e/cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ process.on('unhandledRejection', (reason, p) => {

// test
;(async () => {
const upgraded = await ncu.run({
const upgraded = await ncu({
// --pre 1 to ensure that an upgrade is always suggested even if npm-check-updates is on a prerelease version
pre: true,
packageData: JSON.stringify({
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ process.on('unhandledRejection', (reason, p) => {

// test
;(async () => {
const upgraded = await ncu.run({
const upgraded = await ncu({
// --pre 1 to ensure that an upgrade is always suggested even if npm-check-updates is on a prerelease version
pre: true,
packageData: JSON.stringify({
Expand Down
1 change: 1 addition & 0 deletions test/e2e/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit 6a6ffed

Please sign in to comment.