@se-studio/project-build 1.3.0 → 1.3.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/CHANGELOG.md +6 -0
- package/dist/marketing-routes.mjs +28 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -604,9 +604,35 @@ function supportDrift(appRoot, config) {
|
|
|
604
604
|
return drift;
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
+
/**
|
|
608
|
+
* A people base with `index: false` has no `people/page.ts`. The person
|
|
609
|
+
* pages live under that folder, so the folder itself must stay.
|
|
610
|
+
*
|
|
611
|
+
* @param {string} dir
|
|
612
|
+
*/
|
|
613
|
+
function hasGeneratedPage(dir) {
|
|
614
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
615
|
+
const full = path.join(dir, entry.name);
|
|
616
|
+
if (entry.isDirectory()) {
|
|
617
|
+
if (hasGeneratedPage(full)) {
|
|
618
|
+
return true;
|
|
619
|
+
}
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
if (!entry.name.endsWith('.ts') && !entry.name.endsWith('.tsx')) {
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
if (fs.readFileSync(full, 'utf8').startsWith(GENERATED_MARK)) {
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
631
|
+
|
|
607
632
|
/**
|
|
608
633
|
* Legacy hand routes the CMS generator replaces. A folder is removed only
|
|
609
|
-
* when
|
|
634
|
+
* when nothing in it was written by this generator. A generated person page
|
|
635
|
+
* with no index page is enough to keep `people/`.
|
|
610
636
|
*
|
|
611
637
|
* @param {string} appRoot
|
|
612
638
|
* @returns {string[]}
|
|
@@ -626,11 +652,7 @@ function removeStaleHandRoutes(appRoot) {
|
|
|
626
652
|
if (!fs.existsSync(dir)) {
|
|
627
653
|
continue;
|
|
628
654
|
}
|
|
629
|
-
|
|
630
|
-
.map((name) => path.join(dir, name))
|
|
631
|
-
.find((file) => fs.existsSync(file));
|
|
632
|
-
const text = page ? fs.readFileSync(page, 'utf8') : '';
|
|
633
|
-
if (text.startsWith(GENERATED_MARK)) {
|
|
655
|
+
if (hasGeneratedPage(dir)) {
|
|
634
656
|
continue;
|
|
635
657
|
}
|
|
636
658
|
fs.rmSync(dir, { recursive: true, force: true });
|