Wp-calypso: Jetpack Blocks: Package-level dependencies

Created on 23 Oct 2018  路  3Comments  路  Source: Automattic/wp-calypso

We're publishing client/gutenberg/extensions/presets/jetpack/ to npm as @automattic/jetpack-blocks.

However, we're currently not stating any of its dependencies in its package.json. Rather, we're using Calypso's own package.json file to state some of them (example).

We should change jetpack-blocks' package.json to include all of its dependencies, and remove those that aren't otherwise needed by Calypso from the top-level package.json.

/cc @Automattic/luna @Automattic/team-calypso

Jetpack [Goal] Gutenberg [Pri] Low [Type] Task

Most helpful comment

I think it's important to separate out the notion of a built bundle, which is meant to be delivered to a browser, and a reuse-able module that's intended to be built into a bundle. Usually npm modules are the latter, not the former. I'd expect Jetpack to depend on modules from Calypso via npm and to use a common build tool itself to produce a bundle.

All 3 comments

The published package doesn't have any dependencies, it bundles everything and is a standalone bundle.

If we start to declare dependencies on the packages, consumers will begin to redundantly install them on npm install, but never use them from within the bundle.

This is a strange state of affairs. The Jetpack blocks aren't a traditional module in that it's essentially a compiled/bundled application.

The line between Calypso proper and the bundles that it can produce isn't very clear right now. Further along this may become clearer, something like:

  • The SDK becomes an independent module in the Calypso monorepo that consists mostly of a config and set of dependencies.
  • A large set of modules have been isolated and are ~exported~ published from the Calypso monorepo. The SDK depends on these. SDK-built bundles no longer have access to the entirety of Calypso.

I think it's important to separate out the notion of a built bundle, which is meant to be delivered to a browser, and a reuse-able module that's intended to be built into a bundle. Usually npm modules are the latter, not the former. I'd expect Jetpack to depend on modules from Calypso via npm and to use a common build tool itself to produce a bundle.

Closing since we no longer have @automattic/jetpack-blocks.

Was this page helpful?
0 / 5 - 0 ratings