syncpack 12.0.0-alpha.0 → 12.0.0-alpha.1
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/README.md +24 -26
- package/dist/bin-fix-mismatches/fix-mismatches.js +6 -1
- package/dist/bin-format/format.js +6 -1
- package/dist/bin-prompt/prompt.js +6 -1
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +6 -1
- package/dist/bin-update/effects.d.ts +4 -4
- package/dist/bin-update/update.js +6 -1
- package/dist/config/get-custom-types.d.ts +1 -1
- package/dist/config/get-enabled-types.d.ts +2 -2
- package/dist/constants.d.ts +0 -2
- package/dist/constants.js +1 -2
- package/dist/error-handlers/default-error-handlers.d.ts +0 -13
- package/dist/error-handlers/default-error-handlers.js +1 -20
- package/dist/get-instances/instance.js +14 -0
- package/dist/get-package-json-files/get-file-paths.d.ts +1 -1
- package/dist/get-package-json-files/package-json-file.js +8 -0
- package/dist/io/ask-for-choice.d.ts +2 -2
- package/dist/io/ask-for-choice.js +1 -2
- package/dist/io/ask-for-input.d.ts +2 -2
- package/dist/io/ask-for-input.js +1 -2
- package/dist/io/glob-sync.d.ts +1 -1
- package/dist/io/read-file-sync.d.ts +1 -1
- package/dist/io/read-json-file-sync.d.ts +2 -2
- package/dist/io/read-yaml-file-sync.d.ts +2 -2
- package/dist/io/read-yaml-file-sync.js +1 -2
- package/dist/io/write-file-sync.d.ts +1 -1
- package/dist/lib/ring-buffer.js +2 -0
- package/dist/report.d.ts +15 -15
- package/dist/semver-group/disabled.d.ts +1 -1
- package/dist/semver-group/disabled.js +1 -1
- package/dist/semver-group/filtered-out.d.ts +1 -1
- package/dist/semver-group/filtered-out.js +1 -1
- package/dist/semver-group/ignored.d.ts +1 -1
- package/dist/semver-group/ignored.js +1 -1
- package/dist/semver-group/index.d.ts +1 -1
- package/dist/semver-group/with-range.d.ts +1 -1
- package/dist/semver-group/with-range.js +1 -1
- package/dist/specifier/alias.js +1 -4
- package/dist/specifier/base.js +20 -2
- package/dist/specifier/delete.js +6 -4
- package/dist/specifier/file.js +1 -4
- package/dist/specifier/hosted-git.js +1 -4
- package/dist/specifier/lib/non-semver-error.d.ts +1 -1
- package/dist/specifier/range.js +1 -4
- package/dist/specifier/tag.js +1 -4
- package/dist/specifier/unsupported.js +1 -4
- package/dist/specifier/url.js +1 -5
- package/dist/specifier/version.js +1 -4
- package/dist/specifier/workspace-protocol.js +1 -4
- package/dist/strategy/name-and-version-props.js +4 -1
- package/dist/strategy/named-version-string.js +3 -1
- package/dist/strategy/unnamed-version-string.js +3 -1
- package/dist/strategy/versions-by-name.js +3 -1
- package/dist/version-group/banned.d.ts +1 -1
- package/dist/version-group/banned.js +1 -1
- package/dist/version-group/filtered-out.d.ts +1 -1
- package/dist/version-group/filtered-out.js +1 -1
- package/dist/version-group/ignored.d.ts +1 -1
- package/dist/version-group/ignored.js +1 -1
- package/dist/version-group/index.d.ts +1 -1
- package/dist/version-group/pinned.d.ts +1 -1
- package/dist/version-group/pinned.js +1 -1
- package/dist/version-group/same-range.d.ts +1 -1
- package/dist/version-group/same-range.js +1 -1
- package/dist/version-group/snapped-to.d.ts +1 -1
- package/dist/version-group/snapped-to.js +1 -1
- package/dist/version-group/standard.d.ts +1 -1
- package/dist/version-group/standard.js +1 -1
- package/package.json +29 -30
- package/dist/create-program/effects.d.ts +0 -62
- package/dist/create-program/effects.js +0 -2
package/README.md
CHANGED
|
@@ -8,60 +8,58 @@
|
|
|
8
8
|
npm install --save-dev syncpack
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
<!-- prettier-ignore-start -->
|
|
12
|
+
|
|
13
|
+
> [!NOTE]
|
|
14
|
+
> syncpack 🚀 [12.0.0-alpha.0](https://github.com/JamieMason/syncpack/releases/tag/12.0.0-alpha.0) is available to trial and give feedback. This release adds support for a much wider range of npm version specifiers than before, console output improvements, and more.
|
|
15
|
+
|
|
16
|
+
<!-- prettier-ignore-end -->
|
|
17
|
+
|
|
11
18
|
## Documentation
|
|
12
19
|
|
|
13
20
|
Full information can be found in the documentation at https://jamiemason.github.io/syncpack/.
|
|
14
21
|
|
|
15
22
|
## Commands
|
|
16
23
|
|
|
17
|
-
### [fix-mismatches](https://jamiemason.github.io/syncpack/fix-mismatches)
|
|
24
|
+
### [fix-mismatches](https://jamiemason.github.io/syncpack/command/fix-mismatches)
|
|
18
25
|
|
|
19
|
-
Ensure that multiple packages requiring the same dependency define the same version, so that every
|
|
20
|
-
package requires eg. `react@16.4.2`, instead of a combination of `react@16.4.2`, `react@0.15.9`, and
|
|
21
|
-
`react@16.0.0`.
|
|
26
|
+
Ensure that multiple packages requiring the same dependency define the same version, so that every package requires eg. `react@16.4.2`, instead of a combination of `react@16.4.2`, `react@0.15.9`, and `react@16.0.0`.
|
|
22
27
|
|
|
23
|
-
### [format](https://jamiemason.github.io/syncpack/format)
|
|
28
|
+
### [format](https://jamiemason.github.io/syncpack/command/format)
|
|
24
29
|
|
|
25
|
-
Organise package.json files according to a conventional format, where fields appear in a predictable
|
|
26
|
-
order and nested fields are ordered alphabetically. Shorthand properties are used where available,
|
|
27
|
-
such as the `"repository"` and `"bugs"` fields.
|
|
30
|
+
Organise package.json files according to a conventional format, where fields appear in a predictable order and nested fields are ordered alphabetically. Shorthand properties are used where available, such as the `"repository"` and `"bugs"` fields.
|
|
28
31
|
|
|
29
|
-
### [lint](https://jamiemason.github.io/syncpack/lint)
|
|
32
|
+
### [lint](https://jamiemason.github.io/syncpack/command/lint)
|
|
30
33
|
|
|
31
|
-
Lint all versions and ranges and exit with 0 or 1 based on whether all files match your Syncpack
|
|
32
|
-
configuration file.
|
|
34
|
+
Lint all versions and ranges and exit with 0 or 1 based on whether all files match your Syncpack configuration file.
|
|
33
35
|
|
|
34
|
-
### [lint-semver-ranges](https://jamiemason.github.io/syncpack/lint-semver-ranges)
|
|
36
|
+
### [lint-semver-ranges](https://jamiemason.github.io/syncpack/command/lint-semver-ranges)
|
|
35
37
|
|
|
36
|
-
Check whether dependency versions used within "dependencies", "devDependencies", etc follow a
|
|
37
|
-
consistent format.
|
|
38
|
+
Check whether dependency versions used within "dependencies", "devDependencies", etc follow a consistent format.
|
|
38
39
|
|
|
39
|
-
### [list](https://jamiemason.github.io/syncpack/list)
|
|
40
|
+
### [list](https://jamiemason.github.io/syncpack/command/list)
|
|
40
41
|
|
|
41
42
|
List all dependencies required by your packages.
|
|
42
43
|
|
|
43
|
-
### [list-mismatches](https://jamiemason.github.io/syncpack/list-mismatches)
|
|
44
|
+
### [list-mismatches](https://jamiemason.github.io/syncpack/command/list-mismatches)
|
|
44
45
|
|
|
45
|
-
List dependencies which are required by multiple packages, where the version is not the same across
|
|
46
|
-
every package.
|
|
46
|
+
List dependencies which are required by multiple packages, where the version is not the same across every package.
|
|
47
47
|
|
|
48
|
-
### [prompt](https://jamiemason.github.io/syncpack/prompt)
|
|
48
|
+
### [prompt](https://jamiemason.github.io/syncpack/command/prompt)
|
|
49
49
|
|
|
50
50
|
Displays a series of prompts to fix mismatches which syncpack cannot fix automatically.
|
|
51
51
|
|
|
52
|
-
### [set-semver-ranges](https://jamiemason.github.io/syncpack/set-semver-ranges)
|
|
52
|
+
### [set-semver-ranges](https://jamiemason.github.io/syncpack/command/set-semver-ranges)
|
|
53
53
|
|
|
54
|
-
Ensure dependency versions used within `"dependencies"`, `"devDependencies"` etc follow a consistent
|
|
55
|
-
format.
|
|
54
|
+
Ensure dependency versions used within `"dependencies"`, `"devDependencies"` etc follow a consistent format.
|
|
56
55
|
|
|
57
|
-
### [update](https://jamiemason.github.io/syncpack/update)
|
|
56
|
+
### [update](https://jamiemason.github.io/syncpack/command/update)
|
|
58
57
|
|
|
59
|
-
Interactively update packages to the latest versions from the npm registry, wherever they are in
|
|
60
|
-
your monorepo. You can update every dependency, just dev/peer/prod dependencies, just packages which
|
|
61
|
-
match a name filter, and more.
|
|
58
|
+
Interactively update packages to the latest versions from the npm registry, wherever they are in your monorepo. You can update every dependency, just dev/peer/prod dependencies, just packages which match a name filter, and more.
|
|
62
59
|
|
|
63
60
|
## Badges
|
|
64
61
|
|
|
62
|
+
- [](https://ko-fi.com/C0C4PY4P)
|
|
65
63
|
- [](https://www.npmjs.com/package/syncpack)
|
|
66
64
|
- [](https://www.npmjs.com/package/syncpack)
|
|
67
65
|
- [](https://github.com/JamieMason/syncpack/actions)
|
|
@@ -89,7 +89,12 @@ function fixMismatches({ io, cli, errorHandlers = default_error_handlers_1.defau
|
|
|
89
89
|
}
|
|
90
90
|
yield* $(removeEmptyObjects(ctx));
|
|
91
91
|
return ctx;
|
|
92
|
-
}), effect_1.Effect.flatMap(write_if_changed_1.writeIfChanged), effect_1.Effect.catchTags(
|
|
92
|
+
}), effect_1.Effect.flatMap(write_if_changed_1.writeIfChanged), effect_1.Effect.catchTags({
|
|
93
|
+
WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, effect_1.Effect.map(() => {
|
|
94
|
+
ctx.isInvalid = true;
|
|
95
|
+
return ctx;
|
|
96
|
+
})),
|
|
97
|
+
}), effect_1.Effect.flatMap(exit_if_invalid_1.exitIfInvalid))), effect_1.Effect.provide((0, effect_1.pipe)(effect_1.Context.empty(), effect_1.Context.add(tag_1.CliConfigTag, cli), effect_1.Context.add(io_1.IoTag, io))), with_logger_1.withLogger);
|
|
93
98
|
}
|
|
94
99
|
exports.fixMismatches = fixMismatches;
|
|
95
100
|
function fixMismatch(report) {
|
|
@@ -54,6 +54,11 @@ function format({ io, cli, errorHandlers = default_error_handlers_1.defaultError
|
|
|
54
54
|
sortObject(Object.keys(value).sort(), value);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
}), effect_1.Effect.flatMap((ctx) => (0, effect_1.pipe)((0, write_if_changed_1.writeIfChanged)(ctx), effect_1.Effect.catchTags(
|
|
57
|
+
}), effect_1.Effect.flatMap((ctx) => (0, effect_1.pipe)((0, write_if_changed_1.writeIfChanged)(ctx), effect_1.Effect.catchTags({
|
|
58
|
+
WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, effect_1.Effect.map(() => {
|
|
59
|
+
ctx.isInvalid = true;
|
|
60
|
+
return ctx;
|
|
61
|
+
})),
|
|
62
|
+
}))), effect_1.Effect.flatMap(exit_if_invalid_1.exitIfInvalid), effect_1.Effect.provide((0, effect_1.pipe)(effect_1.Context.empty(), effect_1.Context.add(tag_1.CliConfigTag, cli), effect_1.Context.add(io_1.IoTag, io))), with_logger_1.withLogger);
|
|
58
63
|
}
|
|
59
64
|
exports.format = format;
|
|
@@ -51,7 +51,12 @@ function prompt({ io, cli, errorHandlers = default_error_handlers_1.defaultError
|
|
|
51
51
|
yield* $((0, list_1.logOtherCommands)());
|
|
52
52
|
}
|
|
53
53
|
return ctx;
|
|
54
|
-
}), effect_1.Effect.catchTags(
|
|
54
|
+
}), effect_1.Effect.catchTags({
|
|
55
|
+
WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, effect_1.Effect.map(() => {
|
|
56
|
+
ctx.isInvalid = true;
|
|
57
|
+
return ctx;
|
|
58
|
+
})),
|
|
59
|
+
}), effect_1.Effect.flatMap(exit_if_invalid_1.exitIfInvalid))), effect_1.Effect.provide((0, effect_1.pipe)(effect_1.Context.empty(), effect_1.Context.add(tag_1.CliConfigTag, cli), effect_1.Context.add(io_1.IoTag, io))), with_logger_1.withLogger);
|
|
55
60
|
}
|
|
56
61
|
exports.prompt = prompt;
|
|
57
62
|
function isUnfixable(report) {
|
|
@@ -52,6 +52,11 @@ function setSemverRanges({ io, cli, errorHandlers = default_error_handlers_1.def
|
|
|
52
52
|
if (unfixableCount)
|
|
53
53
|
yield* $((0, fix_mismatches_1.logUnfixableSize)(unfixableCount));
|
|
54
54
|
return ctx;
|
|
55
|
-
}), effect_1.Effect.flatMap(write_if_changed_1.writeIfChanged), effect_1.Effect.catchTags(
|
|
55
|
+
}), effect_1.Effect.flatMap(write_if_changed_1.writeIfChanged), effect_1.Effect.catchTags({
|
|
56
|
+
WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, effect_1.Effect.map(() => {
|
|
57
|
+
ctx.isInvalid = true;
|
|
58
|
+
return ctx;
|
|
59
|
+
})),
|
|
60
|
+
}), effect_1.Effect.flatMap(exit_if_invalid_1.exitIfInvalid))), effect_1.Effect.provide((0, effect_1.pipe)(effect_1.Context.empty(), effect_1.Context.add(tag_1.CliConfigTag, cli), effect_1.Context.add(io_1.IoTag, io))), with_logger_1.withLogger);
|
|
56
61
|
}
|
|
57
62
|
exports.setSemverRanges = setSemverRanges;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Instance } from '../get-instances/instance';
|
|
3
|
-
declare const Releases_base: new <A extends Record<string, any
|
|
3
|
+
declare const Releases_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
4
4
|
readonly _tag: "Releases";
|
|
5
5
|
}>;
|
|
6
6
|
/** full release history from the npm registry for a given package */
|
|
@@ -12,21 +12,21 @@ declare class Releases extends Releases_base<{
|
|
|
12
12
|
};
|
|
13
13
|
}> {
|
|
14
14
|
}
|
|
15
|
-
declare const PromptCancelled_base: new <A extends Record<string, any
|
|
15
|
+
declare const PromptCancelled_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
16
16
|
readonly _tag: "PromptCancelled";
|
|
17
17
|
}>;
|
|
18
18
|
declare class PromptCancelled extends PromptCancelled_base<{
|
|
19
19
|
name: string;
|
|
20
20
|
}> {
|
|
21
21
|
}
|
|
22
|
-
declare const HttpError_base: new <A extends Record<string, any
|
|
22
|
+
declare const HttpError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
23
23
|
readonly _tag: "HttpError";
|
|
24
24
|
}>;
|
|
25
25
|
declare class HttpError extends HttpError_base<{
|
|
26
26
|
error: string;
|
|
27
27
|
}> {
|
|
28
28
|
}
|
|
29
|
-
declare const NpmRegistryError_base: new <A extends Record<string, any
|
|
29
|
+
declare const NpmRegistryError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
30
30
|
readonly _tag: "NpmRegistryError";
|
|
31
31
|
}>;
|
|
32
32
|
declare class NpmRegistryError extends NpmRegistryError_base<{
|
|
@@ -56,6 +56,11 @@ function update(io, cli, effects = effects_1.updateEffects, errorHandlers = defa
|
|
|
56
56
|
// ask the user which updates they want
|
|
57
57
|
effect_1.Effect.flatMap(effects_1.updateEffects.promptForUpdates),
|
|
58
58
|
// if we think the user cancelled, say so
|
|
59
|
-
effect_1.Effect.catchTag('PromptCancelled', () => effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.panic}} aborting after {blue syncpack update} was cancelled`)))), effect_1.Effect.flatMap(({ ctx }) => (0, effect_1.pipe)((0, write_if_changed_1.writeIfChanged)(ctx), effect_1.Effect.catchTags(
|
|
59
|
+
effect_1.Effect.catchTag('PromptCancelled', () => effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.panic}} aborting after {blue syncpack update} was cancelled`)))), effect_1.Effect.flatMap(({ ctx }) => (0, effect_1.pipe)((0, write_if_changed_1.writeIfChanged)(ctx), effect_1.Effect.catchTags({
|
|
60
|
+
WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, effect_1.Effect.map(() => {
|
|
61
|
+
ctx.isInvalid = true;
|
|
62
|
+
return ctx;
|
|
63
|
+
})),
|
|
64
|
+
}))), effect_1.Effect.flatMap(exit_if_invalid_1.exitIfInvalid), effect_1.Effect.withConcurrency(10), effect_1.Effect.provide((0, effect_1.pipe)(effect_1.Context.empty(), effect_1.Context.add(tag_1.CliConfigTag, cli), effect_1.Context.add(io_1.IoTag, io))), with_logger_1.withLogger);
|
|
60
65
|
}
|
|
61
66
|
exports.update = update;
|
|
@@ -7,7 +7,7 @@ import { VersionsByNameStrategy } from '../strategy/versions-by-name';
|
|
|
7
7
|
export declare namespace Strategy {
|
|
8
8
|
type Any = NameAndVersionPropsStrategy | NamedVersionStringStrategy | UnnamedVersionStringStrategy | VersionsByNameStrategy;
|
|
9
9
|
}
|
|
10
|
-
declare const InvalidCustomTypeError_base: new <A extends Record<string, any
|
|
10
|
+
declare const InvalidCustomTypeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
11
11
|
readonly _tag: "InvalidCustomTypeError";
|
|
12
12
|
}>;
|
|
13
13
|
export declare class InvalidCustomTypeError extends InvalidCustomTypeError_base<{
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Ctx } from '../get-context';
|
|
3
3
|
import type { InvalidCustomTypeError, Strategy } from './get-custom-types';
|
|
4
|
-
declare const DeprecatedTypesError_base: new <A extends Record<string, any
|
|
4
|
+
declare const DeprecatedTypesError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
5
5
|
readonly _tag: "DeprecatedTypesError";
|
|
6
6
|
}>;
|
|
7
7
|
export declare class DeprecatedTypesError extends DeprecatedTypesError_base<{
|
|
8
8
|
readonly types: string[];
|
|
9
9
|
}> {
|
|
10
10
|
}
|
|
11
|
-
declare const RenamedWorkspaceTypeError_base: new <A extends Record<string, any
|
|
11
|
+
declare const RenamedWorkspaceTypeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
12
12
|
readonly _tag: "RenamedWorkspaceTypeError";
|
|
13
13
|
}>;
|
|
14
14
|
export declare class RenamedWorkspaceTypeError extends RenamedWorkspaceTypeError_base<Record<string, never>> {
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SemverRange } from './config/types';
|
|
2
1
|
/** Single source of truth, intended to aid testing or to override */
|
|
3
2
|
export declare const CWD: string;
|
|
4
3
|
/** Single source of truth for icons used in output */
|
|
@@ -24,7 +23,6 @@ export declare const RANGE: {
|
|
|
24
23
|
readonly PATCH: "~";
|
|
25
24
|
readonly WORKSPACE: "workspace:";
|
|
26
25
|
};
|
|
27
|
-
export declare const FIXABLE_RANGES: SemverRange[];
|
|
28
26
|
export declare const INTERNAL_TYPES: readonly ["dev", "local", "overrides", "peer", "pnpmOverrides", "prod", "resolutions"];
|
|
29
27
|
export declare const DEFAULT_CONFIG: {
|
|
30
28
|
readonly dependencyTypes: readonly ["**"];
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_CONFIG = exports.INTERNAL_TYPES = exports.
|
|
3
|
+
exports.DEFAULT_CONFIG = exports.INTERNAL_TYPES = exports.RANGE = exports.ICON = exports.CWD = void 0;
|
|
4
4
|
/** Single source of truth, intended to aid testing or to override */
|
|
5
5
|
exports.CWD = process.env.MOCK_CWD || process.cwd();
|
|
6
6
|
/** Single source of truth for icons used in output */
|
|
@@ -26,7 +26,6 @@ exports.RANGE = {
|
|
|
26
26
|
PATCH: '~',
|
|
27
27
|
WORKSPACE: 'workspace:',
|
|
28
28
|
};
|
|
29
|
-
exports.FIXABLE_RANGES = [exports.RANGE.EXACT, exports.RANGE.MINOR, exports.RANGE.PATCH];
|
|
30
29
|
exports.INTERNAL_TYPES = [
|
|
31
30
|
'dev',
|
|
32
31
|
'local',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
2
|
import type { InvalidCustomTypeError } from '../config/get-custom-types';
|
|
3
3
|
import type { DeprecatedTypesError, RenamedWorkspaceTypeError } from '../config/get-enabled-types';
|
|
4
|
-
import type { Ctx } from '../get-context';
|
|
5
4
|
import type { NoSourcesFoundError } from '../get-package-json-files/get-file-paths';
|
|
6
5
|
import type { GlobError } from '../io/glob-sync';
|
|
7
6
|
import type { ReadFileError } from '../io/read-file-sync';
|
|
@@ -22,17 +21,5 @@ export interface ErrorHandlers {
|
|
|
22
21
|
ReadFileError(err: ReadFileError): R;
|
|
23
22
|
WriteFileError(err: WriteFileError): R;
|
|
24
23
|
}
|
|
25
|
-
export declare function chainErrorHandlers(ctx: Ctx, errorHandlers: ErrorHandlers): {
|
|
26
|
-
DeprecatedTypesError: (err: DeprecatedTypesError) => Effect.Effect<never, never, Ctx>;
|
|
27
|
-
GlobError: (err: GlobError) => Effect.Effect<never, never, Ctx>;
|
|
28
|
-
InvalidCustomTypeError: (err: InvalidCustomTypeError) => Effect.Effect<never, never, Ctx>;
|
|
29
|
-
JsonParseError: (err: JsonParseError) => Effect.Effect<never, never, Ctx>;
|
|
30
|
-
NoSourcesFoundError: (err: NoSourcesFoundError) => Effect.Effect<never, never, Ctx>;
|
|
31
|
-
ReadFileError: (err: ReadFileError) => Effect.Effect<never, never, Ctx>;
|
|
32
|
-
RenamedWorkspaceTypeError: (err: RenamedWorkspaceTypeError) => Effect.Effect<never, never, Ctx>;
|
|
33
|
-
SemverGroupConfigError: (err: SemverGroup.ConfigError) => Effect.Effect<never, never, Ctx>;
|
|
34
|
-
VersionGroupConfigError: (err: VersionGroup.ConfigError) => Effect.Effect<never, never, Ctx>;
|
|
35
|
-
WriteFileError: (err: WriteFileError) => Effect.Effect<never, never, Ctx>;
|
|
36
|
-
};
|
|
37
24
|
export declare const defaultErrorHandlers: ErrorHandlers;
|
|
38
25
|
export {};
|
|
@@ -3,29 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.defaultErrorHandlers =
|
|
6
|
+
exports.defaultErrorHandlers = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const effect_1 = require("effect");
|
|
9
9
|
const os_1 = require("os");
|
|
10
|
-
function chainErrorHandlers(ctx, errorHandlers) {
|
|
11
|
-
const markAsInvalid = effect_1.Effect.map(() => {
|
|
12
|
-
ctx.isInvalid = true;
|
|
13
|
-
return ctx;
|
|
14
|
-
});
|
|
15
|
-
return {
|
|
16
|
-
DeprecatedTypesError: (0, effect_1.flow)(errorHandlers.DeprecatedTypesError, markAsInvalid),
|
|
17
|
-
GlobError: (0, effect_1.flow)(errorHandlers.GlobError, markAsInvalid),
|
|
18
|
-
InvalidCustomTypeError: (0, effect_1.flow)(errorHandlers.InvalidCustomTypeError, markAsInvalid),
|
|
19
|
-
JsonParseError: (0, effect_1.flow)(errorHandlers.JsonParseError, markAsInvalid),
|
|
20
|
-
NoSourcesFoundError: (0, effect_1.flow)(errorHandlers.NoSourcesFoundError, markAsInvalid),
|
|
21
|
-
ReadFileError: (0, effect_1.flow)(errorHandlers.ReadFileError, markAsInvalid),
|
|
22
|
-
RenamedWorkspaceTypeError: (0, effect_1.flow)(errorHandlers.RenamedWorkspaceTypeError, markAsInvalid),
|
|
23
|
-
SemverGroupConfigError: (0, effect_1.flow)(errorHandlers.SemverGroupConfigError, markAsInvalid),
|
|
24
|
-
VersionGroupConfigError: (0, effect_1.flow)(errorHandlers.VersionGroupConfigError, markAsInvalid),
|
|
25
|
-
WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, markAsInvalid),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
exports.chainErrorHandlers = chainErrorHandlers;
|
|
29
10
|
exports.defaultErrorHandlers = {
|
|
30
11
|
// getContext
|
|
31
12
|
GlobError(err) {
|
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Instance = void 0;
|
|
4
4
|
class Instance {
|
|
5
|
+
/** The name of this dependency */
|
|
6
|
+
name;
|
|
7
|
+
/** The .name property of the package.json file of this instance */
|
|
8
|
+
pkgName;
|
|
9
|
+
/** The specifier as it is on disk before being fixed */
|
|
10
|
+
rawSpecifier;
|
|
11
|
+
/** The package this dependency is installed in this specific time */
|
|
12
|
+
packageJsonFile;
|
|
13
|
+
/** Locates where in the file this dependency is installed */
|
|
14
|
+
strategy;
|
|
15
|
+
/** The semver group this instance belongs to */
|
|
16
|
+
semverGroup;
|
|
17
|
+
/** The version group this instance belongs to */
|
|
18
|
+
versionGroup;
|
|
5
19
|
constructor(name, rawSpecifier, packageJsonFile, strategy) {
|
|
6
20
|
this.name = name;
|
|
7
21
|
this.pkgName = packageJsonFile.jsonFile.contents.name || 'PACKAGE_JSON_HAS_NO_NAME';
|
|
@@ -2,7 +2,7 @@ import { Data, Effect } from 'effect';
|
|
|
2
2
|
import type { Ctx } from '../get-context';
|
|
3
3
|
import type { Io } from '../io';
|
|
4
4
|
import type { GlobError } from '../io/glob-sync';
|
|
5
|
-
declare const NoSourcesFoundError_base: new <A extends Record<string, any
|
|
5
|
+
declare const NoSourcesFoundError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
6
6
|
readonly _tag: "NoSourcesFoundError";
|
|
7
7
|
}>;
|
|
8
8
|
export declare class NoSourcesFoundError extends NoSourcesFoundError_base<{
|
|
@@ -4,6 +4,14 @@ exports.PackageJsonFile = void 0;
|
|
|
4
4
|
const effect_1 = require("effect");
|
|
5
5
|
const instance_1 = require("../get-instances/instance");
|
|
6
6
|
class PackageJsonFile {
|
|
7
|
+
/** resolved configuration */
|
|
8
|
+
config;
|
|
9
|
+
/** ensure only one set of instances is ever created and shared */
|
|
10
|
+
_instances;
|
|
11
|
+
/** the wrapped package.json file */
|
|
12
|
+
jsonFile;
|
|
13
|
+
/** the .name property from the package.json file */
|
|
14
|
+
name;
|
|
7
15
|
constructor(jsonFile, config) {
|
|
8
16
|
this._instances = null;
|
|
9
17
|
this.config = config;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Io } from '.';
|
|
3
|
-
declare const AskForChoiceError_base: new <A extends Record<string, any
|
|
3
|
+
declare const AskForChoiceError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
4
4
|
readonly _tag: "AskForChoiceError";
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
declare class AskForChoiceError extends AskForChoiceError_base<{
|
|
7
7
|
readonly error: string;
|
|
8
8
|
}> {
|
|
9
9
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.askForChoice =
|
|
3
|
+
exports.askForChoice = void 0;
|
|
4
4
|
const effect_1 = require("effect");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
class AskForChoiceError extends effect_1.Data.TaggedClass('AskForChoiceError') {
|
|
7
7
|
}
|
|
8
|
-
exports.AskForChoiceError = AskForChoiceError;
|
|
9
8
|
function askForChoice(opts) {
|
|
10
9
|
return (0, effect_1.pipe)(_1.IoTag, effect_1.Effect.flatMap((io) => effect_1.Effect.tryPromise({
|
|
11
10
|
try: () => io.enquirer
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Io } from '.';
|
|
3
|
-
declare const AskForInputError_base: new <A extends Record<string, any
|
|
3
|
+
declare const AskForInputError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
4
4
|
readonly _tag: "AskForInputError";
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
declare class AskForInputError extends AskForInputError_base<{
|
|
7
7
|
readonly error: string;
|
|
8
8
|
}> {
|
|
9
9
|
}
|
package/dist/io/ask-for-input.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.askForInput =
|
|
3
|
+
exports.askForInput = void 0;
|
|
4
4
|
const effect_1 = require("effect");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
class AskForInputError extends effect_1.Data.TaggedClass('AskForInputError') {
|
|
7
7
|
}
|
|
8
|
-
exports.AskForInputError = AskForInputError;
|
|
9
8
|
function askForInput(opts) {
|
|
10
9
|
return (0, effect_1.pipe)(_1.IoTag, effect_1.Effect.flatMap((io) => effect_1.Effect.tryPromise({
|
|
11
10
|
try: () => io.enquirer.prompt({
|
package/dist/io/glob-sync.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Io } from '.';
|
|
3
|
-
declare const GlobError_base: new <A extends Record<string, any
|
|
3
|
+
declare const GlobError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
4
4
|
readonly _tag: "GlobError";
|
|
5
5
|
}>;
|
|
6
6
|
export declare class GlobError extends GlobError_base<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Io } from '.';
|
|
3
|
-
declare const ReadFileError_base: new <A extends Record<string, any
|
|
3
|
+
declare const ReadFileError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
4
4
|
readonly _tag: "ReadFileError";
|
|
5
5
|
}>;
|
|
6
6
|
export declare class ReadFileError extends ReadFileError_base<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Io } from '.';
|
|
3
3
|
import type { ReadFileError } from './read-file-sync';
|
|
4
|
-
declare const JsonParseError_base: new <A extends Record<string, any
|
|
4
|
+
declare const JsonParseError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
5
5
|
readonly _tag: "JsonParseError";
|
|
6
6
|
}>;
|
|
7
7
|
export declare class JsonParseError extends JsonParseError_base<{
|
|
@@ -10,7 +10,7 @@ export declare class JsonParseError extends JsonParseError_base<{
|
|
|
10
10
|
readonly json: string;
|
|
11
11
|
}> {
|
|
12
12
|
}
|
|
13
|
-
declare const JsonFile_base: new <A extends Record<string, any
|
|
13
|
+
declare const JsonFile_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
14
14
|
readonly _tag: "JsonFile";
|
|
15
15
|
}>;
|
|
16
16
|
export declare class JsonFile<T> extends JsonFile_base<{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Io } from '.';
|
|
3
|
-
declare const ReadYamlFileError_base: new <A extends Record<string, any
|
|
3
|
+
declare const ReadYamlFileError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
4
4
|
readonly _tag: "ReadYamlFileError";
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
declare class ReadYamlFileError extends ReadYamlFileError_base<{
|
|
7
7
|
readonly filePath: string;
|
|
8
8
|
readonly error: string;
|
|
9
9
|
}> {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readYamlFileSync =
|
|
3
|
+
exports.readYamlFileSync = void 0;
|
|
4
4
|
const effect_1 = require("effect");
|
|
5
5
|
class ReadYamlFileError extends effect_1.Data.TaggedClass('ReadYamlFileError') {
|
|
6
6
|
}
|
|
7
|
-
exports.ReadYamlFileError = ReadYamlFileError;
|
|
8
7
|
function readYamlFileSync(io, filePath) {
|
|
9
8
|
return effect_1.Effect.try({
|
|
10
9
|
try: () => io.readYamlFile.sync(filePath),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Data, Effect } from 'effect';
|
|
2
2
|
import type { Io } from '.';
|
|
3
|
-
declare const WriteFileError_base: new <A extends Record<string, any
|
|
3
|
+
declare const WriteFileError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
4
4
|
readonly _tag: "WriteFileError";
|
|
5
5
|
}>;
|
|
6
6
|
export declare class WriteFileError extends WriteFileError_base<{
|