-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e59275
commit e122fb2
Showing
6 changed files
with
234 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Plopfile generator | ||
* | ||
* https://github.com/amwmedia/plop | ||
*/ | ||
|
||
module.exports = plop => { | ||
plop.setGenerator('component', { | ||
prompts: [ | ||
{ | ||
type: 'input', | ||
name: 'name', | ||
message: 'Component name?', | ||
validate: value => /.+/.test(value) ? true : 'name is required' | ||
} | ||
], | ||
actions: data => { | ||
return [ | ||
{ | ||
type: 'add', | ||
path: 'src/components/{{pascalCase name}}.tsx', | ||
templateFile: 'templates/component.tsx' | ||
}, | ||
{ | ||
type: 'add', | ||
path: 'src/components/{{pascalCase name}}.test.tsx', | ||
templateFile: 'templates/component.test.tsx' | ||
} | ||
]; | ||
} | ||
}); | ||
}; |
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 { shallow } from "enzyme"; | ||
import "jest"; | ||
import * as React from "react"; | ||
import {{pascalCase name}} from "./{{pascalCase name}}"; | ||
|
||
describe("{{pascalCase name}} component", () => { | ||
it("should have the correct text", () => { | ||
const {{name}} = shallow(<{{pascalCase name}} />); | ||
expect({{name}}.text()).toBe("My awesome component"); | ||
}); | ||
}); |
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 * as React from "react"; | ||
|
||
interface {{pascalCase name}}Props extends React.HTMLProps<HTMLDivElement> { | ||
|
||
} | ||
|
||
export default (props: {{pascalCase name}}Props) => { | ||
return ( | ||
<div>My awesome component</div> | ||
); | ||
}; |
Oops, something went wrong.