Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #334 from chromaui/check-package-json
Check existence and validity of package.json
- Loading branch information
Showing
7 changed files
with
53 additions
and
10 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
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,11 @@ | ||
import chalk from 'chalk'; | ||
import dedent from 'ts-dedent'; | ||
|
||
import { error } from '../../components/icons'; | ||
|
||
export default (packagePath) => | ||
dedent(chalk` | ||
${error} {bold Invalid package.json} | ||
Found invalid package.json at {bold ${packagePath}} | ||
Make sure this is a valid Node.js package file, is readable, and contains a {bold "scripts"} block. | ||
`); |
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,7 @@ | ||
import invalidPackageJson from './invalidPackageJson'; | ||
|
||
export default { | ||
title: 'CLI/Messages/Errors', | ||
}; | ||
|
||
export const InvalidPackageJson = () => invalidPackageJson('/path/to/package.json'); |
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,12 @@ | ||
import chalk from 'chalk'; | ||
import dedent from 'ts-dedent'; | ||
|
||
import { error } from '../../components/icons'; | ||
|
||
export default () => | ||
dedent(chalk` | ||
${error} {bold No package.json found} | ||
Chromatic only works from inside a JavaScript project. | ||
We expected to find a package.json somewhere up the directory tree. | ||
Are you sure you're running from your project directory? | ||
`); |
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,7 @@ | ||
import noPackageJson from './noPackageJson'; | ||
|
||
export default { | ||
title: 'CLI/Messages/Errors', | ||
}; | ||
|
||
export const NoPackageJson = () => noPackageJson(); |