woocommerce/plugins/woocommerce-blocks/tsconfig.base.json

78 lines
3.0 KiB
JSON
Raw Normal View History

Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) * add typescript support * Add type declarations for Cart and CartResponse interfaces * make sure we’re resolving .ts files as well as .js files on imports * add more types * type the cart data store * Apply suggestions from code review (implement .tsx in configs) Co-authored-by: Jon Surrell <jon.surrell@automattic.com> * remove global fetchMock declaration and directly import where used. * rename type * remove named action types and just infer by returning action creator values as const * use interface instead of type * rename * renames * create CartAction type as union of action creator returned types and implement in reducer * remove unused imports * refresh package-lock after rebase * Add base TS config that projects will inherit from * Add tsconfig for assets/js/data project * Ignore TS error on cart store registration We will address this in cooldown when we have time to investigate further * Add tsc to build step to catch TypeScript errors * add a separate command for tsc and tweak build command to use * restore checkJs and allowJs values in config and remove ts check from build command * Add ts:check-all command * Add TypeScript checking workflows * Change triggers for TypeScript workflow * Use npm ci instead of npm install * Remove ts:check-all from TypeScript workflow * Remove TS Check GitHub workflow * Remove type-defs dir from TS include, and remove ts:check-all script We no longer need the ts:check-all script because ts:check will do this for us, the old ts:check did nothing and did not work. * fix coupon loading issues * include .ts files only from type-defs folder Co-authored-by: Jon Surrell <jon.surrell@automattic.com> Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2021-02-24 01:36:24 +00:00
{
"exclude": [ "node_modules" ],
"compilerOptions": {
"outDir": "./build",
"sourceMap": true,
"baseUrl": ".",
"module": "esnext",
"emitDeclarationOnly": true,
"esModuleInterop": true,
"exactOptionalPropertyTypes": true,
"resolveJsonModule": true,
"jsx": "preserve",
"target": "esnext",
"allowJs": true,
"moduleResolution": "node",
"lib": [ "dom", "esnext" ],
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"allowSyntheticDefaultImports": true,
"composite": true,
"rootDir": ".",
"typeRoots": [ "./node_modules/@types" ],
"types": [ "jest", "jquery" ],
"paths": {
"@woocommerce/atomic-blocks": [ "assets/js/base/atomic/blocks" ],
"@woocommerce/atomic-blocks/*": [
"assets/js/base/atomic/blocks/*"
],
"@woocommerce/atomic-utils": [ "assets/js/atomic/utils" ],
"@woocommerce/base-components/*": [ "assets/js/base/components/*" ],
"@woocommerce/base-context": [ "assets/js/base/context" ],
"@woocommerce/base-context/*": [ "assets/js/base/context/*" ],
"@woocommerce/base-context/hooks": [
"assets/js/base/context/hooks"
],
"@woocommerce/base-context/components": [
"assets/js/base/context/components"
],
"@woocommerce/base-hocs/*": [ "assets/js/base/hocs/*" ],
"@woocommerce/base-hooks": [ "assets/js/base/hooks" ],
"@woocommerce/interactivity": [ "assets/js/interactivity" ],
"@woocommerce/interactivity/*": [ "assets/js/interactivity/*" ],
"@woocommerce/base-utils": [ "assets/js/base/utils" ],
"@woocommerce/base-utils/*": [ "assets/js/base/utils/*" ],
Add Product Query Support for Atomic Rating Block (https://github.com/woocommerce/woocommerce-blocks/pull/7352) * Add PQ support for client-side. Set up the block for PQ support and add necessary adjustments for the editor. Will address dynamic save functionality in a following commit. * Add dynamic render function for PQ support. * Add dynamic render callback for SSR. * Remove client-side Save function. * Add PQ Context interface to shared type defs. * Convert all block JS files to TS. * Remove commented import from block file. * Add typecasting to block function params. As a workaround, added a general Record type but left a TODO to revisit the proper object, as there is a mismatch in the shape of the default object property types and the actual types. * Update inserter behavior. Allows for the ability to add the rating block from in the inserter (as long as it's an inner block of the listed parents in the config). Also disables the placeholder product selector from being rendered unnecessarily (i.e., when the context ID is present). * Update parent inner blocks config. Reassign parent array to ancestor array which allows for blocks to be included with more flexibility - i.e., added within groups that are children of the ancestor block. * Add productID to rating Attributes interface. * TS type casting and import adustments. Some adjustments to utilize types that we already have available, along with some syntax adjustments and more sensible import tweaks. * Update type-casting to use ProductResponseItem Instead of using the generic Record, we can utilize the ProductResponseItem interface and set an omission for the average_rating property until that is corrected to properly reflect the API response. * Add alias to blocks dir for imports. Allows us to use exports from the blocks dir as "external" imports. This way we do not need to write long, relative import paths (which can be fragile in the long run).
2022-10-31 18:56:17 +00:00
"@woocommerce/blocks/*": [ "assets/js/blocks/*" ],
"@woocommerce/editor-components/*": [
"assets/js/editor-components/*"
],
"@woocommerce/block-data": [ "assets/js/data" ],
"@woocommerce/block-hocs": [ "assets/js/hocs" ],
"@woocommerce/blocks-registry": [ "assets/js/blocks-registry" ],
"@woocommerce/blocks-checkout": [ "packages/checkout" ],
"@woocommerce/blocks-components": [ "packages/components" ],
"@woocommerce/interactivity-components/*": [
"packages/interactivity-components/*"
],
"@woocommerce/price-format": [ "packages/prices" ],
"@woocommerce/block-settings": [ "assets/js/settings/blocks" ],
"@woocommerce/icons": [ "assets/js/icons" ],
"@woocommerce/resource-previews": [ "assets/js/previews" ],
"@woocommerce/settings": [ "assets/js/settings/shared" ],
"@woocommerce/shared-context": [ "assets/js/shared/context" ],
"@woocommerce/shared-hocs": [ "assets/js/shared/hocs" ],
"@woocommerce/type-defs/*": [ "assets/js/types/type-defs/*" ],
"@woocommerce/types": [ "assets/js/types" ],
"@woocommerce/storybook-controls": [ "storybook/custom-controls" ],
"@woocommerce/utils": [ "assets/js/utils" ],
"@woocommerce/e2e-utils": [ "tests/e2e/utils" ],
"@woocommerce/e2e-types": [ "tests/e2e/types" ],
"@woocommerce/e2e-playwright-utils": [ "tests/e2e/playwright-utils" ],
Interactivity API and Product Button (https://github.com/woocommerce/woocommerce-blocks/pull/10006) * Update Interactivity API JS files * Disable TS checks in the Interactivity API for now * Add new SSR files * Replace wp_ prefixes with wc_ ones * Replace wp- prefix with wc- * Replace guternberg_ prefix with woocommerce_ * Remove file comments from Gutenberg * Rename files with `wp` prefix * Fix code to load Interactivity API php files * Remove TODO comments * Replace @wordpress with @woocommerce * Update Webpack configuration * Fix directive prefix * Remove interactivity folder from tsconfig exclude * Add client-side navigation meta tag code * Remove unneeded blocks.php file * Fix store tag id * Register Interactivity API runtime script * Fix Interactivity API runtime registering * Remove all files related to directive processing in PHP * Move json_encode to Store's render method * WIP * WIP * WIP * WIP * Preserve previous context * Ignore Minicart block on client-side navigation * Refresh page on store updatRefresh page on store updatee * Refactor logic * Add console error when a path is missing * fix PHP lint error * WIP store * use store approach * update jest configuration * restore Mini Cart changes * move cart store subscription to interactivity package * move interactivity flag * format HTML * move addToCartText to the context * Load product-query stylesheet when rendering the Products block * update sideEffects array * fix catch * rename moreThanOneItem to isThereMoreThanOneItem * improve how scripts are enqueued * update default value for the filter woocommerce_blocks_enable_interactivity_api * Update assets/js/atomic/blocks/product-elements/button/block.json Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com> * Update assets/js/interactivity/cart/cart-store.ts Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com> * fix block.json * remove updateStore function * restore interactivity api changes * import cart store * show notice when there is an error * add logic to dequeue script on classic themes and block themes * imrpove logic about notice * Interactivity API: add `afterLoad` callbacks to `store()` function (https://github.com/woocommerce/woocommerce-blocks/pull/10338) * show notice when there is an error * Add initial implementation for store callbacks * Run `afterLoad` callbacks after `init` * Move cart state subscription to Product button * Remove cart-store from Interactivity API internals * Change callbacks with options and save only afterLoad callbacks * ProductButton: Add animation (https://github.com/woocommerce/woocommerce-blocks/pull/10351) * implement animation * improve logic * refactor logic * refactor code * address feedback about code style * add support for woocommerce_add_to_cart_quantity * Fix animation flickering * Introduce wp-effect, reduce the amount of numberOfItem variables to 2 and consolidate animation status * add support for added class * Remove unnecessary selector * Don't fetch cart if it was already fetched * remove added class --------- Co-authored-by: Luis Herranz <luisherranz@gmail.com> --------- Co-authored-by: Luigi <gigitux@gmail.com> Co-authored-by: Luis Herranz <luisherranz@gmail.com> * update deepsignal * remove added class * update deepsignal * Interactivity API and Product Button: Add E2E tests (https://github.com/woocommerce/woocommerce-blocks/pull/10036) * Add FrontendUtils class * fix conflicts * use locator * restore click usage * Product Button: Add E2E test * fix util * fix E2E tests * remove comment * Add E2E test to ensure that woocommerce_product_add_to_cart_text works * update sideEffects array * add zip and unzip as package * fix wp-env configuration * fix E2E test * add report * try now * try now * try now * fix E2E test * E2E: Add documentation for testing actions and filters. Fixes woocommerce/woocommerce-blocks#10135 (https://github.com/woocommerce/woocommerce-blocks/pull/10206) * update description * fix label * rename files * make requestUtils private * remove page.goto * use toHaveCount * use productsToDisplay variable * fix E2E tests * rename class utils --------- Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com> --------- Co-authored-by: David Arenas <david.arenas@automattic.com> Co-authored-by: Luis Herranz <luisherranz@gmail.com> Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com> Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2023-08-10 14:02:33 +00:00
"@woocommerce/e2e-mocks/*": [ "tests/e2e/mocks/*" ],
"@woocommerce/templates/*": [ "assets/js/templates/*" ]
}
Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) * add typescript support * Add type declarations for Cart and CartResponse interfaces * make sure we’re resolving .ts files as well as .js files on imports * add more types * type the cart data store * Apply suggestions from code review (implement .tsx in configs) Co-authored-by: Jon Surrell <jon.surrell@automattic.com> * remove global fetchMock declaration and directly import where used. * rename type * remove named action types and just infer by returning action creator values as const * use interface instead of type * rename * renames * create CartAction type as union of action creator returned types and implement in reducer * remove unused imports * refresh package-lock after rebase * Add base TS config that projects will inherit from * Add tsconfig for assets/js/data project * Ignore TS error on cart store registration We will address this in cooldown when we have time to investigate further * Add tsc to build step to catch TypeScript errors * add a separate command for tsc and tweak build command to use * restore checkJs and allowJs values in config and remove ts check from build command * Add ts:check-all command * Add TypeScript checking workflows * Change triggers for TypeScript workflow * Use npm ci instead of npm install * Remove ts:check-all from TypeScript workflow * Remove TS Check GitHub workflow * Remove type-defs dir from TS include, and remove ts:check-all script We no longer need the ts:check-all script because ts:check will do this for us, the old ts:check did nothing and did not work. * fix coupon loading issues * include .ts files only from type-defs folder Co-authored-by: Jon Surrell <jon.surrell@automattic.com> Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2021-02-24 01:36:24 +00:00
}
}