Improve monorepo setup for JS packages

Created on 8 December 2025, about 1 month ago

Overview

Canvas/XB started with a single JS package for UI, then CLI was added, and later more packages like @drupal-canvas/create or @drupal-canvas/eslint-config. Additional packages were added incrementally without setting up proper monorepo tooling for JS packages, and now with multiple packages that start to depend on each other, it starts to be more complicated to work with, maintain and publishing new versions (which is currently done manually).

Proposed resolution

  1. Add all packages to the root project workspace.
    • It is already done for most packages other than ui and ui/lib/astro-hydration.
    • astro-hydration will be added to the root workspace in https://drupal.org/i/3560419
    • For the UI package, this may be a bit more complicated since npm workspaces don't work well when one package is nested in another, like ui/lib/astro-hydration is currently nested in ui/. Maybe we could move astro-hydration to packages/astro-hydration, add it as a dependency of ui and adjust ui build script to copy dist files of astro-hydration to expected location in ui/lib/astro-hydration/dist. Adding ui to the root npm workspace will also require changes to Gitlab CI. Currently ui/node_modules/ is shared between CI jobs as an artifact, with ui in root workspace dependencies will be in the project root node_modules, and when installed for all packages may weight more than the current artifact size limit in GItlab CI.
  2. Move cli into packages/cli, so that the only packages outside the packages/ directory are ui since its path is already used in many places in PHP code, and user docs which are nested in the general docs/ dir.
  3. If possible unify linting configuration. Currently packages under ui/ have different linting configurations than the rest of the repo.
  4. Create base TypeScript config in the project root or in internal (not published to npm package) that all packages will extend to provide a single place for configuring base TS options.
  5. Configure Turborepo for managing JS packages in the monorepo. It will simplify working with packages that depend on each other as well as provide a caching layer and parallelization for task execution, which should speed up working with multiple packages.
  6. Refactor Gitlab CI pipelines configuration to make use of the new monorepo setup and tooling.
  7. Create Gitlab CI jobs for publishing npm packges, similar to the existing CLI Publish job, for all packages from the repo that are published to npmjs.com. So that new versions of the packages will be automatically published to npm after tagging them in the repo.

(In ✨ Make bundled packages and utils used in code components available outside Canvas Active there are two more packages in the works drupal-canvas and @drupal-canvas/vite-plugin.

πŸ“Œ Task
Status

Active

Version

1.0

Component

… to be triaged

Created by

πŸ‡΅πŸ‡±Poland wotnak

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 277s
    #690311
  • Pipeline finished with Failed
    about 1 month ago
    Total: 624s
    #690317
  • Pipeline finished with Failed
    about 1 month ago
    Total: 221s
    #690326
  • Pipeline finished with Failed
    about 1 month ago
    Total: 743s
    #690344
  • Pipeline finished with Failed
    about 1 month ago
    Total: 765s
    #692386
  • Pipeline finished with Failed
    29 days ago
    Total: 239s
    #693575
  • Pipeline finished with Failed
    29 days ago
    Total: 1012s
    #693577
  • Pipeline finished with Failed
    29 days ago
    Total: 1113s
    #693580
  • Pipeline finished with Failed
    29 days ago
    Total: 338s
    #693629
  • Pipeline finished with Failed
    29 days ago
    Total: 525s
    #693630
  • Pipeline finished with Failed
    29 days ago
    Total: 971s
    #693631
  • Pipeline finished with Failed
    29 days ago
    #693635
  • Pipeline finished with Failed
    29 days ago
    #693636
  • Pipeline finished with Failed
    29 days ago
    #693646
  • Pipeline finished with Failed
    29 days ago
    Total: 121s
    #693647
  • Pipeline finished with Failed
    29 days ago
    #693648
  • Pipeline finished with Failed
    29 days ago
    Total: 563s
    #693654
  • Pipeline finished with Failed
    29 days ago
    #693663
  • Pipeline finished with Failed
    29 days ago
    Total: 567s
    #693665
  • Pipeline finished with Failed
    17 days ago
    Total: 553s
    #701460
  • Pipeline finished with Failed
    17 days ago
    #701472
  • Pipeline finished with Failed
    17 days ago
    Total: 579s
    #701489
  • Pipeline finished with Failed
    17 days ago
    Total: 435s
    #701496
  • Pipeline finished with Failed
    17 days ago
    Total: 388s
    #701502
  • Pipeline finished with Failed
    17 days ago
    Total: 574s
    #701514
  • Pipeline finished with Failed
    17 days ago
    Total: 616s
    #701519
  • Pipeline finished with Failed
    17 days ago
    Total: 786s
    #701528
  • Pipeline finished with Failed
    17 days ago
    Total: 645s
    #701547
  • Pipeline finished with Failed
    17 days ago
    Total: 686s
    #701586
  • Pipeline finished with Failed
    17 days ago
    Total: 905s
    #701598
  • Pipeline finished with Failed
    17 days ago
    Total: 722s
    #701637
  • Pipeline finished with Failed
    17 days ago
    Total: 780s
    #701643
  • Pipeline finished with Failed
    15 days ago
    Total: 721s
    #703521
  • Pipeline finished with Failed
    15 days ago
    Total: 916s
    #703534
  • Pipeline finished with Failed
    15 days ago
    #703545
  • Pipeline finished with Failed
    15 days ago
    Total: 890s
    #703558
  • Pipeline finished with Failed
    15 days ago
    Total: 829s
    #703571
  • Pipeline finished with Failed
    15 days ago
    Total: 965s
    #703580
  • Pipeline finished with Failed
    15 days ago
    Total: 766s
    #703591
  • Pipeline finished with Failed
    15 days ago
    Total: 699s
    #703596
  • Pipeline finished with Failed
    15 days ago
    Total: 1212s
    #703609
  • Pipeline finished with Failed
    15 days ago
    Total: 1501s
    #703610
  • Pipeline finished with Failed
    15 days ago
    Total: 559s
    #703625
  • Pipeline finished with Failed
    15 days ago
    Total: 624s
    #703636
  • Pipeline finished with Failed
    15 days ago
    Total: 575s
    #703649
  • Pipeline finished with Failed
    15 days ago
    Total: 495s
    #703666
  • Pipeline finished with Failed
    15 days ago
    Total: 645s
    #703673
  • Pipeline finished with Failed
    15 days ago
    Total: 724s
    #703686
  • Pipeline finished with Failed
    14 days ago
    Total: 285s
    #704828
  • Pipeline finished with Failed
    14 days ago
    Total: 690s
    #704831
  • Pipeline finished with Failed
    14 days ago
    Total: 500s
    #704844
  • Pipeline finished with Failed
    14 days ago
    Total: 476s
    #704849
  • Pipeline finished with Failed
    14 days ago
    Total: 780s
    #704850
  • Pipeline finished with Failed
    about 3 hours ago
    Total: 536s
    #720966
  • Pipeline finished with Failed
    about 3 hours ago
    Total: 456s
    #720981
Production build 0.71.5 2024