Skip to content

Commit 96e7556

Browse files
author
Samer Buna
committed
TS and multiple templates
1 parent bc58c5e commit 96e7556

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+12215
-4016
lines changed

.eslintrc.js

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,29 @@
11
module.exports = {
2-
parser: 'babel-eslint',
2+
parser: '@typescript-eslint/parser',
33
env: {
44
browser: true,
55
commonjs: true,
66
es6: true,
77
node: true,
88
jest: true,
99
},
10-
extends: [
11-
'eslint:recommended',
12-
'plugin:react/recommended',
13-
'plugin:react-hooks/recommended',
14-
],
15-
settings: {
16-
react: {
17-
version: 'detect',
18-
},
19-
},
2010
parserOptions: {
11+
ecmaVersion: 2020,
2112
ecmaFeatures: {
2213
jsx: true,
2314
},
2415
sourceType: 'module',
2516
},
26-
plugins: ['react', 'react-hooks'],
27-
rules: {
28-
'react/prop-types': ['off'],
29-
'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }],
30-
'no-console': ['warn', { allow: ['info', 'error'] }],
31-
'curly': 'error',
32-
'no-else-return': 'error',
33-
'no-unneeded-ternary': 'error',
34-
'no-useless-return': 'error',
35-
'no-var': 'error',
36-
'one-var': ['error', 'never'],
37-
'prefer-const': 'error',
38-
'strict': 'error',
39-
'symbol-description': 'error',
40-
'yoda': ['error', 'never', { exceptRange: true }],
17+
settings: {
18+
react: {
19+
version: '16.x',
20+
},
4121
},
22+
plugins: ['react-hooks', 'react'],
23+
extends: [
24+
'eslint:recommended',
25+
'plugin:@typescript-eslint/recommended',
26+
'plugin:react/recommended',
27+
],
28+
rules: {},
4229
};

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
node_modules/
2-
lerna-debug.log
1+
lib/
2+
node_modules
3+
yarn-error.log
4+
.DS_Store
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
src/
12
node_modules
23
.DS_Store

README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
## Reactful
2+
3+
An opinionated practical CLI for developing full-stack server-rendered React applications. You can use it to generate an independent React application (optionally with TypeScript) that's fully-configured to render on both client and server. You can also use it to render simple template applications (without SSR).
4+
5+
[![npm version](https://badge.fury.io/js/reactful.svg)](https://badge.fury.io/js/reactful)
6+
7+
This CLI requires Node >= 10.x.
8+
9+
### Creating New App
10+
11+
```sh
12+
npx reactful create my-awesome-react-app
13+
```
14+
15+
This will create a new reactful project using the default template (webpack, babel, express, with support for SSR).
16+
17+
You can also use a few different templates using:
18+
19+
```sh
20+
npx reactful create -t <template_name> my-awesome-react-app
21+
```
22+
23+
Supported templates:
24+
25+
- **default**: A babel-based configuration (with support for SSR and production buid)
26+
- **typescript**: A typescript-based configuration (with support for SSR and production build)
27+
- **simple**: A simple Parcel-based configuration (no SSR, no production config)
28+
29+
Once a project is created you can use the "start" command to start it in development mode:
30+
31+
```sh
32+
cd my-awesome-react-app
33+
34+
# To start the dev server and dev bundler watchers
35+
npx reactful start
36+
```
37+
38+
On the "default" and "typescript" templates, the "start" command will run 2 commands concurrently, you can also run them separately with:
39+
40+
```sh
41+
npx reactful dev:server # runs on port 1234 by default
42+
43+
npx reactful dev:bundler # this will re-bundle on save
44+
```
45+
46+
To run all the tests:
47+
48+
```sh
49+
npx reactful test
50+
```
51+
52+
To build and start the app in production:
53+
54+
```sh
55+
npx reactful build:all
56+
57+
npx reactful prod:start
58+
```
59+
60+
If you keep the folder structure initialized by the package, you can use reactful to generate component files. For example:
61+
62+
```sh
63+
npx reactful gc ComponentName # Create a new function component
64+
npx reactful gcc ComponentName # Create a new class component
65+
```
66+
67+
These commands will also create a jest snapshot test for the generated component.
68+
69+
### Updating Existing React App
70+
71+
While in a React application that's created with this tool, you can always revert things back to the default configurations with the `init` command. You can also use this command in an empty directory.
72+
73+
```sh
74+
cd my-awesome-react-app
75+
npx reactful init
76+
```
77+
78+
If that directory already has files, reactful will ask you if you want to override them.
79+
80+
### License
81+
82+
Reactful is [MIT licensed](./LICENSE).

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
};

lerna.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

package.json

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
{
2-
"private": true,
2+
"name": "reactful",
3+
"version": "3.0.0",
4+
"description": "An opinionated practical CLI for developing full-stack server-rendered React applications. You can use it to generate an independent React application (optionally with TypeScript) that's fully-configured to render on both client and server. You can also use it to render simple template applications (without SSR).",
5+
"repository": "jscomplete/reactful",
6+
"author": "Samer Buna <[email protected]>",
37
"license": "MIT",
8+
"scripts": {
9+
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
10+
"format": "prettier --write src/ \"*.{ts,tsx,js,json}\"",
11+
"test": "jest",
12+
"build": "rm -rf lib && tsc --sourceMap false --skipLibCheck true"
13+
},
14+
"bin": {
15+
"reactful": "lib/bin/reactful.js"
16+
},
17+
"dependencies": {
18+
"commander": "^5.1.0",
19+
"fs-jetpack": "^2.4.0",
20+
"prompt-sync": "^4.2.0"
21+
},
422
"devDependencies": {
5-
"babel-eslint": "10.1.0",
6-
"eslint": "^6.8.0",
7-
"eslint-plugin-react": "^7.19.0",
8-
"eslint-plugin-react-hooks": "^3.0.0",
9-
"lerna": "^3.20.2",
10-
"prettier": "^2.0.4"
23+
"@types/jest": "^25.2.3",
24+
"@typescript-eslint/eslint-plugin": "^3.1.0",
25+
"@typescript-eslint/parser": "^3.1.0",
26+
"eslint": "^7.2.0",
27+
"eslint-plugin-react": "^7.20.0",
28+
"eslint-plugin-react-hooks": "^4.0.4",
29+
"jest": "^26.0.1",
30+
"prettier": "^2.0.5",
31+
"ts-jest": "^26.1.0",
32+
"ts-node": "^8.10.2",
33+
"ts-node-dev": "^1.0.0-pre.44",
34+
"typescript": "^3.9.5",
35+
"typesync": "^0.7.0"
1136
}
1237
}

packages/reactful/LICENSE

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/reactful/README.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)