Skip to content

fix: convert to esm #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
10 changes: 10 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"require": [
"ts-node/esm"
],
"watch-extensions": ["ts"],
"recursive": true,
"reporter": "spec",
"timeout": 15000,
"node-option": ["loader=ts-node/esm", "experimental-specifier-resolution=node"]
}
6 changes: 3 additions & 3 deletions examples/favorites.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ux} from '@oclif/core'
import {Errors, ux} from '@oclif/core'

import {Command} from '../src'
import {Command} from '../src/index.js'

type Favorite = {
id: string;
Expand All @@ -26,5 +26,5 @@
}
}

(FavoritesCommand.run([]) as any)

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 29 in examples/favorites.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type
.catch(require('@oclif/core').Errors.handle)
.catch(Errors.handle)
6 changes: 4 additions & 2 deletions examples/login.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Command, flags} from '../src'
import {Errors} from '@oclif/core'

import {Command, flags} from '../src/index.js'

class LoginCommand extends Command {
static flags = {
Expand All @@ -13,5 +15,5 @@
}
}

(LoginCommand.run(process.argv.slice(2)) as any)

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 18 in examples/login.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type
.catch(require('@oclif/core').Errors.handle)
.catch(Errors.handle)
6 changes: 4 additions & 2 deletions examples/logout.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Command} from '../src'
import {Errors} from '@oclif/core'

import {Command} from '../src/index.js'

class LogoutCommand extends Command {
async run() {
Expand All @@ -7,5 +9,5 @@
}
}

(LogoutCommand.run([]) as any)

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 12 in examples/logout.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type
.catch(require('@oclif/core').Errors.handle)
.catch(Errors.handle)
2 changes: 1 addition & 1 deletion examples/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ if [ ! -f "examples/$COMMAND.ts" ]; then
exit 1
fi

./node_modules/.bin/ts-node "examples/$COMMAND.ts" "$@"
NODE_NO_WARNINGS=1 NODE_OPTIONS="--loader ts-node/esm" ./node_modules/.bin/ts-node --esm "examples/$COMMAND.ts" "$@"
6 changes: 3 additions & 3 deletions examples/status.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {HTTP} from '@heroku/http-call'
import {ux} from '@oclif/core'
import {Errors, ux} from '@oclif/core'

import {Command} from '../src'
import {Command} from '../src/index.js'

class StatusCommand extends Command {
async run() {
Expand All @@ -25,5 +25,5 @@
}
}

(StatusCommand.run([]) as any)

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 28 in examples/status.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type
.catch(require('@oclif/core').Errors.handle)
.catch(Errors.handle)
6 changes: 3 additions & 3 deletions examples/whoami.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Heroku from '@heroku-cli/schema'
import {ux} from '@oclif/core'
import {Errors, ux} from '@oclif/core'

import {Command} from '../src'
import {Command} from '../src/index.js'

class StatusCommand extends Command {
notloggedin() {
Expand All @@ -14,13 +14,13 @@
try {
const {body: account} = await this.heroku.get<Heroku.Account>('/account', {retryAuth: false})
ux.stdout(account.email)
} catch (error: any) {

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 17 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type
if (error.statusCode === 401) this.notloggedin()
throw error
}
}
}

(StatusCommand.run([]) as any)

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 22.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type

Check warning on line 24 in examples/whoami.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest, 20.x)

Unexpected any. Specify a different type
.catch(require('@oclif/core').Errors.handle)
.catch(Errors.handle)

Loading