syncpack 7.0.0 → 7.2.2

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 (32) hide show
  1. package/README.md +55 -13
  2. package/dist/bin-fix-mismatches/fix-mismatches.js +13 -0
  3. package/dist/bin-fix-mismatches/get-expected-version/index.d.ts +1 -1
  4. package/dist/bin-fix-mismatches/get-expected-version/index.js +12 -8
  5. package/dist/bin-fix-mismatches/index.js +5 -3
  6. package/dist/bin-format/index.js +4 -2
  7. package/dist/bin-lint-semver-ranges/index.js +7 -5
  8. package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +2 -1
  9. package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +2 -2
  10. package/dist/bin-list/index.js +6 -4
  11. package/dist/bin-list/list-version-groups.d.ts +1 -0
  12. package/dist/bin-list/list-version-groups.js +9 -5
  13. package/dist/bin-list/list.d.ts +2 -1
  14. package/dist/bin-list/list.js +7 -6
  15. package/dist/bin-list-mismatches/index.js +6 -4
  16. package/dist/bin-list-mismatches/list-mismatches.d.ts +2 -1
  17. package/dist/bin-list-mismatches/list-mismatches.js +8 -7
  18. package/dist/bin-set-semver-ranges/index.js +6 -4
  19. package/dist/constants.d.ts +4 -0
  20. package/dist/lib/disk.d.ts +4 -1
  21. package/dist/lib/disk.js +31 -6
  22. package/dist/lib/get-input/get-config.d.ts +4 -1
  23. package/dist/lib/get-input/get-config.js +7 -3
  24. package/dist/lib/get-input/get-wrappers/get-patterns/index.js +3 -2
  25. package/dist/lib/get-input/get-wrappers/tap.js +2 -7
  26. package/dist/lib/get-input/index.d.ts +4 -2
  27. package/dist/lib/get-input/index.js +2 -3
  28. package/dist/lib/log.d.ts +1 -0
  29. package/dist/lib/log.js +48 -0
  30. package/dist/option.d.ts +1 -0
  31. package/dist/option.js +1 -0
  32. package/package.json +7 -7
package/README.md CHANGED
@@ -14,6 +14,10 @@
14
14
  npm install --global syncpack
15
15
  ```
16
16
 
17
+ ## 🤖 GitHub Action
18
+
19
+ As of May 2022 there is now a [Syncpack GitHub Action](https://github.com/marketplace/actions/syncpack-synchronise-monorepo-dependency-versions). It is new and less stable than syncpack itself, but please give it a try and [give your feedback](https://github.com/JamieMason/syncpack-github-action/issues/new).
20
+
17
21
  ## 📝 Commands
18
22
 
19
23
  ### fix-mismatches
@@ -37,6 +41,7 @@ See [`versionGroups`](#versiongroups) if you have advanced requirements.
37
41
  -o, --overrides include overrides (pnpm)
38
42
  -w, --workspace include locally developed package versions
39
43
  -i, --indent [value] override indentation. defaults to " "
44
+ -c, --config <path> path to a syncpack config file
40
45
  -h, --help display help for command
41
46
  ```
42
47
 
@@ -77,7 +82,8 @@ Shorthand properties are used where available, such as the `"repository"` and
77
82
  ```
78
83
  -s, --source [pattern] glob pattern for package.json files to read from
79
84
  -i, --indent [value] override indentation. defaults to " "
80
- -h, --help output usage information
85
+ -c, --config <path> path to a syncpack config file
86
+ -h, --help display help for command
81
87
  ```
82
88
 
83
89
  </details>
@@ -110,13 +116,14 @@ See [`semverGroups`](#semvergroups) if you have advanced requirements.
110
116
 
111
117
  ```
112
118
  -s, --source [pattern] glob pattern for package.json files to read from
113
- -f, --filter [pattern] only include dependencies whose name matches this regex
114
- -r, --semver-range <range> see supported ranges below. defaults to ""
115
119
  -p, --prod include dependencies
116
120
  -d, --dev include devDependencies
117
121
  -P, --peer include peerDependencies
118
122
  -R, --resolutions include resolutions (yarn)
119
123
  -o, --overrides include overrides (pnpm)
124
+ -f, --filter [pattern] only include dependencies whose name matches this regex
125
+ -r, --semver-range <range> see supported ranges below. defaults to ""
126
+ -c, --config <path> path to a syncpack config file
120
127
  -w, --workspace include locally developed package versions
121
128
  -h, --help display help for command
122
129
  ```
@@ -154,12 +161,13 @@ List all dependencies required by your packages.
154
161
 
155
162
  ```
156
163
  -s, --source [pattern] glob pattern for package.json files to read from
157
- -f, --filter [pattern] only include dependencies whose name matches this regex
158
164
  -p, --prod include dependencies
159
165
  -d, --dev include devDependencies
160
166
  -P, --peer include peerDependencies
161
167
  -R, --resolutions include resolutions (yarn)
162
168
  -o, --overrides include overrides (pnpm)
169
+ -f, --filter [pattern] only include dependencies whose name matches this regex
170
+ -c, --config <path> path to a syncpack config file
163
171
  -w, --workspace include locally developed package versions
164
172
  -h, --help display help for command
165
173
  ```
@@ -198,12 +206,13 @@ See [`versionGroups`](#versiongroups) if you have advanced requirements.
198
206
 
199
207
  ```
200
208
  -s, --source [pattern] glob pattern for package.json files to read from
201
- -f, --filter [pattern] only include dependencies whose name matches this regex
202
209
  -p, --prod include dependencies
203
210
  -d, --dev include devDependencies
204
211
  -P, --peer include peerDependencies
205
212
  -R, --resolutions include resolutions (yarn)
206
213
  -o, --overrides include overrides (pnpm)
214
+ -f, --filter [pattern] only include dependencies whose name matches this regex
215
+ -c, --config <path> path to a syncpack config file
207
216
  -w, --workspace include locally developed package versions
208
217
  -h, --help display help for command
209
218
  ```
@@ -251,6 +260,8 @@ See [`semverGroups`](#semvergroups) if you have advanced requirements.
251
260
  -o, --overrides include overrides (pnpm)
252
261
  -w, --workspace include locally developed package versions
253
262
  -i, --indent [value] override indentation. defaults to " "
263
+ -r, --semver-range <range> see supported ranges below. defaults to ""
264
+ -c, --config <path> path to a syncpack config file
254
265
  -h, --help display help for command
255
266
  ```
256
267
 
@@ -292,6 +303,9 @@ tree in the following places:
292
303
  - a `syncpack.config.js` or `syncpack.config.cjs` CommonJS module exporting an
293
304
  object
294
305
 
306
+ If you want to specify a path to a configuration file, overriding the discovered
307
+ configuration file (if present), you can use the `--config` option.
308
+
295
309
  ### Default Configuration
296
310
 
297
311
  ```json
@@ -315,12 +329,7 @@ tree in the following places:
315
329
  "resolutions",
316
330
  "scripts"
317
331
  ],
318
- "sortFirst": [
319
- "name",
320
- "description",
321
- "version",
322
- "author"
323
- ],
332
+ "sortFirst": ["name", "description", "version", "author"],
324
333
  "source": [],
325
334
  "versionGroups": []
326
335
  }
@@ -399,7 +408,7 @@ rest of the repo might need to remain on stable versions.
399
408
 
400
409
  You don't want mismatches within your alpha packages, you don't want mismatches
401
410
  within the other packages, but you _do_ want those groups to use different
402
- versions *to each other* and not have `syncpack` make them all the same.
411
+ versions _to each other_ and not have `syncpack` make them all the same.
403
412
 
404
413
  In the following example, 2 of our packages are using different versions of
405
414
  `react` and `react-dom` to the rest of the project.
@@ -440,7 +449,40 @@ to apply to an entire package:
440
449
  - A specific dependency in some specific packages only.
441
450
  - Any dependency who name matches a pattern such as `@aws-sdk/**`.
442
451
 
443
- See [`semverGroups`](#semverGroups) for some examples, they work the same way.
452
+ See [`semverGroups`](#semverGroups) for more examples, they work the same way.
453
+
454
+ #### `versionGroup.isBanned`
455
+
456
+ Remove dependencies which you've decided should never be allowed.
457
+
458
+ ```json
459
+ {
460
+ "versionGroups": [
461
+ {
462
+ "isBanned": true,
463
+ "dependencies": ["never-gonna"],
464
+ "packages": ["**"]
465
+ }
466
+ ]
467
+ }
468
+ ```
469
+
470
+ #### `versionGroup.pinVersion`
471
+
472
+ Pin the version of all dependencies in this group to match this specific version
473
+ you've defined.
474
+
475
+ ```json
476
+ {
477
+ "versionGroups": [
478
+ {
479
+ "pinVersion": "3.55.0",
480
+ "dependencies": ["@aws-sdk/**"],
481
+ "packages": ["**"]
482
+ }
483
+ ]
484
+ }
485
+ ```
444
486
 
445
487
  ### `semverGroups`
446
488
 
@@ -9,6 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  exports.__esModule = true;
10
10
  exports.fixMismatches = void 0;
11
11
  var chalk_1 = __importDefault(require("chalk"));
12
+ var expect_more_1 = require("expect-more");
12
13
  var list_version_groups_1 = require("../bin-list/list-version-groups");
13
14
  var write_if_changed_1 = require("../lib/write-if-changed");
14
15
  var get_expected_version_1 = require("./get-expected-version");
@@ -39,6 +40,7 @@ function fixMismatches(input, disk) {
39
40
  });
40
41
  });
41
42
  input.wrappers.forEach(function (wrapper) {
43
+ removeEmptyIndexes(wrapper);
42
44
  (0, write_if_changed_1.writeIfChanged)(disk, {
43
45
  contents: wrapper.contents,
44
46
  filePath: wrapper.filePath,
@@ -46,6 +48,17 @@ function fixMismatches(input, disk) {
46
48
  json: wrapper.json
47
49
  });
48
50
  });
51
+ /**
52
+ * Remove eg `{"dependencies": {}, "devDependencies": {}}`
53
+ */
54
+ function removeEmptyIndexes(wrapper) {
55
+ input.dependencyTypes.forEach(function (dependencyType) {
56
+ var deps = wrapper.contents[dependencyType];
57
+ if (deps && Object.values(deps).every(expect_more_1.isUndefined)) {
58
+ delete wrapper.contents[dependencyType];
59
+ }
60
+ });
61
+ }
49
62
  }
50
63
  exports.fixMismatches = fixMismatches;
51
64
  var templateObject_1;
@@ -1,3 +1,3 @@
1
1
  import type { ProgramInput } from '../../lib/get-input';
2
2
  import type { IndexedVersionGroup } from '../../lib/get-input/get-instances';
3
- export declare function getExpectedVersion(name: string, versionGroup: Pick<IndexedVersionGroup, 'instances' | 'pinVersion'>, input: Pick<ProgramInput, 'workspace' | 'wrappers'>): string;
3
+ export declare function getExpectedVersion(name: string, versionGroup: Pick<IndexedVersionGroup, 'isBanned' | 'instances' | 'pinVersion'>, input: Pick<ProgramInput, 'workspace' | 'wrappers'>): string | undefined;
@@ -5,13 +5,17 @@ var get_highest_version_1 = require("./get-highest-version");
5
5
  var get_pinned_version_1 = require("./get-pinned-version");
6
6
  var get_workspace_version_1 = require("./get-workspace-version");
7
7
  function getExpectedVersion(name, versionGroup, input) {
8
- return ((0, get_pinned_version_1.getPinnedVersion)(versionGroup) ||
9
- (input.workspace === true && (0, get_workspace_version_1.getWorkspaceVersion)(name, input.wrappers)) ||
10
- (0, get_highest_version_1.getHighestVersion)(versionGroup.instances
11
- .filter(function (instance) { return instance.name === name; })
12
- .map(function (_a) {
13
- var version = _a.version;
14
- return version;
15
- })));
8
+ return versionGroup.isBanned === true
9
+ ? // remove this dependency
10
+ undefined
11
+ : (0, get_pinned_version_1.getPinnedVersion)(versionGroup) ||
12
+ (input.workspace === true &&
13
+ (0, get_workspace_version_1.getWorkspaceVersion)(name, input.wrappers)) ||
14
+ (0, get_highest_version_1.getHighestVersion)(versionGroup.instances
15
+ .filter(function (instance) { return instance.name === name; })
16
+ .map(function (_a) {
17
+ var version = _a.version;
18
+ return version;
19
+ }));
16
20
  }
17
21
  exports.getExpectedVersion = getExpectedVersion;
@@ -32,7 +32,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
32
32
  var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
34
  };
35
- var _a, _b, _c, _d, _e, _f, _g, _h;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
@@ -44,9 +44,10 @@ commander_1.program.description((0, chalk_1["default"])(templateObject_1 || (tem
44
44
  commander_1.program.on('--help', function () {
45
45
  console.log((0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack fix-mismatches\n {dim # uses packages defined by --source when provided}\n syncpack fix-mismatches --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack fix-mismatches --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack fix-mismatches --filter {yellow \"typescript|tslint\"}\n {dim # only inspect \"devDependencies\"}\n syncpack fix-mismatches --dev\n {dim # only inspect \"devDependencies\" and \"peerDependencies\"}\n syncpack fix-mismatches --dev --peer\n {dim # indent package.json with 4 spaces instead of 2}\n syncpack fix-mismatches --indent {yellow \" \"}\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"], ["\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack fix-mismatches\n {dim # uses packages defined by --source when provided}\n syncpack fix-mismatches --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack fix-mismatches --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack fix-mismatches --filter {yellow \"typescript|tslint\"}\n {dim # only inspect \"devDependencies\"}\n syncpack fix-mismatches --dev\n {dim # only inspect \"devDependencies\" and \"peerDependencies\"}\n syncpack fix-mismatches --dev --peer\n {dim # indent package.json with 4 spaces instead of 2}\n syncpack fix-mismatches --indent {yellow \" \"}\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"]))));
46
46
  });
47
- (_a = (_b = (_c = (_d = (_e = (_f = (_g = (_h = commander_1.program
47
+ (_a = (_b = (_c = (_d = (_e = (_f = (_g = (_h = (_j = commander_1.program
48
48
  .option.apply(commander_1.program, __spreadArray([], __read(option_1.option.source), false)))
49
- .option.apply(_h, __spreadArray([], __read(option_1.option.filter), false)))
49
+ .option.apply(_j, __spreadArray([], __read(option_1.option.filter), false)))
50
+ .option.apply(_h, __spreadArray([], __read(option_1.option.config), false)))
50
51
  .option.apply(_g, __spreadArray([], __read(option_1.option.prod), false)))
51
52
  .option.apply(_f, __spreadArray([], __read(option_1.option.dev), false)))
52
53
  .option.apply(_e, __spreadArray([], __read(option_1.option.peer), false)))
@@ -55,6 +56,7 @@ commander_1.program.on('--help', function () {
55
56
  .option.apply(_b, __spreadArray([], __read(option_1.option.workspace), false)))
56
57
  .option.apply(_a, __spreadArray([], __read(option_1.option.indent), false)).parse(process.argv);
57
58
  (0, fix_mismatches_1.fixMismatches)((0, get_input_1.getInput)(disk_1.disk, {
59
+ configPath: commander_1.program.opts().config,
58
60
  dev: commander_1.program.opts().dev,
59
61
  filter: commander_1.program.opts().filter,
60
62
  indent: commander_1.program.opts().indent,
@@ -32,7 +32,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
32
32
  var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
34
  };
35
- var _a;
35
+ var _a, _b;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
@@ -44,10 +44,12 @@ commander_1.program.description((0, chalk_1["default"])(templateObject_1 || (tem
44
44
  commander_1.program.on('--help', function () {
45
45
  console.log((0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack format\n {dim # uses packages defined by --source when provided}\n syncpack format --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack format --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # indent package.json with 4 spaces instead of 2}\n syncpack format --indent {yellow \" \"}\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"], ["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack format\n {dim # uses packages defined by --source when provided}\n syncpack format --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack format --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # indent package.json with 4 spaces instead of 2}\n syncpack format --indent {yellow \" \"}\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"]))));
46
46
  });
47
- (_a = commander_1.program
47
+ (_a = (_b = commander_1.program
48
48
  .option.apply(commander_1.program, __spreadArray([], __read(option_1.option.source), false)))
49
+ .option.apply(_b, __spreadArray([], __read(option_1.option.config), false)))
49
50
  .option.apply(_a, __spreadArray([], __read(option_1.option.indent), false)).parse(process.argv);
50
51
  (0, format_1.format)((0, get_input_1.getInput)(disk_1.disk, {
52
+ configPath: commander_1.program.opts().config,
51
53
  indent: commander_1.program.opts().indent,
52
54
  source: commander_1.program.opts().source
53
55
  }), disk_1.disk);
@@ -32,7 +32,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
32
32
  var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
34
  };
35
- var _a, _b, _c, _d, _e, _f, _g, _h;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
@@ -44,10 +44,11 @@ commander_1.program.description((0, chalk_1["default"])(templateObject_1 || (tem
44
44
  commander_1.program.on('--help', function () {
45
45
  console.log((0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack lint-semver-ranges\n {dim # uses packages defined by --source when provided}\n syncpack lint-semver-ranges --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack lint-semver-ranges --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack lint-semver-ranges --filter {yellow \"typescript|tslint\"}\n {dim # use ~ range instead of default \"\"}\n syncpack lint-semver-ranges --semver-range ~\n {dim # use ~ range in \"devDependencies\"}\n syncpack lint-semver-ranges --dev --semver-range ~\n {dim # use ~ range in \"devDependencies\" and \"peerDependencies\"}\n syncpack lint-semver-ranges --dev --peer --semver-range ~\n\nSupported Ranges:\n < {dim <1.4.2}\n <= {dim <=1.4.2}\n \"\" {dim 1.4.2}\n ~ {dim ~1.4.2}\n ^ {dim ^1.4.2}\n >= {dim >=1.4.2}\n > {dim >1.4.2}\n * {dim *}\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"], ["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack lint-semver-ranges\n {dim # uses packages defined by --source when provided}\n syncpack lint-semver-ranges --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack lint-semver-ranges --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack lint-semver-ranges --filter {yellow \"typescript|tslint\"}\n {dim # use ~ range instead of default \"\"}\n syncpack lint-semver-ranges --semver-range ~\n {dim # use ~ range in \"devDependencies\"}\n syncpack lint-semver-ranges --dev --semver-range ~\n {dim # use ~ range in \"devDependencies\" and \"peerDependencies\"}\n syncpack lint-semver-ranges --dev --peer --semver-range ~\n\nSupported Ranges:\n < {dim <1.4.2}\n <= {dim <=1.4.2}\n \"\" {dim 1.4.2}\n ~ {dim ~1.4.2}\n ^ {dim ^1.4.2}\n >= {dim >=1.4.2}\n > {dim >1.4.2}\n * {dim *}\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"]))));
46
46
  });
47
- (_a = (_b = (_c = (_d = (_e = (_f = (_g = (_h = commander_1.program
47
+ (_a = (_b = (_c = (_d = (_e = (_f = (_g = (_h = (_j = commander_1.program
48
48
  .option.apply(commander_1.program, __spreadArray([], __read(option_1.option.source), false)))
49
- .option.apply(_h, __spreadArray([], __read(option_1.option.filter), false)))
50
- .option.apply(_g, __spreadArray([], __read(option_1.option.semverRange), false)))
49
+ .option.apply(_j, __spreadArray([], __read(option_1.option.filter), false)))
50
+ .option.apply(_h, __spreadArray([], __read(option_1.option.semverRange), false)))
51
+ .option.apply(_g, __spreadArray([], __read(option_1.option.config), false)))
51
52
  .option.apply(_f, __spreadArray([], __read(option_1.option.prod), false)))
52
53
  .option.apply(_e, __spreadArray([], __read(option_1.option.dev), false)))
53
54
  .option.apply(_d, __spreadArray([], __read(option_1.option.peer), false)))
@@ -55,6 +56,7 @@ commander_1.program.on('--help', function () {
55
56
  .option.apply(_b, __spreadArray([], __read(option_1.option.overrides), false)))
56
57
  .option.apply(_a, __spreadArray([], __read(option_1.option.workspace), false)).parse(process.argv);
57
58
  (0, lint_semver_ranges_1.lintSemverRanges)((0, get_input_1.getInput)(disk_1.disk, {
59
+ configPath: commander_1.program.opts().config,
58
60
  dev: commander_1.program.opts().dev,
59
61
  filter: commander_1.program.opts().filter,
60
62
  overrides: commander_1.program.opts().overrides,
@@ -64,5 +66,5 @@ commander_1.program.on('--help', function () {
64
66
  semverRange: commander_1.program.opts().semverRange,
65
67
  source: commander_1.program.opts().source,
66
68
  workspace: commander_1.program.opts().workspace
67
- }));
69
+ }), disk_1.disk);
68
70
  var templateObject_1, templateObject_2;
@@ -1,2 +1,3 @@
1
+ import type { Disk } from '../lib/disk';
1
2
  import type { ProgramInput } from '../lib/get-input';
2
- export declare function lintSemverRanges(input: ProgramInput): void;
3
+ export declare function lintSemverRanges(input: ProgramInput, disk: Disk): void;
@@ -11,7 +11,7 @@ exports.lintSemverRanges = void 0;
11
11
  var chalk_1 = __importDefault(require("chalk"));
12
12
  var set_semver_range_1 = require("../lib/set-semver-range");
13
13
  var list_semver_group_mismatches_1 = require("./list-semver-group-mismatches");
14
- function lintSemverRanges(input) {
14
+ function lintSemverRanges(input, disk) {
15
15
  var isInvalid = false;
16
16
  /**
17
17
  * Reverse the list so the default/ungrouped semver group is rendered first
@@ -33,7 +33,7 @@ function lintSemverRanges(input) {
33
33
  }
34
34
  });
35
35
  if (isInvalid) {
36
- process.exit(1);
36
+ disk.process.exit(1);
37
37
  }
38
38
  }
39
39
  exports.lintSemverRanges = lintSemverRanges;
@@ -32,7 +32,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
32
32
  var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
34
  };
35
- var _a, _b, _c, _d, _e, _f, _g;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
@@ -44,9 +44,10 @@ commander_1.program.description(' List all dependencies required by your packag
44
44
  commander_1.program.on('--help', function () {
45
45
  console.log((0, chalk_1["default"])(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack list\n {dim # uses packages defined by --source when provided}\n syncpack list --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack list --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack list --filter {yellow \"typescript|tslint\"}\n {dim # only inspect \"devDependencies\"}\n syncpack list --dev\n {dim # only inspect \"devDependencies\" and \"peerDependencies\"}\n syncpack list --dev --peer\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"], ["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack list\n {dim # uses packages defined by --source when provided}\n syncpack list --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack list --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack list --filter {yellow \"typescript|tslint\"}\n {dim # only inspect \"devDependencies\"}\n syncpack list --dev\n {dim # only inspect \"devDependencies\" and \"peerDependencies\"}\n syncpack list --dev --peer\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"]))));
46
46
  });
47
- (_a = (_b = (_c = (_d = (_e = (_f = (_g = commander_1.program
47
+ (_a = (_b = (_c = (_d = (_e = (_f = (_g = (_h = commander_1.program
48
48
  .option.apply(commander_1.program, __spreadArray([], __read(option_1.option.source), false)))
49
- .option.apply(_g, __spreadArray([], __read(option_1.option.filter), false)))
49
+ .option.apply(_h, __spreadArray([], __read(option_1.option.filter), false)))
50
+ .option.apply(_g, __spreadArray([], __read(option_1.option.config), false)))
50
51
  .option.apply(_f, __spreadArray([], __read(option_1.option.prod), false)))
51
52
  .option.apply(_e, __spreadArray([], __read(option_1.option.dev), false)))
52
53
  .option.apply(_d, __spreadArray([], __read(option_1.option.peer), false)))
@@ -54,6 +55,7 @@ commander_1.program.on('--help', function () {
54
55
  .option.apply(_b, __spreadArray([], __read(option_1.option.overrides), false)))
55
56
  .option.apply(_a, __spreadArray([], __read(option_1.option.workspace), false)).parse(process.argv);
56
57
  (0, list_1.list)((0, get_input_1.getInput)(disk_1.disk, {
58
+ configPath: commander_1.program.opts().config,
57
59
  dev: commander_1.program.opts().dev,
58
60
  filter: commander_1.program.opts().filter,
59
61
  overrides: commander_1.program.opts().overrides,
@@ -62,5 +64,5 @@ commander_1.program.on('--help', function () {
62
64
  resolutions: commander_1.program.opts().resolutions,
63
65
  source: commander_1.program.opts().source,
64
66
  workspace: commander_1.program.opts().workspace
65
- }));
67
+ }), disk_1.disk);
66
68
  var templateObject_1;
@@ -2,6 +2,7 @@ import type { IndexedVersionGroup, Instance } from '../lib/get-input/get-instanc
2
2
  export interface ListItem {
3
3
  hasMismatches: boolean;
4
4
  instances: Instance[];
5
+ isBanned: boolean;
5
6
  name: string;
6
7
  uniques: string[];
7
8
  }
@@ -21,7 +21,8 @@ var expect_more_1 = require("expect-more");
21
21
  var group_by_1 = require("../lib/group-by");
22
22
  var sort_by_name_1 = require("../lib/sort-by-name");
23
23
  function listVersionGroups(versionGroup) {
24
- var instancesByName = (0, group_by_1.groupBy)('name', versionGroup.instances.sort(sort_by_name_1.sortByName));
24
+ var instances = versionGroup.instances;
25
+ var instancesByName = (0, group_by_1.groupBy)('name', instances.sort(sort_by_name_1.sortByName));
25
26
  return Object.entries(instancesByName).map(function (_a) {
26
27
  var _b = __read(_a, 2), name = _b[0], instances = _b[1];
27
28
  var pinnedVersion = versionGroup.pinVersion;
@@ -31,13 +32,16 @@ function listVersionGroups(versionGroup) {
31
32
  return version;
32
33
  });
33
34
  var uniques = Array.from(new Set(versions));
34
- var hasMismatches = versions.some(function (version, i) {
35
- return (hasPinnedVersion && version !== pinnedVersion) ||
36
- (i > 0 && version !== versions[i - 1]);
37
- });
35
+ var isBanned = versionGroup.isBanned === true;
36
+ var hasMismatches = isBanned ||
37
+ versions.some(function (version, i) {
38
+ return (hasPinnedVersion && version !== pinnedVersion) ||
39
+ (i > 0 && version !== versions[i - 1]);
40
+ });
38
41
  return {
39
42
  hasMismatches: hasMismatches,
40
43
  instances: instances,
44
+ isBanned: isBanned,
41
45
  name: name,
42
46
  uniques: uniques
43
47
  };
@@ -1,2 +1,3 @@
1
+ import type { Disk } from '../lib/disk';
1
2
  import type { ProgramInput } from '../lib/get-input';
2
- export declare function list(input: ProgramInput): void;
3
+ export declare function list(input: ProgramInput, disk: Disk): void;
@@ -10,7 +10,7 @@ exports.__esModule = true;
10
10
  exports.list = void 0;
11
11
  var chalk_1 = __importDefault(require("chalk"));
12
12
  var list_version_groups_1 = require("./list-version-groups");
13
- function list(input) {
13
+ function list(input, disk) {
14
14
  var isInvalid = false;
15
15
  /**
16
16
  * Reverse the list so the default/ungrouped version group is rendered first
@@ -24,10 +24,11 @@ function list(input) {
24
24
  console.log((0, chalk_1["default"])(templateObject_1 || (templateObject_1 = __makeTemplateObject(["{dim = Version Group ", " ", "}"], ["{dim = Version Group ", " ", "}"])), i, '='.repeat(63)));
25
25
  }
26
26
  groups.forEach(function (_a) {
27
- var hasMismatches = _a.hasMismatches, name = _a.name, uniques = _a.uniques;
27
+ var hasMismatches = _a.hasMismatches, isBanned = _a.isBanned, name = _a.name, uniques = _a.uniques;
28
28
  var versionList = uniques.sort().join(', ');
29
- console.log(hasMismatches
30
- ? (0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["{red \u2715 ", "} {dim.red ", "}"], ["{red \u2715 ", "} {dim.red ", "}"])), name, versionList) : (0, chalk_1["default"])(templateObject_3 || (templateObject_3 = __makeTemplateObject(["{dim -} {white ", "} {dim ", "}"], ["{dim -} {white ", "} {dim ", "}"])), name, versionList));
29
+ console.log(isBanned
30
+ ? (0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["{red \u2715 ", "} {dim.red remove this dependency}"], ["{red \u2715 ", "} {dim.red remove this dependency}"])), name) : hasMismatches
31
+ ? (0, chalk_1["default"])(templateObject_3 || (templateObject_3 = __makeTemplateObject(["{red \u2715 ", "} {dim.red ", "}"], ["{red \u2715 ", "} {dim.red ", "}"])), name, versionList) : (0, chalk_1["default"])(templateObject_4 || (templateObject_4 = __makeTemplateObject(["{dim -} {white ", "} {dim ", "}"], ["{dim -} {white ", "} {dim ", "}"])), name, versionList));
31
32
  });
32
33
  if (groups.some(function (_a) {
33
34
  var hasMismatches = _a.hasMismatches;
@@ -37,8 +38,8 @@ function list(input) {
37
38
  }
38
39
  });
39
40
  if (isInvalid) {
40
- process.exit(1);
41
+ disk.process.exit(1);
41
42
  }
42
43
  }
43
44
  exports.list = list;
44
- var templateObject_1, templateObject_2, templateObject_3;
45
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -32,7 +32,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
32
32
  var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
34
  };
35
- var _a, _b, _c, _d, _e, _f, _g;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
@@ -44,9 +44,10 @@ commander_1.program.description("\n List dependencies which are required by mul
44
44
  commander_1.program.on('--help', function () {
45
45
  console.log((0, chalk_1["default"])(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack list-mismatches\n {dim # uses packages defined by --source when provided}\n syncpack list-mismatches --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack list-mismatches --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack list-mismatches --filter {yellow \"typescript|tslint\"}\n {dim # only inspect \"devDependencies\"}\n syncpack list-mismatches --dev\n {dim # only inspect \"devDependencies\" and \"peerDependencies\"}\n syncpack list-mismatches --dev --peer\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"], ["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack list-mismatches\n {dim # uses packages defined by --source when provided}\n syncpack list-mismatches --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack list-mismatches --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack list-mismatches --filter {yellow \"typescript|tslint\"}\n {dim # only inspect \"devDependencies\"}\n syncpack list-mismatches --dev\n {dim # only inspect \"devDependencies\" and \"peerDependencies\"}\n syncpack list-mismatches --dev --peer\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"]))));
46
46
  });
47
- (_a = (_b = (_c = (_d = (_e = (_f = (_g = commander_1.program
47
+ (_a = (_b = (_c = (_d = (_e = (_f = (_g = (_h = commander_1.program
48
48
  .option.apply(commander_1.program, __spreadArray([], __read(option_1.option.source), false)))
49
- .option.apply(_g, __spreadArray([], __read(option_1.option.filter), false)))
49
+ .option.apply(_h, __spreadArray([], __read(option_1.option.filter), false)))
50
+ .option.apply(_g, __spreadArray([], __read(option_1.option.config), false)))
50
51
  .option.apply(_f, __spreadArray([], __read(option_1.option.prod), false)))
51
52
  .option.apply(_e, __spreadArray([], __read(option_1.option.dev), false)))
52
53
  .option.apply(_d, __spreadArray([], __read(option_1.option.peer), false)))
@@ -54,6 +55,7 @@ commander_1.program.on('--help', function () {
54
55
  .option.apply(_b, __spreadArray([], __read(option_1.option.overrides), false)))
55
56
  .option.apply(_a, __spreadArray([], __read(option_1.option.workspace), false)).parse(process.argv);
56
57
  (0, list_mismatches_1.listMismatches)((0, get_input_1.getInput)(disk_1.disk, {
58
+ configPath: commander_1.program.opts().config,
57
59
  dev: commander_1.program.opts().dev,
58
60
  filter: commander_1.program.opts().filter,
59
61
  overrides: commander_1.program.opts().overrides,
@@ -62,5 +64,5 @@ commander_1.program.on('--help', function () {
62
64
  resolutions: commander_1.program.opts().resolutions,
63
65
  source: commander_1.program.opts().source,
64
66
  workspace: commander_1.program.opts().workspace
65
- }));
67
+ }), disk_1.disk);
66
68
  var templateObject_1;
@@ -1,2 +1,3 @@
1
+ import type { Disk } from '../lib/disk';
1
2
  import type { ProgramInput } from '../lib/get-input';
2
- export declare function listMismatches(input: ProgramInput): void;
3
+ export declare function listMismatches(input: ProgramInput, disk: Disk): void;
@@ -13,7 +13,7 @@ var path_1 = require("path");
13
13
  var get_expected_version_1 = require("../bin-fix-mismatches/get-expected-version");
14
14
  var list_version_groups_1 = require("../bin-list/list-version-groups");
15
15
  var constants_1 = require("../constants");
16
- function listMismatches(input) {
16
+ function listMismatches(input, disk) {
17
17
  var isInvalid = false;
18
18
  /**
19
19
  * Reverse the list so the default/ungrouped version group is rendered first
@@ -33,24 +33,25 @@ function listMismatches(input) {
33
33
  }
34
34
  }
35
35
  groups.forEach(function (_a) {
36
- var instances = _a.instances, name = _a.name;
36
+ var instances = _a.instances, isBanned = _a.isBanned, name = _a.name;
37
37
  var expectedVersion = (0, get_expected_version_1.getExpectedVersion)(name, versionGroup, input);
38
- console.log((0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["{dim -} ", " {green.dim ", "}"], ["{dim -} ", " {green.dim ", "}"])), name, expectedVersion));
38
+ console.log(isBanned
39
+ ? (0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["{red \u2715 ", "} {dim.red remove this dependency}"], ["{red \u2715 ", "} {dim.red remove this dependency}"])), name) : (0, chalk_1["default"])(templateObject_3 || (templateObject_3 = __makeTemplateObject(["{dim -} ", " {green.dim ", "}"], ["{dim -} ", " {green.dim ", "}"])), name, expectedVersion));
39
40
  instances.forEach(function (_a) {
40
41
  var dependencyType = _a.dependencyType, version = _a.version, wrapper = _a.wrapper;
41
42
  if (dependencyType === 'workspace') {
42
43
  var shortPath = (0, path_1.relative)(constants_1.CWD, wrapper.filePath);
43
- console.log((0, chalk_1["default"])(templateObject_3 || (templateObject_3 = __makeTemplateObject(["{red ", " {dim at ", "}}"], ["{red ", " {dim at ", "}}"])), version, shortPath));
44
+ console.log((0, chalk_1["default"])(templateObject_4 || (templateObject_4 = __makeTemplateObject(["{red ", " {dim at ", "}}"], ["{red ", " {dim at ", "}}"])), version, shortPath));
44
45
  }
45
46
  else {
46
- console.log((0, chalk_1["default"])(templateObject_4 || (templateObject_4 = __makeTemplateObject(["{red ", " {dim in ", " of ", "}}"], ["{red ", " {dim in ", " of ", "}}"])), version, dependencyType, wrapper.contents.name));
47
+ console.log((0, chalk_1["default"])(templateObject_5 || (templateObject_5 = __makeTemplateObject(["{red ", " {dim in ", " of ", "}}"], ["{red ", " {dim in ", " of ", "}}"])), version, dependencyType, wrapper.contents.name));
47
48
  }
48
49
  });
49
50
  });
50
51
  });
51
52
  if (isInvalid) {
52
- process.exit(1);
53
+ disk.process.exit(1);
53
54
  }
54
55
  }
55
56
  exports.listMismatches = listMismatches;
56
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
57
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
@@ -32,7 +32,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
32
32
  var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
34
  };
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
@@ -44,10 +44,11 @@ commander_1.program.description((0, chalk_1["default"])(templateObject_1 || (tem
44
44
  commander_1.program.on('--help', function () {
45
45
  console.log((0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack set-semver-ranges\n {dim # uses packages defined by --source when provided}\n syncpack set-semver-ranges --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack set-semver-ranges --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack set-semver-ranges --filter {yellow \"typescript|tslint\"}\n {dim # use ~ range instead of default \"\"}\n syncpack set-semver-ranges --semver-range ~\n {dim # set ~ range in \"devDependencies\"}\n syncpack set-semver-ranges --dev --semver-range ~\n {dim # set ~ range in \"devDependencies\" and \"peerDependencies\"}\n syncpack set-semver-ranges --dev --peer --semver-range ~\n {dim # indent package.json with 4 spaces instead of 2}\n syncpack set-semver-ranges --indent {yellow \" \"}\n\nSupported Ranges:\n < {dim <1.4.2}\n <= {dim <=1.4.2}\n \"\" {dim 1.4.2}\n ~ {dim ~1.4.2}\n ^ {dim ^1.4.2}\n >= {dim >=1.4.2}\n > {dim >1.4.2}\n * {dim *}\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"], ["\nExamples:\n {dim # uses defaults for resolving packages}\n syncpack set-semver-ranges\n {dim # uses packages defined by --source when provided}\n syncpack set-semver-ranges --source {yellow \"apps/*/package.json\"}\n {dim # multiple globs can be provided like this}\n syncpack set-semver-ranges --source {yellow \"apps/*/package.json\"} --source {yellow \"core/*/package.json\"}\n {dim # uses dependencies regular expression defined by --filter when provided}\n syncpack set-semver-ranges --filter {yellow \"typescript|tslint\"}\n {dim # use ~ range instead of default \"\"}\n syncpack set-semver-ranges --semver-range ~\n {dim # set ~ range in \"devDependencies\"}\n syncpack set-semver-ranges --dev --semver-range ~\n {dim # set ~ range in \"devDependencies\" and \"peerDependencies\"}\n syncpack set-semver-ranges --dev --peer --semver-range ~\n {dim # indent package.json with 4 spaces instead of 2}\n syncpack set-semver-ranges --indent {yellow \" \"}\n\nSupported Ranges:\n < {dim <1.4.2}\n <= {dim <=1.4.2}\n \"\" {dim 1.4.2}\n ~ {dim ~1.4.2}\n ^ {dim ^1.4.2}\n >= {dim >=1.4.2}\n > {dim >1.4.2}\n * {dim *}\n\nResolving Packages:\n 1. If {yellow --source} globs are provided, use those.\n 2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.\n 3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.\n 4. If using Lerna, read {yellow packages} from {yellow lerna.json}.\n 5. Default to {yellow \"package.json\"} and {yellow \"packages/*/package.json\"}.\n\nReference:\n globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}\n lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}\n Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}\n Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}\n"]))));
46
46
  });
47
- (_a = (_b = (_c = (_d = (_e = (_f = (_g = (_h = (_j = commander_1.program
47
+ (_a = (_b = (_c = (_d = (_e = (_f = (_g = (_h = (_j = (_k = commander_1.program
48
48
  .option.apply(commander_1.program, __spreadArray([], __read(option_1.option.source), false)))
49
- .option.apply(_j, __spreadArray([], __read(option_1.option.semverRange), false)))
50
- .option.apply(_h, __spreadArray([], __read(option_1.option.filter), false)))
49
+ .option.apply(_k, __spreadArray([], __read(option_1.option.filter), false)))
50
+ .option.apply(_j, __spreadArray([], __read(option_1.option.config), false)))
51
+ .option.apply(_h, __spreadArray([], __read(option_1.option.semverRange), false)))
51
52
  .option.apply(_g, __spreadArray([], __read(option_1.option.prod), false)))
52
53
  .option.apply(_f, __spreadArray([], __read(option_1.option.dev), false)))
53
54
  .option.apply(_e, __spreadArray([], __read(option_1.option.peer), false)))
@@ -56,6 +57,7 @@ commander_1.program.on('--help', function () {
56
57
  .option.apply(_b, __spreadArray([], __read(option_1.option.workspace), false)))
57
58
  .option.apply(_a, __spreadArray([], __read(option_1.option.indent), false)).parse(process.argv);
58
59
  (0, set_semver_ranges_1.setSemverRanges)((0, get_input_1.getInput)(disk_1.disk, {
60
+ configPath: commander_1.program.opts().config,
59
61
  dev: commander_1.program.opts().dev,
60
62
  filter: commander_1.program.opts().filter,
61
63
  indent: commander_1.program.opts().indent,
@@ -30,6 +30,10 @@ export interface VersionGroup {
30
30
  * the names of the dependencies (eg. "lodash") which belong to this group
31
31
  */
32
32
  dependencies: string[];
33
+ /**
34
+ * optionally force all dependencies in this group to be removed
35
+ */
36
+ isBanned?: true;
33
37
  /**
34
38
  * optionally force all dependencies in this group to have this version
35
39
  */
@@ -1,8 +1,11 @@
1
1
  import type { SyncpackConfig } from '../constants';
2
2
  export declare type Disk = typeof disk;
3
3
  export declare const disk: {
4
+ readonly process: {
5
+ readonly exit: (code: number) => void;
6
+ };
4
7
  readonly globSync: (pattern: string) => string[];
5
- readonly readConfigFileSync: () => Partial<SyncpackConfig>;
8
+ readonly readConfigFileSync: (configPath?: string | undefined) => Partial<SyncpackConfig>;
6
9
  readonly readFileSync: (filePath: string) => string;
7
10
  readonly readYamlFileSync: <T = unknown>(filePath: string) => T;
8
11
  readonly removeSync: (filePath: string) => void;
package/dist/lib/disk.js CHANGED
@@ -2,35 +2,60 @@
2
2
  exports.__esModule = true;
3
3
  exports.disk = void 0;
4
4
  var cosmiconfig_1 = require("cosmiconfig");
5
- var expect_more_1 = require("expect-more");
6
5
  var fs_extra_1 = require("fs-extra");
7
6
  var glob_1 = require("glob");
8
7
  var read_yaml_file_1 = require("read-yaml-file");
9
8
  var constants_1 = require("../constants");
9
+ var log_1 = require("./log");
10
+ var client = (0, cosmiconfig_1.cosmiconfigSync)('syncpack');
10
11
  exports.disk = {
12
+ process: {
13
+ exit: function (code) {
14
+ (0, log_1.verbose)('exit(', code, ')');
15
+ process.exit(code);
16
+ }
17
+ },
11
18
  globSync: function (pattern) {
19
+ (0, log_1.verbose)('globSync(', pattern, ')');
12
20
  return (0, glob_1.sync)(pattern, {
13
21
  ignore: '**/node_modules/**',
14
22
  absolute: true,
15
23
  cwd: constants_1.CWD
16
24
  });
17
25
  },
18
- readConfigFileSync: function () {
19
- var rcSearch = (0, cosmiconfig_1.cosmiconfigSync)('syncpack').search();
20
- var rcConfig = rcSearch !== null ? rcSearch.config : {};
21
- var rcFile = (0, expect_more_1.isObject)(rcConfig) ? rcConfig : {};
22
- return rcFile;
26
+ readConfigFileSync: function (configPath) {
27
+ (0, log_1.verbose)('readConfigFileSync(', configPath, ')');
28
+ try {
29
+ var result = configPath ? client.load(configPath) : client.search();
30
+ if (result === null) {
31
+ (0, log_1.verbose)('no config file found');
32
+ return {};
33
+ }
34
+ var rcPath = result.filepath;
35
+ var rcConfig = result.config;
36
+ (0, log_1.verbose)('.syncpackrc path:', rcPath);
37
+ (0, log_1.verbose)('.syncpackrc contents:', rcConfig);
38
+ return rcConfig;
39
+ }
40
+ catch (err) {
41
+ (0, log_1.verbose)('no config file found at:', configPath);
42
+ return {};
43
+ }
23
44
  },
24
45
  readFileSync: function (filePath) {
46
+ (0, log_1.verbose)('readFileSync(', filePath, ')');
25
47
  return (0, fs_extra_1.readFileSync)(filePath, { encoding: 'utf8' });
26
48
  },
27
49
  readYamlFileSync: function (filePath) {
50
+ (0, log_1.verbose)('readYamlFileSync(', filePath, ')');
28
51
  return (0, read_yaml_file_1.sync)(filePath);
29
52
  },
30
53
  removeSync: function (filePath) {
54
+ (0, log_1.verbose)('removeSync(', filePath, ')');
31
55
  (0, fs_extra_1.removeSync)(filePath);
32
56
  },
33
57
  writeFileSync: function (filePath, contents) {
58
+ (0, log_1.verbose)('writeFileSync(', filePath, contents, ')');
34
59
  (0, fs_extra_1.writeFileSync)(filePath, contents);
35
60
  }
36
61
  };
@@ -1,4 +1,5 @@
1
1
  import type { SyncpackConfig } from '../../constants';
2
+ import type { Disk } from '../disk';
2
3
  /**
3
4
  * Take all configuration from the command line and config file, combine it, and
4
5
  * set defaults for anything which hasn't been defined.
@@ -6,4 +7,6 @@ import type { SyncpackConfig } from '../../constants';
6
7
  * @param rcFile Optional configuration file contents
7
8
  * @param program Optional command line options
8
9
  */
9
- export declare const getConfig: (rcFile: Partial<SyncpackConfig>, program: Partial<SyncpackConfig>) => SyncpackConfig;
10
+ export declare const getConfig: (disk: Disk, program: Partial<SyncpackConfig & {
11
+ configPath: string | undefined;
12
+ }>) => SyncpackConfig;
@@ -4,6 +4,7 @@ exports.getConfig = void 0;
4
4
  var expect_more_1 = require("expect-more");
5
5
  var constants_1 = require("../../constants");
6
6
  var is_semver_1 = require("../../lib/is-semver");
7
+ var log_1 = require("../log");
7
8
  /**
8
9
  * Take all configuration from the command line and config file, combine it, and
9
10
  * set defaults for anything which hasn't been defined.
@@ -11,7 +12,9 @@ var is_semver_1 = require("../../lib/is-semver");
11
12
  * @param rcFile Optional configuration file contents
12
13
  * @param program Optional command line options
13
14
  */
14
- var getConfig = function (rcFile, program) {
15
+ var getConfig = function (disk, program) {
16
+ (0, log_1.verbose)('cli arguments:', program);
17
+ var rcFile = disk.readConfigFileSync(program.configPath);
15
18
  var hasTypeOverride = (0, expect_more_1.isBoolean)(program.dev) ||
16
19
  (0, expect_more_1.isBoolean)(program.workspace) ||
17
20
  (0, expect_more_1.isBoolean)(program.overrides) ||
@@ -39,7 +42,6 @@ var getConfig = function (rcFile, program) {
39
42
  var dependencyTypes = dev || workspace || overrides || peer || prod || resolutions
40
43
  ? constants_1.DEPENDENCY_TYPES.filter(function (type) {
41
44
  return (type === 'devDependencies' && dev) ||
42
- (type === 'workspace' && workspace) ||
43
45
  (type === 'overrides' && overrides) ||
44
46
  (type === 'peerDependencies' && peer) ||
45
47
  (type === 'dependencies' && prod) ||
@@ -71,7 +73,7 @@ var getConfig = function (rcFile, program) {
71
73
  dependencies: ['**']
72
74
  };
73
75
  var versionGroups = getOption('versionGroups', isArrayOfVersionGroups).concat(defaultVersionGroup);
74
- return {
76
+ var finalConfig = {
75
77
  dependencyTypes: dependencyTypes,
76
78
  dev: dev,
77
79
  filter: filter,
@@ -88,6 +90,8 @@ var getConfig = function (rcFile, program) {
88
90
  source: source,
89
91
  versionGroups: versionGroups
90
92
  };
93
+ (0, log_1.verbose)('final config:', finalConfig);
94
+ return finalConfig;
91
95
  function getOption(name, isValid) {
92
96
  var cliOption = program[name];
93
97
  if (isValid(cliOption))
@@ -52,7 +52,6 @@ exports.getPatterns = void 0;
52
52
  var expect_more_1 = require("expect-more");
53
53
  var function_1 = require("fp-ts/lib/function");
54
54
  var O = __importStar(require("fp-ts/lib/Option"));
55
- var path_1 = require("path");
56
55
  var constants_1 = require("../../../../constants");
57
56
  var tap_1 = require("../tap");
58
57
  var get_lerna_patterns_1 = require("./get-lerna-patterns");
@@ -70,7 +69,9 @@ function getPatterns(disk, program) {
70
69
  return __spreadArray(['.'], __read(patterns), false);
71
70
  }
72
71
  function limitToPackageJson(patterns) {
73
- return patterns.map(function (pattern) { return (0, path_1.join)(pattern, 'package.json'); });
72
+ return patterns.map(function (pattern) {
73
+ return pattern.includes('package.json') ? pattern : "".concat(pattern, "/package.json");
74
+ });
74
75
  }
75
76
  }
76
77
  exports.getPatterns = getPatterns;
@@ -22,21 +22,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  exports.__esModule = true;
29
26
  exports.tapNone = void 0;
30
- var chalk_1 = __importDefault(require("chalk"));
31
27
  var O = __importStar(require("fp-ts/lib/Option"));
28
+ var log_1 = require("../../log");
32
29
  /**
33
30
  * Log a message when a pipeline contains `None` and let it continue unchanged.
34
31
  */
35
32
  function tapNone(message) {
36
33
  return O.fold(function logNoneValue() {
37
- if (process.env.SYNCPACK_VERBOSE) {
38
- console.log(chalk_1["default"].yellow("? ".concat(message)));
39
- }
34
+ (0, log_1.verbose)(message);
40
35
  return O.none;
41
36
  }, O.of);
42
37
  }
@@ -13,6 +13,8 @@ export declare type ProgramInput = SyncpackConfig & {
13
13
  * that the majority of syncpack and its tests don't have to deal with the file
14
14
  * system and can focus solely on transformation logic.
15
15
  *
16
- * @param program Options received from CLI arguments
16
+ * @param program Options received from CLI arguments
17
17
  */
18
- export declare function getInput(disk: Disk, program: Partial<SyncpackConfig>): ProgramInput;
18
+ export declare function getInput(disk: Disk, program: Partial<SyncpackConfig & {
19
+ configPath: string | undefined;
20
+ }>): ProgramInput;
@@ -21,11 +21,10 @@ var get_wrappers_1 = require("./get-wrappers");
21
21
  * that the majority of syncpack and its tests don't have to deal with the file
22
22
  * system and can focus solely on transformation logic.
23
23
  *
24
- * @param program Options received from CLI arguments
24
+ * @param program Options received from CLI arguments
25
25
  */
26
26
  function getInput(disk, program) {
27
- var rcFile = disk.readConfigFileSync();
28
- var config = (0, get_config_1.getConfig)(rcFile, program);
27
+ var config = (0, get_config_1.getConfig)(disk, program);
29
28
  var wrappers = (0, get_wrappers_1.getWrappers)(disk, config);
30
29
  var instances = (0, get_instances_1.getInstances)(config, wrappers);
31
30
  return __assign(__assign({}, config), { disk: disk, instances: instances, wrappers: wrappers });
@@ -0,0 +1 @@
1
+ export declare function verbose(...values: any[]): void;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
26
+ };
27
+ var __importDefault = (this && this.__importDefault) || function (mod) {
28
+ return (mod && mod.__esModule) ? mod : { "default": mod };
29
+ };
30
+ exports.__esModule = true;
31
+ exports.verbose = void 0;
32
+ var chalk_1 = __importDefault(require("chalk"));
33
+ var expect_more_1 = require("expect-more");
34
+ var util_1 = require("util");
35
+ function verbose() {
36
+ var values = [];
37
+ for (var _i = 0; _i < arguments.length; _i++) {
38
+ values[_i] = arguments[_i];
39
+ }
40
+ if (process.env.SYNCPACK_VERBOSE) {
41
+ console.info.apply(console, __spreadArray([chalk_1["default"].yellow('?')], __read(values.map(function (value) {
42
+ return (0, expect_more_1.isString)(value)
43
+ ? chalk_1["default"].yellow(value)
44
+ : (0, util_1.inspect)(value, false, null, true);
45
+ })), false));
46
+ }
47
+ }
48
+ exports.verbose = verbose;
package/dist/option.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { collect } from './lib/collect';
2
2
  export declare const option: {
3
+ readonly config: readonly ["-c, --config <path>", "path to a syncpack config file"];
3
4
  readonly dev: readonly ["-d, --dev", string];
4
5
  readonly filter: readonly ["-f, --filter [pattern]", string];
5
6
  readonly indent: readonly ["-i, --indent [value]", `override indentation. defaults to "${string}"`];
package/dist/option.js CHANGED
@@ -12,6 +12,7 @@ var chalk_1 = __importDefault(require("chalk"));
12
12
  var constants_1 = require("./constants");
13
13
  var collect_1 = require("./lib/collect");
14
14
  exports.option = {
15
+ config: ['-c, --config <path>', 'path to a syncpack config file'],
15
16
  dev: ['-d, --dev', (0, chalk_1["default"])(templateObject_1 || (templateObject_1 = __makeTemplateObject(["include {yellow devDependencies}"], ["include {yellow devDependencies}"])))],
16
17
  filter: [
17
18
  '-f, --filter [pattern]',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "syncpack",
3
3
  "description": "Manage multiple package.json files, such as in Lerna Monorepos and Yarn/Pnpm Workspaces",
4
- "version": "7.0.0",
4
+ "version": "7.2.2",
5
5
  "author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)",
6
6
  "bin": {
7
7
  "syncpack": "dist/bin.js",
@@ -28,7 +28,7 @@
28
28
  "commander": "9.2.0",
29
29
  "cosmiconfig": "7.0.1",
30
30
  "expect-more": "1.2.0",
31
- "fp-ts": "2.12.0",
31
+ "fp-ts": "2.12.1",
32
32
  "fs-extra": "10.1.0",
33
33
  "glob": "8.0.1",
34
34
  "minimatch": "5.0.1",
@@ -39,10 +39,10 @@
39
39
  "@types/fs-extra": "9.0.13",
40
40
  "@types/glob": "7.2.0",
41
41
  "@types/jest": "27.4.1",
42
- "@types/node": "17.0.25",
42
+ "@types/node": "17.0.31",
43
43
  "@types/semver": "7.3.9",
44
- "@typescript-eslint/eslint-plugin": "5.20.0",
45
- "@typescript-eslint/parser": "5.20.0",
44
+ "@typescript-eslint/eslint-plugin": "5.21.0",
45
+ "@typescript-eslint/parser": "5.21.0",
46
46
  "eslint": "8.14.0",
47
47
  "eslint-plugin-import": "2.26.0",
48
48
  "expect-more-jest": "5.4.0",
@@ -50,7 +50,7 @@
50
50
  "prettier": "2.6.2",
51
51
  "rimraf": "3.0.2",
52
52
  "ts-jest": "27.1.4",
53
- "typescript": "4.6.3"
53
+ "typescript": "4.6.4"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=10"
@@ -88,6 +88,6 @@
88
88
  "format:source": "prettier --write .",
89
89
  "lint": "eslint --ext .ts .",
90
90
  "prepack": "yarn build",
91
- "test": "jest"
91
+ "test": "jest src"
92
92
  }
93
93
  }