1 | #! /usr/bin/env node
|
2 |
|
3 | const shell = require('shelljs')
|
4 | const { generateTestIndex } = require('../lib/story-index-generator')
|
5 | const { PACKAGE_JSON_CONFIG_KEY } = require('../lib/config')
|
6 |
|
7 | const either = generateTestIndex()
|
8 | if (either.isLeft()) {
|
9 | const error = either.left()
|
10 | shell.echo(`Error: ${error.message}`)
|
11 | if (error.code === 'ENOENT') {
|
12 | shell.echo(`Check value in package.json -> ${PACKAGE_JSON_CONFIG_KEY} -> pathToTestIndex`)
|
13 | }
|
14 | shell.exit(1)
|
15 | } else {
|
16 | shell.echo(`Story files found: ${either.right().length}`)
|
17 | shell.exit()
|
18 | }
|