-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): support programmatic API (#21)
- Loading branch information
1 parent
a3fef0c
commit 9c22a80
Showing
7 changed files
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
#!/usr/bin/env node | ||
const dir = require('../src/select-dir') | ||
|
||
const semver = require('semver') | ||
|
||
if (semver.satisfies(process.version, '>=8')) { | ||
require('../src/cli')() // eslint-disable-line global-require | ||
} else { | ||
require('../lib/cli')() // eslint-disable-line global-require | ||
} | ||
require(`../${dir}/cli`)() // eslint-disable-line import/no-dynamic-require |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ module.exports = { | |
'coverage', | ||
'release', | ||
'init', | ||
'api', | ||
]], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const dir = require('./src/select-dir') | ||
|
||
// eslint-disable-next-line import/no-dynamic-require | ||
const init = require(`./${dir}/init`) | ||
|
||
module.exports = { init } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const semver = require('semver') | ||
|
||
module.exports = semver.satisfies(process.version, '>=8') ? 'src' : 'lib' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import assert from 'assert' | ||
import main from '..' | ||
|
||
suite('main', () => { | ||
test('init', async () => { | ||
const init = main.init | ||
assert(typeof init === 'function') | ||
assert(init.name === 'init') | ||
}) | ||
}) |