Skip to content

Commit 46b2114

Browse files
committed
fix: remove module.exports statement from esm build
1 parent 0815980 commit 46b2114

14 files changed

+29
-32
lines changed

examples/basic-usage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli.option('--type [type]', 'Choose a project type')
55

examples/command-examples.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli
55
.command('build', 'Build project')
66
.example('cli build foo.js')
7-
.example(name => {
7+
.example((name) => {
88
return `${name} build foo.js`
99
})
1010
.option('--type [type]', 'Choose a project type')

examples/command-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli
55
.command('rm <dir>', 'Remove a dir')

examples/dot-nested-options.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli
55
.command('build', 'desc')
66
.option('--env <env>', 'Set envs')
77
.option('--foo-bar <value>', 'Set foo bar')
88
.example('--env.API_SECRET xxx')
9-
.action(options => {
9+
.action((options) => {
1010
console.log(options)
1111
})
1212

examples/help.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli.option('--type [type]', 'Choose a project type', {
55
default: 'node',

examples/ignore-default-value.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli
55
.command('build', 'Build project', {
6-
ignoreOptionDefaultValue: true
6+
ignoreOptionDefaultValue: true,
77
})
88
.option('--type [type]', 'Choose a project type', {
9-
default: 'node'
9+
default: 'node',
1010
})
1111

1212
const parsed = cli.parse()

examples/negated-option.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli.option('--no-clear-screen', 'Do not clear screen')
55

examples/sub-command.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli
55
.command('deploy [path]', 'Deploy to AWS')

examples/variadic-arguments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('ts-node/register')
2-
const cli = require('../src/index')()
2+
const cli = require('../src/index').cac()
33

44
cli
55
.command('build <entry> [...otherFiles]', 'Build your app')

index-compat.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const { cac, CAC, Command } = require('./dist/index')
2+
3+
// For backwards compatibility
4+
module.exports = cac
5+
6+
Object.assign(module.exports, {
7+
default: cac,
8+
cac,
9+
CAC,
10+
Command,
11+
})

0 commit comments

Comments
 (0)