-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packages: Publish all modules as independent npm packages #3955
Comments
There is some work being done making Gutenberg modules available as npm packages. This work has started here https://github.com/WordPress/packages (discussions in the #core-js channel). But all modules should not be used as npm packages because:
|
@youknowriad I'm glad to hear this is in progress. You said |
That's a valid use-case that I care about as well, making Gutenberg (or the core of Gutenberg) a reusable piece. While I think it's important to follow this direction, it's not a priority for the first release. |
One valid reason for this is Are you guys considering to get at least the small utilities published in NPM, for everyone in the WP community to be able to use & benefit from them? |
Yes, we are. Expect more in the future but there are some utilities available right now. Others like components, i18n, etc. will follow https://www.npmjs.com/org/wordpress |
One more question is, should I count on the technique of putting the lib globally under If so, I'd like to be able to remove those dependencies from my bundles in the future and just use the globally available ones.
|
Yes, I think so. I think we should think about this module by module because making it available in the global means maintaining backwards compatibility for this global. For example the |
We probably will integrate Lerna into this repository and will publish |
I made a PHP app that copies all of Gutenberg's built JS/CSS files and publishes them as an npm package Not sure if this approach makes sense yet or not, but if I can figure out how to get it work with webpack, I can use Travis to run the app's build command every-time a new tag is added to Gutenberg and then publish the same tag to npm. |
We should publish all Gutenberg modules (except edit-post) as individual packages to npm later this month. I’ll be working on it starting next week the latest. I’m not sure if using built files is the way to go in general but might be beneficial in your case. My thinking is that we should publish sources as they are after each new version is tagged. |
That would be great! That would definitely solve the dependency issues I was running into with unit testing a Jetpack module that depend on Gutenberg's |
I'm testing with
Both tests are passing :) |
I'm moving export * from './components';
export * from './api'; transpiles to commonjs with the unexpected: import _Object$defineProperty from 'babel-runtime/core-js/object/define-property';
import _Object$keys from 'babel-runtime/core-js/object/keys'; |
#7832 upgrades Babel to v7 which will resolve all the issues we have with the transpiled code 🎉 |
I published last of the planned packages with e1811b2 All packages can be downloaded from npm using the stable version. Let's open a follow up issues when they are discovered and iterate on the current setup independently. |
Issue Overview and Possible Solution
When creating a block, I start with something like this:
Strong coupling to global state is consistent with traditional WordPress anti-patterns. But it presents the following problems:
Expected Behavior
Current Behavior
Tasks
api-request
(Add a new@wordpress/api-request
package #7018)blob
(Blob: Extract newblob
package out of utils module #6973) - extracted fromutils
blocks
- depends onandwp.shortcode
window._wpBlocks
(Packages: Add the blocks module to the packages folder #8046)renamed tocore-blocks
block-library
(Extract Core Blocks to the npm packages folder #8287)core-data
(Move the Core Data Module to the reusable packages #7222)components
(Packages: Move the components module partially to the packages folder #7640)compose
(Packages: Add a new compose package #7948)editor
(Packages: Extract the editor package #8081)- we don't plan to publish it, this might changeedit-post
data
(Packages: Move data module to the package maintained by Lerna #6828)date
(Build: Move date module to packages maintained by Lerna #6658)deprecated
(Deprecated: Introduce new module with depreaction util #6914) - extracted fromutils
dom
(Packages: Extract dom package and make it maintained with Lerna #6758) - extracted fromutils
element
(Packages: Move element to packages maintained by Lerna #6756)library-export-default-webpack-plugin
(Build: Add new Webpack plugin to handle library default export #6935)nux
(Packages: Extract@wordpress/nux
package #8016)plugins
(Packages: Move Plugins module to packages #7235)- to be extracted into smaller packages (Editor: Move media upload from utils #7978)utils
viewport
- depends oncomponents
(Packages: Extract viewport package #7975)The text was updated successfully, but these errors were encountered: