hale-commenting-system 2.2.8 → 2.2.91
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 +100 -75
- package/package.json +1 -1
- package/scripts/integrate.js +44 -10
package/README.md
CHANGED
|
@@ -1,109 +1,134 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Hale Commenting System
|
|
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
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **Pin-based commenting** - Click anywhere on a page to add a comment pin
|
|
8
|
+
- **Thread discussions** - Organize comments into threads with replies
|
|
9
|
+
- **GitHub Integration** - Sync comments with GitHub Issues automatically
|
|
10
|
+
- **Jira Integration** - Link Jira tickets to specific pages or sections
|
|
11
|
+
- **PatternFly Design** - Built with PatternFly React components
|
|
12
|
+
- **Responsive** - Works on desktop and mobile devices
|
|
13
|
+
- **Easy Integration** - Automated setup script for seamless installation
|
|
8
14
|
|
|
9
|
-
##
|
|
15
|
+
## Installation
|
|
10
16
|
|
|
11
17
|
```bash
|
|
12
|
-
|
|
13
|
-
cd patternfly-react-seed
|
|
14
|
-
npm install && npm run start:dev
|
|
18
|
+
npm install hale-commenting-system
|
|
15
19
|
```
|
|
16
|
-
## Development scripts
|
|
17
|
-
```sh
|
|
18
|
-
# Install development/build dependencies
|
|
19
|
-
npm install
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
npm run start:dev
|
|
21
|
+
## Quick Start
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
1. **Install the package:**
|
|
24
|
+
```bash
|
|
25
|
+
npm install hale-commenting-system
|
|
26
|
+
```
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
2. **Run the integration script:**
|
|
29
|
+
```bash
|
|
30
|
+
npx hale-commenting-system init
|
|
31
|
+
```
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
3. **Follow the interactive setup:**
|
|
34
|
+
- The script will guide you through project setup
|
|
35
|
+
- Optionally configure GitHub OAuth integration
|
|
36
|
+
- Optionally configure Jira integration
|
|
37
|
+
- Configuration files (`.env` and `.env.server`) will be created automatically
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
4. **Start your dev server:**
|
|
40
|
+
```bash
|
|
41
|
+
npm run start:dev
|
|
42
|
+
```
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
npm run format
|
|
44
|
+
## Usage
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
npm run bundle-profile:analyze
|
|
46
|
+
After running the integration script, the commenting system will be available in your PatternFly React Seed application.
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
npm run start
|
|
44
|
-
```
|
|
48
|
+
### Adding Comments
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* [Editor Config](./.editorconfig)
|
|
50
|
+
- **Click anywhere** on a page to add a comment pin
|
|
51
|
+
- **View all comments** in the "Comments" menu item in the sidebar
|
|
52
|
+
- **Reply to comments** to create discussion threads
|
|
53
|
+
- **Navigate to pins** using the "Go to pin" button in the comments view
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
### GitHub Integration (Optional)
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
When configured, comments automatically sync with GitHub Issues:
|
|
58
|
+
- Each comment thread becomes a GitHub Issue
|
|
59
|
+
- Replies sync as Issue comments
|
|
60
|
+
- Status changes (open/closed) sync between the app and GitHub
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
```js
|
|
58
|
-
import imgSrc from '@assets/images/g_sizing.png';
|
|
59
|
-
<img src={imgSrc} alt="Some image" />
|
|
60
|
-
```
|
|
62
|
+
### Jira Integration (Optional)
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
When configured, you can:
|
|
65
|
+
- Link Jira tickets to specific pages or sections
|
|
66
|
+
- View ticket details in the commenting panel
|
|
67
|
+
- Track design work alongside development tickets
|
|
63
68
|
|
|
64
|
-
|
|
65
|
-
import loader from '@app/assets/images/loader.gif';
|
|
66
|
-
<img src={loader} alt="Content loading" />
|
|
67
|
-
```
|
|
69
|
+
## Configuration
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
Inlining SVG in the app's markup is also possible.
|
|
71
|
+
The integration script creates two configuration files:
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
### `.env`
|
|
74
|
+
Contains client-side configuration (safe to commit):
|
|
75
|
+
- GitHub OAuth client ID
|
|
76
|
+
- Jira base URL
|
|
77
|
+
- Other public configuration
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
### `.env.server`
|
|
80
|
+
Contains server-side secrets (should NOT be committed):
|
|
81
|
+
- GitHub OAuth client secret
|
|
82
|
+
- Jira API tokens
|
|
83
|
+
- Other sensitive credentials
|
|
84
|
+
|
|
85
|
+
**Important:** The `.env.server` file is automatically added to `.gitignore` to prevent committing secrets.
|
|
86
|
+
|
|
87
|
+
See the generated files for detailed setup instructions.
|
|
88
|
+
|
|
89
|
+
## Requirements
|
|
90
|
+
|
|
91
|
+
- **PatternFly React Seed** project (or compatible PatternFly React application)
|
|
92
|
+
- **Node.js 18+** (required for webpack middleware with native `fetch()` support)
|
|
93
|
+
- **React 18+**
|
|
83
94
|
|
|
84
|
-
##
|
|
85
|
-
When importing CSS from a third-party package for the first time, you may encounter the error `Module parse failed: Unexpected token... You may need an appropriate loader to handle this file typ...`. You need to register the path to the stylesheet directory in [stylePaths.js](./stylePaths.js). We specify these explicitly for performance reasons to avoid webpack needing to crawl through the entire node_modules directory when parsing CSS modules.
|
|
95
|
+
## What Gets Integrated
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
* For accessibility compliance, we use [react-axe](https://github.com/dequelabs/react-axe)
|
|
89
|
-
* To keep our bundle size in check, we use [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)
|
|
90
|
-
* To keep our code formatting in check, we use [prettier](https://github.com/prettier/prettier)
|
|
91
|
-
* To keep our code logic and test coverage in check, we use [jest](https://github.com/facebook/jest)
|
|
92
|
-
* To ensure code styles remain consistent, we use [eslint](https://eslint.org/)
|
|
97
|
+
The integration script automatically modifies your project:
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
1. **`src/app/index.tsx`** - Adds `CommentProvider` and `GitHubAuthProvider`
|
|
100
|
+
2. **`src/app/routes.tsx`** - Adds "Comments" route group with "View all" route
|
|
101
|
+
3. **`src/app/AppLayout/AppLayout.tsx`** - Adds `CommentPanel` and `CommentOverlay` components
|
|
102
|
+
4. **`webpack.dev.js`** - Adds middleware for GitHub OAuth and Jira API proxying
|
|
103
|
+
5. **`src/app/Comments/Comments.tsx`** - Creates the Comments view component
|
|
104
|
+
6. **`.env` and `.env.server`** - Creates configuration files
|
|
96
105
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
### Running Locally
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Install dependencies
|
|
112
|
+
npm install
|
|
113
|
+
|
|
114
|
+
# Start development server
|
|
115
|
+
npm run start:dev
|
|
100
116
|
```
|
|
101
117
|
|
|
118
|
+
### Building for Production
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Run production build
|
|
122
|
+
npm run build
|
|
123
|
+
|
|
124
|
+
# Start production server
|
|
125
|
+
npm run start
|
|
126
|
+
```
|
|
102
127
|
|
|
103
|
-
|
|
128
|
+
## License
|
|
104
129
|
|
|
105
|
-
|
|
130
|
+
MIT
|
|
106
131
|
|
|
107
|
-
|
|
132
|
+
## Support
|
|
108
133
|
|
|
109
|
-
|
|
134
|
+
For issues, questions, or contributions, please visit the [repository](https://github.com/patternfly/patternfly-react-seed).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hale-commenting-system",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.91",
|
|
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
|
"repository": "https://github.com/patternfly/patternfly-react-seed.git",
|
|
6
6
|
"homepage": "https://www.npmjs.com/package/hale-commenting-system",
|
package/scripts/integrate.js
CHANGED
|
@@ -1038,10 +1038,16 @@ function modifyIndexTsx(filePath) {
|
|
|
1038
1038
|
function modifyRoutesTsx(filePath) {
|
|
1039
1039
|
const content = fs.readFileSync(filePath, 'utf8');
|
|
1040
1040
|
|
|
1041
|
-
// Check if Comments route already exists
|
|
1041
|
+
// Check if Comments route already exists with actual routes
|
|
1042
|
+
// Use a more sophisticated check that looks for the route path
|
|
1042
1043
|
if (content.includes("label: 'Comments'") || content.includes('label: "Comments"')) {
|
|
1043
|
-
|
|
1044
|
-
|
|
1044
|
+
// Check if it has routes with the /comments path
|
|
1045
|
+
if (content.includes("path: '/comments'") || content.includes('path: "/comments"')) {
|
|
1046
|
+
console.log(' ⚠️ Already integrated (Comments route found)');
|
|
1047
|
+
return false;
|
|
1048
|
+
}
|
|
1049
|
+
// If Comments group exists but has no routes, continue to add them
|
|
1050
|
+
console.log(' ℹ️ Comments group exists but has no routes, adding route...');
|
|
1045
1051
|
}
|
|
1046
1052
|
|
|
1047
1053
|
try {
|
|
@@ -1099,7 +1105,30 @@ function modifyRoutesTsx(filePath) {
|
|
|
1099
1105
|
ast.program.body.splice(importIndex, 0, commentsImport);
|
|
1100
1106
|
}
|
|
1101
1107
|
|
|
1102
|
-
//
|
|
1108
|
+
// Check if Comments route group already exists
|
|
1109
|
+
let existingCommentsGroup = null;
|
|
1110
|
+
let existingCommentsRoutes = null;
|
|
1111
|
+
|
|
1112
|
+
for (const element of routesArray.elements) {
|
|
1113
|
+
if (element.type === 'ObjectExpression') {
|
|
1114
|
+
const labelProp = element.properties.find(
|
|
1115
|
+
prop => prop.key && prop.key.name === 'label' &&
|
|
1116
|
+
prop.value && prop.value.value === 'Comments'
|
|
1117
|
+
);
|
|
1118
|
+
if (labelProp) {
|
|
1119
|
+
existingCommentsGroup = element;
|
|
1120
|
+
const routesProp = element.properties.find(
|
|
1121
|
+
prop => prop.key && prop.key.name === 'routes'
|
|
1122
|
+
);
|
|
1123
|
+
if (routesProp && routesProp.value.type === 'ArrayExpression') {
|
|
1124
|
+
existingCommentsRoutes = routesProp.value;
|
|
1125
|
+
}
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
// Create the Comments route item
|
|
1103
1132
|
const commentsRouteElement = types.jsxElement(
|
|
1104
1133
|
types.jsxOpeningElement(types.jsxIdentifier(commentsImportName), [], true),
|
|
1105
1134
|
null,
|
|
@@ -1114,12 +1143,17 @@ function modifyRoutesTsx(filePath) {
|
|
|
1114
1143
|
types.objectProperty(types.identifier('title'), types.stringLiteral('Hale Commenting System | Comments'))
|
|
1115
1144
|
]);
|
|
1116
1145
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1146
|
+
if (existingCommentsGroup && existingCommentsRoutes) {
|
|
1147
|
+
// Add route to existing Comments group
|
|
1148
|
+
existingCommentsRoutes.elements.push(commentsRouteItem);
|
|
1149
|
+
} else {
|
|
1150
|
+
// Create new Comments route group
|
|
1151
|
+
const commentsRoute = types.objectExpression([
|
|
1152
|
+
types.objectProperty(types.identifier('label'), types.stringLiteral('Comments')),
|
|
1153
|
+
types.objectProperty(types.identifier('routes'), types.arrayExpression([commentsRouteItem]))
|
|
1154
|
+
]);
|
|
1155
|
+
routesArray.elements.push(commentsRoute);
|
|
1156
|
+
}
|
|
1123
1157
|
}
|
|
1124
1158
|
|
|
1125
1159
|
const output = generate(ast, {
|