mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
fix for build errors
This commit is contained in:
parent
bed8a340d1
commit
033c844db2
@ -3,7 +3,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"predev": "agility-next sync",
|
"predev": "agility-next sync",
|
||||||
"dev": "NODE_OPTIONS='--inspect' next dev",
|
"dev": "next dev",
|
||||||
"prebuild": "agility-next prebuild",
|
"prebuild": "agility-next prebuild",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"export": "next export",
|
"export": "next export",
|
||||||
|
@ -47,11 +47,11 @@ const getProducts = async ({ search, config }: any) => {
|
|||||||
|
|
||||||
const commerceConfig = commerce.provider.config
|
const commerceConfig = commerce.provider.config
|
||||||
|
|
||||||
const { data } = await commerceConfig.storeApiFetch<{ data: { id: number }[] }>(
|
const { data } = await commerceConfig.storeApiFetch(
|
||||||
url.pathname + url.search
|
url.pathname + url.search
|
||||||
)
|
)
|
||||||
|
|
||||||
const ids = data.map((p) => String(p.id))
|
const ids = data.map((p: any) => String(p.id))
|
||||||
const found = ids.length > 0
|
const found = ids.length > 0
|
||||||
|
|
||||||
// We want the GraphQL version of each product
|
// We want the GraphQL version of each product
|
||||||
@ -61,9 +61,7 @@ const getProducts = async ({ search, config }: any) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Put the products in an object that we can use to get them by id
|
// Put the products in an object that we can use to get them by id
|
||||||
const productsById = graphqlData.products.reduce<{
|
const productsById = graphqlData.products.reduce((prods: any, p: any) => {
|
||||||
[k: string]: Product
|
|
||||||
}>((prods, p) => {
|
|
||||||
prods[Number(p.id)] = p
|
prods[Number(p.id)] = p
|
||||||
return prods
|
return prods
|
||||||
}, {})
|
}, {})
|
||||||
@ -72,7 +70,7 @@ const getProducts = async ({ search, config }: any) => {
|
|||||||
|
|
||||||
// Populate the products array with the graphql products, in the order
|
// Populate the products array with the graphql products, in the order
|
||||||
// assigned by the list of entity ids
|
// assigned by the list of entity ids
|
||||||
ids.forEach((id) => {
|
ids.forEach((id: any) => {
|
||||||
const product = productsById[id]
|
const product = productsById[id]
|
||||||
if (product) products.push(product)
|
if (product) products.push(product)
|
||||||
})
|
})
|
||||||
|
@ -22,13 +22,14 @@
|
|||||||
"@components/*": ["components/*"],
|
"@components/*": ["components/*"],
|
||||||
"@commerce": ["framework/commerce"],
|
"@commerce": ["framework/commerce"],
|
||||||
"@commerce/*": ["framework/commerce/*"],
|
"@commerce/*": ["framework/commerce/*"],
|
||||||
"@framework": ["framework/bigcommerce"],
|
"@framework": ["framework/local"],
|
||||||
"@framework/*": ["framework/bigcommerce/*"]
|
"@framework/*": ["framework/local/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
"./framework/bigcommerce",
|
||||||
"./framework/shopify",
|
"./framework/shopify",
|
||||||
"./framework/swell",
|
"./framework/swell",
|
||||||
"./framework/vendure",
|
"./framework/vendure",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user