Skip to content

Commit

Permalink
Merge pull request #56 from MakairaIO/feat/add-shop-adapter-shopware5
Browse files Browse the repository at this point in the history
Feat/add shop adapter shopware5
  • Loading branch information
jembach authored Aug 10, 2022
2 parents cf8b71b + ef08c53 commit 15bceea
Show file tree
Hide file tree
Showing 23 changed files with 1,459 additions and 1,040 deletions.
17 changes: 17 additions & 0 deletions cli/create-new-shop-provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const adapterNameUpperCase =
adapterNameCleaned.charAt(0).toUpperCase() + adapterNameCleaned.slice(1)

const destinationDir = `${__dirname}/../../packages/storefront-shop-adapter-${adapterNameCleaned}`
const mainTsConfigPath = `${__dirname}/../../tsconfig.json`

if (fs.existsSync(destinationDir)) {
throw new Error('The adapter already exists')
Expand All @@ -25,6 +26,22 @@ copyAndReplaceAllTemplateFiles(
destinationDir
)

// update the main tsconfig

const mainTsConfig = JSON.parse(
fs.readFileSync(mainTsConfigPath, { encoding: 'utf-8' })
)

mainTsConfig.compilerOptions.paths[
`@makaira/storefront-shop-adapter-${adapterNameCleaned}/*`
] = [`../storefront-shop-adapter-${adapterNameCleaned}/src/*`]

mainTsConfig.compilerOptions.paths[
`@makaira/storefront-shop-adapter-${adapterNameCleaned}`
] = [`../storefront-shop-adapter-${adapterNameCleaned}/src`]

fs.writeFileSync(mainTsConfigPath, JSON.stringify(mainTsConfig, null, 2))

function copyAndReplaceAllTemplateFiles(src, dest) {
const exists = fs.existsSync(src)
const stats = exists && fs.statSync(src)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
MakairaShopProviderCheckout,
MakairaSubmitCheckout,
} from '@makaira/storefront-types'
import { StorefrontShopAdapter__SHOP_ADAPTER_NAME_UPPERCASE__ } from './main'

export class StorefrontShopAdapter__SHOP_ADAPTER_NAME_UPPERCASE__Checkout
implements MakairaShopProviderCheckout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
MakairaGetReviews,
MakairaShopProviderReview,
} from '@makaira/storefront-types'
import { ShopAdapter__SHOP_ADAPTER_NAME_UPPERCASE__StorageVersioned } from '../types'
import { StorefrontShopAdapter__SHOP_ADAPTER_NAME_UPPERCASE__ } from './main'

export class StorefrontShopAdapter__SHOP_ADAPTER_NAME_UPPERCASE__Review
Expand Down
Loading

0 comments on commit 15bceea

Please sign in to comment.