hale-commenting-system 2.2.1 → 2.2.2
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 +1 -1
- package/scripts/integrate.js +36 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hale-commenting-system",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
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",
|
package/scripts/integrate.js
CHANGED
|
@@ -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
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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');
|