Skip to content

Update commitlint to lerna v7 (now v8) #3637

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

Closed
escapedcat opened this issue Aug 9, 2023 · 6 comments
Closed

Update commitlint to lerna v7 (now v8) #3637

escapedcat opened this issue Aug 9, 2023 · 6 comments

Comments

@escapedcat
Copy link
Member

escapedcat commented Aug 9, 2023

Expected Behavior

  • test are passing or have been updated to the new version
  • commitlint can publish using lerna v7 (with installed prettier v3 dependency)

Current Behavior

Installing prettier v3 is breaking the current lerna (v6) setup in a way that yarn publishdoesn't work anymore.
Updating to lerna v7 (which works with prettier v3) leads to some failing tests:

@commitlint/config-lerna-scopes tests

 FAIL  @commitlint/config-lerna-scopes/index.test.js
  ✓ exports rules key (1 ms)
  ✓ rules hold object
  ✓ rules contain scope-enum
  ✓ scope-enum is function
  ✓ scope-enum does not throw for missing context (21 ms)
  ✓ scope-enum has expected severity (1 ms)
  ✓ scope-enum has expected modifier (1 ms)
  ✕ returns empty value for empty lerna repository (43 ms)
  ✕ returns expected value for basic lerna repository (34 ms)
  ✕ returns expected value for lerna repository containing modules (33 ms)
  ✕ returns expected value for scoped lerna repository (32 ms)
  ✓ returns expected value for yarn workspaces (2 ms)
  ✕ returns expected value for yarn workspaces has nested packages (36 ms)

  ● returns empty value for empty lerna repository

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:50:14)

  ● returns expected value for basic lerna repository

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:57:14)

  ● returns expected value for lerna repository containing modules

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:65:14)

  ● returns expected value for scoped lerna repository

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:73:14)

  ● returns expected value for yarn workspaces has nested packages

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:88:14)

Test Suites: 1 failed, 1 total
Tests:       5 failed, 8 passed, 13 total

Context

Created a branch here: #3636

commitlint --version

17.6.7

git --version

v2.41.0

node --version

v18.16.0

@alex-arriaga
Copy link

Hi

Hope you are having a nice day! Wondering if there are any plans to support Lerna v7. Thank you.

@escapedcat
Copy link
Member Author

The plan currently is only this issue. Someone needs to look into the failing tests. Happy for any help.

@JounQin
Copy link
Contributor

JounQin commented Feb 22, 2024

I'll work on this in the next schedule with prettier v3 together.

@escapedcat escapedcat changed the title Update commitlint to lerna v7 Update commitlint to lerna v7 (now v8) Feb 24, 2024
@oscarmarina
Copy link

Hi @JounQin
Could you make progress on the task?. Thank you.

@janbiasi
Copy link
Contributor

janbiasi commented Mar 7, 2025

This issue was resolved within my PR #4284 and can be closed.

@escapedcat
Copy link
Member Author

Still needs a release but yes :) Thanks @janbiasi !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants