Skip to content

Commit f153f61

Browse files
authored
fix: argv is callable (#535)
Fixes a simple syntax error in `eject` where `argv` is not being called
1 parent 6df5802 commit f153f61

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

eject.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function eject (dir, template) {
1919
}
2020

2121
function cli (args) {
22-
const opts = argv[args]
22+
const opts = argv(args)
2323

2424
let template
2525
if (opts.lang === 'ts' || opts.lang === 'typescript') {
@@ -28,7 +28,7 @@ function cli (args) {
2828
template = 'eject'
2929
}
3030

31-
eject(process.cwd(), template).catch(function (err) {
31+
return eject(process.cwd(), template).catch(function (err) {
3232
if (err) {
3333
log('error', err.message)
3434
process.exit(1)

test/eject-ts.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const rimraf = require('rimraf')
1111
const walker = require('walker')
1212
const workdir = path.join(__dirname, 'workdir')
1313
const appTemplateDir = path.join(__dirname, '..', 'templates', 'eject-ts')
14-
const { eject } = require('../eject')
14+
const { eject, cli } = require('../eject')
1515
const expected = {};
1616

1717
(function (cb) {
@@ -63,6 +63,16 @@ function define (t) {
6363
}
6464
})
6565

66+
test('should finish successfully with cli', async (t) => {
67+
try {
68+
process.chdir(workdir)
69+
await cli(['--lang=typescript'])
70+
await verifyCopy(t, expected)
71+
} catch (err) {
72+
t.error(err)
73+
}
74+
})
75+
6676
function verifyCopy (t, expected) {
6777
return new Promise((resolve, reject) => {
6878
let count = 0

0 commit comments

Comments
 (0)