Skip to content

Commit

Permalink
Updated module to make it easier to get started with the woonuxt-sett…
Browse files Browse the repository at this point in the history
…ings plugin.
  • Loading branch information
scottyzen committed Mar 4, 2023
1 parent 5a9bbf2 commit 3efc135
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ STRIPE_PUBLISHABLE_KEY="pk_test_abcdefghijklmnopqrstuvwxyz"
PRIMARY_COLOR="#ff0000"

# Needed for nuxt-image to work with external images
NUXT_IMAGE_DOMAINS="example.com"
NUXT_IMAGE_DOMAINS="example.com, example.org"

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The goal of WooNuxt is to provide a modern, fast, and SEO friendly front-end for

## Get Started

- Download the [WooNuxt Settings](https://github.com/scottyzen/woonuxt-settings/releases/download/1.0.27/woonuxt-settings.zip) plugin.
- Download the [WooNuxt Settings](https://github.com/scottyzen/woonuxt-settings/releases/download/1.0.29/woonuxt-settings.zip) plugin.
- Install and activate the plugin on your WordPress site. This will install all the required plugins for WooNuxt, add some useful fields to the WPGraphQL schema, and automatically retrieve the WooCommerce payment gateway settings for Stripe and PayPal.
- Once the plugin is activated your ready to deploy WooNuxt on a whatever hosting you like, or click one onf the fast deploy button below.
- Once the plugin is activated the only required environment variable is `GQL_HOST`. Checkout the .env.example file for more details.
Expand Down Expand Up @@ -59,7 +59,7 @@ The goal of WooNuxt is to provide a modern, fast, and SEO friendly front-end for
| WooGraphQL | GraphQL API for WooCommerce | https://woographql.com/ |
| WPGraphQL Cors | Enable CORS for WPGraphQL | https://github.com/funkhaus/wp-graphql-cors |

> **Note** The the [WooNuxt Settings](https://github.com/scottyzen/woonuxt-settings/releases/download/1.0.27/woonuxt-settings.zip) plugin will help you install all the required plugins.
> **Note** The the [WooNuxt Settings](https://github.com/scottyzen/woonuxt-settings/releases/download/1.0.29/woonuxt-settings.zip) plugin will help you install all the required plugins.
 

Expand Down
1 change: 1 addition & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[template.environment]
GQL_HOST = "WordPress URL http://example.com"
NUXT_IMAGE_DOMAINS = "Comma separated list of domains. example.com,example2.com"

[build]
command = "npm run generate"
15 changes: 15 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ export default defineNuxtConfig({
'@nuxt/image-edge'
],

image: {
domains: process.env.NUXT_IMAGE_DOMAINS ? process.env.NUXT_IMAGE_DOMAINS.replace(/ /g, '').split(',') : [],
},

'graphql-client': {
codegen: process.env.PUBLIC_INTROSPECTION_ENABLED !== 'on' ? false : {
silent: true,
skipTypename: true,
useTypeImports: true,
dedupeFragments: true,
onlyOperationTypes: true,
disableOnBuild: false
}
},

hooks: {
'pages:extend'(pages) {
pages.push({ name: 'product-page-pager', path: '/products/page/:pageNumber', file: '~/pages/products.vue' });
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woonuxt",
"version": "3.0.4",
"version": "3.0.5",
"private": true,
"scripts": {
"build": "nuxt build",
Expand All @@ -26,7 +26,7 @@
"vue-stripe-js": "^1.0.1"
},
"dependencies": {
"@stripe/stripe-js": "^1.47.0",
"@stripe/stripe-js": "^1.48.0",
"@vueform/slider": "^2.1.7",
"nuxt-graphql-client": "^0.2.25",
"ohmyfetch": "^0.4.21"
Expand Down
8 changes: 1 addition & 7 deletions woonuxt-settings-module/woonuxt-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ query getWooNuxtSettings {
logo
publicIntrospectionEnabled
frontEndUrl
domain
maxPrice
productsPerPage
global_attributes {
Expand Down Expand Up @@ -49,12 +48,7 @@ export default defineNuxtModule<ModuleOptions>({

// Default env variables
process.env.PRIMARY_COLOR = data.woonuxtSettings?.primary_color || '#7F54B2';
process.env.PUBLIC_INTROSPECTION_ENABLED = data.woonuxtSettings?.publicIntrospectionEnabled || 'off';
const nuxtImageDomains = process.env.NUXT_IMAGE_DOMAINS ? process.env.NUXT_IMAGE_DOMAINS.replace(/ /g, '').split(',') : [];

nuxt.options.image = {
domains: [...nuxtImageDomains, data.woonuxtSettings?.domain],
}
process.env.PUBLIC_INTROSPECTION_ENABLED = data.woonuxtSettings?.publicIntrospectionEnabled === 'on' ? 'on' : 'false';

// Default runtimeConfig
nuxt.options.runtimeConfig.public.LOGO = data.woonuxtSettings?.logo || null;
Expand Down

0 comments on commit 3efc135

Please sign in to comment.