hale-commenting-system 2.2.1 → 2.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hale-commenting-system",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "An open source build scaffolding utility for web apps.",
5
5
  "repository": "https://github.com/patternfly/patternfly-react-seed.git",
6
6
  "homepage": "https://patternfly-react-seed.surge.sh",
@@ -67,17 +67,17 @@
67
67
  "webpack-bundle-analyzer": "^4.10.2",
68
68
  "webpack-cli": "^5.1.4",
69
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"
70
+ "webpack-merge": "^6.0.1"
75
71
  },
76
72
  "dependencies": {
77
73
  "@patternfly/react-core": "^6.4.0",
78
74
  "@patternfly/react-icons": "^6.4.0",
79
75
  "@patternfly/react-styles": "^6.4.0",
80
76
  "react": "^18",
77
+ "@babel/parser": "^7.23.0",
78
+ "@babel/traverse": "^7.23.0",
79
+ "@babel/generator": "^7.23.0",
80
+ "@babel/types": "^7.23.0",
81
81
  "react-dom": "^18",
82
82
  "sirv-cli": "^3.0.0"
83
83
  },
@@ -14,14 +14,14 @@ const { execSync } = require('child_process');
14
14
  // Check if required dependencies are available
15
15
  let parser, traverse, generate, types;
16
16
  try {
17
- const babel = require('@babel/core');
18
- parser = babel.parse;
17
+ parser = require('@babel/parser').parse;
19
18
  traverse = require('@babel/traverse').default;
20
19
  generate = require('@babel/generator').default;
21
20
  types = require('@babel/types');
22
21
  } catch (e) {
23
- console.error('❌ Error: @babel/core, @babel/traverse, and @babel/generator are required.');
24
- console.error(' Please install: npm install --save-dev @babel/core @babel/traverse @babel/generator @babel/types');
22
+ console.error('❌ Error: @babel/parser, @babel/traverse, @babel/generator, and @babel/types are required.');
23
+ console.error(' These should be included with hale-commenting-system package.');
24
+ console.error(' If the error persists, please report this issue.');
25
25
  process.exit(1);
26
26
  }
27
27
 
@@ -43,6 +43,8 @@ function findFile(filename, startDir = process.cwd()) {
43
43
  path.join(startDir, filename),
44
44
  path.join(startDir, 'src', filename),
45
45
  path.join(startDir, 'src', 'app', filename),
46
+ // Support for AppLayout subdirectory
47
+ path.join(startDir, 'src', 'app', 'AppLayout', filename),
46
48
  ];
47
49
 
48
50
  for (const filePath of possiblePaths) {
@@ -53,6 +55,30 @@ function findFile(filename, startDir = process.cwd()) {
53
55
  return null;
54
56
  }
55
57
 
58
+ function getPackageVersion() {
59
+ try {
60
+ // Get the script's directory and find package.json relative to it
61
+ const scriptDir = __dirname || path.dirname(require.resolve('./integrate.js'));
62
+ const packageJsonPath = path.join(scriptDir, '..', 'package.json');
63
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
64
+ return packageJson.version || 'unknown';
65
+ } catch (e) {
66
+ // Fallback: try to find package.json in current working directory or parent
67
+ try {
68
+ const cwdPackageJson = path.join(process.cwd(), 'package.json');
69
+ if (fs.existsSync(cwdPackageJson)) {
70
+ const packageJson = JSON.parse(fs.readFileSync(cwdPackageJson, 'utf8'));
71
+ if (packageJson.name === 'hale-commenting-system') {
72
+ return packageJson.version || 'unknown';
73
+ }
74
+ }
75
+ } catch (e2) {
76
+ // ignore
77
+ }
78
+ return 'unknown';
79
+ }
80
+ }
81
+
56
82
  function modifyIndexTsx(filePath) {
57
83
  const content = fs.readFileSync(filePath, 'utf8');
58
84
 
@@ -341,9 +367,15 @@ function modifyAppLayoutTsx(filePath) {
341
367
  }
342
368
 
343
369
  async function main() {
344
- console.log('\n╔══════════════════════════════════════════════════════════╗');
345
- console.log('║ 🎨 Hale Commenting System - Integration ║');
346
- console.log('╚══════════════════════════════════════════════════════════╝\n');
370
+ const version = getPackageVersion();
371
+ const title = `Hale Commenting System (v.${version})`;
372
+ const titleLength = title.length;
373
+ const borderLength = Math.max(titleLength + 4, 54);
374
+ const padding = Math.floor((borderLength - titleLength - 2) / 2);
375
+
376
+ console.log('\n' + '╔' + '═'.repeat(borderLength - 2) + '╗');
377
+ console.log('║' + ' '.repeat(padding) + title + ' '.repeat(borderLength - titleLength - padding - 2) + '║');
378
+ console.log('╚' + '═'.repeat(borderLength - 2) + '╝\n');
347
379
 
348
380
  console.log('We\'ll automatically integrate the commenting system into your project.\n');
349
381
  console.log('This will modify the following files:');
@@ -363,7 +395,7 @@ async function main() {
363
395
 
364
396
  const indexPath = findFile('index.tsx');
365
397
  const routesPath = findFile('routes.tsx');
366
- const appLayoutPath = findFile('AppLayout.tsx');
398
+ const appLayoutPath = findFile('AppLayout/AppLayout.tsx') || findFile('AppLayout.tsx');
367
399
 
368
400
  if (!indexPath) {
369
401
  console.error('❌ Could not find src/app/index.tsx');