woocommerce/packages/js
louwie17 b8c25b49bf
Initial product form field store (#36362)
* Add initial product fields registry store and helper functions

* Add changelog

* Change edit to render and address PR feedback

* Make use of memoize-one instead of rememo as memoize-one is already installed
2023-01-12 04:02:35 -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 Initial product form field store (#36362) 2023-01-12 04:02:35 -04:00
create-woo-extension Dev/woo ext/components (#36328) 2023-01-06 14:04:08 -08: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 Make secondQuestion and title params optional in CES Prompt (#36270) 2023-01-11 18:53:36 +07:00
data Product variations should inherit parent product properties (#36234) 2023-01-11 11:41:25 -03: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 tabs to product layout (#35862) 2022-12-13 08:13:12 -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 Update changelogger to 3.3.0 to support PR number capturing with merge (#36266) 2023-01-05 14:42:51 +05:30
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.