Skip to content

Commit be576c2

Browse files
committed
Added flow as template
1 parent a60f457 commit be576c2

24 files changed

+396
-4
lines changed

lib/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ module.exports = async () => {
2929
defaults.manager
3030
)
3131
.option(
32-
'-t, --template <default|typescript>',
32+
'-t, --template <default|typescript|flow>',
3333
'package template to use',
34-
/^(default|typescript|custom)$/,
34+
/^(default|typescript|flow|custom)$/,
3535
defaults.template
3636
)
3737
.option('-p, --template-path <string>', 'custom package template path')

lib/prompt-library-params.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module.exports = async (opts) => {
7373
type: 'list',
7474
name: 'template',
7575
message: 'Template',
76-
choices: ['default', 'typescript', 'custom'],
76+
choices: ['default', 'typescript','flow', 'custom'],
7777
default: opts.template
7878
},
7979
{

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

template/flow/.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

template/flow/.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build/
2+
dist/
3+
node_modules/
4+
.snapshots/
5+
*.min.js

template/flow/.eslintrc

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": [
4+
"standard",
5+
"standard-react",
6+
"plugin:prettier/recommended",
7+
"prettier/standard",
8+
"prettier/react",
9+
"flowtype"
10+
],
11+
"env": {
12+
"node": true
13+
},
14+
"parserOptions": {
15+
"ecmaVersion": 2020,
16+
"ecmaFeatures": {
17+
"legacyDecorators": true,
18+
"jsx": true
19+
}
20+
},
21+
"settings": {
22+
"react": {
23+
"version": "16"
24+
}
25+
},
26+
"rules": {
27+
"space-before-function-paren": 0,
28+
"react/prop-types": 0,
29+
"react/jsx-handler-names": 0,
30+
"react/jsx-fragments": 0,
31+
"react/no-unused-prop-types": 0,
32+
"import/export": 0,
33+
"flowtype/boolean-style": [
34+
2,
35+
"boolean"
36+
],
37+
"flowtype/define-flow-type": 1,
38+
"flowtype/delimiter-dangle": [
39+
2,
40+
"never"
41+
],
42+
"flowtype/generic-spacing": [
43+
2,
44+
"never"
45+
],
46+
"flowtype/no-mixed": 2,
47+
"flowtype/no-primitive-constructor-types": 2,
48+
"flowtype/no-types-missing-file-annotation": 2,
49+
"flowtype/no-weak-types": 2,
50+
"flowtype/object-type-delimiter": [
51+
2,
52+
"comma"
53+
],
54+
"flowtype/require-parameter-type": 2,
55+
"flowtype/require-readonly-react-props": 0,
56+
"flowtype/require-return-type": [
57+
2,
58+
"always",
59+
{
60+
"annotateUndefined": "never"
61+
}
62+
],
63+
"flowtype/require-valid-file-annotation": 2,
64+
"flowtype/semi": [
65+
2,
66+
"always"
67+
],
68+
"flowtype/space-after-type-colon": [
69+
2,
70+
"always"
71+
],
72+
"flowtype/space-before-generic-bracket": [
73+
2,
74+
"never"
75+
],
76+
"flowtype/space-before-type-colon": [
77+
2,
78+
"never"
79+
],
80+
"flowtype/type-id-match": [
81+
2,
82+
"^([A-Z][a-z0-9]+)+Type$"
83+
],
84+
"flowtype/union-intersection-spacing": [
85+
2,
86+
"always"
87+
],
88+
"flowtype/use-flow-type": 1,
89+
"flowtype/valid-syntax": 1
90+
}
91+
}

template/flow/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
6+
# builds
7+
build
8+
dist
9+
10+
# misc
11+
.DS_Store
12+
.env
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

template/flow/.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"singleQuote": true,
3+
"jsxSingleQuote": true,
4+
"semi": false,
5+
"tabWidth": 2,
6+
"bracketSpacing": true,
7+
"jsxBracketSameLine": false,
8+
"arrowParens": "always",
9+
"trailingComma": "none"
10+
}

template/flow/.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
node_js:
3+
- 12
4+
- 10

template/flow/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# {{name}}
2+
3+
> {{description}}
4+
5+
[![NPM](https://img.shields.io/npm/v/{{name}}.svg)](https://www.npmjs.com/package/{{name}}) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6+
7+
## Install
8+
9+
```bash
10+
npm install --save {{name}}
11+
```
12+
13+
## Usage
14+
15+
```jsx
16+
import React, { Component } from 'react'
17+
18+
import MyComponent from '{{name}}'
19+
import '{{name}}/dist/index.css'
20+
21+
class Example extends Component {
22+
render() {
23+
return <MyComponent />
24+
}
25+
}
26+
```
27+
28+
## License
29+
30+
{{license}} © [{{author}}](https://github.com/{{author}})

0 commit comments

Comments
 (0)