Quellcode durchsuchen

Created shouldCreateWipPage() utility

Shun Miyazawa vor 2 Jahren
Ursprung
Commit
80f057590b

+ 1 - 0
packages/core/src/utils/index.ts

@@ -13,3 +13,4 @@ export * as pageUtils from './page-utils';
 export * from './basic-interceptor';
 export * from './browser-utils';
 export * from './growi-theme-metadata';
+export * from './should-create-wip-page';

+ 14 - 0
packages/core/src/utils/should-create-wip-page.ts

@@ -0,0 +1,14 @@
+import { checkTemplatePath } from './template-checker';
+
+/**
+ * Returns Whether to create pages with the wip flag
+ * @param {string} path
+ * @returns {boolean}
+ */
+export const shouldCreateWipPage = (path?: string): boolean => {
+  if (path == null) {
+    return true;
+  }
+
+  return !(checkTemplatePath(path) || path === '/Sidebar');
+};