3.4.8 • Published 3 years ago

@bufferapp/composer v3.4.8

Weekly downloads
218
License
-
Repository
-
Last release
3 years ago

buffer-composer

Repo Structure

  • composer/: the composer itself, exports a React component; should only be consumed in this package
  • interfaces/: composer wrappers; use those wrappers to make use of the composer in a project; interfaces are named according to their target environment (e.g. buffer-publish.jsx for Publish)
    • utils/: wrapper utilities; for some projects, e.g. buffer-web with its iframe approach, an extra set of helpers is needed on the other side of the frame, for communication and whatnot: this is it

How to update the composer

Use this repo like you would any other Buffer repo: make changes in a separate branch, ask for code review when necessary, merge PR in master when ready. Storybook will be added to this repo so that we can work on the composer easily in isolation. For now, see the last section of this readme for development tips.

Once changes are into master:

  1. Make sure the version number (in package.json) was bumped (we follow semver)
  2. Pull the newest master (which now has your changes)
  3. Publish this new version to npm: npm publish --access public
  4. Update the composer's version number in the other project's package.json dependencies (make @bufferapp/composer point to the version you've just published)
  5. Now that this other project points to the newest composer version, bundle it up before deploying it:
  • For Web: run gulp watch/webpack --app contentController (watch for dev env and watch changes, webpack for prod env)
  • For Publish:

How the composer is consumed

The composer is the same across all projects. However each project has its own set of specificities, so this package offers a tailored interface for each project the composer is currently being used in.

Here's how the composer is being used across our apps:

  • buffer-publish: The Publish interface is nothing more than a Composer React component that you can drop anywhere in the app and pass props to. It's exported as bufferPublishComposer from @bufferapp/composer. Publish will import those source files and build them; the JS is imported into Publish's larger JS bundle, the CSS is transformed and bundled in a separate CSS file.

  • buffer-web: When the composer package is published to npm, JS and CSS bundles are generated at the same time: composer-web-iframe-bundle.js, composer-web-iframe-bundle.css, and composer-web-iframe-utils.js. During the Web build process, the "iframe bundles" (composer-web-iframe-bundle.js & composer-web-iframe-bundle.css) are copied over to the assets directory, to be served to the browser as is. The "iframe utils" bundle (composer-web-iframe-utils.js), however, is imported into Web's content_controller.js to access utility methods that the dashboard needs to handle the Web composer's iframe setup and communication with the composer. How this works when the Web dashboard loads in a browser: an hidden iframe is created without slowing down the loading of the rest of the dashboard, pre-loading the composer (served from buffer.com/add) inside of it. Web's content controller uses postMessage to init the composer with the appropriate data when desired, also showing/hiding its wrapper iframe as needed.

  • buffer-extensions: Down the road we're also hoping this package can pave the way to native browser extensions, instead of the iframe we're currently using, which would make our extensions much faster.

Search for "@bufferapp/composer" in any of those repos to see examples of how the Composer is currently being used!

Dev tips

Without Storybook, there's no super easy way to make changes while getting feedback yet. Here's how I've made it work so far, feel free to add alternative workflows while Storybook makes its way here!

  • buffer-web:

    • Make desired changes to the composer package
    • Run, in buffer-composer: npm run compile
    • Copy /buffer-composer/dist/*.js to /buffer-web/app/webroot/js/bundles/ (replace existing files with the new ones)
    • If you also made CSS changes, copy /buffer-composer/dist/*.css to /buffer-web/app/webroot/css/bundles/ (replace existing files with the new ones)
    • Run gulp watch --app contentController
  • buffer-publish:

    • Make desired changes to the composer package
    • Delete /buffer-publish/node_modules/@bufferapp/composer and /buffer-publish/packages/queue/node_modules/@bufferapp/composer
    • Copy the whole /buffer-composer/ directory and drop it in /buffer-publish/packages/
    • Rename it from /buffer-publish/packages/buffer-composer/ to /buffer-publish/packages/composer/
    • In buffer-publish, run yarn run bootstrap then yarn run watch
2.8.0

3 years ago

2.7.3

4 years ago

2.7.2

4 years ago

3.4.8

5 years ago

3.4.7

5 years ago

3.4.6

5 years ago

3.4.5

5 years ago

3.4.4

5 years ago

3.4.3

5 years ago

3.4.2

5 years ago

3.4.1

5 years ago

3.4.0

5 years ago

3.3.1

5 years ago

3.3.0

5 years ago

3.1.1

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

2.7.1

5 years ago

3.1.0

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0-alpha.1

5 years ago

2.7.0

5 years ago

3.0.0

5 years ago

2.6.19

5 years ago

2.6.18

5 years ago

2.6.17

5 years ago

2.6.16

5 years ago

2.6.15

5 years ago

2.6.14

5 years ago

2.6.13

5 years ago

2.6.12

5 years ago

2.6.11

5 years ago

2.6.8-alpha.4

5 years ago

2.6.10

5 years ago

2.6.8-alpha.3

5 years ago

2.6.8-alpha.2

5 years ago

2.6.8-alpha.1

5 years ago

2.6.9

5 years ago

2.6.8

5 years ago

2.6.7

5 years ago

2.6.6

5 years ago

2.6.5

5 years ago

2.6.4

5 years ago

2.6.3

5 years ago

2.6.2

5 years ago

2.6.1

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.4

5 years ago

2.5.0-beta.2

5 years ago

2.4.3

5 years ago

2.5.0-beta.1

5 years ago

2.4.2

5 years ago

2.4.1

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.7

5 years ago

2.2.6

5 years ago

2.2.5

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.9

6 years ago

2.1.8

6 years ago

2.1.7

6 years ago

2.1.6-beta1

6 years ago

2.1.6

6 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

1.12.7

6 years ago

1.12.6

6 years ago

1.12.5

6 years ago

1.12.4

6 years ago

1.12.3

6 years ago

1.12.2

6 years ago

1.12.1

6 years ago

1.12.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.11.0

6 years ago

1.10.6

6 years ago

1.10.5

6 years ago

1.10.5-beta2

6 years ago

1.10.5-beta1

6 years ago

1.10.4

6 years ago

1.10.3

6 years ago

1.10.2

6 years ago

1.10.2-alpha1

6 years ago

1.10.1

6 years ago

1.10.0-beta1

6 years ago

1.9.8

6 years ago

1.9.8-alpha2

6 years ago

1.9.8-alpha1

6 years ago

1.9.7

6 years ago

1.9.6

6 years ago

1.9.5

6 years ago

1.10.0

6 years ago

1.9.4

6 years ago

1.9.3

6 years ago

1.9.2

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.9.0-beta1

6 years ago

1.8.4

6 years ago

1.8.3

6 years ago

1.8.2

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.5

6 years ago

1.7.4

6 years ago

1.7.3

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.7.0-beta.3

6 years ago

1.8.0-alpha4

6 years ago

1.8.0-alpha3

6 years ago

1.8.0-alpha2

6 years ago

1.8.0-alpha

6 years ago

1.7.0-beta.2

6 years ago

1.6.5

6 years ago

1.6.4

6 years ago

1.6.4-beta

6 years ago

1.7.0-beta

6 years ago

1.6.3

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.11

6 years ago

1.5.10

6 years ago

1.5.9

6 years ago

1.5.8

6 years ago

1.5.7

6 years ago

1.5.6

6 years ago

1.5.5

6 years ago

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.9

6 years ago

1.4.8

6 years ago

1.4.7

6 years ago

1.4.6

6 years ago

1.4.5

6 years ago

1.4.4

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0-beta.2

6 years ago

1.3.0-beta.1

6 years ago

1.3.0

6 years ago

1.1.6-beta.2

6 years ago

1.1.6-beta.1

6 years ago

1.2.1

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

0.0.9

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago