hale-commenting-system 3.4.5 โ†’ 3.5.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/README.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  A commenting system for PatternFly React applications that allows designers and developers to add comments directly on design pages, sync with GitHub Issues, and link Jira tickets.
4
4
 
5
+ ## ๐Ÿšจ **CRITICAL: Read Before Uninstalling**
6
+
7
+ **This package modifies your project files during setup.**
8
+
9
+ **BEFORE uninstalling, you MUST run:**
10
+ ```bash
11
+ npx hale-commenting-system remove
12
+ npm uninstall hale-commenting-system
13
+ ```
14
+
15
+ **Failure to run `remove` first will break your app!** See the [Uninstalling](#uninstalling) section below.
16
+
5
17
  ## Features
6
18
 
7
19
  - **Pin-based commenting** - Click anywhere on a page to add a comment pin
@@ -21,15 +33,9 @@ This package was developed for **PatternFly React Seed** projects, but can be us
21
33
 
22
34
  The automated integration script (`npx hale-commenting-system init`) works best with PatternFly React Seed or projects with a similar structure.
23
35
 
24
- ## Installation
36
+ ## Installation and Setup
25
37
 
26
- ```bash
27
- npm install hale-commenting-system
28
- ```
29
-
30
- > **โš ๏ธ Important:** This package modifies your project files during installation. Before uninstalling, always run `npx hale-commenting-system remove` to cleanly remove the integration and avoid breaking your application.
31
-
32
- ## Quick Start
38
+ > **โš ๏ธ Note:** This package modifies your project files during setup. See the [Uninstalling](#uninstalling) section for proper removal instructions.
33
39
 
34
40
  1. **Install the package:**
35
41
  ```bash
@@ -54,21 +60,50 @@ npm install hale-commenting-system
54
60
 
55
61
  ## Uninstalling
56
62
 
57
- **IMPORTANT:** Before uninstalling the package, you must first remove the integration to avoid breaking your application.
63
+ **โš ๏ธ IMPORTANT: Two-Step Process Required**
64
+
65
+ You **MUST** run the removal script before uninstalling to avoid breaking your app:
66
+
67
+ ### Step 1: Remove Integration
68
+
69
+ ```bash
70
+ npx hale-commenting-system remove
71
+ ```
72
+
73
+ This removes all integration code from your project files.
74
+
75
+ ### Step 2: Uninstall Package
76
+
77
+ ```bash
78
+ npm uninstall hale-commenting-system
79
+ ```
80
+
81
+ ### Step 3: Restart Dev Server
58
82
 
59
- ### Clean Uninstall Process
83
+ ```bash
84
+ npm run start:dev
85
+ ```
86
+
87
+ ### What If I Forgot and Already Uninstalled?
88
+
89
+ If you uninstalled without running `remove` first and your app is now broken:
90
+
91
+ 1. **Reinstall the package:**
92
+ ```bash
93
+ npm install hale-commenting-system
94
+ ```
60
95
 
61
- 1. **Run the removal script:**
96
+ 2. **Run the removal script:**
62
97
  ```bash
63
98
  npx hale-commenting-system remove
64
99
  ```
65
100
 
66
- 2. **Uninstall the package:**
101
+ 3. **Uninstall again:**
67
102
  ```bash
68
103
  npm uninstall hale-commenting-system
69
104
  ```
70
105
 
71
- 3. **Restart your dev server:**
106
+ 4. **Restart your dev server:**
72
107
  ```bash
73
108
  npm run start:dev
74
109
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hale-commenting-system",
3
- "version": "3.4.5",
3
+ "version": "3.5.0",
4
4
  "description": "A commenting system for PatternFly React applications that allows designers and developers to add comments directly on design pages, sync with GitHub Issues, and link Jira tickets.",
5
5
  "homepage": "https://www.npmjs.com/package/hale-commenting-system",
6
6
  "license": "MIT",
@@ -17,6 +17,8 @@
17
17
  "GITHUB_OAUTH_ENV_TEMPLATE.md"
18
18
  ],
19
19
  "scripts": {
20
+ "postinstall": "node scripts/postinstall.js || true",
21
+ "preuninstall": "node scripts/auto-remove.js || true",
20
22
  "prebuild": "npm run type-check && npm run clean",
21
23
  "build": "webpack --config webpack.prod.js",
22
24
  "start": "sirv dist --cors --single --host --port 8080",
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Automatic cleanup script that runs before npm uninstall
5
+ * This ensures the user's app doesn't break when they uninstall the package
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+
11
+ // Determine project root based on where this script is running
12
+ // During preuninstall, CWD could be either:
13
+ // 1. The package directory: /path/to/project/node_modules/hale-commenting-system
14
+ // 2. The project directory: /path/to/project
15
+ let projectRoot;
16
+
17
+ if (process.cwd().includes('node_modules')) {
18
+ // Running from inside node_modules/hale-commenting-system
19
+ projectRoot = path.resolve(process.cwd(), '../..');
20
+ } else {
21
+ // Running from project root
22
+ projectRoot = process.cwd();
23
+ }
24
+
25
+ console.log('\nโ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—');
26
+ console.log('โ•‘ Hale Commenting System - Auto Cleanup โ•‘');
27
+ console.log('โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•\n');
28
+ console.log('๐Ÿงน Removing integration before uninstall...\n');
29
+
30
+ let filesModified = 0;
31
+
32
+ try {
33
+ // 1. Remove from src/app/index.tsx
34
+ const indexPath = path.join(projectRoot, 'src/app/index.tsx');
35
+ if (fs.existsSync(indexPath)) {
36
+ let content = fs.readFileSync(indexPath, 'utf8');
37
+ const originalContent = content;
38
+
39
+ // Remove the import
40
+ content = content.replace(/import\s*{\s*CommentProvider\s*,\s*GitHubAuthProvider\s*}\s*from\s*["']hale-commenting-system["'];?\s*\n?/g, '');
41
+
42
+ // Remove the providers from JSX - be more aggressive with whitespace handling
43
+ content = content.replace(/<GitHubAuthProvider>\s*/g, '');
44
+ content = content.replace(/\s*<\/GitHubAuthProvider>/g, '');
45
+ content = content.replace(/<CommentProvider>\s*/g, '');
46
+ content = content.replace(/\s*<\/CommentProvider>/g, '');
47
+
48
+ if (content !== originalContent) {
49
+ fs.writeFileSync(indexPath, content, 'utf8');
50
+ console.log('โœ… Cleaned up src/app/index.tsx');
51
+ filesModified++;
52
+ }
53
+ }
54
+
55
+ // 2. Remove from src/app/AppLayout/AppLayout.tsx
56
+ const appLayoutPath = path.join(projectRoot, 'src/app/AppLayout/AppLayout.tsx');
57
+ if (fs.existsSync(appLayoutPath)) {
58
+ let content = fs.readFileSync(appLayoutPath, 'utf8');
59
+ const originalContent = content;
60
+
61
+ // Remove the import
62
+ content = content.replace(/import\s*{\s*CommentPanel\s*,\s*CommentOverlay\s*}\s*from\s*["']hale-commenting-system["'];?\s*\n?/g, '');
63
+
64
+ // Remove the components from JSX
65
+ content = content.replace(/<CommentPanel>\s*/g, '');
66
+ content = content.replace(/\s*<\/CommentPanel>/g, '');
67
+ content = content.replace(/<CommentOverlay\s*\/>\s*/g, '');
68
+
69
+ if (content !== originalContent) {
70
+ fs.writeFileSync(appLayoutPath, content, 'utf8');
71
+ console.log('โœ… Cleaned up src/app/AppLayout/AppLayout.tsx');
72
+ filesModified++;
73
+ }
74
+ }
75
+
76
+ if (filesModified > 0) {
77
+ console.log(`\nโœ… Successfully cleaned up ${filesModified} file(s)`);
78
+ console.log(' Your app will continue to work after uninstall.\n');
79
+ } else {
80
+ console.log('โ„น๏ธ No integration found to clean up.\n');
81
+ }
82
+ } catch (error) {
83
+ // Don't block uninstall, but show the error
84
+ console.error('โš ๏ธ Error during automatic cleanup:');
85
+ console.error(' ', error.message);
86
+ console.error('\n You may need to manually remove imports from your files.');
87
+ console.error(' See: https://www.npmjs.com/package/hale-commenting-system#manual-uninstall\n');
88
+ }
89
+
90
+ // Always exit successfully so uninstall can proceed
91
+ process.exit(0);
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ console.log('\nโ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—');
4
+ console.log('โ•‘ โ•‘');
5
+ console.log('โ•‘ ๐Ÿ“ฆ Hale Commenting System installed successfully! โ•‘');
6
+ console.log('โ•‘ โ•‘');
7
+ console.log('โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•\n');
8
+
9
+ console.log('๐Ÿ“ Next steps:');
10
+ console.log(' 1. Run: npx hale-commenting-system init');
11
+ console.log(' 2. Start your dev server\n');
12
+
13
+ console.log('๐Ÿšจ CRITICAL - BEFORE UNINSTALLING:');
14
+ console.log(' โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•');
15
+ console.log(' This package modifies your project files during setup.');
16
+ console.log(' ');
17
+ console.log(' BEFORE running "npm uninstall hale-commenting-system",');
18
+ console.log(' you MUST run:');
19
+ console.log(' ');
20
+ console.log(' โ–ถ npx hale-commenting-system remove');
21
+ console.log(' ');
22
+ console.log(' Otherwise your app will break with import errors!');
23
+ console.log(' โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•\n');
24
+
25
+ console.log('๐Ÿ“š Documentation: https://www.npmjs.com/package/hale-commenting-system\n');