Skip to content

Commit a0c17df

Browse files
Merge pull request transitive-bullshit#253 from psyycker/master
2 parents a60f457 + cbe54de commit a0c17df

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}})

template/flow/example/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This example was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
It is linked to the {{name}} package in the parent directory for development purposes.
4+
5+
You can run `{{manager}} install` and then `{{manager}} start` to test your package.

template/flow/example/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "{{name}}-example",
3+
"homepage": ".",
4+
"version": "0.0.0",
5+
"private": true,
6+
"scripts": {
7+
"start": "node ../node_modules/react-scripts/bin/react-scripts.js start",
8+
"build": "node ../node_modules/react-scripts/bin/react-scripts.js build",
9+
"test": "node ../node_modules/react-scripts/bin/react-scripts.js test",
10+
"eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject"
11+
},
12+
"dependencies": {
13+
"react": "{{#if yarn}}link:..{{else}}file:..{{/if}}/node_modules/react",
14+
"react-dom": "{{#if yarn}}link:..{{else}}file:..{{/if}}/node_modules/react-dom",
15+
"react-scripts": "{{#if yarn}}link:..{{else}}file:..{{/if}}/node_modules/react-scripts",
16+
"{{name}}": "{{#if yarn}}link:..{{else}}file:..{{/if}}"
17+
},
18+
"devDependencies": {
19+
"@babel/plugin-syntax-object-rest-spread": "^7.8.3"
20+
},
21+
"eslintConfig": {
22+
"extends": "react-app"
23+
},
24+
"browserslist": [
25+
">0.2%",
26+
"not dead",
27+
"not ie <= 11",
28+
"not op_mini all"
29+
]
30+
}
3.78 KB
Binary file not shown.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta
7+
name="viewport"
8+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
9+
/>
10+
<meta name="theme-color" content="#000000" />
11+
12+
<!--
13+
manifest.json provides metadata used when your web app is added to the
14+
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
15+
-->
16+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
17+
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>{{name}}</title>
28+
</head>
29+
30+
<body>
31+
<noscript>
32+
You need to enable JavaScript to run this app.
33+
</noscript>
34+
35+
<div id="root"></div>
36+
37+
<!--
38+
This HTML file is a template.
39+
If you open it directly in the browser, you will see an empty page.
40+
41+
You can add webfonts, meta tags, or analytics to this file.
42+
The build step will place the bundled scripts into the <body> tag.
43+
44+
To begin the development, run `npm start` or `yarn start`.
45+
To create a production bundle, use `npm run build` or `yarn build`.
46+
-->
47+
</body>
48+
</html>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "{{name}}",
3+
"name": "{{name}}",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

template/flow/example/src/App.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react'
2+
3+
import { ExampleComponent } from '{{name}}'
4+
import '{{name}}/dist/index.css'
5+
6+
const App = () => {
7+
return <ExampleComponent text="Create React Library Example 😄" />
8+
}
9+
10+
export default App

template/flow/example/src/App.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
import App from './App'
4+
5+
it('renders without crashing', () => {
6+
const div = document.createElement('div')
7+
ReactDOM.render(<App />, div)
8+
ReactDOM.unmountComponentAtNode(div)
9+
})

template/flow/example/src/index.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
5+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
6+
sans-serif;
7+
-webkit-font-smoothing: antialiased;
8+
-moz-osx-font-smoothing: grayscale;
9+
}
10+
11+
code {
12+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
13+
monospace;
14+
}

template/flow/example/src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import './index.css'
2+
3+
import React from 'react'
4+
import ReactDOM from 'react-dom'
5+
import App from './App'
6+
7+
ReactDOM.render(<App />, document.getElementById('root'))

0 commit comments

Comments
 (0)