woocommerce/packages/js
Joel Thiessen c080886262
Implementation of separate variant slots via refactored components (#36646)
* Adding contants, renaming files, wiring up shipping section with discrete slots for variants and non-variants

* Refactoring pricing section to give discrete slots for variant and non-variant forms

* Refactoring inventory fills to give discrete slots for variant and non-variant products

* Adding additional slot to pricing -> taxes -> advanced

* Renaming api fields component file

* Refactoring images, details and attributes to match others

* Ensure variant field IDs are distinct, organize all product field fill IDs

* Adding changelog

* Simplifying IDs used for slots

* Minor refactor of pricing taxes class field

* Give api fill exports their own registerPlugin scope

* Refactoring WooProductFieldItem to generate unique IDs

* Adding components changelog
2023-01-31 07:19:21 -04:00
..
admin-e2e-tests Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
api Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
api-core-tests Prepare api-core-tests for release (#35001) 2022-10-17 12:24:07 -06:00
components Implementation of separate variant slots via refactored components (#36646) 2023-01-31 07:19:21 -04:00
create-woo-extension Create woo extension: Update Woo version (#36567) 2023-01-24 21:08:59 +13:00
csv-export Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
currency Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
customer-effort-score Always show comments for product feedback form (#36484) 2023-01-23 17:36:48 -08:00
data Updating section and field product fills to support multiple slots (#36592) 2023-01-27 08:42:51 -08:00
date Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
dependency-extraction-webpack-plugin Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
e2e-core-tests Update spelling of Cancelled to Canceled for US English. (#36294) 2023-01-12 12:13:36 +08:00
e2e-environment Update pnpm once again to fix issues with auto-install-peers (#35007) 2022-10-10 16:59:51 +13:00
e2e-utils Fix some bugs in syncpack configuration (#35651) 2022-11-22 12:06:47 +13:00
eslint-plugin Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
experimental Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
explat Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
extend-cart-checkout-block Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
internal-e2e-builds Update pnpm once again to fix issues with auto-install-peers (#35007) 2022-10-10 16:59:51 +13:00
internal-js-tests Update pnpm once again to fix issues with auto-install-peers (#35007) 2022-10-10 16:59:51 +13:00
internal-style-build Add product tour to new product management experience (#36428) 2023-01-18 11:11:02 -08:00
navigation Allow product tab navigation without prompting for unsaved changes (#36235) 2023-01-05 18:30:36 -08:00
notices Update pnpm once again to fix issues with auto-install-peers (#35007) 2022-10-10 16:59:51 +13:00
number Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
onboarding Add Tasklist extensibility and WooOnboardingTaskListHeader SlotFill (#36519) 2023-01-21 15:19:20 +08:00
tracks Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
README.md Fix JS package readme (#35595) 2022-11-16 11:54:47 +13:00
tsconfig-cjs.json Added EOF Newlines 2022-05-10 13:35:31 -07:00
tsconfig.json Update dependencies and jest config to pass admin tests for pnpm 7 (#34428) 2022-08-31 12:06:51 +08:00

README.md

WooCommerce Packages

Currently we have a set of public-facing packages that can be dowloaded from npm and used in external applications. Here is a non-exhaustive list.

  • @woocommerce/components: A library of components that can be used to create pages in the WooCommerce dashboard and reports pages.
  • @woocommerce/csv-export: A set of functions to convert data into CSV values, and enable a browser download of the CSV data.
  • @woocommerce/currency: A class to display and work with currency values.
  • @woocommerce/date: A collection of utilities to display and work with date values.
  • @woocommerce/navigation: A collection of navigation-related functions for handling query parameter objects, serializing query parameters, updating query parameters, and triggering path changes.
  • @woocommerce/tracks: User event tracking utility functions for Automattic based projects.

Working with existing packages

  • You can make changes to packages files as normal, and running pnpm start will compile and watch both app files and packages.
  • ⚠️ Add any dependencies to a package using pnpm add from the package root.
  • ⚠️ Make sure you're not importing from any other files outside of the package (you can import from other packages, just use the import from @woocommerce/package syntax).
  • Don't change the version in package.json.
  • Label your PR with the Packages label.
  • See the Package Release Tool for instructions on how to release packages.

Creating a new package

Most of this is pulled from the Gutenberg workflow.

To create a new package, add a new folder to /packages, containing…

  1. package.json based on the template:

    {
    	"name": "@woocommerce/package-name",
    	"version": "1.0.0-beta.0",
    	"description": "Package description.",
    	"author": "Automattic",
    	"license": "GPL-2.0-or-later",
    	"keywords": [ "wordpress", "woocommerce" ],
    	"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/[_YOUR_PACKAGE_]/README.md",
    	"repository": {
    		"type": "git",
    		"url": "https://github.com/woocommerce/woocommerce.git"
    	},
    	"bugs": {
    		"url": "https://github.com/woocommerce/woocommerce/issues"
    	},
    	"main": "build/index.js",
    	"module": "build-module/index.js",
    	"react-native": "src/index",
    	"publishConfig": {
    		"access": "public"
    	}
    }
    
  2. .npmrc file which disables creating package-lock.json file for the package:

    package-lock=false
    
  3. README.md file containing at least:

    • Package name
    • Package description
    • Installation details
    • Usage example
  4. A src directory for the source of your module, which will be built by default using the pnpm run turbo:build command. Note that you'll want an index.js file that exports the package contents, see other packages for examples.

  5. Add the new package name to packages/js/dependency-extraction-webpack-plugin/assets/packages.js so that users of that plugin will also be able to use the new package without enqueuing it.