syncpack 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/bin-fix-mismatches/fix-mismatches.js +8 -19
  2. package/dist/bin-fix-mismatches/index.js +1 -1
  3. package/dist/bin-format/index.js +1 -1
  4. package/dist/bin-lint/index.js +1 -1
  5. package/dist/bin-lint-semver-ranges/index.js +1 -1
  6. package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +5 -5
  7. package/dist/bin-list/index.js +1 -1
  8. package/dist/bin-list/list.d.ts +2 -0
  9. package/dist/bin-list/list.js +76 -48
  10. package/dist/bin-list-mismatches/index.js +1 -1
  11. package/dist/bin-list-mismatches/list-mismatches.d.ts +4 -5
  12. package/dist/bin-list-mismatches/list-mismatches.js +185 -220
  13. package/dist/bin-prompt/prompt.js +7 -3
  14. package/dist/bin-set-semver-ranges/index.js +1 -1
  15. package/dist/config/get-custom-types.js +2 -1
  16. package/dist/config/types.d.ts +4 -5
  17. package/dist/constants.d.ts +39 -8
  18. package/dist/constants.js +31 -0
  19. package/dist/io/index.d.ts +2 -2
  20. package/dist/io/index.js +1 -1
  21. package/dist/io/read-config-file-sync.js +1 -1
  22. package/dist/option.d.ts +1 -1
  23. package/dist/report.d.ts +64 -99
  24. package/dist/report.js +81 -16
  25. package/dist/schema.json +75 -74
  26. package/dist/semver-group/disabled.js +1 -3
  27. package/dist/semver-group/filtered-out.js +1 -3
  28. package/dist/semver-group/ignored.js +1 -3
  29. package/dist/semver-group/index.d.ts +1 -2
  30. package/dist/semver-group/with-range.js +4 -12
  31. package/dist/specifier/index.d.ts +1 -2
  32. package/dist/specifier/lib/parse-specifier.js +1 -1
  33. package/dist/specifier/workspace-protocol.js +3 -2
  34. package/dist/strategy/name-and-version-props.js +4 -4
  35. package/dist/version-group/banned.js +1 -3
  36. package/dist/version-group/filtered-out.js +1 -1
  37. package/dist/version-group/ignored.js +1 -1
  38. package/dist/version-group/index.d.ts +1 -2
  39. package/dist/version-group/pinned.js +2 -2
  40. package/dist/version-group/same-range.js +5 -10
  41. package/dist/version-group/snapped-to.js +7 -17
  42. package/dist/version-group/standard.js +38 -49
  43. package/package.json +19 -13
@@ -24,54 +24,43 @@ class StandardVersionGroup extends effect_1.Data.TaggedClass('Standard') {
24
24
  const localInstance = getLocalInstance(instances);
25
25
  if (localInstance) {
26
26
  const localVersion = localInstance?.rawSpecifier;
27
- return localVersion === 'PACKAGE_JSON_HAS_NO_VERSION'
28
- ? effect_1.Effect.succeed({
29
- name,
30
- reports: instances.map((instance) =>
31
- // ! dependency is a package developed in this repo
32
- // ✘ local package is missing a .version property
33
- // is a mismatch we can't auto-fix
34
- new report_1.Report.MissingLocalVersion({
35
- localInstance,
36
- unfixable: instance,
37
- })),
38
- })
39
- : (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(localInstance, localVersion)), effect_1.Effect.flatMap((local) => effect_1.Effect.all(local._tag !== 'VersionSpecifier'
40
- ? instances.map((instance) =>
41
- // ! dependency is a package developed in this repo
42
- // local package has an invalid .version property
43
- // ✘ is a mismatch we can't auto-fix
44
- effect_1.Effect.succeed(new report_1.Report.MissingLocalVersion({
45
- localInstance,
46
- unfixable: instance,
47
- })))
48
- : instances.flatMap((instance) => (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(instance, instance.rawSpecifier)), effect_1.Effect.flatMap((specifier) => specifier.instance === localInstance
49
- ? // ✓ this is the local package which the others should match
50
- // ! its version must always remain as exact semver
51
- // ! other instances need to be adjusted for their semver groups
52
- effect_1.Effect.succeed(new report_1.Report.Valid({ specifier }))
53
- : (0, effect_1.pipe)(specifier.replaceWith(local), specifier.instance.semverGroup.getFixed, effect_1.Effect.match({
54
- onFailure: /* istanbul ignore next */ () =>
55
- // ! is not the local package instance
56
- // ✘ local version is not fixable by this semver group
57
- // ✘ is a mismatch we can't auto-fix
58
- // ✘ this should be impossible - we already proved the local version is exact semver
59
- new report_1.Report.UnsupportedMismatch({
60
- unfixable: specifier.instance,
61
- }),
62
- onSuccess: (valid) => specifier.instance.rawSpecifier === valid.raw
27
+ return (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(localInstance, localVersion)), effect_1.Effect.flatMap((local) => effect_1.Effect.all(local._tag !== 'VersionSpecifier' && instances.length > 1
28
+ ? instances.map((instance) =>
29
+ // ! dependency is a package developed in this repo
30
+ // ✘ local package has an invalid .version property
31
+ // is a mismatch we can't auto-fix
32
+ effect_1.Effect.succeed(new report_1.Report.MissingLocalVersion(instance, localInstance)))
33
+ : instances.flatMap((instance) =>
34
+ // instances.flatMap((instance) =>
35
+ (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(instance, instance.rawSpecifier)), effect_1.Effect.flatMap((specifier) => specifier.instance === localInstance
36
+ ? // ✓ this is the local package which the others should match
37
+ // ! its version must always remain as exact semver
38
+ // ! other instances need to be adjusted for their semver groups
39
+ effect_1.Effect.succeed(new report_1.Report.Valid(specifier))
40
+ : (0, effect_1.pipe)(specifier.replaceWith(local), specifier.instance.semverGroup.getFixed, effect_1.Effect.match({
41
+ onFailure: /* istanbul ignore next */ () =>
42
+ // ! is not the local package instance
43
+ // ✘ local version is not fixable by this semver group
44
+ // ✘ is a mismatch we can't auto-fix
45
+ // ✘ this should be impossible - we already proved the local version is exact semver
46
+ new report_1.Report.UnsupportedMismatch(specifier.instance),
47
+ onSuccess: (valid) => specifier.instance.rawSpecifier === valid.raw
48
+ ? // ! is not the local package instance
49
+ // ✓ local version matches this semver group
50
+ // current version matches local
51
+ new report_1.Report.Valid(specifier)
52
+ : localVersion === 'PACKAGE_JSON_HAS_NO_VERSION'
63
53
  ? // ! is not the local package instance
54
+ // ✘ local package has a version defined
64
55
  // ✓ local version matches this semver group
65
- // current version matches local
66
- new report_1.Report.Valid({ specifier })
56
+ // current version mismatches local
57
+ new report_1.Report.MissingLocalVersion(specifier.instance, localInstance)
67
58
  : // ! is not the local package instance
59
+ // ✓ local package has a version defined
68
60
  // ✓ local version matches this semver group
69
61
  // ✘ current version mismatches local
70
- new report_1.Report.LocalPackageMismatch({
71
- fixable: valid,
72
- localInstance,
73
- }),
74
- }))))))), effect_1.Effect.map((reports) => ({ name, reports })));
62
+ new report_1.Report.LocalPackageMismatch(valid, localInstance),
63
+ }))))))), effect_1.Effect.map((reports) => ({ name, reports })));
75
64
  }
76
65
  const PreferredMismatch = this.config.preferVersion === 'lowestSemver'
77
66
  ? report_1.Report.LowestSemverMismatch
@@ -83,35 +72,35 @@ class StandardVersionGroup extends effect_1.Data.TaggedClass('Standard') {
83
72
  // ✘ not every version is semver
84
73
  // ✓ every version is identical
85
74
  // ✓ is a match
86
- new report_1.Report.Valid({ specifier }))
75
+ new report_1.Report.Valid(specifier))
87
76
  : instances.map((instance) =>
88
77
  // ✘ not every version is semver
89
78
  // ✘ some versions are not identical
90
79
  // ✘ is a mismatch we can't auto-fix
91
- new report_1.Report.UnsupportedMismatch({ unfixable: instance }))),
80
+ new report_1.Report.UnsupportedMismatch(instance))),
92
81
  onSuccess: (expectedVersion) => (0, effect_1.pipe)(specifiers, effect_1.Effect.forEach((current) => (0, effect_1.pipe)(current.replaceWith(expectedVersion), current.instance.semverGroup.getFixed, effect_1.Effect.match({
93
82
  onFailure: /* istanbul ignore next */ () =>
94
83
  // ✓ every version is semver
95
84
  // ✘ expected version is not fixable by its semver group
96
85
  // ✘ is a mismatch we can't auto-fix
97
86
  // ✘ this should be impossible - any valid semver is fixable by a semver group
98
- new report_1.Report.UnsupportedMismatch({ unfixable: current.instance }),
87
+ new report_1.Report.UnsupportedMismatch(current.instance),
99
88
  onSuccess: (expectedRange) => current.instance.rawSpecifier === expectedRange.raw
100
89
  ? // ✓ every version is semver
101
90
  // ✓ current version matches expected semver
102
91
  // ✓ current version matches expected version
103
- new report_1.Report.Valid({ specifier: current })
92
+ new report_1.Report.Valid(current)
104
93
  : current.instance.rawSpecifier === expectedVersion.raw
105
94
  ? // ✓ every version is semver
106
95
  // ✓ current version matches expected version
107
96
  // ✘ current version does not match expected semver
108
97
  // ✓ is a mismatch we can auto-fix
109
- new report_1.Report.SemverRangeMismatch({ fixable: expectedRange })
98
+ new report_1.Report.SemverRangeMismatch(expectedRange)
110
99
  : // ✓ every version is semver
111
100
  // ✘ current version does not match expected version
112
101
  // ✘ expected version does not match expected semver
113
102
  // ✓ is a mismatch we can auto-fix
114
- new PreferredMismatch({ fixable: expectedRange }),
103
+ new PreferredMismatch(expectedRange),
115
104
  })))),
116
105
  }))), effect_1.Effect.map((reports) => ({ name, reports })));
117
106
  }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "syncpack",
3
3
  "description": "Consistent dependency versions in large JavaScript Monorepos",
4
- "version": "12.0.0",
4
+ "version": "12.1.0",
5
5
  "author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)",
6
6
  "bin": {
7
7
  "syncpack": "dist/bin.js",
@@ -24,6 +24,7 @@
24
24
  "Jamie Haywood (https://github.com/jamiehaywood)",
25
25
  "Jamie Mason (https://github.com/JamieMason)",
26
26
  "Jody Heavener (https://github.com/jodyheavener)",
27
+ "Keyan Zhang (https://github.com/keyz)",
27
28
  "Luis Vieira (https://github.com/luisvieiragmr)",
28
29
  "Marais Rossouw (https://github.com/maraisr)",
29
30
  "Matt Sprague (https://github.com/uforic)",
@@ -32,13 +33,13 @@
32
33
  "Tom Fletcher (https://github.com/tom-fletcher)"
33
34
  ],
34
35
  "dependencies": {
35
- "@effect/match": "0.40.0",
36
36
  "@effect/schema": "0.56.0",
37
37
  "chalk": "4.1.2",
38
38
  "commander": "11.1.0",
39
39
  "cosmiconfig": "9.0.0",
40
40
  "effect": "2.0.0-next.62",
41
41
  "enquirer": "2.4.1",
42
+ "fast-check": "3.15.0",
42
43
  "globby": "11.1.0",
43
44
  "minimatch": "9.0.3",
44
45
  "npm-package-arg": "11.0.1",
@@ -65,8 +66,11 @@
65
66
  "memfs": "4.6.0",
66
67
  "prettier": "3.1.1",
67
68
  "prettier-plugin-astro": "0.12.2",
69
+ "quill-delta": "5.1.0",
68
70
  "release-it": "17.0.1",
71
+ "rxjs": "7.8.1",
69
72
  "ts-node": "10.9.2",
73
+ "tslib": "2.6.2",
70
74
  "typescript": "5.3.3",
71
75
  "typescript-json-schema": "0.62.0",
72
76
  "vitest": "1.1.0"
@@ -100,26 +104,28 @@
100
104
  ],
101
105
  "license": "MIT",
102
106
  "main": "dist/index.js",
103
- "overrides": {
104
- "chalk": "4.1.2",
105
- "effect": "2.0.0-next.62",
106
- "string-width": "<5.0.0",
107
- "strip-ansi": "<7.0.0",
108
- "wrap-ansi": "<8.0.0"
107
+ "pnpm": {
108
+ "overrides": {
109
+ "chalk": "4.1.2",
110
+ "effect": "2.0.0-next.62",
111
+ "string-width": "<5.0.0",
112
+ "strip-ansi": "<7.0.0",
113
+ "wrap-ansi": "<8.0.0"
114
+ }
109
115
  },
110
116
  "repository": "JamieMason/syncpack",
111
117
  "scripts": {
112
- "build": "npm run clean && npm run build:source && npm run build:json-schema",
113
- "build:json-schema": "typescript-json-schema --noExtraProps src/index.ts RcFile --out dist/schema.json",
118
+ "build": "pnpm run clean && pnpm run build:source && pnpm run build:json-schema",
119
+ "build:json-schema": "typescript-json-schema --esModuleInterop --noExtraProps src/index.ts RcFile --out dist/schema.json",
114
120
  "build:source": "tsc --project tsconfig.build.json",
115
121
  "clean": "rm -rf ./dist",
116
- "format": "npm run format:lint && npm run format:source",
122
+ "format": "pnpm run format:lint && pnpm run format:source",
117
123
  "format:lint": "eslint --ext .ts . --fix",
118
124
  "format:source": "prettier --write .",
119
- "lint": "npm run lint:ts && npm run lint:eslint",
125
+ "lint": "pnpm run lint:ts && pnpm run lint:eslint",
120
126
  "lint:eslint": "eslint --ext .ts .",
121
127
  "lint:ts": "tsc --noEmit --project tsconfig.json",
122
- "prepack": "npm run build",
128
+ "prepack": "pnpm run build",
123
129
  "release": "release-it",
124
130
  "test": "vitest run --config vitest.config.ts"
125
131
  }