hale-commenting-system 2.2.0 → 2.2.1
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/.claude/settings.local.json +7 -0
- package/.editorconfig +17 -0
- package/.eslintrc.js +75 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +23 -0
- package/.github/workflows/ci.yaml +51 -0
- package/.prettierignore +1 -0
- package/.prettierrc +4 -0
- package/GITHUB_OAUTH_ENV_TEMPLATE.md +53 -0
- package/LICENSE +21 -0
- package/README.md +92 -21
- package/package.json +74 -50
- package/scripts/README.md +42 -0
- package/scripts/integrate.js +440 -0
- package/src/app/AppLayout/AppLayout.tsx +248 -0
- package/src/app/Comments/Comments.tsx +273 -0
- package/src/app/Dashboard/Dashboard.tsx +10 -0
- package/src/app/NotFound/NotFound.tsx +35 -0
- package/src/app/Settings/General/GeneralSettings.tsx +16 -0
- package/src/app/Settings/Profile/ProfileSettings.tsx +18 -0
- package/src/app/Support/Support.tsx +50 -0
- package/src/app/__snapshots__/app.test.tsx.snap +524 -0
- package/src/app/app.css +11 -0
- package/src/app/app.test.tsx +55 -0
- package/src/app/bgimages/Patternfly-Logo.svg +28 -0
- package/src/app/commenting-system/components/CommentOverlay.tsx +93 -0
- package/src/app/commenting-system/components/CommentPanel.tsx +534 -0
- package/src/app/commenting-system/components/CommentPin.tsx +60 -0
- package/src/app/commenting-system/components/DetailsTab.tsx +516 -0
- package/src/app/commenting-system/components/FloatingWidget.tsx +130 -0
- package/src/app/commenting-system/components/JiraTab.tsx +696 -0
- package/src/app/commenting-system/contexts/CommentContext.tsx +1033 -0
- package/src/app/commenting-system/contexts/GitHubAuthContext.tsx +84 -0
- package/{dist/index.d.ts → src/app/commenting-system/index.ts} +5 -4
- package/src/app/commenting-system/services/githubAdapter.ts +359 -0
- package/src/app/commenting-system/types/index.ts +27 -0
- package/src/app/commenting-system/utils/version.ts +19 -0
- package/src/app/index.tsx +22 -0
- package/src/app/routes.tsx +81 -0
- package/src/app/utils/useDocumentTitle.ts +13 -0
- package/src/favicon.png +0 -0
- package/src/index.html +18 -0
- package/src/index.tsx +25 -0
- package/src/test/setup.ts +33 -0
- package/src/typings.d.ts +12 -0
- package/stylePaths.js +14 -0
- package/tsconfig.json +34 -0
- package/vitest.config.ts +19 -0
- package/webpack.common.js +139 -0
- package/webpack.dev.js +318 -0
- package/webpack.prod.js +38 -0
- package/bin/detect.d.ts +0 -10
- package/bin/detect.js +0 -134
- package/bin/generators.d.ts +0 -20
- package/bin/generators.js +0 -272
- package/bin/hale-commenting.js +0 -4
- package/bin/index.d.ts +0 -2
- package/bin/index.js +0 -61
- package/bin/onboarding.d.ts +0 -1
- package/bin/onboarding.js +0 -395
- package/bin/postinstall.d.ts +0 -2
- package/bin/postinstall.js +0 -65
- package/bin/validators.d.ts +0 -2
- package/bin/validators.js +0 -66
- package/dist/cli/detect.d.ts +0 -10
- package/dist/cli/detect.js +0 -134
- package/dist/cli/generators.d.ts +0 -20
- package/dist/cli/generators.js +0 -272
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +0 -61
- package/dist/cli/onboarding.d.ts +0 -1
- package/dist/cli/onboarding.js +0 -395
- package/dist/cli/postinstall.d.ts +0 -2
- package/dist/cli/postinstall.js +0 -65
- package/dist/cli/validators.d.ts +0 -2
- package/dist/cli/validators.js +0 -66
- package/dist/components/CommentOverlay.d.ts +0 -2
- package/dist/components/CommentOverlay.js +0 -101
- package/dist/components/CommentPanel.d.ts +0 -6
- package/dist/components/CommentPanel.js +0 -334
- package/dist/components/CommentPin.d.ts +0 -11
- package/dist/components/CommentPin.js +0 -64
- package/dist/components/DetailsTab.d.ts +0 -2
- package/dist/components/DetailsTab.js +0 -380
- package/dist/components/FloatingWidget.d.ts +0 -8
- package/dist/components/FloatingWidget.js +0 -128
- package/dist/components/JiraTab.d.ts +0 -2
- package/dist/components/JiraTab.js +0 -507
- package/dist/contexts/CommentContext.d.ts +0 -30
- package/dist/contexts/CommentContext.js +0 -891
- package/dist/contexts/GitHubAuthContext.d.ts +0 -13
- package/dist/contexts/GitHubAuthContext.js +0 -96
- package/dist/index.js +0 -27
- package/dist/services/githubAdapter.d.ts +0 -56
- package/dist/services/githubAdapter.js +0 -321
- package/dist/types/index.d.ts +0 -25
- package/dist/types/index.js +0 -2
- package/dist/utils/version.d.ts +0 -1
- package/dist/utils/version.js +0 -23
- package/templates/webpack-middleware.js +0 -226
package/.editorconfig
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Editor configuration, see http://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
indent_style = space
|
|
7
|
+
indent_size = 2
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.snap]
|
|
12
|
+
max_line_length = off
|
|
13
|
+
trim_trailing_whitespace = false
|
|
14
|
+
|
|
15
|
+
[*.md]
|
|
16
|
+
max_line_length = off
|
|
17
|
+
trim_trailing_whitespace = false
|
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// tells eslint to use the TypeScript parser
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
// tell the TypeScript parser that we want to use JSX syntax
|
|
5
|
+
"parserOptions": {
|
|
6
|
+
"tsx": true,
|
|
7
|
+
"jsx": true,
|
|
8
|
+
"js": true,
|
|
9
|
+
"useJSXTextNode": true,
|
|
10
|
+
"project": "./tsconfig.json",
|
|
11
|
+
"tsconfigRootDir": "."
|
|
12
|
+
},
|
|
13
|
+
// we want to use the recommended rules provided from the typescript plugin
|
|
14
|
+
"extends": [
|
|
15
|
+
"eslint:recommended",
|
|
16
|
+
"plugin:react/recommended",
|
|
17
|
+
"plugin:@typescript-eslint/recommended"
|
|
18
|
+
],
|
|
19
|
+
"globals": {
|
|
20
|
+
"window": "readonly",
|
|
21
|
+
"describe": "readonly",
|
|
22
|
+
"test": "readonly",
|
|
23
|
+
"expect": "readonly",
|
|
24
|
+
"it": "readonly",
|
|
25
|
+
"process": "readonly",
|
|
26
|
+
"document": "readonly",
|
|
27
|
+
"insights": "readonly",
|
|
28
|
+
"shallow": "readonly",
|
|
29
|
+
"render": "readonly",
|
|
30
|
+
"mount": "readonly"
|
|
31
|
+
},
|
|
32
|
+
"overrides": [
|
|
33
|
+
{
|
|
34
|
+
"files": ["src/**/*.ts", "src/**/*.tsx"],
|
|
35
|
+
"parser": "@typescript-eslint/parser",
|
|
36
|
+
"plugins": ["@typescript-eslint"],
|
|
37
|
+
"extends": ["plugin:@typescript-eslint/recommended"],
|
|
38
|
+
"rules": {
|
|
39
|
+
"react/prop-types": "off",
|
|
40
|
+
"@typescript-eslint/no-unused-vars": "error"
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
"settings": {
|
|
45
|
+
"react": {
|
|
46
|
+
"version": "^16.11.0"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// includes the typescript specific rules found here: https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
|
|
50
|
+
"plugins": [
|
|
51
|
+
"@typescript-eslint",
|
|
52
|
+
"react-hooks",
|
|
53
|
+
"eslint-plugin-react-hooks"
|
|
54
|
+
],
|
|
55
|
+
"rules": {
|
|
56
|
+
"sort-imports": [
|
|
57
|
+
"error",
|
|
58
|
+
{
|
|
59
|
+
"ignoreDeclarationSort": true
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
63
|
+
"react-hooks/rules-of-hooks": "error",
|
|
64
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
65
|
+
"@typescript-eslint/interface-name-prefix": "off",
|
|
66
|
+
"prettier/prettier": "off",
|
|
67
|
+
"import/no-unresolved": "off",
|
|
68
|
+
"import/extensions": "off",
|
|
69
|
+
"react/prop-types": "off"
|
|
70
|
+
},
|
|
71
|
+
"env": {
|
|
72
|
+
"browser": true,
|
|
73
|
+
"node": true
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve the react seed
|
|
4
|
+
title: ''
|
|
5
|
+
labels: needs triage
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior
|
|
15
|
+
|
|
16
|
+
**Expected behavior**
|
|
17
|
+
A clear and concise description of what you expected to happen.
|
|
18
|
+
|
|
19
|
+
**Screenshots**
|
|
20
|
+
If applicable, add screenshots to help explain your problem.
|
|
21
|
+
|
|
22
|
+
**Additional context**
|
|
23
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- release*
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
name: Lint
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v3
|
|
16
|
+
- name: Setup Node.js
|
|
17
|
+
uses: actions/setup-node@v3
|
|
18
|
+
with:
|
|
19
|
+
node-version: lts/*
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: npm install
|
|
22
|
+
- name: Run eslint
|
|
23
|
+
run: npm run lint
|
|
24
|
+
test:
|
|
25
|
+
name: Test
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout
|
|
29
|
+
uses: actions/checkout@v3
|
|
30
|
+
- name: Setup Node.js
|
|
31
|
+
uses: actions/setup-node@v3
|
|
32
|
+
with:
|
|
33
|
+
node-version: lts/*
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: npm install
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: npm run test
|
|
38
|
+
build:
|
|
39
|
+
name: Build
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps:
|
|
42
|
+
- name: Checkout
|
|
43
|
+
uses: actions/checkout@v3
|
|
44
|
+
- name: Setup Node.js
|
|
45
|
+
uses: actions/setup-node@v3
|
|
46
|
+
with:
|
|
47
|
+
node-version: lts/*
|
|
48
|
+
- name: Install dependencies
|
|
49
|
+
run: npm install
|
|
50
|
+
- name: Attempt a build
|
|
51
|
+
run: npm run build
|
package/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
package.json
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
## GitHub OAuth + Issue Sync env vars (local dev)
|
|
2
|
+
|
|
3
|
+
This project uses `dotenv-webpack`, which **inlines environment variables into the frontend bundle**.
|
|
4
|
+
|
|
5
|
+
### Create a local `.env` file
|
|
6
|
+
|
|
7
|
+
Create `patternfly-react-seed/.env` (this file is already in `.gitignore`):
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
# GitHub OAuth (client-side; safe to expose)
|
|
11
|
+
VITE_GITHUB_CLIENT_ID=YOUR_GITHUB_OAUTH_CLIENT_ID
|
|
12
|
+
|
|
13
|
+
# Target repo for Issues/Comments
|
|
14
|
+
VITE_GITHUB_OWNER=JustinXHale
|
|
15
|
+
VITE_GITHUB_REPO=pfseed-commenting-system
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Server-only secret (local dev)
|
|
19
|
+
|
|
20
|
+
Create `patternfly-react-seed/.env.server` (also gitignored) and add:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
GITHUB_CLIENT_SECRET=YOUR_GITHUB_OAUTH_CLIENT_SECRET
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Jira (issues.redhat.com) env vars (local dev)
|
|
27
|
+
|
|
28
|
+
### Client-safe `.env`
|
|
29
|
+
|
|
30
|
+
Add:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
VITE_JIRA_BASE_URL=https://issues.redhat.com
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Server-only `.env.server`
|
|
37
|
+
|
|
38
|
+
Add:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
JIRA_EMAIL=YOUR_JIRA_ACCOUNT_EMAIL
|
|
42
|
+
JIRA_API_TOKEN=YOUR_JIRA_API_TOKEN
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Important: do NOT put secrets in `.env`
|
|
46
|
+
|
|
47
|
+
Do **NOT** put your GitHub OAuth **client secret** in `.env`.
|
|
48
|
+
|
|
49
|
+
Because webpack injects these variables into the browser bundle, any secret placed in `.env` would be exposed to end users.
|
|
50
|
+
|
|
51
|
+
When we wire up the OAuth code exchange step, the **client secret must live server-side** (Netlify/Vercel function environment variables, etc.).
|
|
52
|
+
|
|
53
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Red Hat
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,38 +1,109 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Patternfly Seed
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Patternfly Seed is an open source build scaffolding utility for web apps. The primary purpose of this project is to give developers a jump start when creating new projects that will use patternfly. A secondary purpose of this project is to serve as a reference for how to configure various aspects of an application that uses patternfly, webpack, react, typescript, etc.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Out of the box you'll get an app layout with chrome (header/sidebar), routing, build pipeline, test suite, and some code quality tools. Basically, all the essentials.
|
|
6
|
+
|
|
7
|
+
<img width="1058" alt="Out of box dashboard view of patternfly seed" src="https://github.com/user-attachments/assets/0227b366-67f1-4df8-8d92-e8e95d6e08b3" />
|
|
8
|
+
|
|
9
|
+
## Quick-start
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
|
|
12
|
+
git clone https://github.com/patternfly/patternfly-react-seed
|
|
13
|
+
cd patternfly-react-seed
|
|
14
|
+
npm install && npm run start:dev
|
|
9
15
|
```
|
|
16
|
+
## Development scripts
|
|
17
|
+
```sh
|
|
18
|
+
# Install development/build dependencies
|
|
19
|
+
npm install
|
|
10
20
|
|
|
11
|
-
|
|
21
|
+
# Start the development server
|
|
22
|
+
npm run start:dev
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
# Run a production build (outputs to "dist" dir)
|
|
25
|
+
npm run build
|
|
14
26
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- **Details Tab**: Store design goals and context
|
|
18
|
-
- **Floating Widget**: Draggable commenting interface
|
|
19
|
-
- **PatternFly Seed**: Auto-detects and integrates with PF Seed projects
|
|
27
|
+
# Run the test suite
|
|
28
|
+
npm run test
|
|
20
29
|
|
|
21
|
-
|
|
30
|
+
# Run the test suite with coverage
|
|
31
|
+
npm run test:coverage
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- Jira access (Red Hat Jira: issues.redhat.com)
|
|
33
|
+
# Run the linter
|
|
34
|
+
npm run lint
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
# Run the code formatter
|
|
37
|
+
npm run format
|
|
28
38
|
|
|
29
|
-
|
|
39
|
+
# Launch a tool to inspect the bundle size
|
|
40
|
+
npm run bundle-profile:analyze
|
|
30
41
|
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
# Start the express server (run a production build first)
|
|
43
|
+
npm run start
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Configurations
|
|
47
|
+
* [TypeScript Config](./tsconfig.json)
|
|
48
|
+
* [Webpack Config](./webpack.common.js)
|
|
49
|
+
* [Jest Config](./jest.config.js)
|
|
50
|
+
* [Editor Config](./.editorconfig)
|
|
51
|
+
|
|
52
|
+
## Raster image support
|
|
53
|
+
|
|
54
|
+
To use an image asset that's shipped with PatternFly core, you'll prefix the paths with "@assets". `@assets` is an alias for the PatternFly assets directory in node_modules.
|
|
55
|
+
|
|
56
|
+
For example:
|
|
57
|
+
```js
|
|
58
|
+
import imgSrc from '@assets/images/g_sizing.png';
|
|
59
|
+
<img src={imgSrc} alt="Some image" />
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
You can use a similar technique to import assets from your local app, just prefix the paths with "@app". `@app` is an alias for the main src/app directory.
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import loader from '@app/assets/images/loader.gif';
|
|
66
|
+
<img src={loader} alt="Content loading" />
|
|
33
67
|
```
|
|
34
68
|
|
|
35
|
-
##
|
|
69
|
+
## Vector image support
|
|
70
|
+
Inlining SVG in the app's markup is also possible.
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
import logo from '@app/assets/images/logo.svg';
|
|
74
|
+
<span dangerouslySetInnerHTML={{__html: logo}} />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
You can also use SVG when applying background images with CSS. To do this, your SVG's must live under a `bgimages` directory (this directory name is configurable in [webpack.common.js](./webpack.common.js#L5)). This is necessary because you may need to use SVG's in several other context (inline images, fonts, icons, etc.) and so we need to be able to differentiate between these usages so the appropriate loader is invoked.
|
|
78
|
+
```css
|
|
79
|
+
body {
|
|
80
|
+
background: url(./assets/bgimages/img_avatar.svg);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Adding custom CSS
|
|
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.
|
|
86
|
+
|
|
87
|
+
## Code quality tools
|
|
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/)
|
|
93
|
+
|
|
94
|
+
## Multi environment configuration
|
|
95
|
+
This project uses [dotenv-webpack](https://www.npmjs.com/package/dotenv-webpack) for exposing environment variables to your code. Either export them at the system level like `export MY_ENV_VAR=http://dev.myendpoint.com && npm run start:dev` or simply drop a `.env` file in the root that contains your key-value pairs like below:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
ENV_1=http://1.myendpoint.com
|
|
99
|
+
ENV_2=http://2.myendpoint.com
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
With that in place, you can use the values in your code like `console.log(process.env.ENV_1);`
|
|
104
|
+
|
|
105
|
+
### GitHub OAuth / Issues env vars (local dev)
|
|
36
106
|
|
|
37
|
-
|
|
107
|
+
For the commenting system, see `GITHUB_OAUTH_ENV_TEMPLATE.md`.
|
|
38
108
|
|
|
109
|
+
**Important:** because webpack injects `.env` values into the browser bundle, do **not** put secrets (like OAuth client secrets) into `.env`.
|
package/package.json
CHANGED
|
@@ -1,61 +1,85 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hale-commenting-system",
|
|
3
|
-
"version": "2.2.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "2.2.1",
|
|
4
|
+
"description": "An open source build scaffolding utility for web apps.",
|
|
5
|
+
"repository": "https://github.com/patternfly/patternfly-react-seed.git",
|
|
6
|
+
"homepage": "https://patternfly-react-seed.surge.sh",
|
|
7
|
+
"license": "MIT",
|
|
7
8
|
"bin": {
|
|
8
|
-
"hale-commenting": "./
|
|
9
|
+
"hale-commenting-system": "./scripts/integrate.js"
|
|
9
10
|
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist",
|
|
12
|
-
"bin",
|
|
13
|
-
"templates",
|
|
14
|
-
"README.md"
|
|
15
|
-
],
|
|
16
11
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"build
|
|
19
|
-
"
|
|
12
|
+
"prebuild": "npm run type-check && npm run clean",
|
|
13
|
+
"build": "webpack --config webpack.prod.js",
|
|
14
|
+
"start": "sirv dist --cors --single --host --port 8080",
|
|
15
|
+
"start:dev": "webpack serve --color --progress --config webpack.dev.js",
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"test:watch": "vitest",
|
|
18
|
+
"test:coverage": "vitest run --coverage",
|
|
19
|
+
"eslint": "eslint --ext .tsx,.js ./src/",
|
|
20
|
+
"lint": "npm run eslint",
|
|
21
|
+
"format": "prettier --check --write ./src/**/*.{tsx,ts}",
|
|
20
22
|
"type-check": "tsc --noEmit",
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"commenting",
|
|
26
|
-
"feedback",
|
|
27
|
-
"patternfly",
|
|
28
|
-
"github",
|
|
29
|
-
"jira",
|
|
30
|
-
"uxd"
|
|
31
|
-
],
|
|
32
|
-
"author": "Justin X. Hale",
|
|
33
|
-
"license": "MIT",
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "https://github.com/JustinXHale/pfseed-commenting-system.git"
|
|
23
|
+
"ci-checks": "npm run type-check && npm run lint && npm run test:coverage",
|
|
24
|
+
"build:bundle-profile": "webpack --config webpack.prod.js --profile --json > stats.json",
|
|
25
|
+
"bundle-profile:analyze": "npm run build:bundle-profile && webpack-bundle-analyzer ./stats.json",
|
|
26
|
+
"clean": "rimraf dist"
|
|
37
27
|
},
|
|
38
|
-
"
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"react-dom": "^
|
|
43
|
-
"
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
30
|
+
"@testing-library/react": "^16.2.0",
|
|
31
|
+
"@testing-library/user-event": "^14.6.1",
|
|
32
|
+
"@types/react-router-dom": "^5.3.3",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
34
|
+
"@typescript-eslint/parser": "^8.17.0",
|
|
35
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
36
|
+
"copy-webpack-plugin": "^12.0.2",
|
|
37
|
+
"css-loader": "^7.1.2",
|
|
38
|
+
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
39
|
+
"dotenv-webpack": "^8.1.0",
|
|
40
|
+
"eslint": "^8.57.1",
|
|
41
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
42
|
+
"eslint-plugin-react": "^7.37.2",
|
|
43
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
44
|
+
"html-webpack-plugin": "^5.6.3",
|
|
45
|
+
"imagemin": "^9.0.0",
|
|
46
|
+
"jsdom": "^25.0.1",
|
|
47
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
48
|
+
"postcss": "^8.4.49",
|
|
49
|
+
"prettier": "^3.4.2",
|
|
50
|
+
"prop-types": "^15.8.1",
|
|
51
|
+
"raw-loader": "^4.0.2",
|
|
52
|
+
"react-axe": "^3.5.4",
|
|
53
|
+
"react-router-dom": "^7.1.0",
|
|
54
|
+
"regenerator-runtime": "^0.14.1",
|
|
55
|
+
"rimraf": "^6.0.1",
|
|
56
|
+
"style-loader": "^4.0.0",
|
|
57
|
+
"svg-url-loader": "^8.0.0",
|
|
58
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
59
|
+
"ts-loader": "^9.5.1",
|
|
60
|
+
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
61
|
+
"tslib": "^2.8.1",
|
|
62
|
+
"typescript": "^5.7.2",
|
|
63
|
+
"url-loader": "^4.1.1",
|
|
64
|
+
"vite": "^6.4.1",
|
|
65
|
+
"vitest": "^4.0.5",
|
|
66
|
+
"webpack": "^5.97.0",
|
|
67
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
68
|
+
"webpack-cli": "^5.1.4",
|
|
69
|
+
"webpack-dev-server": "^5.2.1",
|
|
70
|
+
"webpack-merge": "^6.0.1",
|
|
71
|
+
"@babel/core": "^7.23.0",
|
|
72
|
+
"@babel/traverse": "^7.23.0",
|
|
73
|
+
"@babel/generator": "^7.23.0",
|
|
74
|
+
"@babel/types": "^7.23.0"
|
|
44
75
|
},
|
|
45
76
|
"dependencies": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"@types/node": "^20.19.27",
|
|
53
|
-
"@types/node-fetch": "^2.6.13",
|
|
54
|
-
"@types/react": "^18.2.45",
|
|
55
|
-
"@types/react-dom": "^18.2.18",
|
|
56
|
-
"typescript": "^5.9.3"
|
|
77
|
+
"@patternfly/react-core": "^6.4.0",
|
|
78
|
+
"@patternfly/react-icons": "^6.4.0",
|
|
79
|
+
"@patternfly/react-styles": "^6.4.0",
|
|
80
|
+
"react": "^18",
|
|
81
|
+
"react-dom": "^18",
|
|
82
|
+
"sirv-cli": "^3.0.0"
|
|
57
83
|
},
|
|
58
|
-
"
|
|
59
|
-
"node": ">=16.0.0"
|
|
60
|
-
}
|
|
84
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
61
85
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Hale Commenting System - Integration Script
|
|
2
|
+
|
|
3
|
+
This script automatically integrates the Hale Commenting System into a PatternFly React Seed project.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
After installing the package:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install hale-commenting-system
|
|
11
|
+
npx hale-commenting-system init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What it does
|
|
15
|
+
|
|
16
|
+
The script automatically modifies three files:
|
|
17
|
+
|
|
18
|
+
1. **src/app/index.tsx**
|
|
19
|
+
- Adds imports for `CommentProvider` and `GitHubAuthProvider`
|
|
20
|
+
- Wraps the Router with the providers
|
|
21
|
+
|
|
22
|
+
2. **src/app/routes.tsx**
|
|
23
|
+
- Adds a "Comments" route group to the navigation
|
|
24
|
+
|
|
25
|
+
3. **src/app/AppLayout/AppLayout.tsx**
|
|
26
|
+
- Adds imports for `CommentPanel` and `CommentOverlay`
|
|
27
|
+
- Wraps the Page content with CommentPanel and CommentOverlay
|
|
28
|
+
|
|
29
|
+
## Requirements
|
|
30
|
+
|
|
31
|
+
The script requires the following Babel packages (should be in devDependencies):
|
|
32
|
+
- `@babel/core`
|
|
33
|
+
- `@babel/traverse`
|
|
34
|
+
- `@babel/generator`
|
|
35
|
+
- `@babel/types`
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
|
|
39
|
+
- The script is idempotent - it can be run multiple times safely
|
|
40
|
+
- It detects if integration is already complete and skips those files
|
|
41
|
+
- No backups are created (users should use git for version control)
|
|
42
|
+
|