Skip to content

Commit 1c1be99

Browse files
committed
feat(cli): add command to update dependencies
1 parent cfde196 commit 1c1be99

File tree

25 files changed

+840
-345
lines changed

25 files changed

+840
-345
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest, windows-latest]
14-
node-version: [16.x]
14+
node-version: [18.x]
1515

1616
steps:
1717
- uses: actions/checkout@v2
@@ -45,7 +45,10 @@ jobs:
4545
env:
4646
FORCE_COLOR: 3
4747
TERM: xterm-256color
48-
- uses: paambaati/[email protected]
48+
49+
- name: Code Climate
50+
uses: paambaati/[email protected]
51+
if: matrix.os == 'ubuntu-latest'
4952
env:
5053
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
5154
with:

.syncpackrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ const config = {
1818
packages: ['**'],
1919
pinVersion: '11.1.0',
2020
},
21+
{
22+
dependencies: ['ora'],
23+
packages: ['**'],
24+
pinVersion: '5.4.1',
25+
},
2126
],
2227
};
2328

CODE_OF_CONDUCT.md

Lines changed: 60 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,124 +2,109 @@
22

33
## Our Pledge
44

5-
We as members, contributors, and leaders pledge to make participation in our
6-
community a harassment-free experience for everyone, regardless of age, body
7-
size, visible or invisible disability, ethnicity, sex characteristics, gender
8-
identity and expression, level of experience, education, socio-economic status,
9-
nationality, personal appearance, race, religion, or sexual identity
10-
and orientation.
5+
We as members, contributors, and leaders pledge to make participation in our community a
6+
harassment-free experience for everyone, regardless of age, body size, visible or invisible
7+
disability, ethnicity, sex characteristics, gender identity and expression, level of experience,
8+
education, socio-economic status, nationality, personal appearance, race, religion, or sexual
9+
identity and orientation.
1110

12-
We pledge to act and interact in ways that contribute to an open, welcoming,
13-
diverse, inclusive, and healthy community.
11+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and
12+
healthy community.
1413

1514
## Our Standards
1615

17-
Examples of behavior that contributes to a positive environment for our
18-
community include:
16+
Examples of behavior that contributes to a positive environment for our community include:
1917

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
24-
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
26-
overall community
18+
- Demonstrating empathy and kindness toward other people
19+
- Being respectful of differing opinions, viewpoints, and experiences
20+
- Giving and gracefully accepting constructive feedback
21+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the
22+
experience
23+
- Focusing on what is best not just for us as individuals, but for the overall community
2724

2825
Examples of unacceptable behavior include:
2926

30-
* The use of sexualized language or imagery, and sexual attention or
31-
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
35-
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
37-
professional setting
27+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
28+
- Trolling, insulting or derogatory comments, and personal or political attacks
29+
- Public or private harassment
30+
- Publishing others' private information, such as a physical or email address, without their
31+
explicit permission
32+
- Other conduct which could reasonably be considered inappropriate in a professional setting
3833

3934
## Enforcement Responsibilities
4035

41-
Community leaders are responsible for clarifying and enforcing our standards of
42-
acceptable behavior and will take appropriate and fair corrective action in
43-
response to any behavior that they deem inappropriate, threatening, offensive,
44-
or harmful.
36+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior
37+
and will take appropriate and fair corrective action in response to any behavior that they deem
38+
inappropriate, threatening, offensive, or harmful.
4539

46-
Community leaders have the right and responsibility to remove, edit, or reject
47-
comments, commits, code, wiki edits, issues, and other contributions that are
48-
not aligned to this Code of Conduct, and will communicate reasons for moderation
49-
decisions when appropriate.
40+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits,
41+
code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and
42+
will communicate reasons for moderation decisions when appropriate.
5043

5144
## Scope
5245

53-
This Code of Conduct applies within all community spaces, and also applies when
54-
an individual is officially representing the community in public spaces.
55-
Examples of representing our community include using an official e-mail address,
56-
posting via an official social media account, or acting as an appointed
57-
representative at an online or offline event.
46+
This Code of Conduct applies within all community spaces, and also applies when an individual is
47+
officially representing the community in public spaces. Examples of representing our community
48+
include using an official e-mail address, posting via an official social media account, or acting as
49+
an appointed representative at an online or offline event.
5850

5951
## Enforcement
6052

61-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62-
reported to the community leaders responsible for enforcement at
63-
64-
All complaints will be reviewed and investigated promptly and fairly.
53+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community
54+
leaders responsible for enforcement at [email protected]. All complaints will be reviewed and
55+
investigated promptly and fairly.
6556

66-
All community leaders are obligated to respect the privacy and security of the
67-
reporter of any incident.
57+
All community leaders are obligated to respect the privacy and security of the reporter of any
58+
incident.
6859

6960
## Enforcement Guidelines
7061

71-
Community leaders will follow these Community Impact Guidelines in determining
72-
the consequences for any action they deem in violation of this Code of Conduct:
62+
Community leaders will follow these Community Impact Guidelines in determining the consequences for
63+
any action they deem in violation of this Code of Conduct:
7364

7465
### 1. Correction
7566

76-
**Community Impact**: Use of inappropriate language or other behavior deemed
77-
unprofessional or unwelcome in the community.
67+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or
68+
unwelcome in the community.
7869

79-
**Consequence**: A private, written warning from community leaders, providing
80-
clarity around the nature of the violation and an explanation of why the
81-
behavior was inappropriate. A public apology may be requested.
70+
**Consequence**: A private, written warning from community leaders, providing clarity around the
71+
nature of the violation and an explanation of why the behavior was inappropriate. A public apology
72+
may be requested.
8273

8374
### 2. Warning
8475

85-
**Community Impact**: A violation through a single incident or series
86-
of actions.
76+
**Community Impact**: A violation through a single incident or series of actions.
8777

88-
**Consequence**: A warning with consequences for continued behavior. No
89-
interaction with the people involved, including unsolicited interaction with
90-
those enforcing the Code of Conduct, for a specified period of time. This
91-
includes avoiding interactions in community spaces as well as external channels
92-
like social media. Violating these terms may lead to a temporary or
93-
permanent ban.
78+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people
79+
involved, including unsolicited interaction with those enforcing the Code of Conduct, for a
80+
specified period of time. This includes avoiding interactions in community spaces as well as
81+
external channels like social media. Violating these terms may lead to a temporary or permanent ban.
9482

9583
### 3. Temporary Ban
9684

97-
**Community Impact**: A serious violation of community standards, including
98-
sustained inappropriate behavior.
85+
**Community Impact**: A serious violation of community standards, including sustained inappropriate
86+
behavior.
9987

100-
**Consequence**: A temporary ban from any sort of interaction or public
101-
communication with the community for a specified period of time. No public or
102-
private interaction with the people involved, including unsolicited interaction
103-
with those enforcing the Code of Conduct, is allowed during this period.
104-
Violating these terms may lead to a permanent ban.
88+
**Consequence**: A temporary ban from any sort of interaction or public communication with the
89+
community for a specified period of time. No public or private interaction with the people involved,
90+
including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this
91+
period. Violating these terms may lead to a permanent ban.
10592

10693
### 4. Permanent Ban
10794

108-
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
110-
individual, or aggression toward or disparagement of classes of individuals.
95+
**Community Impact**: Demonstrating a pattern of violation of community standards, including
96+
sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement
97+
of classes of individuals.
11198

112-
**Consequence**: A permanent ban from any sort of public interaction within
113-
the community.
99+
**Consequence**: A permanent ban from any sort of public interaction within the community.
114100

115101
## Attribution
116102

117-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118-
version 2.0, available at
103+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at
119104
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120105

121-
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122-
enforcement ladder](https://github.com/mozilla/diversity).
106+
Community Impact Guidelines were inspired by
107+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
123108

124109
[homepage]: https://www.contributor-covenant.org
125110

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ Displays a series of prompts to fix mismatches which syncpack cannot fix automat
5454
Ensure dependency versions used within `"dependencies"`, `"devDependencies"` etc follow a consistent
5555
format.
5656

57+
### [update](https://jamiemason.github.io/syncpack/update)
58+
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.
62+
5763
## Badges
5864

5965
- [![NPM version](http://img.shields.io/npm/v/syncpack.svg?style=flat-square)](https://www.npmjs.com/package/syncpack)

jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ module.exports = {
1111
coverageThreshold: {
1212
global: {
1313
branches: 80,
14-
functions: 90,
15-
lines: 90,
16-
statements: 90,
14+
functions: 82,
15+
lines: 87,
16+
statements: 86,
1717
},
1818
},
1919
moduleFileExtensions: ['ts', 'js'],

package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"syncpack-list": "dist/bin-list/index.js",
1313
"syncpack-list-mismatches": "dist/bin-list-mismatches/index.js",
1414
"syncpack-prompt": "dist/bin-prompt/index.js",
15-
"syncpack-set-semver-ranges": "dist/bin-set-semver-ranges/index.js"
15+
"syncpack-set-semver-ranges": "dist/bin-set-semver-ranges/index.js",
16+
"syncpack-update": "dist/bin-update/index.js"
1617
},
1718
"bugs": "https://github.com/JamieMason/syncpack/issues",
1819
"contributors": [
@@ -30,26 +31,30 @@
3031
"Tom Fletcher (https://github.com/tom-fletcher)"
3132
],
3233
"dependencies": {
33-
"@effect/data": "0.12.5",
34-
"@effect/io": "0.26.0",
35-
"@effect/match": "0.24.4",
34+
"@effect/data": "0.12.9",
35+
"@effect/io": "0.27.0",
36+
"@effect/match": "0.24.5",
37+
"@effect/schema": "0.21.0",
3638
"chalk": "4.1.2",
3739
"commander": "11.0.0",
3840
"cosmiconfig": "8.2.0",
3941
"enquirer": "2.3.6",
4042
"fs-extra": "11.1.1",
4143
"globby": "11.1.0",
4244
"minimatch": "9.0.1",
45+
"ora": "5.4.1",
46+
"prompts": "2.4.2",
4347
"read-yaml-file": "2.1.0",
4448
"semver": "7.5.2",
4549
"tightrope": "0.1.0",
4650
"ts-toolbelt": "9.6.0"
4751
},
4852
"devDependencies": {
49-
"@tsconfig/node14": "1.0.3",
53+
"@tsconfig/node18": "2.0.1",
5054
"@types/fs-extra": "11.0.1",
5155
"@types/jest": "29.5.2",
5256
"@types/node": "14.18.36",
57+
"@types/prompts": "2.4.4",
5358
"@types/semver": "7.5.0",
5459
"@typescript-eslint/eslint-plugin": "5.59.11",
5560
"@typescript-eslint/parser": "5.59.11",
@@ -65,7 +70,7 @@
6570
"typescript": "5.1.3"
6671
},
6772
"engines": {
68-
"node": ">=14"
73+
"node": ">=18"
6974
},
7075
"files": [
7176
"dist"

site/docs/update.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
id: update
3+
title: update
4+
---
5+
6+
Interactively update packages to the latest versions from the npm registry.
7+
8+
## CLI Options
9+
10+
```
11+
-s, --source [pattern] glob pattern for package.json files to read from (default: [])
12+
-f, --filter [pattern] only include dependencies whose name matches this regex
13+
-c, --config <path> path to a syncpack config file
14+
-t, --types <names> only include dependencies matching these types (eg. types=dev,prod,myCustomType)
15+
-h, --help display help for command
16+
```
17+
18+
## Examples
19+
20+
```bash
21+
# uses defaults for resolving packages
22+
syncpack update
23+
# uses packages defined by --source when provided
24+
syncpack update --source "apps/*/package.json"
25+
# multiple globs can be provided like this
26+
syncpack update --source "apps/*/package.json" --source "core/*/package.json"
27+
# uses dependencies regular expression defined by --filter when provided
28+
syncpack update --filter "typescript|tslint"
29+
# only inspect "devDependencies"
30+
syncpack update --types dev
31+
# only inspect "devDependencies" and "peerDependencies"
32+
syncpack update --types dev,peer
33+
```

site/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const sidebars = {
2525
'list',
2626
'prompt',
2727
'set-semver-ranges',
28+
'update',
2829
],
2930
'CLI Options': [
3031
'option/config',

src/bin-fix-mismatches/effects.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,41 @@ import type { VersionGroupReport } from '../get-version-groups';
1111
import { DELETE } from '../get-version-groups/lib/delete';
1212
import { logGroupHeader } from '../lib/log-group-header';
1313

14-
export const fixMismatchesEffects: VersionEffects = {
15-
FilteredOut() {
14+
export const fixMismatchesEffects: VersionEffects<void> = {
15+
onFilteredOut() {
1616
return Effect.unit();
1717
},
18-
Ignored() {
18+
onIgnored() {
1919
return Effect.unit();
2020
},
21-
Valid() {
21+
onValid() {
2222
return Effect.unit();
2323
},
24-
Banned: (input) => {
24+
onBanned(input) {
2525
return Effect.sync(() => removeVersions(input));
2626
},
27-
HighestSemverMismatch: (input) => {
27+
onHighestSemverMismatch(input) {
2828
return Effect.sync(() => setVersions(input));
2929
},
30-
LowestSemverMismatch: (input) => {
30+
onLowestSemverMismatch(input) {
3131
return Effect.sync(() => setVersions(input));
3232
},
33-
PinnedMismatch: (input) => {
33+
onPinnedMismatch(input) {
3434
return Effect.sync(() => setVersions(input));
3535
},
36-
SameRangeMismatch: (input) => {
36+
onSameRangeMismatch(input) {
3737
return Effect.sync(() => pipe(input, logHeader, logSameRangeMismatch));
3838
},
39-
SnappedToMismatch: (input) => {
39+
onSnappedToMismatch(input) {
4040
return Effect.sync(() => setVersions(input));
4141
},
42-
UnsupportedMismatch: (input) => {
42+
onUnsupportedMismatch(input) {
4343
return Effect.sync(() => pipe(input, logHeader, logUnsupportedMismatch));
4444
},
45-
WorkspaceMismatch: (input) => {
45+
onWorkspaceMismatch(input) {
4646
return Effect.sync(() => setVersions(input));
4747
},
48-
TearDown(ctx) {
48+
onComplete(ctx) {
4949
return Effect.sync(() => deleteEmptyObjects(ctx));
5050
},
5151
};

0 commit comments

Comments
 (0)