Skip to content
This repository was archived by the owner on Aug 13, 2023. It is now read-only.

add yarn workspaces #4368

Merged
merged 31 commits into from
Mar 2, 2021
Merged

add yarn workspaces #4368

merged 31 commits into from
Mar 2, 2021

Conversation

jroebu14
Copy link
Contributor

@jroebu14 jroebu14 commented Feb 22, 2021

Resolves #4332

Overall change:
Adds Yarn Workspaces.

Update
Talos depends on Lerna exec so not cannot be removed unless we find a replacement for either Lerna or Talos.

Code changes:

  • Removes each package's lockfile. Yarn Workspaces uses a single lockfile rather than one for each workspace
  • Removes ci:packages script:
    • What it did: installed dependencies in each package
    • Why is it removed: because Yarn installs all package's dependencies in a single pass in the root node_modules
  • Removes install:packages script:
    • What it did: installed all package's dependencies and linked any cross-dependencies
    • Why is it removed: because yarn install installs all package's dependencies in a single pass in the root node_modules and links cross-dependencies by default
  • Replaces lerna exec with yarn workspaces run
    • What it did: runs commands in each package - we use it for building packages with babel
    • Why is it replaced: yarn workspaces run is native to Yarn and does the same thing as lerna exec
  • Changes psammead moment-timezone-include package to use commonjs modules. This is because the postinstall script in this package's package.json (which runs a node script in the build directory) ran before the postinstall script in the root package.json (which transpiles code and generates the build directories) and attempts to run a script that doesn't yet exist. Using commonjs modules means we don't need to transpile the code before running the node script.
  • Updates the changeScanner script to check that the root yarn.lock has been updated if any package's dependencies have been updated

  • I have assigned myself to this PR and the corresponding issues
  • Automated jest tests added (for new features) or updated (for existing features)
  • This PR requires manual testing

@github-actions
Copy link

Checkout your storybook preview here http://psammead-preview.tools.bbc.co.uk/4368

@jroebu14 jroebu14 self-assigned this Feb 23, 2021
@jroebu14 jroebu14 added the cross-team For visibility for both World Service teams (Engage & Media) label Feb 23, 2021
@jroebu14 jroebu14 marked this pull request as ready for review February 23, 2021 13:57
@chris-hinds
Copy link
Contributor

Nice work Jonathan. Does this still allow us to publish packages publicly individually to NPM as we do now. I thought the impression that by default yarn wanted packages to be private?

@jroebu14
Copy link
Contributor Author

I thought it was just the root package that had to be private

@chris-hinds
Copy link
Contributor

I thought it was just the root package that had to be private

You are right, just read up on it again.

Copy link
Contributor

@andrewscfc andrewscfc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, really excited to see if this facilitates cross repo dev 🤞 Just a few questions around the change scanner but not blocking

Copy link
Contributor

@chris-hinds chris-hinds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great. Thanks for this @jroebu14

Jonathan Roebuck added 2 commits March 1, 2021 09:35
Bump package versions for psammead, psammead-amp-geo, psammead-brand, psammead-bulleted-list, psammead-bulletin, psammead-byline, psammead-caption, psammead-consent-banner, psammead-content-anchor, psammead-copyright, psammead-embed-error, psammead-episode-list, psammead-figure, psammead-grid, psammead-heading-index, psammead-headings, psammead-image-placeholder, psammead-image, psammead-inline-link, psammead-live-label, psammead-media-indicator, psammead-media-player, psammead-most-read, psammead-navigation, psammead-oembed, psammead-paragraph, psammead-play-button, psammead-podcast-promo, psammead-radio-schedule, psammead-script-link, psammead-section-label, psammead-sitewide-links, psammead-social-embed, psammead-story-promo-list, psammead-story-promo, psammead-timestamp, psammead-topic-tags, psammead-useful-links, psammead-visually-hidden-text, psammead-timestamp-container, gel-foundations, moment-timezone-include, psammead-assets, psammead-calendars, psammead-detokeniser, psammead-locales, psammead-rich-text-transforms, psammead-storybook-helpers, psammead-styles, psammead-test-helpers, web-vitals
Updates changelogs for psammead, psammead-amp-geo, psammead-brand, psammead-bulleted-list, psammead-bulletin, psammead-byline, psammead-caption, psammead-consent-banner, psammead-content-anchor, psammead-copyright, psammead-embed-error, psammead-episode-list, psammead-figure, psammead-grid, psammead-heading-index, psammead-headings, psammead-image-placeholder, psammead-image, psammead-inline-link, psammead-live-label, psammead-media-indicator, psammead-media-player, psammead-most-read, psammead-navigation, psammead-oembed, psammead-paragraph, psammead-play-button, psammead-podcast-promo, psammead-radio-schedule, psammead-script-link, psammead-section-label, psammead-sitewide-links, psammead-social-embed, psammead-story-promo-list, psammead-story-promo, psammead-timestamp, psammead-topic-tags, psammead-useful-links, psammead-visually-hidden-text, psammead-timestamp-container, gel-foundations, moment-timezone-include, psammead-assets, psammead-calendars, psammead-detokeniser, psammead-locales, psammead-rich-text-transforms, psammead-storybook-helpers, psammead-styles, psammead-test-helpers, web-vitals
@jroebu14 jroebu14 changed the title replace lerna with yarn workspaces add yarn workspaces Mar 1, 2021
@jroebu14 jroebu14 merged commit 34cabb0 into latest Mar 2, 2021
@jroebu14 jroebu14 deleted the replace-lerna-with-yarn-workspaces branch March 2, 2021 11:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cross-team For visibility for both World Service teams (Engage & Media)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Lerna with Yarn Workspaces and enable cross-component development
4 participants