hale-commenting-system 2.1.1 ā 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 -18
- package/bin/generators.js +0 -193
- 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 -349
- 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 -18
- package/dist/cli/generators.js +0 -193
- 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 -349
- 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/dist/cli/generators.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.generateFiles = generateFiles;
|
|
37
|
-
exports.integrateIntoProject = integrateIntoProject;
|
|
38
|
-
const fs = __importStar(require("fs"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
async function generateFiles(config) {
|
|
41
|
-
const cwd = process.cwd();
|
|
42
|
-
// Generate .env file (client-safe)
|
|
43
|
-
const envPath = path.join(cwd, '.env');
|
|
44
|
-
const envContent = `# GitHub OAuth (client-side; safe to expose)
|
|
45
|
-
VITE_GITHUB_CLIENT_ID=${config.github.clientId}
|
|
46
|
-
|
|
47
|
-
# Target repo for Issues/Comments
|
|
48
|
-
VITE_GITHUB_OWNER=${config.github.owner}
|
|
49
|
-
VITE_GITHUB_REPO=${config.github.repo}
|
|
50
|
-
|
|
51
|
-
# Jira Base URL
|
|
52
|
-
VITE_JIRA_BASE_URL=${config.jira.baseUrl}
|
|
53
|
-
`;
|
|
54
|
-
// Check if .env exists and append or create
|
|
55
|
-
if (fs.existsSync(envPath)) {
|
|
56
|
-
const existing = fs.readFileSync(envPath, 'utf-8');
|
|
57
|
-
// Only add if not already present
|
|
58
|
-
if (!existing.includes('VITE_GITHUB_CLIENT_ID')) {
|
|
59
|
-
fs.appendFileSync(envPath, '\n' + envContent);
|
|
60
|
-
console.log(' ā
Updated .env file');
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
console.log(' ā ļø .env already contains commenting system config');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
fs.writeFileSync(envPath, envContent);
|
|
68
|
-
console.log(' ā
Created .env file');
|
|
69
|
-
}
|
|
70
|
-
// Generate .env.server file (secrets)
|
|
71
|
-
const envServerPath = path.join(cwd, '.env.server');
|
|
72
|
-
let envServerContent = `# GitHub OAuth Client Secret (server-only)
|
|
73
|
-
GITHUB_CLIENT_SECRET=${config.github.clientSecret}
|
|
74
|
-
|
|
75
|
-
# Jira API Token (server-only)
|
|
76
|
-
JIRA_API_TOKEN=${config.jira.apiToken}
|
|
77
|
-
`;
|
|
78
|
-
if (config.jira.email) {
|
|
79
|
-
envServerContent += `JIRA_EMAIL=${config.jira.email}\n`;
|
|
80
|
-
}
|
|
81
|
-
if (fs.existsSync(envServerPath)) {
|
|
82
|
-
const existing = fs.readFileSync(envServerPath, 'utf-8');
|
|
83
|
-
if (!existing.includes('GITHUB_CLIENT_SECRET')) {
|
|
84
|
-
fs.appendFileSync(envServerPath, '\n' + envServerContent);
|
|
85
|
-
console.log(' ā
Updated .env.server file');
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
console.log(' ā ļø .env.server already contains commenting system config');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
fs.writeFileSync(envServerPath, envServerContent);
|
|
93
|
-
console.log(' ā
Created .env.server file');
|
|
94
|
-
}
|
|
95
|
-
// Ensure .env.server is in .gitignore
|
|
96
|
-
const gitignorePath = path.join(cwd, '.gitignore');
|
|
97
|
-
if (fs.existsSync(gitignorePath)) {
|
|
98
|
-
const gitignore = fs.readFileSync(gitignorePath, 'utf-8');
|
|
99
|
-
if (!gitignore.includes('.env.server')) {
|
|
100
|
-
fs.appendFileSync(gitignorePath, '\n.env.server\n');
|
|
101
|
-
console.log(' ā
Added .env.server to .gitignore');
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
fs.writeFileSync(gitignorePath, '.env.server\n');
|
|
106
|
-
console.log(' ā
Created .gitignore with .env.server');
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async function integrateIntoProject() {
|
|
110
|
-
const cwd = process.cwd();
|
|
111
|
-
const webpackDevPath = path.join(cwd, 'webpack.dev.js');
|
|
112
|
-
if (!fs.existsSync(webpackDevPath)) {
|
|
113
|
-
console.error(' ā webpack.dev.js not found. Cannot auto-integrate.');
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
// Read webpack.dev.js
|
|
117
|
-
let webpackContent = fs.readFileSync(webpackDevPath, 'utf-8');
|
|
118
|
-
// Check if already integrated
|
|
119
|
-
if (webpackContent.includes('/api/github-oauth-callback') || webpackContent.includes('/api/jira-issue')) {
|
|
120
|
-
console.log(' ā ļø webpack.dev.js already appears to have commenting system integration');
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
// Read the template
|
|
124
|
-
// In compiled output, templates are in the package root (same level as bin/)
|
|
125
|
-
const packageRoot = path.resolve(__dirname, '..');
|
|
126
|
-
const templatePath = path.join(packageRoot, 'templates', 'webpack-middleware.js');
|
|
127
|
-
if (!fs.existsSync(templatePath)) {
|
|
128
|
-
console.log(' ā ļø Template file not found. Manual integration required.');
|
|
129
|
-
console.log(' See README for webpack.dev.js integration instructions.\n');
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const templateContent = fs.readFileSync(templatePath, 'utf-8');
|
|
133
|
-
// Find the setupMiddlewares function and inject our code
|
|
134
|
-
// Look for: setupMiddlewares: (middlewares, devServer) => {
|
|
135
|
-
const setupMiddlewaresRegex = /(setupMiddlewares\s*:\s*\([^)]+\)\s*=>\s*\{)/;
|
|
136
|
-
const match = webpackContent.match(setupMiddlewaresRegex);
|
|
137
|
-
if (!match) {
|
|
138
|
-
console.log(' ā ļø Could not find setupMiddlewares in webpack.dev.js');
|
|
139
|
-
console.log(' š Manual integration required. See templates/webpack-middleware.js\n');
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
// Find where to inject (after express.json() setup, before return middlewares)
|
|
143
|
-
const expressJsonMatch = webpackContent.match(/devServer\.app\.use\(express\.json\(\)\);/);
|
|
144
|
-
if (expressJsonMatch) {
|
|
145
|
-
// Inject after express.json()
|
|
146
|
-
const insertIndex = expressJsonMatch.index + expressJsonMatch[0].length;
|
|
147
|
-
const before = webpackContent.substring(0, insertIndex);
|
|
148
|
-
const after = webpackContent.substring(insertIndex);
|
|
149
|
-
// Extract just the middleware code from template (skip comments)
|
|
150
|
-
const middlewareCode = templateContent
|
|
151
|
-
.replace(/^\/\/.*$/gm, '') // Remove comment lines
|
|
152
|
-
.trim()
|
|
153
|
-
.split('\n')
|
|
154
|
-
.filter(line => line.trim() && !line.trim().startsWith('//'))
|
|
155
|
-
.join('\n');
|
|
156
|
-
webpackContent = before + '\n\n' + middlewareCode + '\n' + after;
|
|
157
|
-
fs.writeFileSync(webpackDevPath, webpackContent);
|
|
158
|
-
console.log(' ā
Updated webpack.dev.js with server middleware');
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
// Try to inject at the beginning of setupMiddlewares
|
|
162
|
-
const insertIndex = match.index + match[0].length;
|
|
163
|
-
const before = webpackContent.substring(0, insertIndex);
|
|
164
|
-
const after = webpackContent.substring(insertIndex);
|
|
165
|
-
// Add dotenv loading and express setup if not present
|
|
166
|
-
let middlewareCode = templateContent.trim();
|
|
167
|
-
// Check if dotenv is already loaded
|
|
168
|
-
if (!webpackContent.includes('dotenv.config')) {
|
|
169
|
-
middlewareCode = `// Load env vars for local OAuth/token exchange
|
|
170
|
-
try {
|
|
171
|
-
const dotenv = require('dotenv');
|
|
172
|
-
dotenv.config({ path: path.resolve(__dirname, '.env') });
|
|
173
|
-
dotenv.config({ path: path.resolve(__dirname, '.env.server'), override: true });
|
|
174
|
-
} catch (e) {
|
|
175
|
-
// no-op
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const express = require('express');
|
|
179
|
-
devServer.app.use(express.json());
|
|
180
|
-
|
|
181
|
-
` + middlewareCode;
|
|
182
|
-
}
|
|
183
|
-
else if (!webpackContent.includes('express.json()')) {
|
|
184
|
-
middlewareCode = `const express = require('express');
|
|
185
|
-
devServer.app.use(express.json());
|
|
186
|
-
|
|
187
|
-
` + middlewareCode;
|
|
188
|
-
}
|
|
189
|
-
webpackContent = before + '\n\n' + middlewareCode + '\n' + after;
|
|
190
|
-
fs.writeFileSync(webpackDevPath, webpackContent);
|
|
191
|
-
console.log(' ā
Updated webpack.dev.js with server middleware');
|
|
192
|
-
}
|
|
193
|
-
}
|
package/dist/cli/index.d.ts
DELETED
package/dist/cli/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
const detect = __importStar(require("./detect"));
|
|
38
|
-
const onboarding = __importStar(require("./onboarding"));
|
|
39
|
-
const args = process.argv.slice(2);
|
|
40
|
-
const command = args[0] || 'init';
|
|
41
|
-
async function main() {
|
|
42
|
-
if (command === 'init') {
|
|
43
|
-
// Check if we're in a PatternFly Seed project
|
|
44
|
-
const isPFSeed = detect.detectPatternFlySeed();
|
|
45
|
-
if (!isPFSeed) {
|
|
46
|
-
console.error('ā Error: This package is designed for PatternFly Seed projects.');
|
|
47
|
-
console.error('Please run this command from a PatternFly Seed project directory.');
|
|
48
|
-
process.exit(1);
|
|
49
|
-
}
|
|
50
|
-
console.log('š Hale Commenting System - Onboarding\n');
|
|
51
|
-
await onboarding.runOnboarding();
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
console.log('Usage: hale-commenting-system [init]');
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
main().catch((error) => {
|
|
59
|
-
console.error('ā Error:', error.message);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
});
|
package/dist/cli/onboarding.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function runOnboarding(): Promise<void>;
|
package/dist/cli/onboarding.js
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.runOnboarding = runOnboarding;
|
|
40
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
41
|
-
const validators = __importStar(require("./validators"));
|
|
42
|
-
const generators = __importStar(require("./generators"));
|
|
43
|
-
const detect_1 = require("./detect");
|
|
44
|
-
async function runOnboarding() {
|
|
45
|
-
// Welcome & Explanation
|
|
46
|
-
console.log('š Welcome to Hale Commenting System!\n');
|
|
47
|
-
console.log('This commenting system allows you to:');
|
|
48
|
-
console.log(' ⢠Add comments directly on your design pages');
|
|
49
|
-
console.log(' ⢠Sync comments with GitHub Issues');
|
|
50
|
-
console.log(' ⢠Link Jira tickets to pages');
|
|
51
|
-
console.log(' ⢠Store design goals and context\n');
|
|
52
|
-
console.log('Why GitHub?');
|
|
53
|
-
console.log(' We use GitHub Issues to store and sync all comments. When you add a comment');
|
|
54
|
-
console.log(' on a page, it creates a GitHub Issue. This allows comments to persist, sync');
|
|
55
|
-
console.log(' across devices, and be managed like any other GitHub Issue.\n');
|
|
56
|
-
console.log('Why Jira?');
|
|
57
|
-
console.log(' You can link Jira tickets to specific pages or sections. This helps connect');
|
|
58
|
-
console.log(' design work to development tracking and provides context for reviewers.\n');
|
|
59
|
-
// Step 1: Project Status Check
|
|
60
|
-
console.log('š Step 1: Project Setup Check\n');
|
|
61
|
-
const hasProject = await inquirer_1.default.prompt([
|
|
62
|
-
{
|
|
63
|
-
type: 'list',
|
|
64
|
-
name: 'hasProject',
|
|
65
|
-
message: 'Do you have a PatternFly Seed project set up locally?',
|
|
66
|
-
choices: [
|
|
67
|
-
{ name: 'Yes, I have it set up', value: 'yes' },
|
|
68
|
-
{ name: 'No, I need help setting it up', value: 'no' }
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
]);
|
|
72
|
-
if (hasProject.hasProject === 'no') {
|
|
73
|
-
console.log('\nš Setting up PatternFly Seed:\n');
|
|
74
|
-
console.log('1. Fork the PatternFly Seed repository:');
|
|
75
|
-
console.log(' Visit: https://github.com/patternfly/patternfly-react-seed');
|
|
76
|
-
console.log(' Click "Fork" in the top right\n');
|
|
77
|
-
console.log('2. Clone your fork locally:');
|
|
78
|
-
console.log(' git clone https://github.com/YOUR_USERNAME/patternfly-react-seed.git');
|
|
79
|
-
console.log(' cd patternfly-react-seed\n');
|
|
80
|
-
console.log('3. Install dependencies:');
|
|
81
|
-
console.log(' npm install\n');
|
|
82
|
-
console.log('4. Run this setup again:');
|
|
83
|
-
console.log(' npx hale-commenting-system init\n');
|
|
84
|
-
process.exit(0);
|
|
85
|
-
}
|
|
86
|
-
// Check if it's actually a PF Seed project
|
|
87
|
-
if (!(0, detect_1.detectPatternFlySeed)()) {
|
|
88
|
-
console.error('ā Error: This doesn\'t appear to be a PatternFly Seed project.');
|
|
89
|
-
console.error('Please run this command from a PatternFly Seed project directory.');
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}
|
|
92
|
-
// Detect project setup type
|
|
93
|
-
const gitInfo = (0, detect_1.detectGitRemote)();
|
|
94
|
-
const setupType = (0, detect_1.detectProjectSetup)();
|
|
95
|
-
let projectSetup = 'unknown';
|
|
96
|
-
let owner = gitInfo?.owner;
|
|
97
|
-
let repo = gitInfo?.repo;
|
|
98
|
-
if (setupType === 'none' || !gitInfo) {
|
|
99
|
-
// No git remote - need to set up
|
|
100
|
-
const setupAnswer = await inquirer_1.default.prompt([
|
|
101
|
-
{
|
|
102
|
-
type: 'list',
|
|
103
|
-
name: 'setupType',
|
|
104
|
-
message: 'How did you set up your PatternFly Seed project?',
|
|
105
|
-
choices: [
|
|
106
|
-
{ name: 'I forked the PatternFly Seed repo on GitHub', value: 'forked' },
|
|
107
|
-
{ name: 'I cloned the PatternFly Seed repo locally', value: 'cloned' },
|
|
108
|
-
{ name: 'I\'m not sure', value: 'unknown' }
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
]);
|
|
112
|
-
projectSetup = setupAnswer.setupType;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
projectSetup = setupType;
|
|
116
|
-
}
|
|
117
|
-
// Handle different setup types
|
|
118
|
-
if (projectSetup === 'forked') {
|
|
119
|
-
// Ask for owner/repo if not detected
|
|
120
|
-
if (!owner || !repo) {
|
|
121
|
-
const forkAnswers = await inquirer_1.default.prompt([
|
|
122
|
-
{
|
|
123
|
-
type: 'input',
|
|
124
|
-
name: 'owner',
|
|
125
|
-
message: 'What is your GitHub username or organization name?',
|
|
126
|
-
default: owner,
|
|
127
|
-
validate: (input) => {
|
|
128
|
-
if (!input.trim())
|
|
129
|
-
return 'Owner is required';
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
type: 'input',
|
|
135
|
-
name: 'repo',
|
|
136
|
-
message: 'What is the name of your forked repository?',
|
|
137
|
-
default: repo,
|
|
138
|
-
validate: (input) => {
|
|
139
|
-
if (!input.trim())
|
|
140
|
-
return 'Repository name is required';
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
]);
|
|
145
|
-
owner = forkAnswers.owner;
|
|
146
|
-
repo = forkAnswers.repo;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
console.log(`\nā
Detected repository: ${owner}/${repo}\n`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
else if (projectSetup === 'cloned') {
|
|
153
|
-
console.log('\nš Since you cloned the repo, you\'ll need to create your own GitHub repository.\n');
|
|
154
|
-
console.log('Steps:');
|
|
155
|
-
console.log('1. Create a new repository on GitHub');
|
|
156
|
-
console.log('2. Add it as a remote: git remote add origin <your-repo-url>');
|
|
157
|
-
console.log('3. Push your code: git push -u origin main\n');
|
|
158
|
-
const hasCreated = await inquirer_1.default.prompt([
|
|
159
|
-
{
|
|
160
|
-
type: 'confirm',
|
|
161
|
-
name: 'created',
|
|
162
|
-
message: 'Have you created and pushed to your GitHub repository?',
|
|
163
|
-
default: false
|
|
164
|
-
}
|
|
165
|
-
]);
|
|
166
|
-
if (!hasCreated.created) {
|
|
167
|
-
console.log('\nPlease complete the steps above and run this setup again.');
|
|
168
|
-
process.exit(0);
|
|
169
|
-
}
|
|
170
|
-
// Ask for owner/repo
|
|
171
|
-
const repoAnswers = await inquirer_1.default.prompt([
|
|
172
|
-
{
|
|
173
|
-
type: 'input',
|
|
174
|
-
name: 'owner',
|
|
175
|
-
message: 'What is your GitHub username or organization name?',
|
|
176
|
-
validate: (input) => {
|
|
177
|
-
if (!input.trim())
|
|
178
|
-
return 'Owner is required';
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
type: 'input',
|
|
184
|
-
name: 'repo',
|
|
185
|
-
message: 'What is the name of your GitHub repository?',
|
|
186
|
-
validate: (input) => {
|
|
187
|
-
if (!input.trim())
|
|
188
|
-
return 'Repository name is required';
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
]);
|
|
193
|
-
owner = repoAnswers.owner;
|
|
194
|
-
repo = repoAnswers.repo;
|
|
195
|
-
}
|
|
196
|
-
else if (projectSetup === 'unknown') {
|
|
197
|
-
// Try to detect from git
|
|
198
|
-
if (gitInfo && gitInfo.owner && gitInfo.repo) {
|
|
199
|
-
console.log(`\nā
Detected repository: ${gitInfo.owner}/${gitInfo.repo}\n`);
|
|
200
|
-
owner = gitInfo.owner;
|
|
201
|
-
repo = gitInfo.repo;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
// Ask for owner/repo
|
|
205
|
-
const repoAnswers = await inquirer_1.default.prompt([
|
|
206
|
-
{
|
|
207
|
-
type: 'input',
|
|
208
|
-
name: 'owner',
|
|
209
|
-
message: 'What is your GitHub username or organization name?',
|
|
210
|
-
validate: (input) => {
|
|
211
|
-
if (!input.trim())
|
|
212
|
-
return 'Owner is required';
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
type: 'input',
|
|
218
|
-
name: 'repo',
|
|
219
|
-
message: 'What is the name of your GitHub repository?',
|
|
220
|
-
validate: (input) => {
|
|
221
|
-
if (!input.trim())
|
|
222
|
-
return 'Repository name is required';
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
]);
|
|
227
|
-
owner = repoAnswers.owner;
|
|
228
|
-
repo = repoAnswers.repo;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// Step 2: GitHub OAuth Setup
|
|
232
|
-
console.log('\nš¦ Step 2: GitHub OAuth Setup\n');
|
|
233
|
-
console.log('To sync comments with GitHub Issues, we need to authenticate with GitHub.');
|
|
234
|
-
console.log('This requires creating a GitHub OAuth App.\n');
|
|
235
|
-
console.log('Instructions:');
|
|
236
|
-
console.log('1. Visit: https://github.com/settings/developers');
|
|
237
|
-
console.log('2. Click "New OAuth App"');
|
|
238
|
-
console.log('3. Fill in the form:');
|
|
239
|
-
console.log(' - Application name: Your app name (e.g., "My Design Comments")');
|
|
240
|
-
console.log(' - Homepage URL: http://localhost:9000 (or your dev server URL)');
|
|
241
|
-
console.log(' - Authorization callback URL: http://localhost:9000/api/github-oauth-callback');
|
|
242
|
-
console.log('4. Click "Register application"');
|
|
243
|
-
console.log('5. Copy the Client ID and generate a Client Secret\n');
|
|
244
|
-
const githubAnswers = await inquirer_1.default.prompt([
|
|
245
|
-
{
|
|
246
|
-
type: 'input',
|
|
247
|
-
name: 'clientId',
|
|
248
|
-
message: 'GitHub OAuth Client ID:',
|
|
249
|
-
validate: (input) => {
|
|
250
|
-
if (!input.trim())
|
|
251
|
-
return 'Client ID is required';
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
type: 'password',
|
|
257
|
-
name: 'clientSecret',
|
|
258
|
-
message: 'GitHub OAuth Client Secret:',
|
|
259
|
-
mask: '*',
|
|
260
|
-
validate: (input) => {
|
|
261
|
-
if (!input.trim())
|
|
262
|
-
return 'Client Secret is required';
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
]);
|
|
267
|
-
// Validate GitHub credentials
|
|
268
|
-
console.log('\nš Validating GitHub credentials...');
|
|
269
|
-
const githubValid = await validators.validateGitHubCredentials(githubAnswers.clientId, githubAnswers.clientSecret, owner, repo);
|
|
270
|
-
if (!githubValid) {
|
|
271
|
-
console.error('ā GitHub validation failed. Please check your credentials and try again.');
|
|
272
|
-
process.exit(1);
|
|
273
|
-
}
|
|
274
|
-
console.log('ā
GitHub credentials validated!\n');
|
|
275
|
-
// Step 3: Jira Setup
|
|
276
|
-
console.log('š« Step 3: Jira Setup\n');
|
|
277
|
-
console.log('You can link Jira tickets to pages in your design. This helps connect');
|
|
278
|
-
console.log('design work to development tracking.\n');
|
|
279
|
-
console.log('For Red Hat Jira, generate a Personal Access Token:');
|
|
280
|
-
console.log('1. Visit: https://issues.redhat.com/secure/ViewProfile.jspa');
|
|
281
|
-
console.log('2. Click "Personal Access Tokens" in the left sidebar');
|
|
282
|
-
console.log('3. Click "Create token"');
|
|
283
|
-
console.log('4. Give it a name (e.g., "Hale Commenting System")');
|
|
284
|
-
console.log('5. Remove expiration (or set a long expiration)');
|
|
285
|
-
console.log('6. Click "Create" and copy the token\n');
|
|
286
|
-
console.log('Note: We use Bearer token authentication (no email required for Red Hat Jira).\n');
|
|
287
|
-
const jiraAnswers = await inquirer_1.default.prompt([
|
|
288
|
-
{
|
|
289
|
-
type: 'input',
|
|
290
|
-
name: 'baseUrl',
|
|
291
|
-
message: 'Jira Base URL (press Enter for Red Hat Jira):',
|
|
292
|
-
default: 'https://issues.redhat.com',
|
|
293
|
-
validate: (input) => {
|
|
294
|
-
if (!input.trim())
|
|
295
|
-
return 'Base URL is required';
|
|
296
|
-
try {
|
|
297
|
-
new URL(input);
|
|
298
|
-
return true;
|
|
299
|
-
}
|
|
300
|
-
catch {
|
|
301
|
-
return 'Please enter a valid URL';
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
type: 'password',
|
|
307
|
-
name: 'apiToken',
|
|
308
|
-
message: 'Jira API Token:',
|
|
309
|
-
mask: '*',
|
|
310
|
-
validate: (input) => {
|
|
311
|
-
if (!input.trim())
|
|
312
|
-
return 'API Token is required';
|
|
313
|
-
return true;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
]);
|
|
317
|
-
// Validate Jira credentials
|
|
318
|
-
console.log('\nš Validating Jira credentials...');
|
|
319
|
-
const jiraValid = await validators.validateJiraCredentials(jiraAnswers.baseUrl, jiraAnswers.apiToken, undefined // No email for Bearer token
|
|
320
|
-
);
|
|
321
|
-
if (!jiraValid) {
|
|
322
|
-
console.error('ā Jira validation failed. Please check your credentials and try again.');
|
|
323
|
-
process.exit(1);
|
|
324
|
-
}
|
|
325
|
-
console.log('ā
Jira credentials validated!\n');
|
|
326
|
-
// Step 4: Generate files
|
|
327
|
-
console.log('š Step 4: Generating configuration files...\n');
|
|
328
|
-
await generators.generateFiles({
|
|
329
|
-
github: {
|
|
330
|
-
clientId: githubAnswers.clientId,
|
|
331
|
-
clientSecret: githubAnswers.clientSecret,
|
|
332
|
-
owner: owner,
|
|
333
|
-
repo: repo
|
|
334
|
-
},
|
|
335
|
-
jira: {
|
|
336
|
-
baseUrl: jiraAnswers.baseUrl,
|
|
337
|
-
apiToken: jiraAnswers.apiToken,
|
|
338
|
-
email: undefined // Not used for Bearer token
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
// Step 5: Integrate into project
|
|
342
|
-
console.log('š§ Step 5: Integrating into PatternFly Seed project...\n');
|
|
343
|
-
await generators.integrateIntoProject();
|
|
344
|
-
console.log('\nā
Setup complete!');
|
|
345
|
-
console.log('\nNext steps:');
|
|
346
|
-
console.log('1. Start your dev server: npm run start:dev');
|
|
347
|
-
console.log(' (If it\'s already running, restart it to load the new configuration)');
|
|
348
|
-
console.log('2. The commenting system will be available in your app!\n');
|
|
349
|
-
}
|
package/dist/cli/postinstall.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const detect = __importStar(require("./detect"));
|
|
40
|
-
const onboarding = __importStar(require("./onboarding"));
|
|
41
|
-
async function main() {
|
|
42
|
-
const cwd = process.cwd();
|
|
43
|
-
const envPath = path.join(cwd, '.env');
|
|
44
|
-
// Check if already configured (has GitHub client ID in .env)
|
|
45
|
-
if (fs.existsSync(envPath)) {
|
|
46
|
-
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
47
|
-
if (envContent.includes('VITE_GITHUB_CLIENT_ID')) {
|
|
48
|
-
// Already configured, skip onboarding
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Check if we're in a PatternFly Seed project
|
|
53
|
-
const isPFSeed = detect.detectPatternFlySeed();
|
|
54
|
-
if (!isPFSeed) {
|
|
55
|
-
// Not a PF Seed project, skip silently (might be installing in a different context)
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
// Run onboarding
|
|
59
|
-
console.log('š Hale Commenting System - First-time setup\n');
|
|
60
|
-
await onboarding.runOnboarding();
|
|
61
|
-
}
|
|
62
|
-
main().catch((error) => {
|
|
63
|
-
// Don't fail the install if onboarding has issues
|
|
64
|
-
console.error('ā ļø Onboarding error (non-fatal):', error.message);
|
|
65
|
-
});
|
package/dist/cli/validators.d.ts
DELETED