Giter Club home page Giter Club logo

Comments (30)

JamieMason avatar JamieMason commented on May 9, 2024 1

Released in 7.0.0

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024 1

On mobile now but that seems right, I will take a look at that branch soon and try to reproduce and fix, thanks.

from syncpack.

mxro avatar mxro commented on May 9, 2024 1

Running this on Windows - maybe let me try running it in Linux env and see what the result is!

from syncpack.

mxro avatar mxro commented on May 9, 2024 1

Excellent, thanks for looking into this! Sorry I think I tried it initially with quotes but then forget to do that for the new version. Maybe the Yarn shell interferes here so it could be that nothing needs to change for syncpack.

Works perfectly now and helped me do a good clean up of the repository. Also could configure it to support multiple versions of the same package I needed using version groups.

And could use the list-mismatches in the CI workflow, since it will return 1 exit code when there are mismatches which makes for a great test ❤️

https://github.com/goldstack/goldstack/blob/master/.github/workflows/branch.yml#L65

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024 1

You're welcome. A lot of nice ideas and improvements have come off the back of your feedback and repros, so thanks a lot for that.

from syncpack.

Aghassi avatar Aghassi commented on May 9, 2024 1

Yep you are right! Let me add that. Just for future releases, as a consumer, it would be better if minors didn't have potentially breaking changes is all. Thanks so much! Looking forward to actually using this feature!

from syncpack.

mxro avatar mxro commented on May 9, 2024

Tested this out, does this look like the correct way to use the command package.json#19?:

 "ensure-local-packages-syncpack": "syncpack fix-mismatches --workspace -p -d --source package.json --source workspaces/*/package.json --source workspaces/*/packages/*/package.json",

I manually changed on of the internal dependencies to be wrong workspaces/templates/packages/serverless-api/package.json

Ideally using syncpack this should be changed from "@goldstack/template-lambda-api": "0.4.36", to "@goldstack/template-lambda-api": "0.4.37", (the most recent version of this package in the workspace). But running the above command does not change this package.json

image

Did I use the command wrong? Thank you!!

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

@mxro would you mind forking and adding your scenario to this file? I'll pick up from there and add a test and fix. Hopefully it makes sense 🤞🏻, the tests that use these mock scenarios look a bit like this but I'll do those, I just need a reduced scenario that matches your situation then I can take a look 👍🏻

from syncpack.

mxro avatar mxro commented on May 9, 2024

Added a draft PR - but very low confidence on my part whether that is right: #74

(I think there is also an option in GitHub to mark PRs as drafts but I couldn't find / missed the option)

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

Thanks Max appreciate it

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

I've added tests for your scenarios but they're passing, so I'm still not sure what the problem might be. The work on this can be seen at https://github.com/JamieMason/syncpack/compare/mxro-add_scenario. Maybe it's a problem with parsing combinations of --workspace, --dev etc correctly, I'll check that next.

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

I think I've managed to reproduce it in github actions here, it looks like it's a problem with syncpack's compatibility with Windows. Parking this for now but will come back to it soon.

from syncpack.

mxro avatar mxro commented on May 9, 2024

Ah yes that could be the case! I was running the command on Windows! Thanks for looking into it!

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

If you could check out that branch and try taking a look on Windows @mxro that would be a huge help, I spent ages on Sunday messing around trying to get a Windows VM running and got nowhere. It's something I've had working before but I was hitting errors this time I've never seen before, so it'll take some time.

I think the problem is around paths being different on windows, probably path.normalize needs using in a few places to convert them according to the running OS.

from syncpack.

mxro avatar mxro commented on May 9, 2024

Thanks for looking into this and happy to help!

With which version should I try - I think on npm it is still the same one I tried with last time 7.2.1?

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

If you can clone the mxro-add_scenario branch and run the tests on Windows that would be great, and try to see if you can apply fixes. I'll do this too once I can finally get a Windows vm working.

from syncpack.

mxro avatar mxro commented on May 9, 2024

Roger that, got a few test failures

image

And here the full log:

 PASS  src/lib/set-semver-range.spec.ts (7.85 s)
 FAIL  src/bin-format/format.spec.ts (8.054 s)
  ● format › sorts array properties alphabetically by value

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
    Received: "✓", "..\\..\\..\\..\\some\\package.json"

    Number of calls: 1

      24 |     );
      25 |     expect(before).toEqual(after);
    > 26 |     expect(log).toHaveBeenCalledWith(
         |                 ^
      27 |       expect.stringMatching(/✓/),
      28 |       expect.stringMatching('/some/package.json'),
      29 |     );

      at Object.<anonymous> (src/bin-format/format.spec.ts:26:17)

  ● format › sorts object properties alphabetically by key

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
    Received
           1: "✓", "..\\..\\..\\..\\some\\package.json"
           2: "✓", "..\\..\\..\\..\\some\\package.json"

    Number of calls: 2

      46 |     );
      47 |     expect(before).toEqual(after);
    > 48 |     expect(log).toHaveBeenCalledWith(
         |                 ^
      49 |       expect.stringMatching(/✓/),
      50 |       expect.stringMatching('/some/package.json'),
      51 |     );

      at Object.<anonymous> (src/bin-format/format.spec.ts:48:17)

  ● format › sorts named properties first, then the rest alphabetically

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
    Received
           1: "✓", "..\\..\\..\\..\\some\\package.json"
           2: "✓", "..\\..\\..\\..\\some\\package.json"
           3: "✓", "..\\..\\..\\..\\some\\package.json"

    Number of calls: 3

      68 |     );
      69 |     expect(before).toEqual(after);
    > 70 |     expect(log).toHaveBeenCalledWith(
         |                 ^
      71 |       expect.stringMatching(/✓/),
      72 |       expect.stringMatching('/some/package.json'),
      73 |     );

      at Object.<anonymous> (src/bin-format/format.spec.ts:70:17)

  ● format › uses shorthand format for "bugs"

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
    Received
           1: "✓", "..\\..\\..\\..\\some\\package.json"
           2: "✓", "..\\..\\..\\..\\some\\package.json"
           3: "✓", "..\\..\\..\\..\\some\\package.json"

    Number of calls: 4

      89 |     );
      90 |     expect(before).toEqual(after);
    > 91 |     expect(log).toHaveBeenCalledWith(
         |                 ^
      92 |       expect.stringMatching(/✓/),
      93 |       expect.stringMatching('/some/package.json'),
      94 |     );

      at Object.<anonymous> (src/bin-format/format.spec.ts:91:17)

  ● format › uses shorthand format for "repository"

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
    Received
           1: "✓", "..\\..\\..\\..\\some\\package.json"
           2: "✓", "..\\..\\..\\..\\some\\package.json"
           3: "✓", "..\\..\\..\\..\\some\\package.json"

    Number of calls: 5

      112 |     );
      113 |     expect(before).toEqual(after);
    > 114 |     expect(log).toHaveBeenCalledWith(
          |                 ^
      115 |       expect.stringMatching(/✓/),
      116 |       expect.stringMatching('/some/package.json'),
      117 |     );

      at Object.<anonymous> (src/bin-format/format.spec.ts:114:17)

  ● format › uses github shorthand format for "repository"

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
    Received
           1: "✓", "..\\..\\..\\..\\some\\package.json"
           2: "✓", "..\\..\\..\\..\\some\\package.json"
           3: "✓", "..\\..\\..\\..\\some\\package.json"

    Number of calls: 6

      135 |     );
      136 |     expect(before).toEqual(after);
    > 137 |     expect(log).toHaveBeenCalledWith(
          |                 ^
      138 |       expect.stringMatching(/✓/),
      139 |       expect.stringMatching('/some/package.json'),
      140 |     );

      at Object.<anonymous> (src/bin-format/format.spec.ts:137:17)

 PASS  src/bin-fix-mismatches/get-expected-version/get-highest-version.spec.ts (8.192 s)
 PASS  src/bin-fix-mismatches/get-expected-version/get-expected-version.spec.ts
 PASS  src/lib/disk.spec.ts
 PASS  src/bin-list/list-version-groups.spec.ts       
 FAIL  src/lib/get-input/get-input.spec.ts (10.414 s)
  ● getInput › wrappers › when no --source cli options are given › when yarn workspaces are defined › as an array › resolves yarn workspace packages

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

      Array [
        Array [
          "package.json",
        ],
        Array [
    -     "as-array/*/package.json",
    +     "as-array\\*\\package.json",
        ],
      ]

      179 |             disk.readFileSync.mockReturnValue(json);
      180 |             getInput(disk, {});
    > 181 |             expect(disk.globSync.mock.calls).toEqual([
          |                                              ^
      182 |               ['package.json'],
      183 |               ['as-array/*/package.json'],
      184 |             ]);

      at Object.<anonymous> (src/lib/get-input/get-input.spec.ts:181:46)

  ● getInput › wrappers › when no --source cli options are given › when yarn workspaces are defined › as an object › resolves yarn workspace packages

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

      Array [
        Array [
          "package.json",
        ],
        Array [
    -     "as-object/*/package.json",
    +     "as-object\\*\\package.json",
        ],
      ]

      195 |             disk.readFileSync.mockReturnValue(json);
      196 |             getInput(disk, {});
    > 197 |             expect(disk.globSync.mock.calls).toEqual([
          |                                              ^
      198 |               ['package.json'],
      199 |               ['as-object/*/package.json'],
      200 |             ]);

      at Object.<anonymous> (src/lib/get-input/get-input.spec.ts:197:46)

  ● getInput › wrappers › when no --source cli options are given › when yarn workspaces are not defined › when lerna.json is defined › resolves lerna packages

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

      Array [
        Array [
          "package.json",
        ],
        Array [
    -     "lerna/*/package.json",
    +     "lerna\\*\\package.json",
        ],
      ]

      217 |             });
      218 |             getInput(disk, {});
    > 219 |             expect(disk.globSync.mock.calls).toEqual([
          |                                              ^
      220 |               ['package.json'],
      221 |               ['lerna/*/package.json'],
      222 |             ]);

      at Object.<anonymous> (src/lib/get-input/get-input.spec.ts:219:46)

  ● getInput › wrappers › when no --source cli options are given › when yarn workspaces are not defined › when lerna.json is not defined › when pnpm workspaces are defined › resolves pnpm packages

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

      Array [
        Array [
          "package.json",
        ],
        Array [
    -     "from-pnpm/*/package.json",
    +     "from-pnpm\\*\\package.json",
        ],
      ]

      234 |               });
      235 |               getInput(disk, {});
    > 236 |               expect(disk.globSync.mock.calls).toEqual([
          |                                                ^
      237 |                 ['package.json'],
      238 |                 ['from-pnpm/*/package.json'],
      239 |               ]);

      at Object.<anonymous> (src/lib/get-input/get-input.spec.ts:236:48)

 FAIL  src/bin-list/list.spec.ts
  ● list › when dependencies are installed with different versions › when the dependency is a package maintained in this workspace › warns ab the workspace version

    expect(received).toEqual(expected) // deep equality

    - Expected  - 5
    + Received  + 1

    - Array [
    -   Array [
    -     "✕ c 0.1.0, 0.2.0",
    -   ],
    - ]
    + Array []

      14 |         const scenario = scenarios.dependentDoesNotMatchWorkspaceVersion();
      15 |         list(getInput(scenario.disk, scenario.config), scenario.disk);
    > 16 |         expect(scenario.log.mock.calls).toEqual([['✕ c 0.1.0, 0.2.0']]);
         |                                         ^
      17 |         expect(scenario.disk.process.exit).toHaveBeenCalledWith(1);
      18 |       });
      19 |     });

      at Object.<anonymous> (src/bin-list/list.spec.ts:16:41)

  ● list › when dependencies are installed with different versions › replaces non-semver dependencies with valid semver dependencies

    expect(received).toEqual(expected) // deep equality

    - Expected  - 5
    + Received  + 1

    - Array [
    -   Array [
    -     "✕ foo 0.2.0, 0.3.0, link:vendor/foo-0.1.0, link:vendor/foo-0.2.0",
    -   ],
    - ]
    + Array []

      22 |       const scenario = scenarios.mismatchesIncludeNonSemverVersions();
      23 |       list(getInput(scenario.disk, scenario.config), scenario.disk);
    > 24 |       expect(scenario.log.mock.calls).toEqual([
         |                                       ^
      25 |         ['✕ foo 0.2.0, 0.3.0, link:vendor/foo-0.1.0, link:vendor/foo-0.2.0'],
      26 |       ]);
      27 |       expect(scenario.disk.process.exit).toHaveBeenCalledWith(1);

      at Object.<anonymous> (src/bin-list/list.spec.ts:24:39)

  ● list › when dependencies are installed with different versions › removes banned/disallowed dependencies

    expect(received).toEqual(expected) // deep equality

    - Expected  - 7
    + Received  + 1

      Array [
        Array [
    -     "- foo 0.1.0",
    -   ],
    -   Array [
    -     StringMatching /Version Group 1/,
    -   ],
    -   Array [
    -     "✕ bar remove this dependency",
    +     "= Version Group 1 ===============================================================",
        ],
      ]

      31 |       const scenario = scenarios.dependencyIsBanned();
      32 |       list(getInput(scenario.disk, scenario.config), scenario.disk);
    > 33 |       expect(scenario.log.mock.calls).toEqual([
         |                                       ^
      34 |         ['- foo 0.1.0'],
      35 |         [expect.stringMatching(/Version Group 1/)],
      36 |         ['✕ bar remove this dependency'],

      at Object.<anonymous> (src/bin-list/list.spec.ts:33:39)

 FAIL  src/bin-fix-mismatches/fix-mismatches.spec.ts (10.636 s)
  ● fixMismatches › when dependencies are installed with different versions › when the dependency is a package maintained in this workspace › uses the workspace version

    expect(received).toEqual(expected) // deep equality

    - Expected  - 22
    + Received  +  1

    - Array [
    -   Array [
    -     StringContaining "packages/a/package.json",
    -     "{
    -   \"name\": \"a\",
    -   \"dependencies\": {
    -     \"c\": \"0.0.1\"
    -   }
    - }
    - ",
    -   ],
    -   Array [
    -     StringContaining "packages/b/package.json",
    -     "{
    -   \"name\": \"b\",
    -   \"devDependencies\": {
    -     \"c\": \"0.0.1\"
    -   }
    - }
    - ",
    -   ],
    - ]
    + Array []

      14 |         const scenario = scenarios.dependentDoesNotMatchWorkspaceVersion();
      15 |         fixMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
    > 16 |         expect(scenario.disk.writeFileSync.mock.calls).toEqual([
         |                                                        ^
      17 |           scenario.files['packages/a/package.json'].diskWriteWhenChanged,
      18 |           scenario.files['packages/b/package.json'].diskWriteWhenChanged,
      19 |         ]);

      at Object.<anonymous> (src/bin-fix-mismatches/fix-mismatches.spec.ts:16:56)

  ● fixMismatches › when dependencies are installed with different versions › replaces non-semver dependencies with valid semver dependencies    

    expect(received).toEqual(expected) // deep equality

    - Expected  - 32
    + Received  +  1

    - Array [
    -   Array [
    -     StringContaining "packages/a/package.json",
    -     "{
    -   \"name\": \"a\",
    -   \"dependencies\": {
    -     \"foo\": \"0.3.0\"
    -   }
    - }
    - ",
    -   ],
    -   Array [
    -     StringContaining "packages/b/package.json",
    -     "{
    -   \"name\": \"b\",
    -   \"dependencies\": {
    -     \"foo\": \"0.3.0\"
    -   }
    - }
    - ",
    -   ],
    -   Array [
    -     StringContaining "packages/d/package.json",
    -     "{
    -   \"name\": \"d\",
    -   \"dependencies\": {
    -     \"foo\": \"0.3.0\"
    -   }
    - }
    - ",
    -   ],
    - ]
    + Array []

      29 |       const scenario = scenarios.mismatchesIncludeNonSemverVersions();
      30 |       fixMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
    > 31 |       expect(scenario.disk.writeFileSync.mock.calls).toEqual([
         |                                                      ^
      32 |         scenario.files['packages/a/package.json'].diskWriteWhenChanged,
      33 |         scenario.files['packages/b/package.json'].diskWriteWhenChanged,
      34 |         scenario.files['packages/d/package.json'].diskWriteWhenChanged,

      at Object.<anonymous> (src/bin-fix-mismatches/fix-mismatches.spec.ts:31:54)

  ● fixMismatches › when dependencies are installed with different versions › removes banned/disallowed dependencies

    expect(received).toEqual(expected) // deep equality

    - Expected  - 9
    + Received  + 1

    - Array [
    -   Array [
    -     StringContaining "packages/b/package.json",
    -     "{
    -   \"name\": \"b\"
    - }
    - ",
    -   ],
    - ]
    + Array []

      45 |       const scenario = scenarios.dependencyIsBanned();
      46 |       fixMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
    > 47 |       expect(scenario.disk.writeFileSync.mock.calls).toEqual([
         |                                                      ^
      48 |         scenario.files['packages/b/package.json'].diskWriteWhenChanged,
      49 |       ]);
      50 |       expect(scenario.log.mock.calls).toEqual([

      at Object.<anonymous> (src/bin-fix-mismatches/fix-mismatches.spec.ts:47:54)

 FAIL  src/bin-list-mismatches/list-mismatches.spec.ts
  ● listMismatches › when dependencies are installed with different versions › when the dependency is a package maintained in this workspace › warns ab the workspace version

    expect(received).toEqual(expected) // deep equality

    - Expected  - 11
    + Received  +  1

    - Array [
    -   Array [
    -     "- c 0.0.1",
    -   ],
    -   Array [
    -     "  0.1.0 in dependencies of a",
    -   ],
    -   Array [
    -     "  0.2.0 in devDependencies of b",
    -   ],
    - ]
    + Array []

      14 |         const scenario = scenarios.dependentDoesNotMatchWorkspaceVersion();
      15 |         listMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
    > 16 |         expect(scenario.log.mock.calls).toEqual([
         |                                         ^
      17 |           ['- c 0.0.1'],
      18 |           ['  0.1.0 in dependencies of a'],
      19 |           ['  0.2.0 in devDependencies of b'],

      at Object.<anonymous> (src/bin-list-mismatches/list-mismatches.spec.ts:16:41)

  ● listMismatches › when dependencies are installed with different versions › replaces non-semver dependencies with valid semver dependencies   

    expect(received).toEqual(expected) // deep equality

    - Expected  - 17
    + Received  +  1

    - Array [
    -   Array [
    -     "- foo 0.3.0",
    -   ],
    -   Array [
    -     "  link:vendor/foo-0.1.0 in dependencies of a",
    -   ],
    -   Array [
    -     "  link:vendor/foo-0.2.0 in dependencies of b",
    -   ],
    -   Array [
    -     "  0.3.0 in dependencies of c",
    -   ],
    -   Array [
    -     "  0.2.0 in dependencies of d",
    -   ],
    - ]
    + Array []

      26 |       const scenario = scenarios.mismatchesIncludeNonSemverVersions();
      27 |       listMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
    > 28 |       expect(scenario.log.mock.calls).toEqual([
         |                                       ^
      29 |         ['- foo 0.3.0'],
      30 |         ['  link:vendor/foo-0.1.0 in dependencies of a'],
      31 |         ['  link:vendor/foo-0.2.0 in dependencies of b'],

      at Object.<anonymous> (src/bin-list-mismatches/list-mismatches.spec.ts:28:39)

  ● listMismatches › when dependencies are installed with different versions › removes banned/disallowed dependencies

    expect(received).toEqual(expected) // deep equality

    - Expected  - 11
    + Received  +  1

    - Array [
    -   Array [
    -     StringMatching /Version Group 1/,
    -   ],
    -   Array [
    -     "✕ bar remove this dependency",
    -   ],
    -   Array [
    -     "  0.2.0 in dependencies of b",
    -   ],
    - ]
    + Array []

      39 |       const scenario = scenarios.dependencyIsBanned();
      40 |       listMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
    > 41 |       expect(scenario.log.mock.calls).toEqual([
         |                                       ^
      42 |         [expect.stringMatching(/Version Group 1/)],
      43 |         ['✕ bar remove this dependency'],
      44 |         ['  0.2.0 in dependencies of b'],

      at Object.<anonymous> (src/bin-list-mismatches/list-mismatches.spec.ts:41:39)

 PASS  src/bin-lint-semver-ranges/list-semver-group-mismatches.spec.ts
 PASS  src/lib/sort-by-name.spec.ts
 PASS  src/lib/is-semver.spec.ts
 PASS  src/lib/collect.spec.ts
 FAIL  src/bin-set-semver-ranges/set-semver-ranges.spec.ts
  ● setSemverRanges › sets all versions to use the supplied range

    expect(received).toEqual(expected) // deep equality

    - Expected  - 13
    + Received  +  1

    - Array [
    -   Array [
    -     StringContaining "packages/a/package.json",
    -     "{
    -   \"name\": \"a\",
    -   \"dependencies\": {
    -     \"foo\": \"~0.1.0\",
    -     \"bar\": \"~2.0.0\"
    -   }
    - }
    - ",
    -   ],
    - ]
    + Array []

      12 |     const scenario = scenarios.semverRangesDoNotMatchConfig();
      13 |     setSemverRanges(getInput(scenario.disk, scenario.config), scenario.disk);
    > 14 |     expect(scenario.disk.writeFileSync.mock.calls).toEqual([
         |                                                    ^
      15 |       scenario.files['packages/a/package.json'].diskWriteWhenChanged,
      16 |     ]);
      17 |     expect(scenario.log.mock.calls).toEqual([

      at Object.<anonymous> (src/bin-set-semver-ranges/set-semver-ranges.spec.ts:14:52)

 FAIL  src/bin-lint-semver-ranges/lint-semver-ranges.spec.ts
  ● lintSemverRanges › lists versions with ranges which do not match the project config

    expect(received).toEqual(expected) // deep equality

    - Expected  - 8
    + Received  + 1

    - Array [
    -   Array [
    -     "✕ bar 2.0.0 in dependencies of a should be ~2.0.0",
    -   ],
    -   Array [
    -     "✕ foo 0.1.0 in dependencies of a should be ~0.1.0",
    -   ],
    - ]
    + Array []

      12 |     const scenario = scenarios.semverRangesDoNotMatchConfig();
      13 |     lintSemverRanges(getInput(scenario.disk, scenario.config), scenario.disk);
    > 14 |     expect(scenario.log.mock.calls).toEqual([
         |                                     ^
      15 |       ['✕ bar 2.0.0 in dependencies of a should be ~2.0.0'],
      16 |       ['✕ foo 0.1.0 in dependencies of a should be ~0.1.0'],
      17 |     ]);

      at Object.<anonymous> (src/bin-lint-semver-ranges/lint-semver-ranges.spec.ts:14:37)

Jest: "global" coverage threshold for statements (92%) not met: 77.29%
Jest: "global" coverage threshold for branches (79%) not met: 63.07%  
Jest: "global" coverage threshold for lines (93%) not met: 82.27%     
Jest: "global" coverage threshold for functions (93%) not met: 80.16% 
Test Suites: 7 failed, 9 passed, 16 total  
Tests:       21 failed, 33 passed, 54 total
Snapshots:   0 total
Time:        15.924 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

from syncpack.

mxro avatar mxro commented on May 9, 2024

Never used this before but maybe using something like https://aws.amazon.com/workspaces/?nc=sn&loc=0 maybe easier than trying to get a windows up and running locally?

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

Good as a plan B but I'll get VirtualBox sorted hopefully. I've had it working before but was having trouble this time for some reason - maybe the latest Mac OS version or something, I don't know yet.

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

Closing this again as the issue we were discussing when reopening was actually windows support generally – finding mismatches in internal monorepo packages was working on other OSes.

from syncpack.

mxro avatar mxro commented on May 9, 2024

Just ran this again on a branch: goldstack/goldstack#184 using both latest syncpack@7 and syncpack@8.

Still it does not seem to be picking up the dependencies that should be fixed, eg.

https://github.com/goldstack/goldstack/pull/184/files#diff-b8887ab84535f11d344b8d3c65fcb822bad521f7044dfc34cf57808fb122bfcdR44

Here the command I am trying to run:

https://github.com/goldstack/goldstack/pull/184/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R19

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

Is that on Windows? Or also on Linux or osx?

from syncpack.

mxro avatar mxro commented on May 9, 2024

Seems like the result is the same when running in GHA using ubuntu-latest:

https://github.com/goldstack/goldstack/runs/6716718149?check_suite_focus=true#step:6:1

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

Perfect, this will be easier to debug and suggests a real code problem rather than something subtle with environments. Hopefully it just means that the test scenario we made possibly doesn't reproduce the issue correctly, we'll see. Thanks for setting that up.

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

I have 64f30940 of https://github.com/goldstack/goldstack.git checked out locally, I think the problem is that the --source options weren't quoted – so the shell is resolving those patterns before they're received by syncpack.

Without quoting the patterns, the only files being operated on were:

goldstack/package.json
goldstack/workspaces/apps/package.json
goldstack/workspaces/apps/packages/goldstack-api/package.json

Without quotes

syncpack list-mismatches \
  --workspace \
  -p \
  -d \
  --source package.json \
  --source workspaces/*/package.json \
  --source workspaces/*/packages/*/package.json

↓↓↓

no output

With quotes

syncpack list-mismatches \
  --workspace \
  -p \
  -d \
  --source 'package.json' \
  --source 'workspaces/*/package.json' \
  --source 'workspaces/*/packages/*/package.json'

↓↓↓

- @goldstack/template-nextjs 0.3.109
  0.3.109 in devDependencies of @goldstack/goldstack-home
  0.3.109 in devDependencies of @goldstack/docs-main
  0.3.108 in devDependencies of @goldstack/app-nextjs-bootstrap
  0.3.109 in devDependencies of @goldstack/app-nextjs
- @types/fs-extra ^9.0.13
  ^9.0.13 in devDependencies of @goldstack/utils-sh
  ^9.0.1 in devDependencies of @goldstack/template-repository
- @types/react ^16.9.49
  ^16.9.46 in devDependencies of @goldstack/goldstack-home
  ^16.9.46 in devDependencies of @goldstack/docs-main
  ^16.9.49 in devDependencies of @goldstack/utils-track
  ^16.9.46 in devDependencies of @goldstack/app-nextjs-bootstrap
  ^16.9.46 in devDependencies of @goldstack/app-nextjs
  ^16.9.46 in devDependencies of @goldstack/app-react
  ^16.9.46 in devDependencies of @goldstack/react-components
- ajv ^6.12.2
  6.12.2 in dependencies of @goldstack/goldstack-home
  ^6.12.2 in dependencies of @goldstack/utils-config
- babel-plugin-styled-components ^1.10.7
  ^1.8.0 in devDependencies of @goldstack/goldstack-home
  ^1.10.7 in devDependencies of @goldstack/docs-main
- fs-extra ^10.0.0
  ^10.0.0 in dependencies of @goldstack/utils-sh
  ^9.0.1 in dependencies of @goldstack/auth
  ^9.0.1 in dependencies of @goldstack/project-repository
  ^9.0.1 in dependencies of @goldstack/session-repository
  ^9.0.1 in dependencies of @goldstack/template-repository
- ignore-loader ^0.1.2
  ^0.1.2 in devDependencies of @goldstack/goldstack-home
  ^0.1.2 in dependencies of @goldstack/docs-main
  ^0.1.2 in devDependencies of @goldstack/docs-main
  ~0.1.2 in dependencies of @goldstack/app-nextjs-bootstrap
  ^0.1.2 in devDependencies of @goldstack/app-nextjs-bootstrap
  ^0.1.2 in dependencies of @goldstack/app-nextjs
- next-compose-plugins ^2.2.1
  ^2.2.0 in devDependencies of @goldstack/goldstack-home
  ^2.2.0 in devDependencies of @goldstack/docs-main
  ^2.2.0 in devDependencies of @goldstack/app-nextjs-bootstrap
  ^2.2.1 in dependencies of @goldstack/app-nextjs
- react-bootstrap ^2.2.1
  ^1.4.3 in dependencies of @goldstack/goldstack-home
  ^1.4.3 in dependencies of @goldstack/docs-main
  ^2.2.1 in dependencies of @goldstack/app-nextjs-bootstrap
- stripe ^8.114.0
  ^8.114.0 in dependencies of @goldstack/goldstack-api
  8.91.0 in dependencies of @goldstack/session-repository
- styled-components ^5.1.1
  ^5.0.0 in dependencies of @goldstack/goldstack-home
  ^5.1.1 in dependencies of @goldstack/docs-main

I'm doing some work to improve this, but in the meantime adding quotes around your sources should hopefully get it working 🤞🏻

from syncpack.

Aghassi avatar Aghassi commented on May 9, 2024

Hey @JamieMason , I'm really glad you added this feature! However, in the case like ours where we have some misalignment, this is breaking. Is there a way to make this opt in only for the 8.x versions going forward and have it enabled by default in 9.x? That will give folks like me time to turn it on and fix our stuff. Otherwise for now I have to operate on 8.0.0 because this feature will block our development (or I turn it off and fix all the things)

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

Hey @Aghassi,
You can disable workspace either via your config file:

This might be enough:

{
  "workspace": false
}

Otherwise do:

{
  "dev": true,
  "overrides": true,
  "peer": true,
  "pnpmOverrides": true,
  "prod": true,
  "resolutions": true,
  "workspace": false
}

or the command line:

syncpack list -pdPRo

Shout if I've misunderstood anything. I'm reading this that you want to skip checking workspace versions, the new --workspace flag.

Thanks

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

--workspace was a breaking change in 7.0.0.

from syncpack.

Aghassi avatar Aghassi commented on May 9, 2024

Hmmm.. well we were on that version so I'll look into why I tripped over it and get back to you. Maybe we are an edge case :P

from syncpack.

JamieMason avatar JamieMason commented on May 9, 2024

Yeah there could've been some regression, please make a new issue if so, thanks.

from syncpack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.