first commit
This commit is contained in:
commit
1511d51edd
15
.eslintrc
Normal file
15
.eslintrc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended", "plugin:react/recommended"],
|
||||||
|
"plugins": ["react"],
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"react/prop-types": 0,
|
||||||
|
"no-unused-vars": 1
|
||||||
|
}
|
||||||
|
}
|
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.js
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
4
.prettierrc
Normal file
4
.prettierrc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
trailingComma: "es5"
|
||||||
|
tabWidth: 2
|
||||||
|
semi: false
|
||||||
|
singleQuote: true
|
33
App.js
Normal file
33
App.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import React, { Component } from 'react'
|
||||||
|
import blessed from 'blessed'
|
||||||
|
import { render } from 'react-blessed'
|
||||||
|
import { Box } from './components'
|
||||||
|
|
||||||
|
const getDefaultState = () => ({ text: 'Hello, world!' })
|
||||||
|
|
||||||
|
// Rendering a simple centered box
|
||||||
|
class App extends Component {
|
||||||
|
constructor() {
|
||||||
|
super()
|
||||||
|
this.state = getDefaultState()
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
return <Box {...this.state} />
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creating our screen
|
||||||
|
const screen = blessed.screen({
|
||||||
|
autoPadding: true,
|
||||||
|
smartCSR: true,
|
||||||
|
title: 'hello world',
|
||||||
|
})
|
||||||
|
|
||||||
|
// Adding a way to quit the program
|
||||||
|
screen.key(['escape', 'q', 'C-c'], () => {
|
||||||
|
//callback has access to ch, key
|
||||||
|
return process.exit(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Rendering the React app using our screen
|
||||||
|
render(<App />, screen)
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
- to run: `npm start`
|
||||||
|
- use `npm run dev` to use nodemon (must be installed globally)
|
||||||
|
|
||||||
|
#### todo
|
||||||
|
|
||||||
|
- chalk works for text color!
|
||||||
|
- restore terminal title after exiting ?
|
20
components/Box.js
Normal file
20
components/Box.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
const Box = props => {
|
||||||
|
const { text } = props
|
||||||
|
|
||||||
|
return (
|
||||||
|
<box
|
||||||
|
top="center"
|
||||||
|
left="center"
|
||||||
|
width="50%"
|
||||||
|
height="50%"
|
||||||
|
border={{ type: 'line' }}
|
||||||
|
style={{ border: { fg: 'blue' } }}
|
||||||
|
>
|
||||||
|
{text}
|
||||||
|
</box>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Box
|
1
components/index.js
Normal file
1
components/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { default as Box } from './Box'
|
5
index.js
Normal file
5
index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
require('@babel/register')({
|
||||||
|
presets: [['@babel/preset-env'], ['@babel/preset-react']],
|
||||||
|
})
|
||||||
|
|
||||||
|
require('./App')
|
4407
package-lock.json
generated
Normal file
4407
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
package.json
Normal file
30
package.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "react-cli",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node index.js",
|
||||||
|
"dev": "nodemon index.js",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"blessed": "^0.1.81",
|
||||||
|
"react": "^16.12.0",
|
||||||
|
"react-blessed": "^0.6.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.7.2",
|
||||||
|
"@babel/preset-env": "^7.7.1",
|
||||||
|
"@babel/preset-react": "^7.7.0",
|
||||||
|
"@babel/register": "^7.7.0",
|
||||||
|
"babel-eslint": "^10.0.3",
|
||||||
|
"eslint": "^6.6.0",
|
||||||
|
"eslint-plugin-react": "^7.16.0",
|
||||||
|
"react-devtools": "^4.2.0",
|
||||||
|
"ws": "^7.2.0"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user