syncpack 6.2.0 → 7.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 (35) hide show
  1. package/README.md +95 -59
  2. package/dist/bin-fix-mismatches/get-expected-version/index.d.ts +1 -1
  3. package/dist/bin-fix-mismatches/get-expected-version/index.js +1 -1
  4. package/dist/bin-fix-mismatches/index.js +9 -5
  5. package/dist/bin-format/index.js +5 -5
  6. package/dist/bin-lint-semver-ranges/index.js +15 -11
  7. package/dist/bin-list/index.js +9 -5
  8. package/dist/bin-list/list-version-groups.d.ts +1 -2
  9. package/dist/bin-list-mismatches/index.js +9 -5
  10. package/dist/bin-list-mismatches/list-mismatches.js +10 -2
  11. package/dist/bin-set-semver-ranges/index.js +16 -12
  12. package/dist/constants.d.ts +7 -2
  13. package/dist/constants.js +2 -0
  14. package/dist/lib/disk.d.ts +1 -1
  15. package/dist/lib/disk.js +20 -6
  16. package/dist/lib/get-input/get-config.d.ts +4 -1
  17. package/dist/lib/get-input/get-config.js +9 -2
  18. package/dist/lib/get-input/get-instances.js +42 -26
  19. package/dist/lib/get-input/get-wrappers/get-file-paths.js +5 -1
  20. package/dist/lib/get-input/get-wrappers/get-patterns/get-lerna-patterns.js +5 -1
  21. package/dist/lib/get-input/get-wrappers/get-patterns/get-pnpm-patterns.js +5 -1
  22. package/dist/lib/get-input/get-wrappers/get-patterns/get-yarn-patterns.js +5 -1
  23. package/dist/lib/get-input/get-wrappers/get-patterns/index.js +5 -1
  24. package/dist/lib/get-input/get-wrappers/get-patterns/props.js +5 -1
  25. package/dist/lib/get-input/get-wrappers/get-patterns/read-json-safe.js +5 -1
  26. package/dist/lib/get-input/get-wrappers/get-patterns/read-yaml-safe.js +5 -1
  27. package/dist/lib/get-input/get-wrappers/index.js +6 -2
  28. package/dist/lib/get-input/get-wrappers/tap.js +7 -8
  29. package/dist/lib/get-input/index.d.ts +4 -2
  30. package/dist/lib/get-input/index.js +2 -3
  31. package/dist/lib/log.d.ts +1 -0
  32. package/dist/lib/log.js +13 -0
  33. package/dist/option.d.ts +2 -0
  34. package/dist/option.js +4 -2
  35. package/package.json +19 -18
package/README.md CHANGED
@@ -28,14 +28,16 @@ See [`versionGroups`](#versiongroups) if you have advanced requirements.
28
28
  <summary>Options</summary>
29
29
 
30
30
  ```
31
- -s, --source [pattern] glob pattern for package.json files to read from (default: [])
31
+ -s, --source [pattern] glob pattern for package.json files to read from
32
+ -f, --filter [pattern] only include dependencies whose name matches this regex
32
33
  -p, --prod include dependencies
33
34
  -d, --dev include devDependencies
34
35
  -P, --peer include peerDependencies
35
36
  -R, --resolutions include resolutions (yarn)
36
37
  -o, --overrides include overrides (pnpm)
37
- -f, --filter [pattern] only include dependencies whose name matches this regex
38
+ -w, --workspace include locally developed package versions
38
39
  -i, --indent [value] override indentation. defaults to " "
40
+ -c, --config <path> path to a syncpack config file
39
41
  -h, --help display help for command
40
42
  ```
41
43
 
@@ -76,7 +78,8 @@ Shorthand properties are used where available, such as the `"repository"` and
76
78
  ```
77
79
  -s, --source [pattern] glob pattern for package.json files to read from
78
80
  -i, --indent [value] override indentation. defaults to " "
79
- -h, --help output usage information
81
+ -c, --config <path> path to a syncpack config file
82
+ -h, --help display help for command
80
83
  ```
81
84
 
82
85
  </details>
@@ -108,7 +111,7 @@ See [`semverGroups`](#semvergroups) if you have advanced requirements.
108
111
  <summary>Options</summary>
109
112
 
110
113
  ```
111
- -s, --source [pattern] glob pattern for package.json files to read from (default: [])
114
+ -s, --source [pattern] glob pattern for package.json files to read from
112
115
  -p, --prod include dependencies
113
116
  -d, --dev include devDependencies
114
117
  -P, --peer include peerDependencies
@@ -116,6 +119,8 @@ See [`semverGroups`](#semvergroups) if you have advanced requirements.
116
119
  -o, --overrides include overrides (pnpm)
117
120
  -f, --filter [pattern] only include dependencies whose name matches this regex
118
121
  -r, --semver-range <range> see supported ranges below. defaults to ""
122
+ -c, --config <path> path to a syncpack config file
123
+ -w, --workspace include locally developed package versions
119
124
  -h, --help display help for command
120
125
  ```
121
126
 
@@ -151,13 +156,15 @@ List all dependencies required by your packages.
151
156
  <summary>Options</summary>
152
157
 
153
158
  ```
154
- -s, --source [pattern] glob pattern for package.json files to read from (default: [])
159
+ -s, --source [pattern] glob pattern for package.json files to read from
155
160
  -p, --prod include dependencies
156
161
  -d, --dev include devDependencies
157
162
  -P, --peer include peerDependencies
158
163
  -R, --resolutions include resolutions (yarn)
159
164
  -o, --overrides include overrides (pnpm)
160
165
  -f, --filter [pattern] only include dependencies whose name matches this regex
166
+ -c, --config <path> path to a syncpack config file
167
+ -w, --workspace include locally developed package versions
161
168
  -h, --help display help for command
162
169
  ```
163
170
 
@@ -194,13 +201,15 @@ See [`versionGroups`](#versiongroups) if you have advanced requirements.
194
201
  <summary>Options</summary>
195
202
 
196
203
  ```
197
- -s, --source [pattern] glob pattern for package.json files to read from (default: [])
204
+ -s, --source [pattern] glob pattern for package.json files to read from
198
205
  -p, --prod include dependencies
199
206
  -d, --dev include devDependencies
200
207
  -P, --peer include peerDependencies
201
208
  -R, --resolutions include resolutions (yarn)
202
209
  -o, --overrides include overrides (pnpm)
203
210
  -f, --filter [pattern] only include dependencies whose name matches this regex
211
+ -c, --config <path> path to a syncpack config file
212
+ -w, --workspace include locally developed package versions
204
213
  -h, --help display help for command
205
214
  ```
206
215
 
@@ -237,15 +246,18 @@ See [`semverGroups`](#semvergroups) if you have advanced requirements.
237
246
  <summary>Options</summary>
238
247
 
239
248
  ```
240
- -s, --source [pattern] glob pattern for package.json files to read from (default: [])
249
+ -s, --source [pattern] glob pattern for package.json files to read from
250
+ -r, --semver-range <range> see supported ranges below. defaults to ""
251
+ -f, --filter [pattern] only include dependencies whose name matches this regex
241
252
  -p, --prod include dependencies
242
253
  -d, --dev include devDependencies
243
254
  -P, --peer include peerDependencies
244
255
  -R, --resolutions include resolutions (yarn)
245
256
  -o, --overrides include overrides (pnpm)
246
- -f, --filter [pattern] only include dependencies whose name matches this regex
257
+ -w, --workspace include locally developed package versions
247
258
  -i, --indent [value] override indentation. defaults to " "
248
259
  -r, --semver-range <range> see supported ranges below. defaults to ""
260
+ -c, --config <path> path to a syncpack config file
249
261
  -h, --help display help for command
250
262
  ```
251
263
 
@@ -287,6 +299,9 @@ tree in the following places:
287
299
  - a `syncpack.config.js` or `syncpack.config.cjs` CommonJS module exporting an
288
300
  object
289
301
 
302
+ If you want to specify a path to a configuration file, overriding the discovered
303
+ configuration file (if present), you can use the `--config` option.
304
+
290
305
  ### Default Configuration
291
306
 
292
307
  ```json
@@ -298,6 +313,7 @@ tree in the following places:
298
313
  "peer": true,
299
314
  "prod": true,
300
315
  "resolutions": true,
316
+ "workspace": true,
301
317
  "semverGroups": [],
302
318
  "semverRange": "",
303
319
  "sortAz": [
@@ -306,23 +322,31 @@ tree in the following places:
306
322
  "devDependencies",
307
323
  "keywords",
308
324
  "peerDependencies",
325
+ "resolutions",
309
326
  "scripts"
310
327
  ],
311
- "sortFirst": ["name", "description", "version", "author"],
312
- "source": ["package.json", "packages/*/package.json"],
328
+ "sortFirst": [
329
+ "name",
330
+ "description",
331
+ "version",
332
+ "author"
333
+ ],
334
+ "source": [],
313
335
  "versionGroups": []
314
336
  }
315
337
  ```
316
338
 
317
- ### `dev`, `peer`, `prod`, `resolutions`, and `overrides`
339
+ ### `dev`, `peer`, `prod`, `resolutions`, `overrides`, and `workspace`
318
340
 
319
341
  Whether to search within `devDependencies`, `peerDependencies`, `dependencies`,
320
- `resolutions` (Yarn), and `overrides` (Pnpm) respectively.
342
+ `resolutions` (Yarn), `overrides` (Pnpm), and the `version` property of the
343
+ package.json files of your own packages developed within your `workspace`
344
+ respectively.
321
345
 
322
346
  All of these locations are searched by default but they can be disabled
323
347
  individually in your config file. If any are set via the command line options
324
- `--dev`, `--peer`, `--prod`, `--resolutions`, or `overrides` then only the
325
- options you provide will be searched.
348
+ `--dev`, `--peer`, `--prod`, `--resolutions`, `--overrides`, or `--workspace`
349
+ then only the options you provide will be searched.
326
350
 
327
351
  ### `filter`
328
352
 
@@ -373,6 +397,61 @@ using Lerna or Yarn Workspaces, but this can be overridden in your config file
373
397
  or via multiple `--source` command line options. Supports any patterns supported
374
398
  by [glob](https://github.com/isaacs/node-glob).
375
399
 
400
+ ### `versionGroups`
401
+
402
+ The most common use case for version groups is when some of the packages in your
403
+ Monorepo are considered alpha (or legacy). Since those packages are much further
404
+ ahead (or behind) the other packages, the dependencies within those packages
405
+ need to be managed differently to the rest of the Monorepo.
406
+
407
+ Your alpha packages might use unstable versions of some dependencies, while the
408
+ rest of the repo might need to remain on stable versions.
409
+
410
+ You don't want mismatches within your alpha packages, you don't want mismatches
411
+ within the other packages, but you _do_ want those groups to use different
412
+ versions *to each other* and not have `syncpack` make them all the same.
413
+
414
+ In the following example, 2 of our packages are using different versions of
415
+ `react` and `react-dom` to the rest of the project.
416
+
417
+ ```json
418
+ {
419
+ "versionGroups": [
420
+ {
421
+ "dependencies": ["react", "react-dom"],
422
+ "packages": ["@alpha/server", "@alpha/ui"]
423
+ }
424
+ ]
425
+ }
426
+ ```
427
+
428
+ > 👋 The `dependencies` and `packages` fields are processed using
429
+ > [minimatch](https://github.com/isaacs/minimatch), so the above example can
430
+ > also be written as `"packages": ["@alpha/**"]`.
431
+
432
+ `syncpack` will make ensure that:
433
+
434
+ - The versions of `react` and `react-dom` are the same within `@alpha/server`
435
+ and `@alpha/ui`.
436
+ - The versions of `react` and `react-dom` are the same across every package
437
+ except `@alpha/server` and `@alpha/ui`.
438
+ - The versions of `react` and `react-dom` within `@alpha/server` and `@alpha/ui`
439
+ can be different to the other packages in the monorepo.
440
+ - The versions of every other dependency in the monorepo (eg `lodash`) are the
441
+ same across every package including `@alpha/server` and `@alpha/ui`.
442
+
443
+ Each dependency can only belong to one version group, the first rule which
444
+ matches a given dependency and package will apply.
445
+
446
+ You can be quite granular with these rules, so the partitioning doesn't _have_
447
+ to apply to an entire package:
448
+
449
+ - A specific dependency in a specific package.
450
+ - A specific dependency in some specific packages only.
451
+ - Any dependency who name matches a pattern such as `@aws-sdk/**`.
452
+
453
+ See [`semverGroups`](#semverGroups) for some examples, they work the same way.
454
+
376
455
  ### `semverGroups`
377
456
 
378
457
  Allow some packages to have different semver range rules to the rest of your
@@ -397,14 +476,14 @@ regardless of what the rest of the monorepo uses:
397
476
  ```
398
477
 
399
478
  2: Every dependency of `@myrepo/library` whose name matches `@alpha/**` should
400
- have a semver range of `~`, regardless of what the rest of that package or the
479
+ have a semver range of `^`, regardless of what the rest of that package or the
401
480
  rest of the monorepo uses:
402
481
 
403
482
  ```json
404
483
  {
405
484
  "semverGroups": [
406
485
  {
407
- "range": "~",
486
+ "range": "^",
408
487
  "dependencies": ["@alpha/**"],
409
488
  "packages": ["@myrepo/library"]
410
489
  }
@@ -427,49 +506,6 @@ semver range of `~`, regardless of what the rest of the monorepo uses:
427
506
  }
428
507
  ```
429
508
 
430
- ### `versionGroups`
431
-
432
- If some packages in your Monorepo relate to "alpha" (or legacy) versions of your
433
- software, you will need to manage dependencies differently within those
434
- packages. Your alpha packages might use latest or unstable versions of some 3rd
435
- party dependencies, while the rest of the repo might need to remain on older
436
- versions. You don't want mismatches within your alpha packages, or within the
437
- other packages in your monorepo – but you do want those groups to use different
438
- versions to each other and not have `syncpack fix-mismatches` make them all the
439
- same.
440
-
441
- In the following example, 2 packages in our monorepo are using different
442
- versions of `react` and `react-dom` to the rest of the project.
443
-
444
- ```json
445
- {
446
- "versionGroups": [
447
- {
448
- "dependencies": ["react", "react-dom"],
449
- "packages": ["@alpha/server", "@alpha/ui"]
450
- }
451
- ]
452
- }
453
- ```
454
-
455
- > ℹ️ The `dependencies` and `packages` fields are processed using
456
- > [minimatch](https://github.com/isaacs/minimatch), so the above example can
457
- > also be written as `"packages": ["@alpha/**"]`.
458
-
459
- `syncpack` will make ensure that:
460
-
461
- - The versions of `react` and `react-dom` are the same within `@alpha/server`
462
- and `@alpha/ui`.
463
- - The versions of `react` and `react-dom` are the same across every package
464
- except `@alpha/server` and `@alpha/ui`.
465
- - The versions of `react` and `react-dom` within `@alpha/server` and `@alpha/ui`
466
- can be different to the other packages in the monorepo.
467
- - The versions of every other dependency in the monorepo (eg `lodash`) are the
468
- same across every package including `@alpha/server` and `@alpha/ui`.
469
-
470
- Each dependency can only belong to one version group, the first rule which
471
- matches a given dependency and package will apply.
472
-
473
509
  ## 🕵🏾‍♀️ Resolving Packages
474
510
 
475
511
  package.json files are resolved in this order of precendence:
@@ -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, 'wrappers'>): string;
3
+ export declare function getExpectedVersion(name: string, versionGroup: Pick<IndexedVersionGroup, 'instances' | 'pinVersion'>, input: Pick<ProgramInput, 'workspace' | 'wrappers'>): string;
@@ -6,7 +6,7 @@ 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
8
  return ((0, get_pinned_version_1.getPinnedVersion)(versionGroup) ||
9
- (0, get_workspace_version_1.getWorkspaceVersion)(name, input.wrappers) ||
9
+ (input.workspace === true && (0, get_workspace_version_1.getWorkspaceVersion)(name, input.wrappers)) ||
10
10
  (0, get_highest_version_1.getHighestVersion)(versionGroup.instances
11
11
  .filter(function (instance) { return instance.name === name; })
12
12
  .map(function (_a) {
@@ -32,28 +32,31 @@ 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, _j;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
39
- var option_1 = require("../option");
40
39
  var disk_1 = require("../lib/disk");
41
40
  var get_input_1 = require("../lib/get-input");
41
+ var option_1 = require("../option");
42
42
  var fix_mismatches_1 = require("./fix-mismatches");
43
43
  commander_1.program.description((0, chalk_1["default"])(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Ensure that multiple packages requiring the same dependency define the same\n version, so that every package requires eg. {yellow react@16.4.2}, instead of a\n combination of {yellow react@16.4.2}, {yellow react@0.15.9}, and {yellow react@16.0.0}."], ["\n Ensure that multiple packages requiring the same dependency define the same\n version, so that every package requires eg. {yellow react@16.4.2}, instead of a\n combination of {yellow react@16.4.2}, {yellow react@0.15.9}, and {yellow react@16.0.0}."]))).replace(/^\n/, ''));
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 = 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(_j, __spreadArray([], __read(option_1.option.filter), false)))
50
+ .option.apply(_h, __spreadArray([], __read(option_1.option.config), false)))
49
51
  .option.apply(_g, __spreadArray([], __read(option_1.option.prod), false)))
50
52
  .option.apply(_f, __spreadArray([], __read(option_1.option.dev), false)))
51
53
  .option.apply(_e, __spreadArray([], __read(option_1.option.peer), false)))
52
54
  .option.apply(_d, __spreadArray([], __read(option_1.option.resolutions), false)))
53
55
  .option.apply(_c, __spreadArray([], __read(option_1.option.overrides), false)))
54
- .option.apply(_b, __spreadArray([], __read(option_1.option.filter), false)))
56
+ .option.apply(_b, __spreadArray([], __read(option_1.option.workspace), false)))
55
57
  .option.apply(_a, __spreadArray([], __read(option_1.option.indent), false)).parse(process.argv);
56
58
  (0, fix_mismatches_1.fixMismatches)((0, get_input_1.getInput)(disk_1.disk, {
59
+ configPath: commander_1.program.opts().config,
57
60
  dev: commander_1.program.opts().dev,
58
61
  filter: commander_1.program.opts().filter,
59
62
  indent: commander_1.program.opts().indent,
@@ -61,6 +64,7 @@ commander_1.program.on('--help', function () {
61
64
  peer: commander_1.program.opts().peer,
62
65
  prod: commander_1.program.opts().prod,
63
66
  resolutions: commander_1.program.opts().resolutions,
64
- source: commander_1.program.opts().source
67
+ source: commander_1.program.opts().source,
68
+ workspace: commander_1.program.opts().workspace
65
69
  }), disk_1.disk);
66
70
  var templateObject_1, templateObject_2;
@@ -32,25 +32,25 @@ 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");
39
- var option_1 = require("../option");
40
39
  var disk_1 = require("../lib/disk");
41
40
  var get_input_1 = require("../lib/get-input");
41
+ var option_1 = require("../option");
42
42
  var format_1 = require("./format");
43
43
  commander_1.program.description((0, chalk_1["default"])(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Organise package.json files according to a conventional format, where fields\n appear in a predictable order and nested fields are ordered alphabetically.\n Shorthand properties are used where available, such as the {yellow repository} and\n {yellow bugs} fields."], ["\n Organise package.json files according to a conventional format, where fields\n appear in a predictable order and nested fields are ordered alphabetically.\n Shorthand properties are used where available, such as the {yellow repository} and\n {yellow bugs} fields."]))).replace(/^\n/, ''));
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
- overrides: commander_1.program.opts().overrides,
53
- resolutions: commander_1.program.opts().resolutions,
54
54
  source: commander_1.program.opts().source
55
55
  }), disk_1.disk);
56
56
  var templateObject_1, templateObject_2;
@@ -32,28 +32,31 @@ 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, _j;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
39
- var option_1 = require("../option");
40
39
  var disk_1 = require("../lib/disk");
41
40
  var get_input_1 = require("../lib/get-input");
41
+ var option_1 = require("../option");
42
42
  var lint_semver_ranges_1 = require("./lint-semver-ranges");
43
43
  commander_1.program.description((0, chalk_1["default"])(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Check dependency versions within {yellow dependencies}, {yellow devDependencies},\n {yellow peerDependencies}, {yellow overrides}, and {yellow resolutions} follow a consistent format."], ["\n Check dependency versions within {yellow dependencies}, {yellow devDependencies},\n {yellow peerDependencies}, {yellow overrides}, and {yellow resolutions} follow a consistent format."]))).replace(/^\n/, ''));
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 = 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(_g, __spreadArray([], __read(option_1.option.prod), false)))
50
- .option.apply(_f, __spreadArray([], __read(option_1.option.dev), false)))
51
- .option.apply(_e, __spreadArray([], __read(option_1.option.peer), false)))
52
- .option.apply(_d, __spreadArray([], __read(option_1.option.resolutions), false)))
53
- .option.apply(_c, __spreadArray([], __read(option_1.option.overrides), false)))
54
- .option.apply(_b, __spreadArray([], __read(option_1.option.filter), false)))
55
- .option.apply(_a, __spreadArray([], __read(option_1.option.semverRange), false)).parse(process.argv);
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)))
52
+ .option.apply(_f, __spreadArray([], __read(option_1.option.prod), false)))
53
+ .option.apply(_e, __spreadArray([], __read(option_1.option.dev), false)))
54
+ .option.apply(_d, __spreadArray([], __read(option_1.option.peer), false)))
55
+ .option.apply(_c, __spreadArray([], __read(option_1.option.resolutions), false)))
56
+ .option.apply(_b, __spreadArray([], __read(option_1.option.overrides), false)))
57
+ .option.apply(_a, __spreadArray([], __read(option_1.option.workspace), false)).parse(process.argv);
56
58
  (0, lint_semver_ranges_1.lintSemverRanges)((0, get_input_1.getInput)(disk_1.disk, {
59
+ configPath: commander_1.program.opts().config,
57
60
  dev: commander_1.program.opts().dev,
58
61
  filter: commander_1.program.opts().filter,
59
62
  overrides: commander_1.program.opts().overrides,
@@ -61,6 +64,7 @@ commander_1.program.on('--help', function () {
61
64
  prod: commander_1.program.opts().prod,
62
65
  resolutions: commander_1.program.opts().resolutions,
63
66
  semverRange: commander_1.program.opts().semverRange,
64
- source: commander_1.program.opts().source
67
+ source: commander_1.program.opts().source,
68
+ workspace: commander_1.program.opts().workspace
65
69
  }));
66
70
  var templateObject_1, templateObject_2;
@@ -32,33 +32,37 @@ 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;
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");
39
- var option_1 = require("../option");
40
39
  var disk_1 = require("../lib/disk");
41
40
  var get_input_1 = require("../lib/get-input");
41
+ var option_1 = require("../option");
42
42
  var list_1 = require("./list");
43
43
  commander_1.program.description(' List all dependencies required by your packages.');
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 = 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(_h, __spreadArray([], __read(option_1.option.filter), false)))
50
+ .option.apply(_g, __spreadArray([], __read(option_1.option.config), false)))
49
51
  .option.apply(_f, __spreadArray([], __read(option_1.option.prod), false)))
50
52
  .option.apply(_e, __spreadArray([], __read(option_1.option.dev), false)))
51
53
  .option.apply(_d, __spreadArray([], __read(option_1.option.peer), false)))
52
54
  .option.apply(_c, __spreadArray([], __read(option_1.option.resolutions), false)))
53
55
  .option.apply(_b, __spreadArray([], __read(option_1.option.overrides), false)))
54
- .option.apply(_a, __spreadArray([], __read(option_1.option.filter), false)).parse(process.argv);
56
+ .option.apply(_a, __spreadArray([], __read(option_1.option.workspace), false)).parse(process.argv);
55
57
  (0, list_1.list)((0, get_input_1.getInput)(disk_1.disk, {
58
+ configPath: commander_1.program.opts().config,
56
59
  dev: commander_1.program.opts().dev,
57
60
  filter: commander_1.program.opts().filter,
58
61
  overrides: commander_1.program.opts().overrides,
59
62
  peer: commander_1.program.opts().peer,
60
63
  prod: commander_1.program.opts().prod,
61
64
  resolutions: commander_1.program.opts().resolutions,
62
- source: commander_1.program.opts().source
65
+ source: commander_1.program.opts().source,
66
+ workspace: commander_1.program.opts().workspace
63
67
  }));
64
68
  var templateObject_1;
@@ -1,9 +1,8 @@
1
1
  import type { IndexedVersionGroup, Instance } from '../lib/get-input/get-instances';
2
- interface ListItem {
2
+ export interface ListItem {
3
3
  hasMismatches: boolean;
4
4
  instances: Instance[];
5
5
  name: string;
6
6
  uniques: string[];
7
7
  }
8
8
  export declare function listVersionGroups(versionGroup: IndexedVersionGroup): ListItem[];
9
- export {};
@@ -32,33 +32,37 @@ 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;
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");
39
- var option_1 = require("../option");
40
39
  var disk_1 = require("../lib/disk");
41
40
  var get_input_1 = require("../lib/get-input");
41
+ var option_1 = require("../option");
42
42
  var list_mismatches_1 = require("./list-mismatches");
43
43
  commander_1.program.description("\n List dependencies which are required by multiple packages, where the version\n is not the same across every package.".replace(/^\n/, ''));
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 = 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(_h, __spreadArray([], __read(option_1.option.filter), false)))
50
+ .option.apply(_g, __spreadArray([], __read(option_1.option.config), false)))
49
51
  .option.apply(_f, __spreadArray([], __read(option_1.option.prod), false)))
50
52
  .option.apply(_e, __spreadArray([], __read(option_1.option.dev), false)))
51
53
  .option.apply(_d, __spreadArray([], __read(option_1.option.peer), false)))
52
54
  .option.apply(_c, __spreadArray([], __read(option_1.option.resolutions), false)))
53
55
  .option.apply(_b, __spreadArray([], __read(option_1.option.overrides), false)))
54
- .option.apply(_a, __spreadArray([], __read(option_1.option.filter), false)).parse(process.argv);
56
+ .option.apply(_a, __spreadArray([], __read(option_1.option.workspace), false)).parse(process.argv);
55
57
  (0, list_mismatches_1.listMismatches)((0, get_input_1.getInput)(disk_1.disk, {
58
+ configPath: commander_1.program.opts().config,
56
59
  dev: commander_1.program.opts().dev,
57
60
  filter: commander_1.program.opts().filter,
58
61
  overrides: commander_1.program.opts().overrides,
59
62
  peer: commander_1.program.opts().peer,
60
63
  prod: commander_1.program.opts().prod,
61
64
  resolutions: commander_1.program.opts().resolutions,
62
- source: commander_1.program.opts().source
65
+ source: commander_1.program.opts().source,
66
+ workspace: commander_1.program.opts().workspace
63
67
  }));
64
68
  var templateObject_1;
@@ -9,8 +9,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  exports.__esModule = true;
10
10
  exports.listMismatches = void 0;
11
11
  var chalk_1 = __importDefault(require("chalk"));
12
+ var path_1 = require("path");
12
13
  var get_expected_version_1 = require("../bin-fix-mismatches/get-expected-version");
13
14
  var list_version_groups_1 = require("../bin-list/list-version-groups");
15
+ var constants_1 = require("../constants");
14
16
  function listMismatches(input) {
15
17
  var isInvalid = false;
16
18
  /**
@@ -36,7 +38,13 @@ function listMismatches(input) {
36
38
  console.log((0, chalk_1["default"])(templateObject_2 || (templateObject_2 = __makeTemplateObject(["{dim -} ", " {green.dim ", "}"], ["{dim -} ", " {green.dim ", "}"])), name, expectedVersion));
37
39
  instances.forEach(function (_a) {
38
40
  var dependencyType = _a.dependencyType, version = _a.version, wrapper = _a.wrapper;
39
- console.log((0, chalk_1["default"])(templateObject_3 || (templateObject_3 = __makeTemplateObject(["{red ", " {dim in ", " of ", "}}"], ["{red ", " {dim in ", " of ", "}}"])), version, dependencyType, wrapper.contents.name));
41
+ if (dependencyType === 'workspace') {
42
+ 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
+ }
45
+ 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
+ }
40
48
  });
41
49
  });
42
50
  });
@@ -45,4 +53,4 @@ function listMismatches(input) {
45
53
  }
46
54
  }
47
55
  exports.listMismatches = listMismatches;
48
- var templateObject_1, templateObject_2, templateObject_3;
56
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -32,29 +32,32 @@ 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, _k;
36
36
  exports.__esModule = true;
37
37
  var chalk_1 = __importDefault(require("chalk"));
38
38
  var commander_1 = require("commander");
39
- var option_1 = require("../option");
40
39
  var disk_1 = require("../lib/disk");
41
40
  var get_input_1 = require("../lib/get-input");
41
+ var option_1 = require("../option");
42
42
  var set_semver_ranges_1 = require("./set-semver-ranges");
43
43
  commander_1.program.description((0, chalk_1["default"])(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Ensure dependency versions within {yellow dependencies}, {yellow devDependencies},\n {yellow peerDependencies}, {yellow overrides}, and {yellow resolutions} follow a consistent format."], ["\n Ensure dependency versions within {yellow dependencies}, {yellow devDependencies},\n {yellow peerDependencies}, {yellow overrides}, and {yellow resolutions} follow a consistent format."]))).replace(/^\n/, ''));
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 = 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(_h, __spreadArray([], __read(option_1.option.prod), false)))
50
- .option.apply(_g, __spreadArray([], __read(option_1.option.dev), false)))
51
- .option.apply(_f, __spreadArray([], __read(option_1.option.peer), false)))
52
- .option.apply(_e, __spreadArray([], __read(option_1.option.resolutions), false)))
53
- .option.apply(_d, __spreadArray([], __read(option_1.option.overrides), false)))
54
- .option.apply(_c, __spreadArray([], __read(option_1.option.filter), false)))
55
- .option.apply(_b, __spreadArray([], __read(option_1.option.indent), false)))
56
- .option.apply(_a, __spreadArray([], __read(option_1.option.semverRange), false)).parse(process.argv);
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)))
52
+ .option.apply(_g, __spreadArray([], __read(option_1.option.prod), false)))
53
+ .option.apply(_f, __spreadArray([], __read(option_1.option.dev), false)))
54
+ .option.apply(_e, __spreadArray([], __read(option_1.option.peer), false)))
55
+ .option.apply(_d, __spreadArray([], __read(option_1.option.resolutions), false)))
56
+ .option.apply(_c, __spreadArray([], __read(option_1.option.overrides), false)))
57
+ .option.apply(_b, __spreadArray([], __read(option_1.option.workspace), false)))
58
+ .option.apply(_a, __spreadArray([], __read(option_1.option.indent), false)).parse(process.argv);
57
59
  (0, set_semver_ranges_1.setSemverRanges)((0, get_input_1.getInput)(disk_1.disk, {
60
+ configPath: commander_1.program.opts().config,
58
61
  dev: commander_1.program.opts().dev,
59
62
  filter: commander_1.program.opts().filter,
60
63
  indent: commander_1.program.opts().indent,
@@ -63,6 +66,7 @@ commander_1.program.on('--help', function () {
63
66
  prod: commander_1.program.opts().prod,
64
67
  resolutions: commander_1.program.opts().resolutions,
65
68
  semverRange: commander_1.program.opts().semverRange,
66
- source: commander_1.program.opts().source
69
+ source: commander_1.program.opts().source,
70
+ workspace: commander_1.program.opts().workspace
67
71
  }), disk_1.disk);
68
72
  var templateObject_1, templateObject_2;
@@ -1,5 +1,5 @@
1
- export declare type DependencyType = 'dependencies' | 'devDependencies' | 'overrides' | 'peerDependencies' | 'resolutions';
2
- export declare type DependencyOption = Pick<SyncpackConfig, 'dev' | 'overrides' | 'peer' | 'prod' | 'resolutions'>;
1
+ export declare type DependencyType = 'dependencies' | 'devDependencies' | 'overrides' | 'peerDependencies' | 'resolutions' | 'workspace';
2
+ export declare type DependencyOption = Pick<SyncpackConfig, 'dev' | 'workspace' | 'overrides' | 'peer' | 'prod' | 'resolutions'>;
3
3
  export declare type ValidRange = typeof RANGE_ANY | typeof RANGE_EXACT | typeof RANGE_GT | typeof RANGE_GTE | typeof RANGE_LOOSE | typeof RANGE_LT | typeof RANGE_LTE | typeof RANGE_MINOR | typeof RANGE_PATCH;
4
4
  export interface SemverGroup {
5
5
  /**
@@ -100,6 +100,11 @@ export declare type SyncpackConfig = Readonly<{
100
100
  *
101
101
  */
102
102
  versionGroups: VersionGroup[];
103
+ /**
104
+ * whether to include the versions of the `--source` packages developed in
105
+ * your workspace/monorepo as part of the search for versions to sync
106
+ */
107
+ workspace: boolean;
103
108
  }>;
104
109
  export declare const ALL_PATTERNS: string[];
105
110
  export declare const DEPENDENCY_TYPES: DependencyType[];
package/dist/constants.js CHANGED
@@ -8,6 +8,7 @@ exports.DEPENDENCY_TYPES = [
8
8
  'overrides',
9
9
  'peerDependencies',
10
10
  'resolutions',
11
+ 'workspace',
11
12
  ];
12
13
  exports.CWD = process.cwd();
13
14
  exports.GREATER = 1;
@@ -41,6 +42,7 @@ exports.DEFAULT_CONFIG = {
41
42
  peer: true,
42
43
  prod: true,
43
44
  resolutions: true,
45
+ workspace: true,
44
46
  semverGroups: [],
45
47
  semverRange: '',
46
48
  sortAz: [
@@ -2,7 +2,7 @@ import type { SyncpackConfig } from '../constants';
2
2
  export declare type Disk = typeof disk;
3
3
  export declare const disk: {
4
4
  readonly globSync: (pattern: string) => string[];
5
- readonly readConfigFileSync: () => Partial<SyncpackConfig>;
5
+ readonly readConfigFileSync: (configPath?: string | undefined) => Partial<SyncpackConfig>;
6
6
  readonly readFileSync: (filePath: string) => string;
7
7
  readonly readYamlFileSync: <T = unknown>(filePath: string) => T;
8
8
  readonly removeSync: (filePath: string) => void;
package/dist/lib/disk.js CHANGED
@@ -7,15 +7,29 @@ var fs_extra_1 = require("fs-extra");
7
7
  var glob_1 = require("glob");
8
8
  var read_yaml_file_1 = require("read-yaml-file");
9
9
  var constants_1 = require("../constants");
10
+ var log_1 = require("./log");
11
+ var client = (0, cosmiconfig_1.cosmiconfigSync)('syncpack');
10
12
  exports.disk = {
11
13
  globSync: function (pattern) {
12
- return (0, glob_1.sync)(pattern, { absolute: true, cwd: constants_1.CWD });
14
+ return (0, glob_1.sync)(pattern, {
15
+ ignore: '**/node_modules/**',
16
+ absolute: true,
17
+ cwd: constants_1.CWD
18
+ });
13
19
  },
14
- readConfigFileSync: function () {
15
- var rcSearch = (0, cosmiconfig_1.cosmiconfigSync)('syncpack').search();
16
- var rcConfig = rcSearch !== null ? rcSearch.config : {};
17
- var rcFile = (0, expect_more_1.isObject)(rcConfig) ? rcConfig : {};
18
- return rcFile;
20
+ readConfigFileSync: function (configPath) {
21
+ try {
22
+ var result = configPath ? client.load(configPath) : client.search();
23
+ var rcConfig = result !== null ? result.config : {};
24
+ var rcFile = (0, expect_more_1.isObject)(rcConfig)
25
+ ? rcConfig
26
+ : {};
27
+ return rcFile;
28
+ }
29
+ catch (err) {
30
+ (0, log_1.verbose)("no config file found at ".concat(configPath));
31
+ return {};
32
+ }
19
33
  },
20
34
  readFileSync: function (filePath) {
21
35
  return (0, fs_extra_1.readFileSync)(filePath, { encoding: 'utf8' });
@@ -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;
12
+ }>) => SyncpackConfig;
@@ -11,8 +11,10 @@ var is_semver_1 = require("../../lib/is-semver");
11
11
  * @param rcFile Optional configuration file contents
12
12
  * @param program Optional command line options
13
13
  */
14
- var getConfig = function (rcFile, program) {
14
+ var getConfig = function (disk, program) {
15
+ var rcFile = disk.readConfigFileSync(program.configPath);
15
16
  var hasTypeOverride = (0, expect_more_1.isBoolean)(program.dev) ||
17
+ (0, expect_more_1.isBoolean)(program.workspace) ||
16
18
  (0, expect_more_1.isBoolean)(program.overrides) ||
17
19
  (0, expect_more_1.isBoolean)(program.peer) ||
18
20
  (0, expect_more_1.isBoolean)(program.prod) ||
@@ -20,6 +22,9 @@ var getConfig = function (rcFile, program) {
20
22
  var dev = hasTypeOverride
21
23
  ? Boolean(program.dev)
22
24
  : getOption('dev', expect_more_1.isBoolean);
25
+ var workspace = hasTypeOverride
26
+ ? Boolean(program.workspace)
27
+ : getOption('workspace', expect_more_1.isBoolean);
23
28
  var overrides = hasTypeOverride
24
29
  ? Boolean(program.overrides)
25
30
  : getOption('overrides', expect_more_1.isBoolean);
@@ -32,9 +37,10 @@ var getConfig = function (rcFile, program) {
32
37
  var resolutions = hasTypeOverride
33
38
  ? Boolean(program.resolutions)
34
39
  : getOption('resolutions', expect_more_1.isBoolean);
35
- var dependencyTypes = dev || overrides || peer || prod || resolutions
40
+ var dependencyTypes = dev || workspace || overrides || peer || prod || resolutions
36
41
  ? constants_1.DEPENDENCY_TYPES.filter(function (type) {
37
42
  return (type === 'devDependencies' && dev) ||
43
+ (type === 'workspace' && workspace) ||
38
44
  (type === 'overrides' && overrides) ||
39
45
  (type === 'peerDependencies' && peer) ||
40
46
  (type === 'dependencies' && prod) ||
@@ -71,6 +77,7 @@ var getConfig = function (rcFile, program) {
71
77
  dev: dev,
72
78
  filter: filter,
73
79
  indent: indent,
80
+ workspace: workspace,
74
81
  overrides: overrides,
75
82
  peer: peer,
76
83
  prod: prod,
@@ -46,7 +46,7 @@ var expect_more_1 = require("expect-more");
46
46
  var minimatch_1 = __importDefault(require("minimatch"));
47
47
  function getInstances(options, wrappers) {
48
48
  var e_1, _a, e_2, _b, e_3, _c;
49
- var _d;
49
+ var _d, _e, _f;
50
50
  var allInstances = {
51
51
  all: [],
52
52
  semverGroups: options.semverGroups.map(withInstances),
@@ -57,40 +57,56 @@ function getInstances(options, wrappers) {
57
57
  var wrapper = wrappers_1_1.value;
58
58
  var pkgName = wrapper.contents.name || 'packagewithoutaname';
59
59
  try {
60
- for (var _e = (e_2 = void 0, __values(options.dependencyTypes)), _f = _e.next(); !_f.done; _f = _e.next()) {
61
- var dependencyType = _f.value;
62
- var versionsByName = (_d = wrapper.contents) === null || _d === void 0 ? void 0 : _d[dependencyType];
63
- if (!(0, expect_more_1.isObject)(versionsByName))
64
- continue;
65
- var pkgs = Object.entries(versionsByName);
66
- try {
67
- for (var pkgs_1 = (e_3 = void 0, __values(pkgs)), pkgs_1_1 = pkgs_1.next(); !pkgs_1_1.done; pkgs_1_1 = pkgs_1.next()) {
68
- var _g = __read(pkgs_1_1.value, 2), name = _g[0], version = _g[1];
69
- if (!(0, expect_more_1.isNonEmptyString)(name))
70
- continue;
71
- if (name.search(new RegExp(options.filter)) === -1)
72
- continue;
73
- if (!(0, expect_more_1.isNonEmptyString)(version))
74
- continue;
75
- var instance = { dependencyType: dependencyType, name: name, version: version, wrapper: wrapper };
76
- allInstances.all.push(instance);
77
- groupInstancesBy('semverGroups', dependencyType, pkgName, instance);
78
- groupInstancesBy('versionGroups', dependencyType, pkgName, instance);
79
- }
60
+ for (var _g = (e_2 = void 0, __values(options.dependencyTypes)), _h = _g.next(); !_h.done; _h = _g.next()) {
61
+ var dependencyType = _h.value;
62
+ if (dependencyType === 'workspace') {
63
+ var name = (_d = wrapper.contents) === null || _d === void 0 ? void 0 : _d.name;
64
+ var version = (_e = wrapper.contents) === null || _e === void 0 ? void 0 : _e.version;
65
+ if (!(0, expect_more_1.isNonEmptyString)(name))
66
+ continue;
67
+ if (name.search(new RegExp(options.filter)) === -1)
68
+ continue;
69
+ if (!(0, expect_more_1.isNonEmptyString)(version))
70
+ continue;
71
+ var instance = { dependencyType: dependencyType, name: name, version: version, wrapper: wrapper };
72
+ allInstances.all.push(instance);
73
+ groupInstancesBy('semverGroups', dependencyType, pkgName, instance);
74
+ groupInstancesBy('versionGroups', dependencyType, pkgName, instance);
80
75
  }
81
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
82
- finally {
76
+ else {
77
+ var versionsByName = (_f = wrapper.contents) === null || _f === void 0 ? void 0 : _f[dependencyType];
78
+ if (!(0, expect_more_1.isObject)(versionsByName))
79
+ continue;
80
+ var pkgs = Object.entries(versionsByName);
83
81
  try {
84
- if (pkgs_1_1 && !pkgs_1_1.done && (_c = pkgs_1["return"])) _c.call(pkgs_1);
82
+ for (var pkgs_1 = (e_3 = void 0, __values(pkgs)), pkgs_1_1 = pkgs_1.next(); !pkgs_1_1.done; pkgs_1_1 = pkgs_1.next()) {
83
+ var _j = __read(pkgs_1_1.value, 2), name = _j[0], version = _j[1];
84
+ if (!(0, expect_more_1.isNonEmptyString)(name))
85
+ continue;
86
+ if (name.search(new RegExp(options.filter)) === -1)
87
+ continue;
88
+ if (!(0, expect_more_1.isNonEmptyString)(version))
89
+ continue;
90
+ var instance = { dependencyType: dependencyType, name: name, version: version, wrapper: wrapper };
91
+ allInstances.all.push(instance);
92
+ groupInstancesBy('semverGroups', dependencyType, pkgName, instance);
93
+ groupInstancesBy('versionGroups', dependencyType, pkgName, instance);
94
+ }
95
+ }
96
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
97
+ finally {
98
+ try {
99
+ if (pkgs_1_1 && !pkgs_1_1.done && (_c = pkgs_1["return"])) _c.call(pkgs_1);
100
+ }
101
+ finally { if (e_3) throw e_3.error; }
85
102
  }
86
- finally { if (e_3) throw e_3.error; }
87
103
  }
88
104
  }
89
105
  }
90
106
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
91
107
  finally {
92
108
  try {
93
- if (_f && !_f.done && (_b = _e["return"])) _b.call(_e);
109
+ if (_h && !_h.done && (_b = _g["return"])) _b.call(_g);
94
110
  }
95
111
  finally { if (e_2) throw e_2.error; }
96
112
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -21,8 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
25
  exports.__esModule = true;
22
26
  exports.getWrappers = void 0;
23
27
  var E = __importStar(require("fp-ts/lib/Either"));
24
- var O = __importStar(require("fp-ts/lib/Option"));
25
28
  var function_1 = require("fp-ts/lib/function");
29
+ var O = __importStar(require("fp-ts/lib/Option"));
26
30
  var get_file_paths_1 = require("./get-file-paths");
27
31
  var read_json_safe_1 = require("./get-patterns/read-json-safe");
28
32
  var readonly_1 = require("./readonly");
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -18,21 +22,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
22
  __setModuleDefault(result, mod);
19
23
  return result;
20
24
  };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
25
  exports.__esModule = true;
25
26
  exports.tapNone = void 0;
26
- var chalk_1 = __importDefault(require("chalk"));
27
27
  var O = __importStar(require("fp-ts/lib/Option"));
28
+ var log_1 = require("../../log");
28
29
  /**
29
30
  * Log a message when a pipeline contains `None` and let it continue unchanged.
30
31
  */
31
32
  function tapNone(message) {
32
33
  return O.fold(function logNoneValue() {
33
- if (process.env.SYNCPACK_VERBOSE) {
34
- console.log(chalk_1["default"].yellow("? ".concat(message)));
35
- }
34
+ (0, log_1.verbose)(message);
36
35
  return O.none;
37
36
  }, O.of);
38
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;
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(message: string): void;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ exports.verbose = void 0;
7
+ var chalk_1 = __importDefault(require("chalk"));
8
+ function verbose(message) {
9
+ if (process.env.SYNCPACK_VERBOSE) {
10
+ console.log(chalk_1["default"].yellow("? ".concat(message)));
11
+ }
12
+ }
13
+ 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}"`];
@@ -9,4 +10,5 @@ export declare const option: {
9
10
  readonly resolutions: readonly ["-R, --resolutions", string];
10
11
  readonly semverRange: readonly ["-r, --semver-range <range>", "see supported ranges below. defaults to \"\"" | "see supported ranges below. defaults to \"*\"" | "see supported ranges below. defaults to \">\"" | "see supported ranges below. defaults to \">=\"" | "see supported ranges below. defaults to \".x\"" | "see supported ranges below. defaults to \"<\"" | "see supported ranges below. defaults to \"<=\"" | "see supported ranges below. defaults to \"^\"" | "see supported ranges below. defaults to \"~\""];
11
12
  readonly source: readonly ["-s, --source [pattern]", "glob pattern for package.json files to read from", typeof collect, string[]];
13
+ readonly workspace: readonly ["-w, --workspace", "include locally developed package versions"];
12
14
  };
package/dist/option.js CHANGED
@@ -9,9 +9,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  exports.__esModule = true;
10
10
  exports.option = void 0;
11
11
  var chalk_1 = __importDefault(require("chalk"));
12
- var collect_1 = require("./lib/collect");
13
12
  var constants_1 = require("./constants");
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]',
@@ -37,6 +38,7 @@ exports.option = {
37
38
  'glob pattern for package.json files to read from',
38
39
  collect_1.collect,
39
40
  [],
40
- ]
41
+ ],
42
+ workspace: ['-w, --workspace', 'include locally developed package versions']
41
43
  };
42
44
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
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": "6.2.0",
4
+ "version": "7.1.0",
5
5
  "author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)",
6
6
  "bin": {
7
7
  "syncpack": "dist/bin.js",
@@ -20,36 +20,37 @@
20
20
  "Jamie Mason (https://github.com/JamieMason)",
21
21
  "Luis Vieira (https://github.com/luisvieiragmr)",
22
22
  "Marais Rossouw (https://github.com/maraisr)",
23
- "Matt Sprague (https://github.com/uforic)"
23
+ "Matt Sprague (https://github.com/uforic)",
24
+ "Tom Fletcher (https://github.com/tom-fletcher)"
24
25
  ],
25
26
  "dependencies": {
26
27
  "chalk": "4.1.2",
27
- "commander": "8.3.0",
28
+ "commander": "9.2.0",
28
29
  "cosmiconfig": "7.0.1",
29
30
  "expect-more": "1.2.0",
30
- "fp-ts": "2.11.5",
31
- "fs-extra": "10.0.0",
32
- "glob": "7.2.0",
33
- "minimatch": "3.0.4",
31
+ "fp-ts": "2.12.0",
32
+ "fs-extra": "10.1.0",
33
+ "glob": "8.0.1",
34
+ "minimatch": "5.0.1",
34
35
  "read-yaml-file": "2.1.0",
35
- "semver": "7.3.5"
36
+ "semver": "7.3.7"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@types/fs-extra": "9.0.13",
39
40
  "@types/glob": "7.2.0",
40
- "@types/jest": "27.4.0",
41
- "@types/node": "17.0.6",
41
+ "@types/jest": "27.4.1",
42
+ "@types/node": "17.0.25",
42
43
  "@types/semver": "7.3.9",
43
- "@typescript-eslint/eslint-plugin": "5.8.1",
44
- "@typescript-eslint/parser": "5.8.1",
45
- "eslint": "8.6.0",
46
- "eslint-plugin-import": "2.25.3",
44
+ "@typescript-eslint/eslint-plugin": "5.20.0",
45
+ "@typescript-eslint/parser": "5.20.0",
46
+ "eslint": "8.14.0",
47
+ "eslint-plugin-import": "2.26.0",
47
48
  "expect-more-jest": "5.4.0",
48
- "jest": "27.4.5",
49
- "prettier": "2.5.1",
49
+ "jest": "27.5.1",
50
+ "prettier": "2.6.2",
50
51
  "rimraf": "3.0.2",
51
- "ts-jest": "27.1.2",
52
- "typescript": "4.5.4"
52
+ "ts-jest": "27.1.4",
53
+ "typescript": "4.6.3"
53
54
  },
54
55
  "engines": {
55
56
  "node": ">=10"