nextpress-core 3.0.1 → 3.1.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/cli/np-install.js CHANGED
@@ -33,3 +33,5 @@ write(
33
33
  path.join(__dirname, '..', 'lib', 'wp-lib', 'src'),
34
34
  path.join(process.cwd(), 'wp', 'wp-content', 'themes', 'nextpress_theme', '.nextpress')
35
35
  )
36
+
37
+ console.log('Nextpress installation successful.');
@@ -0,0 +1,23 @@
1
+ # ==========================================
2
+ # Database Configuration (MySQL)
3
+ # ==========================================
4
+
5
+ MYSQL_ROOT_PASSWORD={{MYSQL_ROOT_PASSWORD}}
6
+ MYSQL_DATABASE={{MYSQL_DATABASE}}
7
+
8
+ # ==========================================
9
+ # Domain Configuration
10
+ # ==========================================
11
+ DOMAIN_NAME={{DOMAIN_NAME}}
12
+ PROTOCOL={{PROTOCOL}}
13
+
14
+ # ==========================================
15
+ # WordPress / WP-CLI Configuration
16
+ # ==========================================
17
+ WP_SITE_URL=${PROTOCOL}://${DOMAIN_NAME}
18
+ WP_SITE_TITLE={{WP_SITE_TITLE}}
19
+ WP_ADMIN_USER={{WP_ADMIN_USER}}
20
+ WP_ADMIN_PASSWORD={{WP_ADMIN_PASSWORD}}
21
+ WP_ADMIN_EMAIL={{WP_ADMIN_EMAIL}}
22
+
23
+ CROSS_CONTAINER_API_KEY={{CROSS_CONTAINER_API_KEY}}
@@ -116,6 +116,7 @@ services:
116
116
  DATABASE_URL: mysql://root:${MYSQL_ROOT_PASSWORD}@db:3306/${MYSQL_DATABASE}
117
117
  WP_SERVICE_URL: http://wordpress:80
118
118
  WP_SITE_URL: ${WP_SITE_URL}
119
+ DOMAIN_NAME: ${DOMAIN_NAME}
119
120
  CROSS_CONTAINER_API_KEY: ${CROSS_CONTAINER_API_KEY}
120
121
  healthcheck:
121
122
  test: ["CMD-SHELL", "wget --spider -q http://0.0.0.0:3000 || exit 1"]
@@ -138,10 +139,12 @@ services:
138
139
  next-js:
139
140
  condition: service_healthy
140
141
  ports:
141
- - "8080:80"
142
+ - "80:80"
142
143
  volumes:
143
144
  - ./node_modules/nextpress-core/lib/container-lib/nginx.conf:/etc/nginx/conf.d/default.conf:ro
144
145
  - ./nginx.extend.conf:/etc/nginx/snippets/extend.conf:ro
146
+ environment:
147
+ DOMAIN_NAME: ${DOMAIN_NAME}
145
148
  healthcheck:
146
149
  test: ["CMD-SHELL", "pgrep nginx || exit 1"]
147
150
  interval: 30s
@@ -1,5 +1,7 @@
1
1
  server {
2
2
  listen 80;
3
+ server_name ${DOMAIN_NAME};
4
+
3
5
  access_log off;
4
6
  client_max_body_size 256M;
5
7
 
@@ -23,7 +23,7 @@ declare global {
23
23
  fieldGroup: T,
24
24
  selector: K,
25
25
  location?: Location
26
- ) => Promise<FieldProps<T>[K]>;
26
+ ) => Promise<FieldProps<T>[K] | undefined>;
27
27
  }
28
28
 
29
29
  globalThis.getField = async (fieldGroup, selector, location) => {
@@ -41,7 +41,7 @@ globalThis.getField = async (fieldGroup, selector, location) => {
41
41
  // break;
42
42
  }
43
43
  }
44
- if (!location) return [];
44
+ if (!location) return;
45
45
 
46
46
  const values = await (async () => {
47
47
  if (location === 'options') {
@@ -0,0 +1,22 @@
1
+ import type { NextConfig } from "next";
2
+
3
+ const wpUrl = new URL(process.env.WP_SERVICE_URL ?? '');
4
+
5
+ const nextpressNextConfig: NextConfig = {
6
+ reactCompiler: true,
7
+ images: {
8
+ dangerouslyAllowLocalIP: true, // Required compromise to allow cross fetching within docker container
9
+ remotePatterns: [
10
+ {
11
+ protocol: wpUrl.protocol.replace(':', '') === 'https' ? 'https' : 'http',
12
+ hostname: wpUrl.hostname,
13
+ port: wpUrl.port || undefined,
14
+ pathname: '/wp-content/uploads/**',
15
+ },
16
+ ],
17
+ qualities: [25, 50, 75, 100],
18
+ },
19
+ allowedDevOrigins: [process.env.DOMAIN_NAME ?? ''],
20
+ };
21
+
22
+ export default nextpressNextConfig;
@@ -1,18 +1,18 @@
1
1
  import { IMenuItem } from "../entities/post/post.interface";
2
2
  import { getThemeMods } from "./get-theme-mods";
3
3
 
4
- type Menu = {
5
- menuItem: IMenuItem,
6
- children: Menu[]
4
+ export type NextpressMenu = {
5
+ item: IMenuItem,
6
+ children: NextpressMenu[]
7
7
  }
8
8
 
9
9
  /**
10
10
  * Retrieves a menu by its location identifier.
11
11
  *
12
12
  * @param {string} menuLocation - The location identifier of the menu.
13
- * @returns {Promise<Menu[] | undefined>} An array of menu items representing the menu tree, or undefined if the menu is not found.
13
+ * @returns {Promise<NextpressMenu[] | undefined>} An array of menu items representing the menu tree, or undefined if the menu is not found.
14
14
  */
15
- export async function getMenu(menuLocation: string): Promise<Menu[] | undefined> {
15
+ export async function getMenu(menuLocation: string): Promise<NextpressMenu[] | undefined> {
16
16
  const navMenuLocations = await getThemeMods('nav_menu_locations');
17
17
  if (!navMenuLocations || typeof navMenuLocations !== 'object') return;
18
18
 
@@ -40,8 +40,8 @@ export async function getMenu(menuLocation: string): Promise<Menu[] | undefined>
40
40
  }
41
41
  }
42
42
 
43
- const map = new Map<number, Menu>();
44
- const tree: Menu[] = [];
43
+ const map = new Map<number, NextpressMenu>();
44
+ const tree: NextpressMenu[] = [];
45
45
 
46
46
  for (const item of menuItems) {
47
47
  if (!item.menuItemAttributes) continue;
@@ -71,8 +71,8 @@ export async function getMenu(menuLocation: string): Promise<Menu[] | undefined>
71
71
  menuItemAttributes
72
72
  };
73
73
 
74
- const node: Menu = {
75
- menuItem: safeItem,
74
+ const node: NextpressMenu = {
75
+ item: safeItem,
76
76
  children: []
77
77
  };
78
78
 
@@ -96,7 +96,7 @@ export async function getMenu(menuLocation: string): Promise<Menu[] | undefined>
96
96
 
97
97
  if (parentNode) {
98
98
  parentNode.children.push(currentNode);
99
- map.set(parentNode.menuItem.ID, parentNode);
99
+ map.set(parentNode.item.ID, parentNode);
100
100
  }
101
101
  }
102
102
 
@@ -7,8 +7,8 @@ add_action('admin_menu', function() {
7
7
 
8
8
  // Create a brand new top-level menu item for Customize
9
9
  add_menu_page(
10
- 'Customize', // Page title
11
- 'Customize', // Menu title
10
+ __('Customize'), // Page title
11
+ __('Customize'), // Menu title
12
12
  'edit_theme_options', // Capability required to see it
13
13
  'customize.php', // Direct link to the Customizer
14
14
  '', // No function needed for an existing file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextpress-core",
3
- "version": "3.0.1",
3
+ "version": "3.1.1",
4
4
  "description": "Nextpress Core",
5
5
  "keywords": [],
6
6
  "bin": {