@akinon/projectzero 2.0.0-beta.2 → 2.0.0-beta.21
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/CHANGELOG.md +155 -6
- package/app-template/.env.example +8 -0
- package/app-template/.github/instructions/account.instructions.md +749 -0
- package/app-template/.github/instructions/checkout.instructions.md +678 -0
- package/app-template/.github/instructions/default.instructions.md +279 -0
- package/app-template/.github/instructions/edge-cases.instructions.md +73 -0
- package/app-template/.github/instructions/routing.instructions.md +603 -0
- package/app-template/.github/instructions/settings.instructions.md +338 -0
- package/app-template/.gitignore +5 -0
- package/app-template/AGENTS.md +7 -0
- package/app-template/CHANGELOG.md +1783 -61
- package/app-template/Procfile +1 -1
- package/app-template/README.md +6 -0
- package/app-template/akinon.json +1 -4
- package/app-template/build.sh +10 -0
- package/app-template/config/prebuild-tests.json +5 -0
- package/app-template/docs/advanced-usage.md +111 -0
- package/app-template/docs/plugins.md +60 -25
- package/app-template/docs/sentry-usage.md +35 -0
- package/app-template/jest.config.ts +2 -2
- package/app-template/next-env.d.ts +1 -0
- package/app-template/next.config.mjs +8 -6
- package/app-template/package.json +61 -50
- package/app-template/postcss.config.mjs +5 -0
- package/app-template/public/amex.svg +12 -0
- package/app-template/public/apple-pay.svg +16 -0
- package/app-template/public/assets/images/product-placeholder-1.jpg +0 -0
- package/app-template/public/assets/images/product-placeholder-2.jpg +0 -0
- package/app-template/public/assets/images/product-placeholder-3.jpg +0 -0
- package/app-template/public/assets/images/product-placeholder-4.jpg +0 -0
- package/app-template/public/google-pay.svg +16 -0
- package/app-template/public/locales/en/account.json +13 -4
- package/app-template/public/locales/en/auth.json +6 -7
- package/app-template/public/locales/en/basket.json +6 -6
- package/app-template/public/locales/en/blog.json +7 -0
- package/app-template/public/locales/en/category.json +3 -1
- package/app-template/public/locales/en/checkout.json +17 -4
- package/app-template/public/locales/en/common.json +71 -3
- package/app-template/public/locales/en/forgot_password.json +6 -7
- package/app-template/public/locales/en/product.json +84 -4
- package/app-template/public/locales/tr/account.json +13 -4
- package/app-template/public/locales/tr/auth.json +16 -17
- package/app-template/public/locales/tr/basket.json +4 -4
- package/app-template/public/locales/tr/blog.json +7 -0
- package/app-template/public/locales/tr/category.json +3 -1
- package/app-template/public/locales/tr/checkout.json +48 -36
- package/app-template/public/locales/tr/common.json +70 -2
- package/app-template/public/locales/tr/forgot_password.json +12 -13
- package/app-template/public/locales/tr/product.json +82 -0
- package/app-template/public/logo.svg +3 -27
- package/app-template/public/mastercard.svg +14 -0
- package/app-template/public/masterpass-javascript-sdk-web.min.js +1 -0
- package/app-template/public/promotion-banner.jpg +0 -0
- package/app-template/public/shop-pay.svg +12 -0
- package/app-template/public/visa.svg +12 -0
- package/app-template/src/__tests__/middleware-matcher.test.ts +135 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/[...prettyurl]/page.tsx +11 -11
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/layout.tsx +4 -3
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/cancellation/page.tsx +105 -13
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/page.tsx +136 -52
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/profile/page.tsx +2 -2
- package/app-template/src/app/[pz]/blog/[slug]/page.tsx +120 -0
- package/app-template/src/app/[pz]/category/[pk]/page.tsx +37 -0
- package/app-template/src/app/[pz]/error.tsx +17 -0
- package/app-template/src/app/[pz]/flat-page/[pk]/page.tsx +23 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/forms/[pk]/generate/page.tsx +1 -2
- package/app-template/src/app/[pz]/group-product/[pk]/page.tsx +93 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/landing-page/[pk]/page.tsx +2 -4
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/layout.tsx +6 -11
- package/app-template/src/app/[pz]/list/page.tsx +26 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency]/pz-not-found/page.tsx → [pz]/not-found.tsx} +5 -7
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/checkout/page.tsx +7 -4
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/completed/[token]/page.tsx +6 -4
- package/app-template/src/app/[pz]/page.tsx +28 -0
- package/app-template/src/app/[pz]/pages/[slug]/page.tsx +19 -0
- package/app-template/src/app/[pz]/product/[pk]/page.tsx +102 -0
- package/app-template/src/app/[pz]/special-page/[pk]/page.tsx +35 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/email-set-primary/[[...id]]/page.tsx +3 -4
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/registration/account-confirm-email/[[...id]]/page.tsx +3 -3
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/reset/[[...id]]/page.tsx +41 -5
- package/app-template/src/app/[pz]/xml-sitemap/[node]/route.ts +73 -0
- package/app-template/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/app-template/src/app/api/barcode-search/route.ts +1 -0
- package/app-template/src/app/api/cache/route.ts +1 -1
- package/app-template/src/app/api/form/[...id]/route.ts +1 -7
- package/app-template/src/app/api/image-proxy/route.ts +1 -0
- package/app-template/src/app/api/logout/route.ts +1 -1
- package/app-template/src/app/api/product-categories/route.ts +1 -0
- package/app-template/src/app/api/similar-product-list/route.ts +1 -0
- package/app-template/src/app/api/similar-products/route.ts +1 -0
- package/app-template/src/app/api/theme-settings/route.ts +12 -0
- package/app-template/src/app/api/virtual-try-on/limited-categories/route.ts +1 -0
- package/app-template/src/app/api/virtual-try-on/route.ts +1 -0
- package/app-template/src/app/api/web-vitals/route.ts +1 -1
- package/app-template/src/assets/fonts/pz-icon.css +211 -49
- package/app-template/src/assets/fonts/pz-icon.eot +0 -0
- package/app-template/src/assets/fonts/pz-icon.html +486 -0
- package/app-template/src/assets/fonts/pz-icon.scss +373 -49
- package/app-template/src/assets/fonts/pz-icon.svg +215 -53
- package/app-template/src/assets/fonts/pz-icon.ttf +0 -0
- package/app-template/src/assets/fonts/pz-icon.woff +0 -0
- package/app-template/src/assets/fonts/pz-icon.woff2 +0 -0
- package/app-template/src/assets/globals.scss +37 -34
- package/app-template/src/assets/icons/arrow-right.svg +3 -0
- package/app-template/src/assets/icons/cart.svg +4 -12
- package/app-template/src/assets/icons/check.svg +2 -18
- package/app-template/src/assets/icons/chevron-down.svg +2 -7
- package/app-template/src/assets/icons/delete.svg +3 -0
- package/app-template/src/assets/icons/facebook.svg +2 -8
- package/app-template/src/assets/icons/fav-off.svg +5 -0
- package/app-template/src/assets/icons/fav-on.svg +5 -0
- package/app-template/src/assets/icons/filter-and-sort.svg +3 -0
- package/app-template/src/assets/icons/heart.svg +3 -0
- package/app-template/src/assets/icons/instagram.svg +2 -13
- package/app-template/src/assets/icons/materials.svg +3 -0
- package/app-template/src/assets/icons/person.svg +4 -0
- package/app-template/src/assets/icons/pinterest.svg +5 -11
- package/app-template/src/assets/icons/ruler.svg +3 -0
- package/app-template/src/assets/icons/search.svg +8 -11
- package/app-template/src/assets/icons/share.svg +2 -9
- package/app-template/src/assets/icons/snapchat.svg +3 -0
- package/app-template/src/assets/icons/tiktok.svg +3 -0
- package/app-template/src/assets/icons/tumblr.svg +6 -0
- package/app-template/src/assets/icons/twitter.svg +2 -10
- package/app-template/src/assets/icons/vimeo.svg +3 -0
- package/app-template/src/assets/icons/youtube.svg +3 -0
- package/app-template/src/assets/icons/zoom.svg +8 -0
- package/app-template/src/auth.ts +3 -0
- package/app-template/src/components/__tests__/link.test.tsx +2 -0
- package/app-template/src/components/accordion.tsx +48 -23
- package/app-template/src/components/action-tooltip.tsx +160 -0
- package/app-template/src/components/button.tsx +50 -35
- package/app-template/src/components/carousel-core.tsx +4 -11
- package/app-template/src/components/checkbox.tsx +2 -1
- package/app-template/src/components/currency-select.tsx +150 -4
- package/app-template/src/components/file-input.tsx +64 -2
- package/app-template/src/components/generate-form-fields.tsx +49 -10
- package/app-template/src/components/icon.tsx +5 -6
- package/app-template/src/components/index.ts +4 -1
- package/app-template/src/components/input.tsx +8 -2
- package/app-template/src/components/language-select.tsx +88 -2
- package/app-template/src/components/modal.tsx +34 -16
- package/app-template/src/components/pagination.tsx +133 -20
- package/app-template/src/components/price.tsx +1 -1
- package/app-template/src/components/pwa-tags.tsx +1 -0
- package/app-template/src/components/quantity-input.tsx +63 -0
- package/app-template/src/components/quantity-selector.tsx +215 -0
- package/app-template/src/components/route-handler.tsx +50 -0
- package/app-template/src/components/select.tsx +86 -54
- package/app-template/src/components/tabs.tsx +2 -2
- package/app-template/src/components/types/index.ts +55 -2
- package/app-template/src/components/widget-content.tsx +323 -0
- package/app-template/src/data/server/theme.ts +70 -0
- package/app-template/src/hooks/use-fav-button.tsx +9 -10
- package/app-template/src/hooks/use-product-cart.ts +80 -0
- package/app-template/src/hooks/use-stock-alert.ts +74 -0
- package/app-template/src/hooks/use-theme-settings.ts +42 -0
- package/app-template/src/lib/fonts.ts +149 -0
- package/app-template/src/middleware.ts +1 -0
- package/app-template/src/plugins.js +13 -2
- package/app-template/src/redux/middlewares/category.ts +6 -5
- package/app-template/src/redux/reducers/category.ts +1 -1
- package/app-template/src/redux/store.ts +21 -1
- package/app-template/src/routes/index.ts +8 -7
- package/app-template/src/settings.js +5 -3
- package/app-template/src/types/hookform-resolvers-yup.d.ts +28 -0
- package/app-template/src/types/index.ts +74 -3
- package/app-template/src/types/next-auth.d.ts +2 -2
- package/app-template/src/types/widget.ts +169 -0
- package/app-template/src/utils/__tests__/theme-page-context.test.ts +145 -0
- package/app-template/src/utils/convert-facet-search-params.ts +1 -1
- package/app-template/src/utils/formatDate.ts +48 -0
- package/app-template/src/utils/styles.ts +71 -0
- package/app-template/src/utils/theme-page-context.ts +309 -0
- package/app-template/src/utils/variant-validation.ts +41 -0
- package/app-template/src/views/account/address-form.tsx +8 -4
- package/app-template/src/views/account/contact-form.tsx +148 -136
- package/app-template/src/views/account/content-header.tsx +2 -2
- package/app-template/src/views/account/faq/faq-tabs.tsx +8 -2
- package/app-template/src/views/account/favorite-item.tsx +1 -1
- package/app-template/src/views/account/order.tsx +10 -8
- package/app-template/src/views/account/orders/order-cancellation-item.tsx +4 -3
- package/app-template/src/views/account/orders/order-detail-header.tsx +1 -1
- package/app-template/src/views/anonymous-tracking/order-detail/index.tsx +44 -37
- package/app-template/src/views/basket/basket-item.tsx +7 -1
- package/app-template/src/views/basket/summary.tsx +16 -0
- package/app-template/src/views/breadcrumb.tsx +2 -2
- package/app-template/src/views/category/category-active-filters.tsx +1 -1
- package/app-template/src/views/category/category-banner.tsx +4 -23
- package/app-template/src/views/category/category-header.tsx +12 -6
- package/app-template/src/views/category/category-info.tsx +4 -3
- package/app-template/src/views/category/filters/filter-item.tsx +138 -42
- package/app-template/src/views/category/filters/index.tsx +3 -3
- package/app-template/src/views/category/layout.tsx +1 -0
- package/app-template/src/views/checkout/auth.tsx +64 -40
- package/app-template/src/views/checkout/layout/header.tsx +9 -5
- package/app-template/src/views/checkout/steps/payment/index.tsx +1 -1
- package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +21 -5
- package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +25 -5
- package/app-template/src/views/checkout/steps/payment/options/loyalty.tsx +21 -2
- package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +27 -5
- package/app-template/src/views/checkout/steps/payment/options/store-credit.tsx +464 -0
- package/app-template/src/views/checkout/steps/shipping/address-box.tsx +30 -17
- package/app-template/src/views/checkout/steps/shipping/addresses.tsx +1 -1
- package/app-template/src/views/checkout/summary.tsx +10 -0
- package/app-template/src/views/find-in-store/index.tsx +2 -2
- package/app-template/src/views/guest-login/index.tsx +62 -58
- package/app-template/src/views/header/action-menu.tsx +7 -4
- package/app-template/src/views/header/index.tsx +1 -1
- package/app-template/src/views/header/mini-basket.tsx +14 -3
- package/app-template/src/views/header/mobile-hamburger-button.tsx +5 -8
- package/app-template/src/views/header/mobile-menu.tsx +12 -0
- package/app-template/src/views/header/search/index.tsx +23 -1
- package/app-template/src/views/installment-options/index.tsx +1 -1
- package/app-template/src/views/login/index.tsx +89 -56
- package/app-template/src/views/otp-login/index.tsx +23 -20
- package/app-template/src/views/product/index.ts +1 -0
- package/app-template/src/views/product/layout.tsx +26 -6
- package/app-template/src/views/product/price-wrapper.tsx +3 -24
- package/app-template/src/views/product/product-actions.tsx +165 -0
- package/app-template/src/views/product/product-info.tsx +75 -237
- package/app-template/src/views/product/product-share.tsx +58 -0
- package/app-template/src/views/product/product-variants.tsx +26 -0
- package/app-template/src/views/product/slider.tsx +21 -0
- package/app-template/src/views/product/variant.tsx +69 -41
- package/app-template/src/views/register/index.tsx +54 -44
- package/app-template/src/views/share/index.tsx +9 -6
- package/app-template/src/views/widgets/home-hero-slider-content.tsx +41 -39
- package/app-template/src/widgets/flatpages/about-us/index.tsx +78 -0
- package/app-template/src/widgets/flatpages/blog-list/index.tsx +129 -0
- package/app-template/src/widgets/footer-menu.tsx +6 -2
- package/app-template/src/widgets/footer-subscription/footer-subscription-form.tsx +17 -14
- package/app-template/src/widgets/home-stories-eng.tsx +42 -34
- package/app-template/src/widgets/index.ts +7 -0
- package/app-template/src/widgets/schemas/about-us.json +46 -0
- package/app-template/src/widgets/schemas/blog-list.json +37 -0
- package/app-template/src/widgets/schemas/blog.json +29 -0
- package/app-template/tailwind.config.js +19 -7
- package/app-template/tsconfig.json +29 -11
- package/codemods/migrate-segments/index.js +591 -0
- package/codemods/sentry-9/index.js +30 -0
- package/codemods/sentry-9/remove-sentry-configs.js +14 -0
- package/codemods/sentry-9/remove-sentry-dependency.js +25 -0
- package/codemods/sentry-9/replace-error-page.js +32 -0
- package/codemods/update-tailwind-config/index.js +30 -0
- package/codemods/update-tailwind-config/transform.js +102 -0
- package/commands/codemod.ts +17 -0
- package/commands/index.ts +3 -1
- package/commands/plugins.ts +115 -46
- package/dist/codemods/sentry-9/templates/error.js +14 -0
- package/dist/commands/codemod.js +15 -0
- package/dist/commands/index.js +3 -1
- package/dist/commands/plugins.js +108 -36
- package/package.json +3 -2
- package/app-template/postcss.config.js +0 -6
- package/app-template/sentry.client.config.ts +0 -16
- package/app-template/sentry.edge.config.ts +0 -3
- package/app-template/sentry.properties +0 -4
- package/app-template/sentry.server.config.ts +0 -3
- package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/page.tsx +0 -22
- package/app-template/src/app/[commerce]/[locale]/[currency]/error.tsx +0 -20
- package/app-template/src/app/[commerce]/[locale]/[currency]/flat-page/[pk]/page.tsx +0 -20
- package/app-template/src/app/[commerce]/[locale]/[currency]/group-product/[pk]/page.tsx +0 -74
- package/app-template/src/app/[commerce]/[locale]/[currency]/list/page.tsx +0 -18
- package/app-template/src/app/[commerce]/[locale]/[currency]/page.tsx +0 -50
- package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/loading.tsx +0 -67
- package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/page.tsx +0 -84
- package/app-template/src/app/[commerce]/[locale]/[currency]/special-page/[pk]/page.tsx +0 -27
- package/app-template/src/app/[commerce]/[locale]/[currency]/xml-sitemap/[node]/route.ts +0 -25
- package/app-template/src/pages/api/auth/[...nextauth].ts +0 -3
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/address/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/change-email/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/change-password/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/contact/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/coupons/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/email-verification/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/faq/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/favourite-products/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/my-quotations/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/layout.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/address/stores/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/anonymous-tracking/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/auth/oauth-login/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/auth/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/basket/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/basket-b2b/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/category/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/client-root.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/contact-us/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/flat-page/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/group-product/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/landing-page/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/list/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/completed/[token]/layout.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/special-page/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/template.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/password/reset/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/xml-sitemap/route.ts +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const jscodeshift = require('jscodeshift/src/Runner');
|
|
3
|
+
|
|
4
|
+
const codemodScript = path.resolve(__dirname, 'transform.js');
|
|
5
|
+
|
|
6
|
+
const transform = () => {
|
|
7
|
+
const workingDir = path.resolve(process.cwd());
|
|
8
|
+
|
|
9
|
+
jscodeshift
|
|
10
|
+
.run(codemodScript, [workingDir], {
|
|
11
|
+
verbose: 0,
|
|
12
|
+
dry: false,
|
|
13
|
+
print: false,
|
|
14
|
+
extensions: 'js',
|
|
15
|
+
ignorePattern: '**/node_modules/**',
|
|
16
|
+
filter: '**/tailwind.config.js'
|
|
17
|
+
})
|
|
18
|
+
.then(
|
|
19
|
+
(stats) => {
|
|
20
|
+
console.log(`Codemod completed. Stats:`, stats);
|
|
21
|
+
},
|
|
22
|
+
(error) => {
|
|
23
|
+
console.error(`Error executing codemod: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
transform
|
|
30
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
function transform(fileInfo, api) {
|
|
2
|
+
const j = api.jscodeshift;
|
|
3
|
+
const root = j(fileInfo.source);
|
|
4
|
+
|
|
5
|
+
if (!fileInfo.path.includes('tailwind.config.js')) {
|
|
6
|
+
return fileInfo.source;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
console.log(`Processing file: ${fileInfo.path}`);
|
|
10
|
+
|
|
11
|
+
const hasAkinonNextImport = root.find(j.VariableDeclarator, {
|
|
12
|
+
id: { name: 'getAkinonNextContent' }
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (hasAkinonNextImport.size() === 0) {
|
|
16
|
+
const requireStatement = j.variableDeclaration('const', [
|
|
17
|
+
j.variableDeclarator(
|
|
18
|
+
j.identifier('getAkinonNextContent'),
|
|
19
|
+
j.callExpression(j.identifier('require'), [
|
|
20
|
+
j.literal('@akinon/next/tailwind/content')
|
|
21
|
+
])
|
|
22
|
+
)
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
root.get().node.program.body.unshift(requireStatement);
|
|
26
|
+
|
|
27
|
+
console.log(`Added getAkinonNextContent import to ${fileInfo.path}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const defaultConfig = root
|
|
31
|
+
.find(j.VariableDeclarator, {
|
|
32
|
+
id: { name: 'defaultConfig' },
|
|
33
|
+
init: { type: 'ObjectExpression' }
|
|
34
|
+
})
|
|
35
|
+
.paths()[0];
|
|
36
|
+
|
|
37
|
+
if (!defaultConfig) {
|
|
38
|
+
console.log(`No defaultConfig found in ${fileInfo.path}`);
|
|
39
|
+
return fileInfo.source;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const contentArray = defaultConfig.value.init.properties.find(
|
|
43
|
+
(prop) =>
|
|
44
|
+
prop.key.name === 'content' && prop.value.type === 'ArrayExpression'
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if (!contentArray) {
|
|
48
|
+
console.log(`No content array found in defaultConfig`);
|
|
49
|
+
return fileInfo.source;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const pluginsVarName = root
|
|
53
|
+
.find(j.VariableDeclarator, {
|
|
54
|
+
id: { name: 'plugins' },
|
|
55
|
+
init: {
|
|
56
|
+
type: 'CallExpression',
|
|
57
|
+
callee: { name: 'require' }
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.paths()[0]?.value.id.name;
|
|
61
|
+
|
|
62
|
+
if (!pluginsVarName) {
|
|
63
|
+
console.log(`No plugins variable found in ${fileInfo.path}`);
|
|
64
|
+
return fileInfo.source;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const contentElements = contentArray.value.elements;
|
|
68
|
+
|
|
69
|
+
const filteredElements = contentElements.filter((element) => {
|
|
70
|
+
if (element.type === 'SpreadElement') {
|
|
71
|
+
if (
|
|
72
|
+
element.argument.type === 'CallExpression' &&
|
|
73
|
+
element.argument.callee.object?.callee.object.name === 'plugins'
|
|
74
|
+
) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (
|
|
79
|
+
element.argument.type === 'CallExpression' &&
|
|
80
|
+
element.argument.callee.name === 'getAkinonNextContent'
|
|
81
|
+
) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
filteredElements.push(
|
|
89
|
+
j.spreadElement(
|
|
90
|
+
j.callExpression(j.identifier('getAkinonNextContent'), [
|
|
91
|
+
j.identifier(pluginsVarName)
|
|
92
|
+
])
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
contentArray.value.elements = filteredElements;
|
|
97
|
+
|
|
98
|
+
console.log(`Successfully updated ${fileInfo.path}`);
|
|
99
|
+
return root.toSource();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = transform;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
const yargs = require('yargs/yargs');
|
|
4
|
+
const { hideBin } = require('yargs/helpers');
|
|
5
|
+
const args = yargs(hideBin(process.argv)).argv;
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
const codemodName = args.codemod;
|
|
9
|
+
const codemodPath = path.resolve(
|
|
10
|
+
__dirname,
|
|
11
|
+
`../../codemods/${codemodName}/index.js`
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const codemod = require(codemodPath);
|
|
15
|
+
|
|
16
|
+
codemod.transform();
|
|
17
|
+
};
|
package/commands/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import addLanguage from './add-language';
|
|
|
4
4
|
import removeLanguage from './remove-language';
|
|
5
5
|
import defaultLanguage from './default-language';
|
|
6
6
|
import plugins from './plugins';
|
|
7
|
+
import codemod from './codemod';
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
commerceUrl,
|
|
@@ -11,5 +12,6 @@ export default {
|
|
|
11
12
|
addLanguage,
|
|
12
13
|
removeLanguage,
|
|
13
14
|
defaultLanguage,
|
|
14
|
-
plugins
|
|
15
|
+
plugins,
|
|
16
|
+
codemod
|
|
15
17
|
};
|
package/commands/plugins.ts
CHANGED
|
@@ -2,8 +2,7 @@ import * as fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
4
|
import semver from 'semver';
|
|
5
|
-
|
|
6
|
-
const Prompt = require('prompt-checkbox');
|
|
5
|
+
import { checkbox } from '@inquirer/prompts';
|
|
7
6
|
|
|
8
7
|
const rootDir = path.resolve(process.cwd());
|
|
9
8
|
|
|
@@ -30,7 +29,14 @@ async function checkVersion(pkg: PackageJson) {
|
|
|
30
29
|
|
|
31
30
|
if (!semver.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
32
31
|
console.warn(
|
|
33
|
-
`\x1b[
|
|
32
|
+
`\x1b[43m Warning: The "${packageName}" package is currently at`,
|
|
33
|
+
`\x1b[41m version ${pkg.dependencies['@akinon/next']}`,
|
|
34
|
+
`\x1b[43m Please upgrade it to the latest version (${latestVersion}) to ensure plugin compatibility.`,
|
|
35
|
+
'\x1b[0m\n'
|
|
36
|
+
);
|
|
37
|
+
} else {
|
|
38
|
+
console.log(
|
|
39
|
+
`\x1b[42m Info: The package "${packageName}" is currently in the current version (${latestVersion}).`,
|
|
34
40
|
'\x1b[0m\n'
|
|
35
41
|
);
|
|
36
42
|
}
|
|
@@ -55,7 +61,27 @@ export default async () => {
|
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
function findPackageJson(): PackageJson {
|
|
65
|
+
const packageJsonPaths = [
|
|
66
|
+
path.resolve(rootDir, './package.json'),
|
|
67
|
+
path.resolve(rootDir, './apps/projectzeronext/package.json')
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
for (const packageJsonPath of packageJsonPaths) {
|
|
71
|
+
try {
|
|
72
|
+
const pkg = require(packageJsonPath);
|
|
73
|
+
if (pkg.dependencies['@akinon/next']) {
|
|
74
|
+
return pkg;
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
throw new Error('Could not find package.json with @akinon/next dependency');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const pkg = findPackageJson();
|
|
59
85
|
await checkVersion(pkg);
|
|
60
86
|
|
|
61
87
|
const pluginsFilePath = findPluginsFilePath();
|
|
@@ -70,82 +96,123 @@ export default async () => {
|
|
|
70
96
|
}
|
|
71
97
|
|
|
72
98
|
const definedPlugins = [
|
|
99
|
+
{
|
|
100
|
+
name: 'Akifast',
|
|
101
|
+
value: 'pz-akifast'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Apple Pay',
|
|
105
|
+
value: 'pz-apple-pay'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'B2B',
|
|
109
|
+
value: 'pz-b2b'
|
|
110
|
+
},
|
|
73
111
|
{
|
|
74
112
|
name: 'Basket Gift Pack',
|
|
75
113
|
value: 'pz-basket-gift-pack'
|
|
76
114
|
},
|
|
77
115
|
{
|
|
78
|
-
name: '
|
|
79
|
-
value: 'pz-
|
|
116
|
+
name: 'BKM Express',
|
|
117
|
+
value: 'pz-bkm'
|
|
80
118
|
},
|
|
81
119
|
{
|
|
82
120
|
name: 'Checkout Gift Pack',
|
|
83
121
|
value: 'pz-checkout-gift-pack'
|
|
84
122
|
},
|
|
85
123
|
{
|
|
86
|
-
name: '
|
|
87
|
-
value: 'pz-
|
|
124
|
+
name: 'Click & Collect',
|
|
125
|
+
value: 'pz-click-collect'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'Credit Payment',
|
|
129
|
+
value: 'pz-credit-payment'
|
|
88
130
|
},
|
|
89
131
|
{
|
|
90
132
|
name: 'Garanti Pay',
|
|
91
133
|
value: 'pz-gpay'
|
|
92
134
|
},
|
|
93
135
|
{
|
|
94
|
-
name: '
|
|
95
|
-
value: 'pz-
|
|
136
|
+
name: 'Masterpass',
|
|
137
|
+
value: 'pz-masterpass'
|
|
96
138
|
},
|
|
97
139
|
{
|
|
98
|
-
name: '
|
|
99
|
-
value: 'pz-
|
|
140
|
+
name: 'Multi Basket',
|
|
141
|
+
value: 'pz-multi-basket'
|
|
100
142
|
},
|
|
101
143
|
{
|
|
102
|
-
name: '
|
|
103
|
-
value: 'pz-
|
|
144
|
+
name: 'One Click Checkout',
|
|
145
|
+
value: 'pz-one-click-checkout'
|
|
104
146
|
},
|
|
105
147
|
{
|
|
106
|
-
name: '
|
|
107
|
-
value: 'pz-
|
|
148
|
+
name: 'Otp',
|
|
149
|
+
value: 'pz-otp'
|
|
108
150
|
},
|
|
109
151
|
{
|
|
110
|
-
name: '
|
|
111
|
-
value: 'pz-
|
|
152
|
+
name: 'Pay On Delivery',
|
|
153
|
+
value: 'pz-pay-on-delivery'
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'Saved Card',
|
|
157
|
+
value: 'pz-saved-card'
|
|
112
158
|
},
|
|
113
159
|
{
|
|
114
160
|
name: 'Tabby Payment Extension',
|
|
115
161
|
value: 'pz-tabby-extension'
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'Tamara Payment Extension',
|
|
165
|
+
value: 'pz-tamara-extension'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'Hepsipay',
|
|
169
|
+
value: 'pz-hepsipay'
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'Flow Payment',
|
|
173
|
+
value: 'pz-flow-payment'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'Virtual Try-On',
|
|
177
|
+
value: 'pz-virtual-try-on'
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'Masterpass Rest',
|
|
181
|
+
value: 'pz-masterpass-rest'
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'Similar Products',
|
|
185
|
+
value: 'pz-similar-products'
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'Haso Payment Gateway',
|
|
189
|
+
value: 'pz-haso'
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'Google Pay',
|
|
193
|
+
value: 'pz-google-pay'
|
|
116
194
|
}
|
|
117
195
|
];
|
|
118
196
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
answer.replace(/\d\)\s/, '')
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const values = formattedAnswers.map(
|
|
135
|
-
(answer) => definedPlugins.find((p) => p.name === answer)?.value
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
if (formattedAnswers.length) {
|
|
139
|
-
console.log(`\nInstalling ${formattedAnswers.join(', ')}.`);
|
|
140
|
-
} else {
|
|
141
|
-
console.log(`\nUninstalling all plugins.`);
|
|
197
|
+
try {
|
|
198
|
+
const answers = await checkbox({
|
|
199
|
+
message: 'Please check/uncheck plugins to install/uninstall.',
|
|
200
|
+
choices: definedPlugins.map((plugin) => ({
|
|
201
|
+
name: plugin.name,
|
|
202
|
+
value: plugin.value,
|
|
203
|
+
checked: installedPlugins.includes(plugin.value)
|
|
204
|
+
}))
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
if (!answers.length) {
|
|
208
|
+
console.log('\x1b[33m%s\x1b[0m', `\nUninstalling all plugins.`);
|
|
142
209
|
}
|
|
143
210
|
|
|
144
|
-
console.log(`\nPlease wait...`);
|
|
211
|
+
console.log('\x1b[36m%s\x1b[0m', `\nPlease wait...`);
|
|
145
212
|
|
|
146
213
|
fs.writeFileSync(
|
|
147
214
|
pluginsFilePath,
|
|
148
|
-
`module.exports = ${JSON.stringify(
|
|
215
|
+
`module.exports = ${JSON.stringify(answers)};\n`,
|
|
149
216
|
{
|
|
150
217
|
encoding: 'utf-8'
|
|
151
218
|
}
|
|
@@ -155,11 +222,13 @@ export default async () => {
|
|
|
155
222
|
|
|
156
223
|
console.log(
|
|
157
224
|
'\x1b[32m%s\x1b[0m',
|
|
158
|
-
`\n
|
|
159
|
-
|
|
225
|
+
`\n✓ ${
|
|
226
|
+
answers.length
|
|
160
227
|
? 'Installed selected plugins'
|
|
161
228
|
: 'Uninstalled all plugins'
|
|
162
229
|
}.\n`
|
|
163
230
|
);
|
|
164
|
-
})
|
|
231
|
+
} catch (error) {
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
165
234
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const hooks_1 = require("@akinon/next/hooks");
|
|
8
|
+
const error_page_1 = __importDefault(require("@akinon/next/views/error-page"));
|
|
9
|
+
function ErrorPage({ error, reset }) {
|
|
10
|
+
// DO NOT REMOVE THIS LINE TO REPORT UNCAUGHT ERRORS TO SENTRY
|
|
11
|
+
(0, hooks_1.useSentryUncaughtErrors)(error);
|
|
12
|
+
return React.createElement(error_page_1.default, { error: error, reset: reset });
|
|
13
|
+
}
|
|
14
|
+
exports.default = ErrorPage;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const yargs = require('yargs/yargs');
|
|
8
|
+
const { hideBin } = require('yargs/helpers');
|
|
9
|
+
const args = yargs(hideBin(process.argv)).argv;
|
|
10
|
+
exports.default = () => {
|
|
11
|
+
const codemodName = args.codemod;
|
|
12
|
+
const codemodPath = path_1.default.resolve(__dirname, `../../codemods/${codemodName}/index.js`);
|
|
13
|
+
const codemod = require(codemodPath);
|
|
14
|
+
codemod.transform();
|
|
15
|
+
};
|
package/dist/commands/index.js
CHANGED
|
@@ -9,11 +9,13 @@ const add_language_1 = __importDefault(require("./add-language"));
|
|
|
9
9
|
const remove_language_1 = __importDefault(require("./remove-language"));
|
|
10
10
|
const default_language_1 = __importDefault(require("./default-language"));
|
|
11
11
|
const plugins_1 = __importDefault(require("./plugins"));
|
|
12
|
+
const codemod_1 = __importDefault(require("./codemod"));
|
|
12
13
|
exports.default = {
|
|
13
14
|
commerceUrl: commerce_url_1.default,
|
|
14
15
|
create: create_1.default,
|
|
15
16
|
addLanguage: add_language_1.default,
|
|
16
17
|
removeLanguage: remove_language_1.default,
|
|
17
18
|
defaultLanguage: default_language_1.default,
|
|
18
|
-
plugins: plugins_1.default
|
|
19
|
+
plugins: plugins_1.default,
|
|
20
|
+
codemod: codemod_1.default
|
|
19
21
|
};
|
package/dist/commands/plugins.js
CHANGED
|
@@ -49,7 +49,7 @@ const fs = __importStar(require("fs"));
|
|
|
49
49
|
const path_1 = __importDefault(require("path"));
|
|
50
50
|
const child_process_1 = require("child_process");
|
|
51
51
|
const semver_1 = __importDefault(require("semver"));
|
|
52
|
-
const
|
|
52
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
53
53
|
const rootDir = path_1.default.resolve(process.cwd());
|
|
54
54
|
function checkVersion(pkg) {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -60,7 +60,10 @@ function checkVersion(pkg) {
|
|
|
60
60
|
const pkgInfo = (yield response.json());
|
|
61
61
|
const latestVersion = pkgInfo['dist-tags'].latest;
|
|
62
62
|
if (!semver_1.default.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
63
|
-
console.warn(`\x1b[
|
|
63
|
+
console.warn(`\x1b[43m Warning: The "${packageName}" package is currently at`, `\x1b[41m version ${pkg.dependencies['@akinon/next']}`, `\x1b[43m Please upgrade it to the latest version (${latestVersion}) to ensure plugin compatibility.`, '\x1b[0m\n');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
console.log(`\x1b[42m Info: The package "${packageName}" is currently in the current version (${latestVersion}).`, '\x1b[0m\n');
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
catch (error) {
|
|
@@ -82,7 +85,25 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
82
85
|
throw new Error('plugins.js was not found in either of the expected locations.');
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
|
-
|
|
88
|
+
function findPackageJson() {
|
|
89
|
+
const packageJsonPaths = [
|
|
90
|
+
path_1.default.resolve(rootDir, './package.json'),
|
|
91
|
+
path_1.default.resolve(rootDir, './apps/projectzeronext/package.json')
|
|
92
|
+
];
|
|
93
|
+
for (const packageJsonPath of packageJsonPaths) {
|
|
94
|
+
try {
|
|
95
|
+
const pkg = require(packageJsonPath);
|
|
96
|
+
if (pkg.dependencies['@akinon/next']) {
|
|
97
|
+
return pkg;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
throw new Error('Could not find package.json with @akinon/next dependency');
|
|
105
|
+
}
|
|
106
|
+
const pkg = findPackageJson();
|
|
86
107
|
yield checkVersion(pkg);
|
|
87
108
|
const pluginsFilePath = findPluginsFilePath();
|
|
88
109
|
let installedPlugins = [];
|
|
@@ -94,74 +115,125 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
94
115
|
process.exit(1);
|
|
95
116
|
}
|
|
96
117
|
const definedPlugins = [
|
|
118
|
+
{
|
|
119
|
+
name: 'Akifast',
|
|
120
|
+
value: 'pz-akifast'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'Apple Pay',
|
|
124
|
+
value: 'pz-apple-pay'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'B2B',
|
|
128
|
+
value: 'pz-b2b'
|
|
129
|
+
},
|
|
97
130
|
{
|
|
98
131
|
name: 'Basket Gift Pack',
|
|
99
132
|
value: 'pz-basket-gift-pack'
|
|
100
133
|
},
|
|
101
134
|
{
|
|
102
|
-
name: '
|
|
103
|
-
value: 'pz-
|
|
135
|
+
name: 'BKM Express',
|
|
136
|
+
value: 'pz-bkm'
|
|
104
137
|
},
|
|
105
138
|
{
|
|
106
139
|
name: 'Checkout Gift Pack',
|
|
107
140
|
value: 'pz-checkout-gift-pack'
|
|
108
141
|
},
|
|
109
142
|
{
|
|
110
|
-
name: '
|
|
111
|
-
value: 'pz-
|
|
143
|
+
name: 'Click & Collect',
|
|
144
|
+
value: 'pz-click-collect'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'Credit Payment',
|
|
148
|
+
value: 'pz-credit-payment'
|
|
112
149
|
},
|
|
113
150
|
{
|
|
114
151
|
name: 'Garanti Pay',
|
|
115
152
|
value: 'pz-gpay'
|
|
116
153
|
},
|
|
117
154
|
{
|
|
118
|
-
name: '
|
|
119
|
-
value: 'pz-
|
|
155
|
+
name: 'Masterpass',
|
|
156
|
+
value: 'pz-masterpass'
|
|
120
157
|
},
|
|
121
158
|
{
|
|
122
|
-
name: '
|
|
123
|
-
value: 'pz-
|
|
159
|
+
name: 'Multi Basket',
|
|
160
|
+
value: 'pz-multi-basket'
|
|
124
161
|
},
|
|
125
162
|
{
|
|
126
|
-
name: '
|
|
127
|
-
value: 'pz-
|
|
163
|
+
name: 'One Click Checkout',
|
|
164
|
+
value: 'pz-one-click-checkout'
|
|
128
165
|
},
|
|
129
166
|
{
|
|
130
|
-
name: '
|
|
131
|
-
value: 'pz-
|
|
167
|
+
name: 'Otp',
|
|
168
|
+
value: 'pz-otp'
|
|
132
169
|
},
|
|
133
170
|
{
|
|
134
|
-
name: '
|
|
135
|
-
value: 'pz-
|
|
171
|
+
name: 'Pay On Delivery',
|
|
172
|
+
value: 'pz-pay-on-delivery'
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'Saved Card',
|
|
176
|
+
value: 'pz-saved-card'
|
|
136
177
|
},
|
|
137
178
|
{
|
|
138
179
|
name: 'Tabby Payment Extension',
|
|
139
180
|
value: 'pz-tabby-extension'
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'Tamara Payment Extension',
|
|
184
|
+
value: 'pz-tamara-extension'
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'Hepsipay',
|
|
188
|
+
value: 'pz-hepsipay'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'Flow Payment',
|
|
192
|
+
value: 'pz-flow-payment'
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'Virtual Try-On',
|
|
196
|
+
value: 'pz-virtual-try-on'
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: 'Masterpass Rest',
|
|
200
|
+
value: 'pz-masterpass-rest'
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: 'Similar Products',
|
|
204
|
+
value: 'pz-similar-products'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: 'Haso Payment Gateway',
|
|
208
|
+
value: 'pz-haso'
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'Google Pay',
|
|
212
|
+
value: 'pz-google-pay'
|
|
140
213
|
}
|
|
141
214
|
];
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
console.log(`\nInstalling ${formattedAnswers.join(', ')}.`);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
console.log(`\nUninstalling all plugins.`);
|
|
215
|
+
try {
|
|
216
|
+
const answers = yield (0, prompts_1.checkbox)({
|
|
217
|
+
message: 'Please check/uncheck plugins to install/uninstall.',
|
|
218
|
+
choices: definedPlugins.map((plugin) => ({
|
|
219
|
+
name: plugin.name,
|
|
220
|
+
value: plugin.value,
|
|
221
|
+
checked: installedPlugins.includes(plugin.value)
|
|
222
|
+
}))
|
|
223
|
+
});
|
|
224
|
+
if (!answers.length) {
|
|
225
|
+
console.log('\x1b[33m%s\x1b[0m', `\nUninstalling all plugins.`);
|
|
157
226
|
}
|
|
158
|
-
console.log(`\nPlease wait...`);
|
|
159
|
-
fs.writeFileSync(pluginsFilePath, `module.exports = ${JSON.stringify(
|
|
227
|
+
console.log('\x1b[36m%s\x1b[0m', `\nPlease wait...`);
|
|
228
|
+
fs.writeFileSync(pluginsFilePath, `module.exports = ${JSON.stringify(answers)};\n`, {
|
|
160
229
|
encoding: 'utf-8'
|
|
161
230
|
});
|
|
162
231
|
(0, child_process_1.execSync)('yarn install', { stdio: 'pipe' });
|
|
163
|
-
console.log('\x1b[32m%s\x1b[0m', `\n
|
|
232
|
+
console.log('\x1b[32m%s\x1b[0m', `\n✓ ${answers.length
|
|
164
233
|
? 'Installed selected plugins'
|
|
165
234
|
: 'Uninstalled all plugins'}.\n`);
|
|
166
|
-
}
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
167
239
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/projectzero",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI tool to manage your Project Zero Next project",
|
|
6
6
|
"bin": {
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"@types/temp": "0.9.4"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"jscodeshift": "^0.15.1",
|
|
23
|
+
"@inquirer/prompts": "7.5.0",
|
|
22
24
|
"loading-spinner": "1.2.1",
|
|
23
|
-
"prompt-checkbox": "2.2.0",
|
|
24
25
|
"semver": "7.6.2",
|
|
25
26
|
"temp": "0.9.4",
|
|
26
27
|
"yargs": "^17.6.0"
|