Major Refactoring. Test update
This commit is contained in:
Vendored
+3
@@ -2,6 +2,7 @@ import { existsSync, readdirSync, statSync } from "fs";
|
||||
import grabDirNames from "./grab-dir-names";
|
||||
import path from "path";
|
||||
import AppNames from "./grab-app-names";
|
||||
import pagePathTransform from "./page-path-transform";
|
||||
export default function grabAllPages(params) {
|
||||
const { PAGES_DIR } = grabDirNames();
|
||||
const pages = grabPageDirRecursively({ page_dir: PAGES_DIR });
|
||||
@@ -56,8 +57,10 @@ function grabPageFileObject({ file_path, }) {
|
||||
let file_name = url_path.split("/").pop();
|
||||
if (!file_name)
|
||||
return;
|
||||
const transformed_path = pagePathTransform({ page_path: file_path });
|
||||
return {
|
||||
local_path: file_path,
|
||||
transformed_path,
|
||||
url_path,
|
||||
file_name,
|
||||
};
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
type Params = {
|
||||
page_url?: string | string[];
|
||||
page_file_path?: string | string[];
|
||||
};
|
||||
export default function rewritePagesModule(params?: Params): Promise<void>;
|
||||
export {};
|
||||
|
||||
Vendored
+5
-3
@@ -2,10 +2,12 @@ import grabAllPages from "./grab-all-pages";
|
||||
import pagePathTransform from "./page-path-transform";
|
||||
import stripServerSideLogic from "../functions/bundler/strip-server-side-logic";
|
||||
export default async function rewritePagesModule(params) {
|
||||
const { page_url } = params || {};
|
||||
const { page_file_path } = params || {};
|
||||
let target_pages;
|
||||
if (page_url) {
|
||||
target_pages = Array.isArray(page_url) ? page_url : [page_url];
|
||||
if (page_file_path) {
|
||||
target_pages = Array.isArray(page_file_path)
|
||||
? page_file_path
|
||||
: [page_file_path];
|
||||
}
|
||||
else {
|
||||
const pages = grabAllPages({ exclude_api: true });
|
||||
|
||||
Reference in New Issue
Block a user