# All files syncpack-options.ts

100% Statements 10/10
100% Branches 0/0
100% Functions 0/0
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176

    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x

    1x

     /*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved.
    SPDX-License-Identifier: Apache-2.0 */
    // This file was forked form https://github.com/JamieMason/syncpack/blob/master/src/constants.ts (v8.2.4)
    export type DependencyType =
      | "dependencies"
      | "devDependencies"
      | "overrides"
      | "peerDependencies"
      | "pnpmOverrides"
      | "resolutions"
      | "workspace";

    export 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;

    export interface SemverGroup {
      /**
       * the names of packages in your monorepo which belong to this group, taken
       * from the "name" field in package.json, not the package directory name
       */
      readonly packages: string[];
      /**
       * the names of the dependencies (eg. "lodash") which belong to this group
       */
      readonly dependencies: string[];
      /**
       * the semver range which dependencies in this group should use
       */
      readonly range: ValidRange;
      /**
       * optionally only apply this group to dependencies of the provided types
       */
      readonly dependencyTypes?: DependencyType[];
    }

    export interface VersionGroup {
      /**
       * the names of packages in your monorepo which belong to this group, taken
       * from the "name" field in package.json, not the package directory name
       */
      readonly packages: string[];
      /**
       * the names of the dependencies (eg. "lodash") which belong to this group
       */
      readonly dependencies: string[];
      /**
       * optionally force all dependencies in this group to be removed
       */
      readonly isBanned?: true;
      /**
       * optionally force all dependencies in this group to have this version
       */
      readonly pinVersion?: string;
      /**
       * optionally only apply this group to dependencies of the provided types
       */
      readonly dependencyTypes?: DependencyType[];
    }

    export interface SyncpackConfig {
      /**
       * which dependency properties to search within
       */
      readonly dependencyTypes: DependencyType[];
      /**
       * whether to search within devDependencies
       */
      readonly dev: boolean;
      /**
       * a string which will be passed to `new RegExp()` to match against package
       * names that should be included
       */
      readonly filter: string;
      /**
       * the character(s) to be used to indent your package.json files when writing
       * to disk
       */
      readonly indent: string;
      /**
       * whether to search within npm overrides
       */
      readonly overrides: boolean;
      /**
       * whether to search within peerDependencies
       */
      readonly peer: boolean;
      /**
       * whether to search within pnpm overrides
       */
      readonly pnpmOverrides: boolean;
      /**
       * whether to search within dependencies
       */
      readonly prod: boolean;
      /**
       * whether to search within yarn resolutions
       */
      readonly resolutions: boolean;
      /**
       *
       */
      readonly semverGroups: SemverGroup[];
      /**
       * defaults to `""` to ensure that exact dependency versions are used instead
       * of loose ranges
       */
      readonly semverRange: ValidRange;
      /**
       * which fields within package.json files should be sorted alphabetically
       */
      readonly sortAz: string[];
      /**
       * which fields within package.json files should appear at the top, and in
       * what order
       */
      readonly sortFirst: string[];
      /**
       * glob patterns for package.json file locations
       */
      readonly source: string[];
      /**
       *
       */
      readonly versionGroups: VersionGroup[];
      /**
       * whether to include the versions of the `--source` packages developed in
       * your workspace/monorepo as part of the search for versions to sync
       */
      readonly workspace: boolean;
    }

    export const RANGE_ANY = "*";
    export const RANGE_EXACT = "";
    export const RANGE_GT = ">";
    export const RANGE_GTE = ">=";
    export const RANGE_LOOSE = ".x";
    export const RANGE_LT = "<";
    export const RANGE_LTE = "<=";
    export const RANGE_MINOR = "^";
    export const RANGE_PATCH = "~";

    export const DEFAULT_CONFIG: SyncpackConfig = {
      dependencyTypes: [],
      dev: true,
      filter: ".",
      indent: "  ",
      overrides: true,
      peer: true,
      pnpmOverrides: true,
      prod: true,
      resolutions: true,
      workspace: true,
      semverGroups: [],
      semverRange: "",
      sortAz: [
        "contributors",
        "dependencies",
        "devDependencies",
        "keywords",
        "peerDependencies",
        "resolutions",
        "scripts",
      ],
      sortFirst: ["name", "description", "version", "author"],
      source: [],
      versionGroups: [],
    };