diff --git a/.github/workflows/deploy-zeit.yml b/.github/workflows/deploy-zeit.yml index f9ba52c8d..502984579 100644 --- a/.github/workflows/deploy-zeit.yml +++ b/.github/workflows/deploy-zeit.yml @@ -22,7 +22,7 @@ jobs: - name: Build packages run: | yarn - yarn build + yarn build --ci - name: Deploy PR to zeit if: github.event_name == 'pull_request' uses: patzick/now-deployment@master diff --git a/api-extractor.json b/api-extractor.json index 5d26120d6..8e3cbfe11 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -4,7 +4,7 @@ "apiReport": { "enabled": true, - "reportFolder": "/temp/" + "reportFolder": "/api/" }, "docModel": { diff --git a/api/composables.api.md b/api/composables.api.md new file mode 100644 index 000000000..0f4226bc7 --- /dev/null +++ b/api/composables.api.md @@ -0,0 +1,137 @@ +## API Report File for "@shopware-pwa/composables" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { AddressType } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/customer/CustomerAddress'; +import { Customer } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/customer/Customer'; +import { CustomerAddress } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/customer/CustomerAddress'; +import { CustomerRegistrationParams } from '@shopware-pwa/shopware-6-client/src/interfaces/request/CustomerRegistrationParams'; +import { Order } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/order/Order'; +import { Product } from '@shopware-pwa/shopware-6-client/src/interfaces/models/content/product/Product'; +import { Ref } from '@vue/composition-api'; + +// @alpha (undocumented) +export function getStore(): any; + +// @alpha (undocumented) +export type Search = (path: string, associations?: any) => any; + +// @alpha (undocumented) +export function setStore(ref: any): void; + +// @alpha (undocumented) +export interface UseAddToCart { + // (undocumented) + addToCart: () => Promise; + // (undocumented) + error: Ref; + // (undocumented) + getStock: Ref; + // (undocumented) + isInCart: Ref; + // (undocumented) + loading: Ref; + // (undocumented) + quantity: Ref; +} + +// @alpha (undocumented) +export const useAddToCart: (product: Product) => UseAddToCart; + +// @alpha (undocumented) +export const useCart: () => any; + +// @alpha (undocumented) +export const useCartSidebar: () => any; + +// @alpha (undocumented) +export const useCategoryFilters: () => any; + +// @alpha (undocumented) +export const useCms: () => any; + +// @public (undocumented) +export const useNavigation: () => any; + +// @alpha (undocumented) +export interface UseProduct { + // (undocumented) + [x: string]: any; + // (undocumented) + error: Ref; + // (undocumented) + loading: Ref; + // (undocumented) + product: Ref; + // (undocumented) + search: SEARCH; +} + +// @alpha (undocumented) +export const useProduct: (loadedProduct?: any) => UseProduct; + +// @alpha (undocumented) +export interface UseProductListing { + // (undocumented) + [x: string]: any; + // (undocumented) + error: Ref; + // (undocumented) + loading: Ref; +} + +// @alpha (undocumented) +export const useProductListing: (initialProducts?: Product[]) => UseProductListing; + +// @alpha (undocumented) +export interface UseUser { + // (undocumented) + addresses: Ref; + // (undocumented) + deleteAddress: (addressId: string) => Promise; + // (undocumented) + error: Ref; + // (undocumented) + getOrderDetails: (orderId: string) => Promise; + // (undocumented) + isLoggedIn: Ref; + // (undocumented) + loadAddresses: () => Promise; + // (undocumented) + loading: Ref; + // (undocumented) + loadOrders: () => Promise; + // (undocumented) + login: ({ username, password }: { + username?: string; + password?: string; + }) => Promise; + // (undocumented) + logout: () => Promise; + // (undocumented) + markAddressAsDefault: ({ addressId, type }: { + addressId?: string; + type?: AddressType; + }) => Promise; + // (undocumented) + orders: Ref; + // (undocumented) + refreshUser: () => Promise; + // (undocumented) + register: ({}: CustomerRegistrationParams) => Promise; + // (undocumented) + user: Ref; +} + +// @alpha (undocumented) +export const useUser: () => UseUser; + +// @public (undocumented) +export const useUserLoginModal: () => any; + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/api/helpers.api.md b/api/helpers.api.md new file mode 100644 index 000000000..f9b7dd7f1 --- /dev/null +++ b/api/helpers.api.md @@ -0,0 +1,254 @@ +## API Report File for "@shopware-pwa/helpers" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { CmsPage } from '@shopware-pwa/shopware-6-client/src/interfaces/models/content/cms/CmsPage'; +import { CmsSection } from '@shopware-pwa/shopware-6-client/src/interfaces/models/content/cms/CmsPage'; +import { Product } from '@shopware-pwa/shopware-6-client/src/interfaces/models/content/product/Product'; +import { PropertyGroupOption } from '@shopware-pwa/shopware-6-client/src/interfaces/models/content/property/PropertyGroupOption'; +import { SearchCriteria } from '@shopware-pwa/shopware-6-client/src/interfaces/search/SearchCriteria'; +import { Sort } from '@shopware-pwa/shopware-6-client/src/interfaces/search/SearchCriteria'; +import { UiMediaGalleryItem as UiMediaGalleryItem_2 } from '@shopware-pwa/helpers'; +import { UiProductOption as UiProductOption_2 } from '@shopware-pwa/helpers'; +import { UiProductProperty as UiProductProperty_2 } from '@shopware-pwa/helpers'; +import { UiProductReview as UiProductReview_2 } from '@shopware-pwa/helpers'; + +// @alpha (undocumented) +export interface CategoryFilterEntityValue { + // (undocumented) + customFields: any; + // (undocumented) + description: string | null; + // (undocumented) + name: string; +} + +// @alpha (undocumented) +export interface CategoryFilterEntityValues { + // (undocumented) + [valueId: string]: CategoryFilterEntityValue; +} + +// @alpha (undocumented) +export interface CategoryFilterRangeValues { + // (undocumented) + max: string; + // (undocumented) + min: string; +} + +// @alpha (undocumented) +export interface CategoryFilterTermValue { + // (undocumented) + count: number; + // (undocumented) + extensions: any; + // (undocumented) + key: string; +} + +// @alpha (undocumented) +export function exportUrlQuery(searchCriteria: SearchCriteria): string | undefined; + +// @alpha (undocumented) +export function getCategoryAvailableFilters({ filters }?: { + filters?: Filter; +}): UiCategoryFilter[]; + +// @alpha (undocumented) +export function getCategoryAvailableSorting({ sorting }?: { + sorting?: Sorting; +}): UiCategorySorting[]; + +// @alpha (undocumented) +export function getCmsSections(content: CmsPage): CmsSection[]; + +// @alpha (undocumented) +export const getFilterSearchCriteria: (selectedFilters: any) => any[]; + +// @alpha (undocumented) +export function getProductMainImageUrl({ product }?: { + product?: Product; +}): string; + +// @alpha (undocumented) +export function getProductMediaGallery({ product }?: { + product?: Product; +}): UiMediaGalleryItem_2[]; + +// @alpha (undocumented) +export function getProductName({ product }?: { + product?: Product; +}): string | null; + +// @alpha (undocumented) +export function getProductOption({ product, attribute }?: { + product?: Product; + attribute?: string; +}): PropertyGroupOption | undefined; + +// Warning: (ae-forgotten-export) The symbol "ProductOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export function getProductOptions({ product }?: { + product?: Product; +}): ProductOptions; + +// @alpha (undocumented) +export function getProductOptionsUrl({ product, options }?: { + product?: Product; + options?: string[]; +}): string; + +// @alpha (undocumented) +export function getProductProperties({ product }?: { + product?: Product; +}): UiProductProperty_2[]; + +// @alpha (undocumented) +export function getProductRegularPrice({ product }?: { + product?: Product; +}): number; + +// @alpha (undocumented) +export function getProductReviews({ product }?: { + product?: Product; +}): UiProductReview_2[]; + +// @alpha (undocumented) +export function getProductSpecialPrice(product: Product): number; + +// @alpha (undocumented) +export function getProductUrl(product: Product | null): string; + +// @alpha (undocumented) +export const getSortingLabel: (sorting: SwSorting) => string; + +// @alpha (undocumented) +export const getSortingSearchCriteria: (selectedSorting: SwSorting) => Sort; + +// @alpha (undocumented) +export function getVariantOptionsLabel({ product }?: { + product?: Product; +}): string | null; + +// @alpha (undocumented) +export function isProductSimple({ product }?: { + product?: Product; +}): boolean; + +// @alpha (undocumented) +export function parseUrlQuery(query: any): SearchCriteria; + +// @alpha (undocumented) +export interface SwSorting { + // (undocumented) + active: boolean; + // (undocumented) + field: string; + // (undocumented) + name: string; + // (undocumented) + order: string; +} + +// @alpha (undocumented) +export interface UiCategoryFilter { + // (undocumented) + name: string; + // Warning: (ae-forgotten-export) The symbol "UiCategoryFilterOption" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "UiCategoryRangeFilterOption" needs to be exported by the entry point index.d.ts + // + // (undocumented) + options: UiCategoryFilterOption[] | UiCategoryRangeFilterOption | any; + // (undocumented) + type: UiCategoryFilterType; +} + +// @public (undocumented) +export enum UiCategoryFilterType { + // (undocumented) + entity = "entity", + // (undocumented) + max = "max", + // (undocumented) + range = "range", + // (undocumented) + term = "term" +} + +// @alpha (undocumented) +export interface UiCategorySorting { + // (undocumented) + active: boolean; + // (undocumented) + field: string; + // (undocumented) + name: string; + // (undocumented) + order: string; +} + +// @alpha (undocumented) +export interface UiMediaGalleryItem { + // (undocumented) + big: UiMediaGalleryItemUrl; + // (undocumented) + normal: UiMediaGalleryItemUrl; + // (undocumented) + small: UiMediaGalleryItemUrl; +} + +// @alpha (undocumented) +export interface UiMediaGalleryItemUrl { + // (undocumented) + url: string; +} + +// @alpha (undocumented) +export interface UiProductOption { + // (undocumented) + [attribute: string]: string; + // (undocumented) + attribute: string; + // (undocumented) + code: string; + // (undocumented) + label: string; + // (undocumented) + value: string; +} + +// @alpha (undocumented) +export interface UiProductProperty { + // (undocumented) + name: string; + // (undocumented) + value: string | null; +} + +// @alpha (undocumented) +export interface UiProductReview { + // (undocumented) + author: string; + // (undocumented) + date: Date; + // (undocumented) + id: string; + // (undocumented) + message: string | null; + // (undocumented) + rating: number | null; +} + + +// Warnings were encountered during analysis: +// +// dist/packages/helpers/src/category/getCategoryAvailableFilters.d.ts:42:5 - (ae-forgotten-export) The symbol "Filter" needs to be exported by the entry point index.d.ts +// dist/packages/helpers/src/category/getCategoryAvailableSorting.d.ts:12:5 - (ae-forgotten-export) The symbol "Sorting" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/api/shopware-6-client.api.md b/api/shopware-6-client.api.md new file mode 100644 index 000000000..59e37e190 --- /dev/null +++ b/api/shopware-6-client.api.md @@ -0,0 +1,252 @@ +## API Report File for "@shopware-pwa/shopware-6-client" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Cart } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/cart/Cart'; +import { Category } from '@shopware-pwa/shopware-6-client/src/interfaces/models/content/category/Category'; +import { CmsPage } from '@shopware-pwa/shopware-6-client/src/interfaces/models/content/cms/CmsPage'; +import { ContextTokenResponse } from '@shopware-pwa/shopware-6-client/src/interfaces/response/ContextTokenResponse'; +import { Country } from '@shopware-pwa/shopware-6-client/src/interfaces/models/system/country/Country'; +import { Currency } from '@shopware-pwa/shopware-6-client/src/interfaces/models/system/currency/Currency'; +import { Customer } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/customer/Customer'; +import { CustomerAddress } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/customer/CustomerAddress'; +import { CustomerRegistrationParams } from '@shopware-pwa/shopware-6-client/src/interfaces/request/CustomerRegistrationParams'; +import { Language } from '@shopware-pwa/shopware-6-client/src/interfaces/models/framework/language/Language'; +import { Order } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/order/Order'; +import { PaymentMethod } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/payment/PaymentMethod'; +import { Product } from '@shopware-pwa/shopware-6-client/src/interfaces/models/content/product/Product'; +import { SearchCriteria } from '@shopware-pwa/shopware-6-client/src/interfaces/search/SearchCriteria'; +import { SearchResult } from '@shopware-pwa/shopware-6-client/src/interfaces/response/SearchResult'; +import { ShippingMethod } from '@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/shipping/ShippingMethod'; + +// @alpha +export function addCartItemQuantity(itemId: string, quantity: number): Promise; + +// @alpha +export function addProductToCart(productId: string, quantity: number): Promise; + +// @alpha +export function addPromotionCode(promotionCode: string): Promise; + +// @alpha +export function changeCartItemQuantity(itemId: string, newQuantity?: number): Promise; + +// @alpha +export function clearCart(): Promise; + +// Warning: (ae-forgotten-export) The symbol "ClientSettings" needs to be exported by the entry point index.d.ts +// +// @beta (undocumented) +export const config: ClientSettings; + +// @alpha (undocumented) +export interface ConfigChangedArgs { + // (undocumented) + config: ClientSettings; +} + +// @alpha +export function createCustomerAddress(params: CustomerAddressParam): Promise; + +// @alpha (undocumented) +export interface CustomerAddressParam extends Partial { +} + +// @alpha (undocumented) +export interface CustomerRegisterResponse { + // (undocumented) + data: string; +} + +// @alpha (undocumented) +export interface CustomerUpdateEmailParam { + // (undocumented) + email: string; + // (undocumented) + emailConfirmation: string; + // (undocumented) + password: string; +} + +// @alpha (undocumented) +export interface CustomerUpdatePasswordParam { + // (undocumented) + newPassword: string; + // (undocumented) + newPasswordConfirm: string; + // (undocumented) + password: string; +} + +// @alpha (undocumented) +export interface CustomerUpdateProfileParam { + // (undocumented) + firstName: string; + // (undocumented) + lastName: string; + // (undocumented) + salutationId: string; + // (undocumented) + title: string | null; +} + +// @alpha +export function deleteCustomerAddress(addressId: string): Promise; + +// @alpha (undocumented) +export function getAvailableCountries(): Promise>; + +// @alpha (undocumented) +export function getAvailableCurrencies(): Promise>; + +// @alpha (undocumented) +export function getAvailableLanguages(): Promise>; + +// @alpha (undocumented) +export function getAvailablePaymentMethods(): Promise>; + +// @alpha (undocumented) +export function getAvailableShippingMethods(): Promise>; + +// @alpha +export function getCart(): Promise; + +// @alpha (undocumented) +export function getCategories(searchCriteria?: SearchCriteria): Promise>; + +// @alpha (undocumented) +export function getCategory(categoryId: string): Promise; + +// @alpha +export function getCustomer(): Promise; + +// @alpha +export function getCustomerAddress(addressId: string): Promise; + +// @alpha +export function getCustomerAddresses(): Promise; + +// @alpha +export function getCustomerOrderDetails(orderId: string): Promise; + +// @alpha +export function getCustomerOrders(): Promise; + +// @alpha (undocumented) +export function getNavigation(params: GetNavigationParams): Promise; + +// @alpha (undocumented) +export interface GetNavigationParams { + // (undocumented) + depth: number; + // (undocumented) + rootNode?: string; +} + +// @alpha (undocumented) +export function getPage(path: string, searchCriteria?: SearchCriteria): Promise>; + +// @alpha +export function getProduct(productId: string, params?: any): Promise; + +// @alpha +export const getProducts: (searchCriteria?: SearchCriteria | undefined) => Promise>; + +// @alpha +export const getProductsIds: () => Promise>; + +// @alpha +export function login({ username, password }?: { + username?: string; + password?: string; +}): Promise; + +// @alpha +export function logout(): Promise; + +// @alpha (undocumented) +export interface NavigationElement { + // (undocumented) + children: NavigationElement[] | null; + // (undocumented) + count: number; + // (undocumented) + extensions: any[]; + // (undocumented) + id: string; + // (undocumented) + level: number; + // (undocumented) + name: string; + // (undocumented) + path: string; +} + +// @alpha (undocumented) +export interface NavigationResponse { + // (undocumented) + children: NavigationElement[]; + // (undocumented) + count: number; +} + +// @alpha (undocumented) +export function onConfigChange(fn: (context: ConfigChangedArgs) => void): void; + +// @alpha (undocumented) +export interface PageResolverResult { + // (undocumented) + breadcrumb: any[]; + // (undocumented) + cmsPage: T; + // (undocumented) + resourceIdentifier: string; + // (undocumented) + resourceType: string; +} + +// @alpha +export function register(params: CustomerRegistrationParams): Promise; + +// @alpha +export function removeCartItem(itemId: string): Promise; + +// @alpha (undocumented) +export function setCurrentCurrency(newCurrencyID: string): Promise; + +// @alpha (undocumented) +export function setCurrentLanguage(newLanguageId: string): Promise; + +// @alpha (undocumented) +export function setCurrentPaymentMethod(newPaymentMethodId: string): Promise; + +// @alpha (undocumented) +export function setCurrentShippingMethod(newShippingMethodId: string): Promise; + +// @alpha +export function setDefaultCustomerBillingAddress(addressId: string): Promise; + +// @alpha +export function setDefaultCustomerShippingAddress(addressId: string): Promise; + +// @public +export function setup(config?: ClientSettings): void; + +// @public +export function update(config?: ClientSettings): void; + +// @alpha +export function updateEmail(params: CustomerUpdateEmailParam): Promise; + +// @alpha +export function updatePassword(params: CustomerUpdatePasswordParam): Promise; + +// @alpha +export function updateProfile(params: CustomerUpdateProfileParam): Promise; + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/scripts/build.js b/scripts/build.js index 419846631..8b8aa5520 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -31,6 +31,7 @@ const isRelease = args.release; const buildTypes = args.t || args.types || isRelease; const buildAllMatching = args.all || args.a; const lean = args.lean || args.l; +const isCIRun = !!args.ci; const commit = execa.sync("git", ["rev-parse", "HEAD"]).stdout.slice(0, 7); run(); @@ -47,7 +48,8 @@ async function run() { async function buildAll(targets) { for (const target of targets) { - await build(target); + const result = await build(target); + if (result === false) return; } } @@ -101,12 +103,12 @@ async function build(target) { const extractorConfig = ExtractorConfig.loadFileAndPrepare( extractorConfigPath ); - const result = Extractor.invoke(extractorConfig, { - localBuild: true, + const extractorResult = Extractor.invoke(extractorConfig, { + localBuild: !isCIRun, showVerboseMessages: true }); - if (result.succeeded) { + if (extractorResult.succeeded) { // concat additional d.ts to rolled-up dts (mostly for JSX) if (pkg.buildOptions && pkg.buildOptions.dts) { const dtsPath = path.resolve(pkgDir, pkg.types); @@ -126,7 +128,15 @@ async function build(target) { `API Extractor completed with ${extractorResult.errorCount} errors` + ` and ${extractorResult.warningCount} warnings` ); + console.log( + chalk.bold( + chalk.red( + `Probably public API has changed. You need to run 'yarn build' locally and commit generated public API documentation.` + ) + ) + ); process.exitCode = 1; + return false; } await fs.remove(`${pkgDir}/dist/packages`);