@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @se-studio/project-build
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 99cfb6c: `generate-marketing-routes --write` keeps generated person pages when a people path has no index page.
8
+
3
9
  ## 1.3.0
4
10
 
5
11
  ### Minor Changes
@@ -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 its page was not written by this generator.
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
- const page = ['page.ts', 'page.tsx']
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 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/project-build",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Build tools and management scripts for SE Studio projects",
5
5
  "repository": {
6
6
  "type": "git",