Skip to content

Commit ba519d8

Browse files
author
Tom Softreck
committed
Release version 0.3.1
### Added - Changes in .version - Changes in AUTHORS.txt - Changes in CLASSIFIERS.txt - Changes in SCRIPTS.txt - Changes in increment_init.py - Changes in increment_project.py - Changes in increment_setup.py - Changes in increment_version.py - Changes in upgrade.sh - Changes in version.sh
1 parent e6f8216 commit ba519d8

4 files changed

Lines changed: 60 additions & 15 deletions

File tree

MyComponent.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React, { useState } from 'react';
2+
3+
const MyComponent = () => {
4+
const [count, setCount] = useState(0);
5+
const [isVisible, setIsVisible] = useState(true);
6+
7+
const handleIncrement = () => {
8+
setCount(prevCount => prevCount + 1);
9+
};
10+
11+
const toggleVisibility = () => {
12+
setIsVisible(prev => !prev);
13+
};
14+
15+
return (
16+
<div className="my-component">
17+
<h2>My Example Component</h2>
18+
19+
{isVisible && (
20+
<div className="counter-section">
21+
<p>Count: {count}</p>
22+
<button onClick={handleIncrement}>
23+
Increment
24+
</button>
25+
</div>
26+
)}
27+
28+
<button onClick={toggleVisibility}>
29+
{isVisible ? 'Hide' : 'Show'} Counter
30+
</button>
31+
</div>
32+
);
33+
};
34+
35+
export default MyComponent;

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Przykład użycia:
44

55
```bash
6+
node src/index.js MyComponent
7+
68
# Analiza pojedynczego komponentu
79
./reactstream-analyze MyComponent.js --debug
810

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@
1111
"reactstream-run": "./src/index.js"
1212
},
1313
"dependencies": {
14-
"webpack": "^4.46.0",
15-
"webpack-dev-server": "^3.11.3",
16-
"babel-loader": "^8.2.5",
1714
"@babel/core": "^7.12.10",
18-
"@babel/preset-react": "^7.12.10",
15+
"@babel/eslint-parser": "^7.12.1",
1916
"@babel/preset-env": "^7.12.11",
20-
"style-loader": "^2.0.0",
21-
"css-loader": "^5.2.7",
17+
"@babel/preset-react": "^7.12.10",
18+
"babel-loader": "^8.2.5",
2219
"chalk": "^4.1.2",
23-
"minimist": "^1.2.5",
24-
"express": "^4.17.1",
25-
"react": "^17.0.2",
26-
"react-dom": "^17.0.2",
27-
"esprima": "^4.0.1",
20+
"css-loader": "^5.2.7",
2821
"escodegen": "^2.0.0",
29-
"estraverse": "^5.2.0",
3022
"eslint": "^7.32.0",
31-
"@babel/eslint-parser": "^7.12.1",
3223
"eslint-plugin-react": "^7.24.0",
33-
"eslint-plugin-react-hooks": "^4.2.0"
24+
"eslint-plugin-react-hooks": "^4.2.0",
25+
"esprima": "^4.0.1",
26+
"estraverse": "^5.2.0",
27+
"express": "^4.17.1",
28+
"minimist": "^1.2.5",
29+
"react": "^17.0.2",
30+
"react-dom": "^17.0.2",
31+
"style-loader": "^2.0.0",
32+
"webpack": "^5.98.0",
33+
"webpack-dev-server": "^5.2.1"
3434
},
3535
"engines": {
3636
"node": ">=14.0.0"

src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ const argv = minimist(process.argv.slice(2));
1111
const components = argv._;
1212
const port = argv.port || 3000;
1313

14+
const args = process.argv.slice(2);
15+
16+
if (args.length === 0) {
17+
console.error('Error: Please specify at least one component to debug');
18+
console.error('Usage: reactstream ComponentName [AnotherComponent...] [--port=3000]');
19+
process.exit(1);
20+
}
21+
1422
if (components.length === 0) {
1523
console.error(chalk.red('Error: Please specify at least one component to debug'));
1624
console.log(chalk.yellow('Usage: reactstream ComponentName [AnotherComponent...] [--port=3000]'));
@@ -448,4 +456,4 @@ process.on('SIGINT', () => {
448456
main().catch(error => {
449457
console.error(chalk.red('Error:', error));
450458
process.exit(1);
451-
});
459+
});

0 commit comments

Comments
 (0)