Alokai Changelog
0.2.0
Minor Changes
- CHANGED In both
@vue-storefront/nextand@vue-storefront/nuxt, theconfigparameter available in the callback passed todefineSdkConfig()no longer contains computedmiddlewareUrlproperty. It now exposesapiUrlandssrApiUrlthat should be used instead. Read the migration guides for this Storefront version to see examples of usingapiUrlandssrApiUrlin your SDK configuration files. This change is necessary to support custom domain setup OOTB. - CHANGED Storefronts has been update to be compliant with the European Accessibility Act (EAA) and Web Content Accessibility Guidelines (WCAG) 2.1 AA.
- ADDED Multistore capabilities with shared configuration packages
- ADDED File-based inheritance system for efficient code sharing across stores
- ADDED Centralized configuration management for ESLint, Prettier, Tailwind, and lint-staged
- CHANGED Project structure to support multiple stores with shared packages
- CHANGED Turbo configuration updated to version 2.4.4 with new tasks format
- ADDED Alokai CLI integration for store management
- ADDED CI/CD pipeline setup for multistore deployments
Migration guide (Multistore)
To migrate your existing project to the new multistore setup, follow the multistore migration guide. Your Alokai Solution Architect can help you with the migration process.
Migration guide (Custom domains setup OOTB - Next.js)
The changes below are only relevant for Next apps. If you are using Nuxt, you can skip this section.
- Update environment variables
In the apps/storefront-unified-nextjs/sdk/options.ts file, verify the NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL environment variable exists:
const ssrApiUrl = env('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL');
+ if (!ssrApiUrl) {
+ throw new Error('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL is required to run the app');
+ }
See our guide on initializing the SDK for a complete version of the file.
Also, make sure the environment variable is added to the apps/storefront-unified-nextjs/.env.example file and - if it exists - the apps/storefront-unified-nextjs/.env file:
+ NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL="http://localhost:4000"
- Update
@vue-storefront/nextversion
In apps/storefront-unified-nextjs/package.json, upgrade the version of @vue-storefront/next package to 5.1.0.
{
"dependencies": {
- "@vue-storefront/next": "4.3.2",
+ "@vue-storefront/next": "5.1.0",
}
}
remember to reinstall the dependencies of your project with the yarn install command afterwards.
- Update SDK configuration file
Update your SDK configuration file (apps/storefront-unified-nextjs/sdk/config.ts) so that registered modules use apiUrl and ssrApiUrl properties instead of middlewareUrl.
import { defineSdkConfig } from '@vue-storefront/next';
export function getSdkConfig() {
return defineSdkConfig(({ buildModule, config, getRequestHeaders, middlewareModule }) => ({
commerce: buildModule(middlewareModule, {
- apiUrl: `${config.middlewareUrl}/commerce`,
+ apiUrl: `${config.apiUrl}/commerce`,
+ ssrApiUrl: `${config.ssrApiUrl}/commerce`,
}),
}));
}
Migration guide (Custom domains setup OOTB - Nuxt)
- Update environment variables
Make sure the NUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL environment variable is added to the apps/storefront-unified-nuxt/.env.example file and - if it exists - the apps/storefront-unified-nuxt/.env file:
+ NUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL="http://localhost:4000"
- Update
@vue-storefront/nuxtversion
In apps/storefront-unified-nuxt/package.json, upgrade the version of @vue-storefront/nuxt package to 8.1.0.
{
"dependencies": {
- "@vue-storefront/nuxt": "7.0.0",
+ "@vue-storefront/nuxt": "8.1.0",
}
}
remember to reinstall the dependencies of your project with the yarn install command afterwards.
- Update SDK configuration file
Update your SDK configuration file (apps/storefront-unified-nuxt/sdk.config.ts) so that registered modules use apiUrl and ssrApiUrl properties instead of middlewareUrl.
export default defineSdkConfig(({ buildModule, config, getRequestHeaders, middlewareModule }) => ({
commerce: buildModule(middlewareModule, {
- apiUrl: `${config.middlewareUrl}/commerce`,
+ apiUrl: `${config.apiUrl}/commerce`,
+ ssrApiUrl: `${config.ssrApiUrl}/commerce`,
}),
}));
0.1.0
Minor Changes
- ADDED Alokai ecosystem versioning: Each release of a core package now includes a version bump for the entire ecosystem, simplifying tracking of changes and ensuring compatibility between packages. Core packages include:
@vue-storefront/middleware@vue-storefront/multistore@vue-storefront/unified-data-model@vue-storefront/sdk@vue-storefront/nuxt@vue-storefront/nextCompatibility matrix for the entire ecosystem is available here.
- CHANGED
@vue-storefront/nuxtversion updated tov7.0.0. - CHANGED from now on
getSdkis available instead ofsdkproperty on globalNuxtApp.$alokaiobject. - CHANGED You should now ensure that environment variables
NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL(for Next.js apps) andNUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL(for Nuxt apps) are set in your file both locally and in your deployed application.
Patch Changes
- FIXED Nuxt App -
useLazyProductcomposable merged product data wrongly. - FIXED Nuxt App - localization plugin need to set locale cookie directly in the plugin initialization.
- FIXED Next App - the initial page load with a locale in the URL, different from the previously set one, now correctly fetches data in the right language from the server.
Migration guide (Next.js)
The changes below are only relevant for Next apps. If you are using Nuxt, you can skip this section.
- Set the
NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URLenvironment variable in your.envfile.
+ NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL=http://localhost:4000
- Set the
NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URLenvironment variable tohttp://additional-app-middleware:4000in your deployed application. - Use
cookiesfromnext/headersin yourgetSdkfunction to fix the issue with the initial page load with a locale in the URL, different from the previously set one.
import {
headers,
+ cookies,
} from 'next/headers;
import { getSdk } from './sdk.server';
// ...
getSdk({
- getRequestHeaders: () => headers
+ getRequestHeaders: () => ({
+ headers: headers(),
+ cookies: cookies(),
+ }),
});
Migration guide (Nuxt)
The changes below are only relevant for Nuxt apps. If you are using Next.js, you can skip this section.
- Set the
NUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URLenvironment variable in your.envfile.
+ NUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL=http://localhost:4000
- Set the
NUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URLenvironment variable tohttp://additional-app-middleware:4000in your deployed application. - Modify localization plugin to set locale cookie directly in the plugin initialization.
+ import type { Composer } from '#i18n';
// ...
- nuxtApp.hook('vue:setup', () => {
- const { locale: i18nLocale, locales: i18nLocales } = useI18n();
+ const { locale: i18nLocale, locales: i18nLocales } = (nuxtApp as unknown as { $i18n: Composer }).$i18n;
// ...
- });
- Update
@vue-storefront/nuxtpackage tov7.0.0.
- "@vue-storefront/nuxt": "6.x.x",
+ "@vue-storefront/nuxt": "7.0.0",
- Update the way you get the SDK instance.
// get sdk instance
- const { sdk } = useNuxtApp().$alokai;
+ const sdk = useNuxtApp().$alokai.getSdk();
// fetch some data
sdk.unified.getProducts();
Common issues
Despite following this migration guide, you might still experience issues in several areas of your project.
Nuxt Checkout module linting errors
Running the yarn lint command might result in errors caused by the Checkout module in the Nuxt Storefront. If that is the case in your project:
- In the
apps/storefront-unified-nuxt/sf-modules/checkout/components/Checkout/Checkout.vuefile disable the following eslint rule on line 1:
+ <!-- eslint-disable vue/multi-word-component-names -->
<template>
...
</template>
and the following eslint rule on line 151:
if (!termsAndConditions.value) {
validationMessages.push('validation.missingTermsAndConditions');
+ // eslint-disable-next-line vue/no-side-effects-in-computed-properties
invalidTermsAndConditions.value = true;
}
- In the
apps/storefront-unified-nuxt/sf-modules/checkout/pages/checkout.vuefile disable the following eslint rule on line 1:
+ <!-- eslint-disable vue/multi-word-component-names -->
<template>
...
</template>
Custom extension linting errors
Running the yarn lint command might result in errors caused by the custom extension in the Storefront Middleware app. If that is the case in your project, in the apps/storefront-middleware/api/custom-methods/custom.ts file disable the following eslint rule on line 1:
+ /* eslint-disable @typescript-eslint/no-unused-vars */
import { type IntegrationContext } from '../../types';
import type { CustomMethodArgs, CustomMethodResponse } from './types';
Nuxt and Middleware tsconfig.json linting errors
Running the yarn lint command might result in errors caused by the Typescript configuration files in the Nuxt Storefront and Storefront Middleware apps. If that is the case in your project, add new lines at the end of the apps/storefront-unified-nuxt/tsconfig.json and apps/storefront-middleware/tsconfig.json files.