syncpack 14.0.0-alpha.2 → 14.0.0-alpha.4

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.
package/index.cjs ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require('node:child_process');
4
+
5
+ const args = process.argv.slice(2);
6
+ const arch = process.arch;
7
+ const [os, extension] = ['win32', 'cygwin'].includes(process.platform)
8
+ ? ['windows', '.exe']
9
+ : [process.platform, ''];
10
+ const optionalDep = `syncpack-${os}-${arch}`;
11
+ const pkgSpecifier = `${optionalDep}/bin/syncpack${extension}`;
12
+ const pathToBinary = require.resolve(pkgSpecifier);
13
+
14
+ process.exit(
15
+ spawnSync(pathToBinary, args, {
16
+ cwd: process.cwd(),
17
+ stdio: ['ignore', 'inherit', 'inherit'],
18
+ env: {
19
+ ...process.env,
20
+ COSMICONFIG_REQUIRE_PATH: require.resolve('cosmiconfig'),
21
+ RUST_BACKTRACE: 'full',
22
+ },
23
+ }).status || 0,
24
+ );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "syncpack",
3
3
  "description": "Consistent dependency versions in large JavaScript Monorepos",
4
- "version": "14.0.0-alpha.2",
4
+ "version": "14.0.0-alpha.4",
5
5
  "author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)",
6
6
  "bugs": "https://github.com/JamieMason/syncpack/issues",
7
7
  "contributors": [
@@ -14,6 +14,7 @@
14
14
  "Aparajita Fishman (https://github.com/aparajita)",
15
15
  "Artur Wierzbicki (https://github.com/ArturWierzbicki)",
16
16
  "Chase Holdren (https://github.com/chaseholdren)",
17
+ "Chase Tamnoon (https://github.com/chase-tamnoon)",
17
18
  "Daniel Silva (https://github.com/dsilvasc)",
18
19
  "Elchin Valiyev (https://github.com/evaliyev)",
19
20
  "Gabriel Pereira Woitechen (https://github.com/wtchnm)",
@@ -64,15 +65,15 @@
64
65
  "license": "MIT",
65
66
  "repository": "JamieMason/syncpack",
66
67
  "bin": {
67
- "syncpack": "./index.js"
68
+ "syncpack": "./index.cjs"
68
69
  },
69
70
  "optionalDependencies": {
70
- "syncpack-linux-x64": "14.0.0-alpha.2",
71
- "syncpack-linux-arm64": "14.0.0-alpha.2",
72
- "syncpack-darwin-x64": "14.0.0-alpha.2",
73
- "syncpack-darwin-arm64": "14.0.0-alpha.2",
74
- "syncpack-windows-x64": "14.0.0-alpha.2",
75
- "syncpack-windows-arm64": "14.0.0-alpha.2"
71
+ "syncpack-linux-x64": "14.0.0-alpha.4",
72
+ "syncpack-linux-arm64": "14.0.0-alpha.4",
73
+ "syncpack-darwin-x64": "14.0.0-alpha.4",
74
+ "syncpack-darwin-arm64": "14.0.0-alpha.4",
75
+ "syncpack-windows-x64": "14.0.0-alpha.4",
76
+ "syncpack-windows-arm64": "14.0.0-alpha.4"
76
77
  },
77
78
  "types": "./syncpack.d.ts"
78
79
  }
package/schema.json CHANGED
@@ -99,6 +99,88 @@
99
99
  ],
100
100
  "type": "object"
101
101
  },
102
+ "DependencyGroup": {
103
+ "additionalProperties": false,
104
+ "properties": {
105
+ "aliasName": {
106
+ "see": "https://jamiemason.github.io/syncpack/config/dependency-groups/#aliasname",
107
+ "type": "string"
108
+ },
109
+ "dependencies": {
110
+ "items": {
111
+ "type": "string"
112
+ },
113
+ "see": "https://jamiemason.github.io/syncpack/config/dependency-groups/#dependencies",
114
+ "type": "array"
115
+ },
116
+ "dependencyTypes": {
117
+ "items": {
118
+ "anyOf": [
119
+ {
120
+ "type": "string"
121
+ },
122
+ {
123
+ "enum": [
124
+ "dev",
125
+ "local",
126
+ "overrides",
127
+ "peer",
128
+ "pnpmOverrides",
129
+ "prod",
130
+ "resolutions"
131
+ ],
132
+ "type": "string"
133
+ }
134
+ ]
135
+ },
136
+ "see": "https://jamiemason.github.io/syncpack/config/dependency-groups/#dependencytypes",
137
+ "type": "array"
138
+ },
139
+ "packages": {
140
+ "items": {
141
+ "type": "string"
142
+ },
143
+ "see": "https://jamiemason.github.io/syncpack/config/dependency-groups/#packages",
144
+ "type": "array"
145
+ },
146
+ "specifierTypes": {
147
+ "items": {
148
+ "anyOf": [
149
+ {
150
+ "type": "string"
151
+ },
152
+ {
153
+ "enum": [
154
+ "alias",
155
+ "exact",
156
+ "file",
157
+ "git",
158
+ "latest",
159
+ "major",
160
+ "minor",
161
+ "missing",
162
+ "range",
163
+ "range-complex",
164
+ "range-major",
165
+ "range-minor",
166
+ "tag",
167
+ "unsupported",
168
+ "url",
169
+ "workspace-protocol"
170
+ ],
171
+ "type": "string"
172
+ }
173
+ ]
174
+ },
175
+ "see": "https://jamiemason.github.io/syncpack/config/dependency-groups/#specifiertypes",
176
+ "type": "array"
177
+ }
178
+ },
179
+ "required": [
180
+ "aliasName"
181
+ ],
182
+ "type": "object"
183
+ },
102
184
  "RcFile": {
103
185
  "additionalProperties": false,
104
186
  "properties": {
@@ -113,6 +195,13 @@
113
195
  "see": "https://jamiemason.github.io/syncpack/config/custom-types",
114
196
  "type": "object"
115
197
  },
198
+ "dependencyGroups": {
199
+ "items": {
200
+ "$ref": "#/definitions/DependencyGroup"
201
+ },
202
+ "see": "https://jamiemason.github.io/syncpack/config/dependency-groups",
203
+ "type": "array"
204
+ },
116
205
  "formatBugs": {
117
206
  "see": "https://jamiemason.github.io/syncpack/config/format-bugs",
118
207
  "type": "boolean"
package/syncpack.d.ts CHANGED
@@ -2,7 +2,11 @@ export interface RcFile {
2
2
  /** @see https://jamiemason.github.io/syncpack/integrations/json-schema */
3
3
  $schema?: string;
4
4
  /** @see https://jamiemason.github.io/syncpack/config/custom-types */
5
- customTypes?: Record<string, CustomType.Any>;
5
+ customTypes?: {
6
+ [name: string]: CustomType.Any;
7
+ };
8
+ /** @see https://jamiemason.github.io/syncpack/config/dependency-groups */
9
+ dependencyGroups?: DependencyGroup[];
6
10
  /** @see https://jamiemason.github.io/syncpack/config/format-bugs */
7
11
  formatBugs?: boolean;
8
12
  /** @see https://jamiemason.github.io/syncpack/config/format-repository */
@@ -36,7 +40,7 @@ export interface RcFile {
36
40
  /** @deprecated */
37
41
  specifierTypes?: never;
38
42
  }
39
- export interface DependencyGroup {
43
+ export interface GroupSelector {
40
44
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/standard/#dependencies */
41
45
  dependencies?: string[];
42
46
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/standard/#dependencytypes */
@@ -48,41 +52,53 @@ export interface DependencyGroup {
48
52
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/standard/#specifiertypes */
49
53
  specifierTypes?: SpecifierType[];
50
54
  }
55
+ export interface DependencyGroup {
56
+ /** @see https://jamiemason.github.io/syncpack/config/dependency-groups/#aliasname */
57
+ aliasName: string;
58
+ /** @see https://jamiemason.github.io/syncpack/config/dependency-groups/#dependencies */
59
+ dependencies?: string[];
60
+ /** @see https://jamiemason.github.io/syncpack/config/dependency-groups/#dependencytypes */
61
+ dependencyTypes?: DependencyType[];
62
+ /** @see https://jamiemason.github.io/syncpack/config/dependency-groups/#packages */
63
+ packages?: string[];
64
+ /** @see https://jamiemason.github.io/syncpack/config/dependency-groups/#specifiertypes */
65
+ specifierTypes?: SpecifierType[];
66
+ }
51
67
  declare namespace SemverGroup {
52
- interface Ignored extends DependencyGroup {
68
+ interface Ignored extends GroupSelector {
53
69
  /** @see https://jamiemason.github.io/syncpack/config/semver-groups/ignored/#isignored */
54
70
  isIgnored: true;
55
71
  }
56
- interface WithRange extends DependencyGroup {
72
+ interface WithRange extends GroupSelector {
57
73
  /** @see https://jamiemason.github.io/syncpack/config/semver-groups/with-range/#range */
58
74
  range: SemverRange;
59
75
  }
60
76
  type Any = Ignored | WithRange;
61
77
  }
62
78
  declare namespace VersionGroup {
63
- interface Banned extends DependencyGroup {
79
+ interface Banned extends GroupSelector {
64
80
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/banned/#isbanned */
65
81
  isBanned: true;
66
82
  }
67
- interface Ignored extends DependencyGroup {
83
+ interface Ignored extends GroupSelector {
68
84
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/ignored/#isignored */
69
85
  isIgnored: true;
70
86
  }
71
- interface Pinned extends DependencyGroup {
87
+ interface Pinned extends GroupSelector {
72
88
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/pinned/#pinversion */
73
89
  pinVersion: string;
74
90
  }
75
- interface SnappedTo extends DependencyGroup {
91
+ interface SnappedTo extends GroupSelector {
76
92
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/snapped-to/#snapto */
77
93
  snapTo: string[];
78
94
  }
79
- interface SameRange extends DependencyGroup {
95
+ interface SameRange extends GroupSelector {
80
96
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/same-range/#policy */
81
- policy: "sameRange";
97
+ policy: 'sameRange';
82
98
  }
83
- interface Standard extends DependencyGroup {
99
+ interface Standard extends GroupSelector {
84
100
  /** @see https://jamiemason.github.io/syncpack/config/version-groups/lowest-version/#preferversion */
85
- preferVersion?: "highestSemver" | "lowestSemver";
101
+ preferVersion?: 'highestSemver' | 'lowestSemver';
86
102
  }
87
103
  type Any = Banned | Ignored | Pinned | SameRange | SnappedTo | Standard;
88
104
  }
@@ -93,30 +109,30 @@ declare namespace CustomType {
93
109
  /** @see https://jamiemason.github.io/syncpack/config/custom-types/#name */
94
110
  path: string;
95
111
  /** @see https://jamiemason.github.io/syncpack/config/custom-types/#namestrategy */
96
- strategy: "name~version";
112
+ strategy: 'name~version';
97
113
  }
98
114
  interface NamedVersionString {
99
115
  /** @see https://jamiemason.github.io/syncpack/config/custom-types/#name */
100
116
  path: string;
101
117
  /** @see https://jamiemason.github.io/syncpack/config/custom-types/#namestrategy */
102
- strategy: "name@version";
118
+ strategy: 'name@version';
103
119
  }
104
120
  interface UnnamedVersionString {
105
121
  /** @see https://jamiemason.github.io/syncpack/config/custom-types/#name */
106
122
  path: string;
107
123
  /** @see https://jamiemason.github.io/syncpack/config/custom-types/#namestrategy */
108
- strategy: "version";
124
+ strategy: 'version';
109
125
  }
110
126
  interface VersionsByName {
111
127
  /** @see https://jamiemason.github.io/syncpack/config/custom-types/#name */
112
128
  path: string;
113
129
  /** @see https://jamiemason.github.io/syncpack/config/custom-types/#namestrategy */
114
- strategy: "versionsByName";
130
+ strategy: 'versionsByName';
115
131
  }
116
132
  type Any = NameAndVersionProps | NamedVersionString | UnnamedVersionString | VersionsByName;
117
133
  }
118
- type SemverRange = "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
119
- type DependencyType = "dev" | "local" | "overrides" | "peer" | "pnpmOverrides" | "prod" | "resolutions" | AnyString;
120
- type SpecifierType = "alias" | "exact" | "file" | "git" | "latest" | "major" | "minor" | "missing" | "range" | "range-complex" | "range-major" | "range-minor" | "tag" | "unsupported" | "url" | "workspace-protocol" | AnyString;
134
+ type SemverRange = '' | '*' | '>' | '>=' | '.x' | '<' | '<=' | '^' | '~';
135
+ type DependencyType = 'dev' | 'local' | 'overrides' | 'peer' | 'pnpmOverrides' | 'prod' | 'resolutions' | AnyString;
136
+ type SpecifierType = 'alias' | 'exact' | 'file' | 'git' | 'latest' | 'major' | 'minor' | 'missing' | 'range' | 'range-complex' | 'range-major' | 'range-minor' | 'tag' | 'unsupported' | 'url' | 'workspace-protocol' | AnyString;
121
137
  type AnyString = string & {};
122
138
  export {};
package/index.js DELETED
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { spawnSync } = require("child_process");
4
- const { cosmiconfig } = require("cosmiconfig");
5
-
6
- const args = process.argv.slice(2);
7
- const arch = process.arch;
8
- const [os, extension] = ["win32", "cygwin"].includes(process.platform)
9
- ? ["windows", ".exe"]
10
- : [process.platform, ""];
11
- const optionalDep = `syncpack-${os}-${arch}`;
12
- const pkgSpecifier = `${optionalDep}/bin/syncpack${extension}`;
13
-
14
- cosmiconfig("syncpack")
15
- .search()
16
- .then(({ config }) => (config ? JSON.stringify(config) : "{}"))
17
- .catch(() => "{}")
18
- .then((rcfileAsJson) => ({
19
- pathToBinary: require.resolve(pkgSpecifier),
20
- rcfileAsJson,
21
- }))
22
- .catch((err) => {
23
- panic(
24
- `expected optionalDependency "${optionalDep}" containing a Rust binary at "${pkgSpecifier}"`,
25
- err
26
- );
27
- })
28
- .then(({ pathToBinary, rcfileAsJson }) => {
29
- process.exit(
30
- spawnSync(pathToBinary, args, {
31
- input: rcfileAsJson,
32
- stdio: ["pipe", "inherit", "inherit"],
33
- }).status ?? 0
34
- );
35
- })
36
- .catch((err) => {
37
- panic("syncpack encountered an unknown error", err);
38
- });
39
-
40
- function panic(message, err) {
41
- console.error(
42
- "\x1b[31m%s\n%s\x1b[0m",
43
- `! ${message}`,
44
- " Please raise issue at https://github.com/JamieMason/syncpack/issues/new?template=bug_report.yaml",
45
- err
46
- );
47
- process.exit(1);
48
- }