create-enchilada 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/index.js +123 -0
- package/index.js +3 -0
- package/package.json +79 -0
- package/templates/node-express/.prettierrc.json +9 -0
- package/templates/node-express/.sequelizerc +6 -0
- package/templates/node-express/env-example +8 -0
- package/templates/node-express/eslint.config.mjs +15 -0
- package/templates/node-express/jest.config.js +13 -0
- package/templates/node-express/jest.config.unit.js +17 -0
- package/templates/node-express/package.json +47 -0
- package/templates/node-express/src/auth/index.js +1 -0
- package/templates/node-express/src/config/index.js +13 -0
- package/templates/node-express/src/db/index.js +16 -0
- package/templates/node-express/src/dtos/index.js +1 -0
- package/templates/node-express/src/index.js +24 -0
- package/templates/node-express/src/libs/sequelize.js +23 -0
- package/templates/node-express/src/middlewares/index.js +1 -0
- package/templates/node-express/src/routes/index.js +1 -0
- package/templates/node-express/src/services/index.js +1 -0
- package/templates/node-express/unit/fake.unit.test.js +5 -0
- package/templates/react/_gitignore +89 -0
- package/templates/react/index.html +13 -0
- package/templates/react/package.json +21 -0
- package/templates/react/src/App.css +3 -0
- package/templates/react/src/App.jsx +19 -0
- package/templates/react/src/index.css +57 -0
- package/templates/react/src/main.jsx +10 -0
- package/templates/react/vite.config.js +7 -0
- package/templates/react-dev/.babelrc +7 -0
- package/templates/react-dev/__tests__/App.test.jsx +9 -0
- package/templates/react-dev/_gitignore +89 -0
- package/templates/react-dev/eslint.config.js +27 -0
- package/templates/react-dev/index.html +13 -0
- package/templates/react-dev/jest.config.cjs +13 -0
- package/templates/react-dev/jest.setup.js +1 -0
- package/templates/react-dev/package.json +41 -0
- package/templates/react-dev/postcss.config.mjs +5 -0
- package/templates/react-dev/src/App.jsx +22 -0
- package/templates/react-dev/src/index.css +1 -0
- package/templates/react-dev/src/main.jsx +10 -0
- package/templates/react-dev/vite.config.js +7 -0
- package/templates/react-dev-typescript/.babelrc +11 -0
- package/templates/react-dev-typescript/__tests__/App.test.tsx +11 -0
- package/templates/react-dev-typescript/_gitignore +89 -0
- package/templates/react-dev-typescript/eslint.config.js +29 -0
- package/templates/react-dev-typescript/index.html +13 -0
- package/templates/react-dev-typescript/jest.config.cjs +13 -0
- package/templates/react-dev-typescript/jest.setup.js +1 -0
- package/templates/react-dev-typescript/package.json +44 -0
- package/templates/react-dev-typescript/postcss.config.mjs +5 -0
- package/templates/react-dev-typescript/src/App.tsx +21 -0
- package/templates/react-dev-typescript/src/index.css +1 -0
- package/templates/react-dev-typescript/src/main.tsx +10 -0
- package/templates/react-dev-typescript/src/vite-env.d.ts +1 -0
- package/templates/react-dev-typescript/tsconfig.app.json +27 -0
- package/templates/react-dev-typescript/tsconfig.json +11 -0
- package/templates/react-dev-typescript/tsconfig.node.json +13 -0
- package/templates/react-dev-typescript/vite.config.ts +7 -0
- package/templates/react-dev-webpack/.babelrc +7 -0
- package/templates/react-dev-webpack/__tests__/App.test.jsx +9 -0
- package/templates/react-dev-webpack/_gitignore +89 -0
- package/templates/react-dev-webpack/eslint.config.js +27 -0
- package/templates/react-dev-webpack/index.html +13 -0
- package/templates/react-dev-webpack/jest.config.cjs +13 -0
- package/templates/react-dev-webpack/jest.setup.js +1 -0
- package/templates/react-dev-webpack/package.json +45 -0
- package/templates/react-dev-webpack/postcss.config.mjs +5 -0
- package/templates/react-dev-webpack/src/App.jsx +22 -0
- package/templates/react-dev-webpack/src/index.css +1 -0
- package/templates/react-dev-webpack/src/main.jsx +10 -0
- package/templates/react-dev-webpack/webpack.config.cjs +43 -0
- package/templates/react-experimental/_gitignore +89 -0
- package/templates/react-experimental/farm.config.ts +5 -0
- package/templates/react-experimental/index.html +12 -0
- package/templates/react-experimental/oxlintrc.json +12 -0
- package/templates/react-experimental/package.json +28 -0
- package/templates/react-experimental/src/App.css +3 -0
- package/templates/react-experimental/src/App.jsx +20 -0
- package/templates/react-experimental/src/index.css +57 -0
- package/templates/react-experimental/src/main.jsx +10 -0
- package/templates/react-experimental/tsconfig.json +25 -0
- package/templates/react-experimental/tsconfig.node.json +11 -0
- package/templates/react-typescript/_gitignore +89 -0
- package/templates/react-typescript/eslint.config.js +26 -0
- package/templates/react-typescript/index.html +13 -0
- package/templates/react-typescript/package.json +29 -0
- package/templates/react-typescript/src/App.css +3 -0
- package/templates/react-typescript/src/App.tsx +18 -0
- package/templates/react-typescript/src/index.css +57 -0
- package/templates/react-typescript/src/main.tsx +10 -0
- package/templates/react-typescript/src/vite-env.d.ts +1 -0
- package/templates/react-typescript/tsconfig.app.json +27 -0
- package/templates/react-typescript/tsconfig.json +11 -0
- package/templates/react-typescript/tsconfig.node.json +13 -0
- package/templates/react-typescript/vite.config.ts +7 -0
- package/templates/react-webpack/.babelrc +6 -0
- package/templates/react-webpack/_gitignore +89 -0
- package/templates/react-webpack/index.html +13 -0
- package/templates/react-webpack/package.json +25 -0
- package/templates/react-webpack/src/App.css +3 -0
- package/templates/react-webpack/src/App.jsx +19 -0
- package/templates/react-webpack/src/index.css +57 -0
- package/templates/react-webpack/src/main.jsx +10 -0
- package/templates/react-webpack/webpack.config.js +43 -0
- package/templates/vanilla-js/_gitignore +89 -0
- package/templates/vanilla-js/index.html +17 -0
- package/templates/vanilla-js/index.js +11 -0
- package/templates/vanilla-js/package.json +14 -0
- package/templates/vanilla-js/style.css +60 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// For migrations, models and seeders. Also db connection.
|
|
2
|
+
const config = require('../config');
|
|
3
|
+
|
|
4
|
+
const USER = encodeURIComponent(config.dbUser);
|
|
5
|
+
const PASSWORD = encodeURIComponent(config.dbPassword);
|
|
6
|
+
const getURI = (dialect) => `${dialect}://${USER}:${PASSWORD}@${config.dbHost}:${config.dbPort}/${config.dbName}`;
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
url: getURI('mysql'),
|
|
10
|
+
dialect: 'mysql',
|
|
11
|
+
dialectOptions: {
|
|
12
|
+
ssl: {
|
|
13
|
+
rejectUnauthorized: false,
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Your DTOs or Schemas.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const cors = require('cors');
|
|
3
|
+
|
|
4
|
+
const router = express.Router();
|
|
5
|
+
const PORT = process.env.PORT || 3000;
|
|
6
|
+
|
|
7
|
+
router.get('/', async (req, res) => {
|
|
8
|
+
res.send('Hello World!');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const createApp = () => {
|
|
12
|
+
const app = express();
|
|
13
|
+
app.use(express.json());
|
|
14
|
+
app.use(cors());
|
|
15
|
+
app.use(router);
|
|
16
|
+
|
|
17
|
+
return app;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const app = createApp();
|
|
21
|
+
|
|
22
|
+
app.listen(PORT, () => {
|
|
23
|
+
console.log(`Server running at http://localhost:${PORT}`);
|
|
24
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Some libs as ORM config.
|
|
2
|
+
const { Sequelize } = require('sequelize');
|
|
3
|
+
const config = require('../config');
|
|
4
|
+
// const setupModels = require('../db/models');
|
|
5
|
+
|
|
6
|
+
const USER = encodeURIComponent(config.dbUser);
|
|
7
|
+
const PASSWORD = encodeURIComponent(config.dbPassword);
|
|
8
|
+
const getURI = (dialect) => `${dialect}://${USER}:${PASSWORD}@${config.dbHost}:${config.dbPort}/${config.dbName}`;
|
|
9
|
+
|
|
10
|
+
const dialect = 'mysql';
|
|
11
|
+
const sequelize = new Sequelize(getURI(dialect), {
|
|
12
|
+
dialect,
|
|
13
|
+
dialectOptions: {
|
|
14
|
+
ssl: {
|
|
15
|
+
rejectUnauthorized: false,
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
logging: false,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// setupModels(sequelize);
|
|
22
|
+
|
|
23
|
+
module.exports = sequelize;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Handlers for errors, auth and validations.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Your endpoints.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Your services.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# compiled output
|
|
2
|
+
/dist
|
|
3
|
+
/tmp
|
|
4
|
+
/out-tsc
|
|
5
|
+
|
|
6
|
+
# Runtime data
|
|
7
|
+
pids
|
|
8
|
+
*.pid
|
|
9
|
+
*.seed
|
|
10
|
+
*.pid.lock
|
|
11
|
+
|
|
12
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
13
|
+
lib-cov
|
|
14
|
+
|
|
15
|
+
# Coverage directory used by tools like istanbul
|
|
16
|
+
coverage
|
|
17
|
+
|
|
18
|
+
# nyc test coverage
|
|
19
|
+
.nyc_output
|
|
20
|
+
|
|
21
|
+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
22
|
+
.grunt
|
|
23
|
+
|
|
24
|
+
# Bower dependency directory (https://bower.io/)
|
|
25
|
+
bower_components
|
|
26
|
+
|
|
27
|
+
# node-waf configuration
|
|
28
|
+
.lock-wscript
|
|
29
|
+
|
|
30
|
+
# IDEs and editors
|
|
31
|
+
.idea
|
|
32
|
+
.project
|
|
33
|
+
.classpath
|
|
34
|
+
.c9/
|
|
35
|
+
*.launch
|
|
36
|
+
.settings/
|
|
37
|
+
*.sublime-workspace
|
|
38
|
+
|
|
39
|
+
# IDE - VSCode
|
|
40
|
+
.vscode/*
|
|
41
|
+
!.vscode/settings.json
|
|
42
|
+
!.vscode/tasks.json
|
|
43
|
+
!.vscode/launch.json
|
|
44
|
+
!.vscode/extensions.json
|
|
45
|
+
|
|
46
|
+
# misc
|
|
47
|
+
.sass-cache
|
|
48
|
+
connect.lock
|
|
49
|
+
typings
|
|
50
|
+
|
|
51
|
+
# Logs
|
|
52
|
+
logs
|
|
53
|
+
*.log
|
|
54
|
+
npm-debug.log*
|
|
55
|
+
yarn-debug.log*
|
|
56
|
+
yarn-error.log*
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# Dependency directories
|
|
60
|
+
node_modules/
|
|
61
|
+
jspm_packages/
|
|
62
|
+
|
|
63
|
+
# Optional npm cache directory
|
|
64
|
+
.npm
|
|
65
|
+
|
|
66
|
+
# Optional eslint cache
|
|
67
|
+
.eslintcache
|
|
68
|
+
|
|
69
|
+
# Optional REPL history
|
|
70
|
+
.node_repl_history
|
|
71
|
+
|
|
72
|
+
# Output of 'npm pack'
|
|
73
|
+
*.tgz
|
|
74
|
+
|
|
75
|
+
# Yarn Integrity file
|
|
76
|
+
.yarn-integrity
|
|
77
|
+
|
|
78
|
+
# dotenv environment variables file
|
|
79
|
+
.env
|
|
80
|
+
|
|
81
|
+
# next.js build output
|
|
82
|
+
.next
|
|
83
|
+
|
|
84
|
+
# Lerna
|
|
85
|
+
lerna-debug.log
|
|
86
|
+
|
|
87
|
+
# System Files
|
|
88
|
+
.DS_Store
|
|
89
|
+
Thumbs.db
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="#" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>React App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"react": "^19.1.0",
|
|
13
|
+
"react-dom": "^19.1.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/react": "^19.1.2",
|
|
17
|
+
"@types/react-dom": "^19.1.2",
|
|
18
|
+
"@vitejs/plugin-react-oxc": "^0.2.2",
|
|
19
|
+
"vite": "npm:rolldown-vite@latest"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import './App.css'
|
|
3
|
+
|
|
4
|
+
function App() {
|
|
5
|
+
const [count, setCount] = useState(0)
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<h1>React</h1>
|
|
10
|
+
<div className="card">
|
|
11
|
+
<button onClick={() => setCount((count) => count + 1)}>
|
|
12
|
+
count is {count}
|
|
13
|
+
</button>
|
|
14
|
+
</div>
|
|
15
|
+
</>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default App
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
|
+
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
body {
|
|
16
|
+
margin: 0;
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
place-items: center;
|
|
20
|
+
min-width: 320px;
|
|
21
|
+
min-height: 100vh;
|
|
22
|
+
}
|
|
23
|
+
h1 {
|
|
24
|
+
font-size: 3.2em;
|
|
25
|
+
line-height: 1.1;
|
|
26
|
+
text-align: center;
|
|
27
|
+
}
|
|
28
|
+
button {
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
border: 1px solid transparent;
|
|
31
|
+
padding: 0.6em 1.2em;
|
|
32
|
+
font-size: 1em;
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
font-family: inherit;
|
|
35
|
+
background-color: #1a1a1a;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transition: border-color 0.25s;
|
|
38
|
+
}
|
|
39
|
+
button:hover {
|
|
40
|
+
border-color: #646cff;
|
|
41
|
+
}
|
|
42
|
+
button:focus,
|
|
43
|
+
button:focus-visible {
|
|
44
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
45
|
+
}
|
|
46
|
+
@media (prefers-color-scheme: light) {
|
|
47
|
+
:root {
|
|
48
|
+
color: #213547;
|
|
49
|
+
background-color: #ffffff;
|
|
50
|
+
}
|
|
51
|
+
a:hover {
|
|
52
|
+
color: #747bff;
|
|
53
|
+
}
|
|
54
|
+
button {
|
|
55
|
+
background-color: #f9f9f9;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import App from '../src/App';
|
|
4
|
+
|
|
5
|
+
test('App component render', async () => {
|
|
6
|
+
render(<App />);
|
|
7
|
+
|
|
8
|
+
expect(screen.getByRole('button')).toHaveTextContent('count');
|
|
9
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# compiled output
|
|
2
|
+
/dist
|
|
3
|
+
/tmp
|
|
4
|
+
/out-tsc
|
|
5
|
+
|
|
6
|
+
# Runtime data
|
|
7
|
+
pids
|
|
8
|
+
*.pid
|
|
9
|
+
*.seed
|
|
10
|
+
*.pid.lock
|
|
11
|
+
|
|
12
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
13
|
+
lib-cov
|
|
14
|
+
|
|
15
|
+
# Coverage directory used by tools like istanbul
|
|
16
|
+
coverage
|
|
17
|
+
|
|
18
|
+
# nyc test coverage
|
|
19
|
+
.nyc_output
|
|
20
|
+
|
|
21
|
+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
22
|
+
.grunt
|
|
23
|
+
|
|
24
|
+
# Bower dependency directory (https://bower.io/)
|
|
25
|
+
bower_components
|
|
26
|
+
|
|
27
|
+
# node-waf configuration
|
|
28
|
+
.lock-wscript
|
|
29
|
+
|
|
30
|
+
# IDEs and editors
|
|
31
|
+
.idea
|
|
32
|
+
.project
|
|
33
|
+
.classpath
|
|
34
|
+
.c9/
|
|
35
|
+
*.launch
|
|
36
|
+
.settings/
|
|
37
|
+
*.sublime-workspace
|
|
38
|
+
|
|
39
|
+
# IDE - VSCode
|
|
40
|
+
.vscode/*
|
|
41
|
+
!.vscode/settings.json
|
|
42
|
+
!.vscode/tasks.json
|
|
43
|
+
!.vscode/launch.json
|
|
44
|
+
!.vscode/extensions.json
|
|
45
|
+
|
|
46
|
+
# misc
|
|
47
|
+
.sass-cache
|
|
48
|
+
connect.lock
|
|
49
|
+
typings
|
|
50
|
+
|
|
51
|
+
# Logs
|
|
52
|
+
logs
|
|
53
|
+
*.log
|
|
54
|
+
npm-debug.log*
|
|
55
|
+
yarn-debug.log*
|
|
56
|
+
yarn-error.log*
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# Dependency directories
|
|
60
|
+
node_modules/
|
|
61
|
+
jspm_packages/
|
|
62
|
+
|
|
63
|
+
# Optional npm cache directory
|
|
64
|
+
.npm
|
|
65
|
+
|
|
66
|
+
# Optional eslint cache
|
|
67
|
+
.eslintcache
|
|
68
|
+
|
|
69
|
+
# Optional REPL history
|
|
70
|
+
.node_repl_history
|
|
71
|
+
|
|
72
|
+
# Output of 'npm pack'
|
|
73
|
+
*.tgz
|
|
74
|
+
|
|
75
|
+
# Yarn Integrity file
|
|
76
|
+
.yarn-integrity
|
|
77
|
+
|
|
78
|
+
# dotenv environment variables file
|
|
79
|
+
.env
|
|
80
|
+
|
|
81
|
+
# next.js build output
|
|
82
|
+
.next
|
|
83
|
+
|
|
84
|
+
# Lerna
|
|
85
|
+
lerna-debug.log
|
|
86
|
+
|
|
87
|
+
# System Files
|
|
88
|
+
.DS_Store
|
|
89
|
+
Thumbs.db
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import pluginReact from "eslint-plugin-react";
|
|
4
|
+
import pluginJest from 'eslint-plugin-jest';
|
|
5
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
6
|
+
|
|
7
|
+
export default defineConfig([
|
|
8
|
+
{ plugins: { jest: pluginJest }, },
|
|
9
|
+
{ files: ["**/*.{js,mjs,cjs,jsx}"], plugins: { js }, extends: ["js/recommended"] },
|
|
10
|
+
{ files: ["**/*.{js,mjs,cjs,jsx}"], languageOptions: { globals: { ...globals.browser, ...globals.jest } } },
|
|
11
|
+
pluginReact.configs.flat.recommended,
|
|
12
|
+
{
|
|
13
|
+
rules: {
|
|
14
|
+
...pluginJest.configs.recommended.rules,
|
|
15
|
+
"react/react-in-jsx-scope": 0,
|
|
16
|
+
"react/jsx-uses-react": 0
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
settings: {
|
|
21
|
+
react: {
|
|
22
|
+
version: "detect",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
globalIgnores(["**/coverage/**", "**/dist/**"]),
|
|
27
|
+
]);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="#" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>React TailwindCSS ESlint React Testing Library</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @type {import('jest').Config} */
|
|
2
|
+
const config = {
|
|
3
|
+
verbose: true,
|
|
4
|
+
transform: {"\\.[jt]sx?$": "babel-jest"},
|
|
5
|
+
collectCoverage: true,
|
|
6
|
+
collectCoverageFrom: ['src/**/*.{js,jsx}'],
|
|
7
|
+
coverageDirectory: 'coverage',
|
|
8
|
+
testEnvironment: 'jest-environment-jsdom',
|
|
9
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
10
|
+
testMatch: ['**/__tests__/**/?(*.)+(spec|test).[j]s?(x)']
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
module.exports = config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-dev",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"lint": "eslint .",
|
|
11
|
+
"test": "jest",
|
|
12
|
+
"coverage": "jest --coverage"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"react": "^19.1.0",
|
|
16
|
+
"react-dom": "^19.1.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
20
|
+
"@babel/preset-env": "^7.24.7",
|
|
21
|
+
"@babel/preset-react": "^7.24.7",
|
|
22
|
+
"@eslint/js": "^9.26.0",
|
|
23
|
+
"@tailwindcss/postcss": "^4.1.5",
|
|
24
|
+
"@testing-library/dom": "^10.1.0",
|
|
25
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
26
|
+
"@testing-library/react": "^16.0.0",
|
|
27
|
+
"@types/react": "^19.1.2",
|
|
28
|
+
"@types/react-dom": "^19.1.3",
|
|
29
|
+
"@vitejs/plugin-react-oxc": "^0.2.2",
|
|
30
|
+
"babel-jest": "^30.0.0",
|
|
31
|
+
"eslint": "^9.26.0",
|
|
32
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
33
|
+
"eslint-plugin-react": "^7.37.5",
|
|
34
|
+
"globals": "^15.15.0",
|
|
35
|
+
"jest": "^30.0.0",
|
|
36
|
+
"jest-environment-jsdom": "^30.0.0",
|
|
37
|
+
"postcss": "^8.5.3",
|
|
38
|
+
"tailwindcss": "^4.1.5",
|
|
39
|
+
"vite": "npm:rolldown-vite@latest"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
function App() {
|
|
4
|
+
const [count, setCount] = useState(0);
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div className="flex flex-col justify-center items-center h-screen bg-neutral-800">
|
|
8
|
+
<h1 className="text-5xl text-blue-400 text-center">React</h1>
|
|
9
|
+
<div className="p-8">
|
|
10
|
+
<button
|
|
11
|
+
className="bg-slate-950 px-4 py-2 rounded-lg text-slate-200"
|
|
12
|
+
onClick={() => setCount((counter) => counter + 1)}
|
|
13
|
+
type="button"
|
|
14
|
+
>
|
|
15
|
+
{`count is ${count}`}
|
|
16
|
+
</button>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
|
|
5
|
+
import App from '../src/App';
|
|
6
|
+
|
|
7
|
+
test('App component render', async () => {
|
|
8
|
+
render(<App />);
|
|
9
|
+
|
|
10
|
+
expect(screen.getByRole('button')).toHaveTextContent('count');
|
|
11
|
+
});
|