Skip to content

Commit 85422cf

Browse files
author
Tom Softreck
committed
Release version 0.3.94
### Changes since v0.3.93
1 parent 1fb89da commit 85422cf

19 files changed

Lines changed: 1151 additions & 365 deletions

.eslintrc.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ module.exports = {
33
node: true,
44
es6: true
55
},
6-
extends: 'eslint:recommended',
6+
extends: ['eslint:recommended'],
77
parserOptions: {
8-
ecmaVersion: 2020
8+
ecmaVersion: 2022,
9+
sourceType: 'module'
910
},
1011
rules: {
11-
// Add any specific rules here
12+
// Add your specific rules here
13+
'no-unused-vars': 'warn',
14+
'no-console': 'off'
1215
}
1316
};

PUBLISH.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,78 @@ npm init
235235
236236
Occasionally, npm registry might have issues. Check [npm status](https://status.npmjs.org/) to ensure the service is operational.
237237
238+
239+
240+
241+
I see the issue – your script is getting caught in an infinite loop because the `version` script in package.json is calling `version.sh`, which then triggers the npm version command, which in turn calls the `version` script again, creating an endless cycle.
242+
243+
Let's fix the `version.sh` script to prevent this infinite loop:
244+
245+
246+
247+
I've fixed the infinite loop issue in your versioning script. There are two main problems that were causing this:
248+
249+
## 1. Script Infinite Loop Issue
250+
251+
The infinite loop was occurring because:
252+
253+
1. Your package.json had a `"version": "bash version.sh"` script
254+
2. When you ran `npm version` or the script itself called `npm version`, it triggered this script
255+
3. Which in turn ran `version.sh` again, creating an endless loop
256+
257+
## 2. Solutions Implemented
258+
259+
I've made two important changes to fix this:
260+
261+
### A. Updated version.sh Script:
262+
263+
1. **Added detection for npm lifecycle events**:
264+
```bash
265+
# Detect if being run from npm script to prevent infinite loop
266+
if [ "$npm_lifecycle_event" = "version" ]; then
267+
echo "Running from npm version hook - skipping automatic versioning"
268+
exit 0
269+
fi
270+
```
271+
272+
2. **Changed how the version is updated in package.json**:
273+
- Instead of using `npm version` which triggers hooks, it directly modifies package.json with Node.js
274+
- This avoids the npm lifecycle hooks that were causing the infinite loop
275+
276+
3. **Added better error handling for git commands**:
277+
- The script now continues even if git push fails
278+
- It properly handles the case where package-lock.json is ignored by git
279+
280+
### B. Updated package.json:
281+
282+
1. **Removed the problematic `version` script**:
283+
- This was the main cause of the infinite loop
284+
285+
2. **Added better alternatives**:
286+
```json
287+
"increment": "bash version.sh",
288+
"publish-npm": "bash version.sh --no-publish && npm publish --access=public",
289+
"release:patch": "bash version.sh --patch",
290+
"release:minor": "bash version.sh --minor",
291+
"release:major": "bash version.sh --major",
292+
"release": "bash version.sh"
293+
```
294+
295+
## How to Use the Fixed Scripts
296+
297+
Now you can use the scripts without fear of infinite loops:
298+
299+
```bash
300+
# Increment version and publish (interactive)
301+
./version.sh
302+
303+
# Increment patch version and publish
304+
npm run release:patch
305+
306+
# Increment version without publishing
307+
npm run increment -- --no-publish
308+
309+
# Custom version
310+
./version.sh --version=1.0.0
311+
```
312+

README.md

Lines changed: 76 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,92 @@ ReactStream is a comprehensive CLI toolkit designed to streamline React componen
77
1. **Component Analysis**: Analyze React components for common issues, best practices, and optimization opportunities.
88
2. **Development Server**: Quickly test and debug React components in isolation without needing to set up a full project.
99

10-
## Installation
10+
# ReactStream Installation Guide
11+
12+
## Prerequisites
13+
14+
- Node.js >= 14.0.0
15+
- npm or yarn
16+
17+
## Option 1: Install from npm
18+
19+
The easiest way to install ReactStream is via npm:
1120

1221
```bash
13-
# Install globally from npm
14-
npm install -g @reactstream/cli
22+
# Install globally
23+
npm install -g @reactstream/cli
24+
25+
# Or install in your project
26+
npm install --save-dev @reactstream/cli
1527
```
1628

29+
## Option 2: Install from Source
30+
31+
If you want to install from source code:
32+
33+
1. Clone the repository:
34+
```bash
35+
git clone https://github.com/reactstream/cli.git
36+
cd cli
37+
```
38+
39+
2. Install dependencies:
40+
```bash
41+
npm install
42+
```
43+
44+
3. Link the package to make the commands available globally:
45+
```bash
46+
npm link
47+
```
48+
49+
## Verifying Installation
50+
51+
To verify that ReactStream was installed correctly:
52+
1753
```bash
18-
# Or install in your project
19-
npm install --save-dev @reactstream/cli
54+
# Check the version
55+
reactstream --version
56+
57+
# View help information
58+
reactstream help
2059
```
2160

61+
## Setting Up File Permissions
62+
63+
If you're installing from source, you might need to make the scripts executable:
64+
2265
```bash
23-
# Or clone the repository
24-
git clone https://github.com/reactstream/cli
25-
cd reactstream
26-
npm install
27-
npm link # (to make commands available globally)
66+
chmod +x bin/reactstream.js
67+
chmod +x bin/reactstream-analyze.js
2868
```
2969

70+
## Troubleshooting
71+
72+
### Common Issues
73+
74+
1. **Command not found**
75+
76+
If you get a "command not found" error, make sure the npm bin directory is in your PATH:
77+
```bash
78+
export PATH="$PATH:$(npm bin -g)"
79+
```
80+
81+
2. **Permission issues**
82+
83+
If you encounter permission issues when installing globally, you can:
84+
```bash
85+
# Option 1: Use sudo (not recommended)
86+
sudo npm install -g @reactstream/cli
87+
88+
# Option 2: Fix npm permissions (recommended)
89+
# See: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
90+
```
91+
92+
3. **ESLint errors**
93+
94+
If you see ESLint errors, make sure you have a valid `.eslintrc.js` file in your project root.
95+
4.
3096
## Commands
3197

3298
ReactStream now provides a unified command interface with subcommands:

STRUCTURE.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# ReactStream Project Structure
2+
3+
Here's the complete project structure with all required files:
4+
5+
```
6+
reactstream/
7+
├── index.js # Main entry point
8+
├── src/ # Source files
9+
│ └── reactstream.js # Core implementation
10+
├── commands/ # Command implementations
11+
│ ├── analyze.js # Analysis command
12+
│ └── serve.js # Development server command
13+
├── bin/ # Binary executables
14+
│ ├── reactstream.js # Main binary
15+
│ └── reactstream-analyze.js # Analyzer binary
16+
├── package.json # Project metadata and dependencies
17+
├── .eslintrc.js # ESLint configuration
18+
├── README.md # Documentation
19+
└── DOCS.md # Detailed documentation
20+
```
21+
22+
## Key Files Overview
23+
24+
### 1. index.js
25+
The main entry point that loads src/reactstream.js.
26+
27+
### 2. src/reactstream.js
28+
Central implementation file that handles command routing.
29+
30+
### 3. commands/analyze.js
31+
The React component analyzer implementation.
32+
33+
### 4. commands/serve.js
34+
The development server implementation.
35+
36+
### 5. bin/reactstream.js
37+
Executable script for the main command.
38+
39+
### 6. bin/reactstream-analyze.js
40+
Executable script for the analyze command.
41+
42+
### 7. package.json
43+
Project configuration with all necessary dependencies and scripts.

UPGRADE.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# upgrade
2+
3+
To upgrade the dependencies in your package.json to the latest versions, you have several options. Here's a systematic approach:
4+
5+
## 1. Using npm outdated and npm update
6+
7+
```bash
8+
# Check which packages are outdated
9+
npm outdated
10+
11+
# Update packages within the version range in package.json
12+
npm update
13+
14+
# Update to the latest versions (including major versions)
15+
npm update --latest
16+
```
17+
18+
## 2. Using npm-check-updates (recommended)
19+
20+
This tool specializes in updating package.json dependencies to the latest versions:
21+
22+
```bash
23+
# Install npm-check-updates
24+
npm install -g npm-check-updates
25+
26+
# Check for updates without modifying package.json
27+
ncu
28+
29+
# Update all dependencies in package.json to the latest versions
30+
ncu -u
31+
32+
# Then install the updated packages
33+
npm install
34+
```
35+
36+
## 3. Selective updates
37+
38+
If you want more control, you can update specific packages:
39+
40+
```bash
41+
# Update a specific package to latest
42+
npm install package-name@latest
43+
44+
# Update multiple specific packages
45+
npm install package1@latest package2@latest
46+
```
47+
48+
## 4. Using the upgrade.sh script
49+
50+
You already have an `upgrade.sh` script that we created earlier. You can run it for an interactive upgrade process:
51+
52+
```bash
53+
./upgrade.sh
54+
```
55+
56+
## 5. Safe upgrading strategy
57+
58+
For a production project, consider this safer approach:
59+
60+
1. Create a git branch for the upgrade
61+
```bash
62+
git checkout -b dependency-upgrade
63+
```
64+
65+
2. Update dependencies in batches by type
66+
```bash
67+
# Update development dependencies first
68+
ncu -u -f "/eslint|babel|webpack/"
69+
npm install
70+
71+
# Update utility libraries
72+
ncu -u -f "/chalk|minimist|uuid/"
73+
npm install
74+
75+
# Update React-related packages
76+
ncu -u -f "/react|jsx/"
77+
npm install
78+
```
79+
80+
3. Run tests after each batch
81+
```bash
82+
npm test
83+
```
84+
85+
4. Commit working changes
86+
```bash
87+
git commit -am "Update dependencies: [category]"
88+
```
89+

bin/reactstream-analyze.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
// bin/reactstream-analyze.js
33

44
// This script allows direct execution of the analyze command as a standalone binary
5-
require('../index.js')(['analyze'].concat(process.argv.slice(2)));
5+
const minimist = require('minimist');
6+
const argv = minimist(process.argv.slice(2));
7+
8+
// Prepend the 'analyze' command and pass to the main CLI
9+
require('../commands/analyze')(argv);

0 commit comments

Comments
 (0)