Skip to content

Commit 7812607

Browse files
Syncpack (#1060)
* feat: add syncpack to monorepo * docs(changeset): Updates to support using syncpack. * docs * fix: remove @types rule in syncpack * ci perf updates * regen lock --------- Co-authored-by: Kawika Bader <ekbader@gmail.com>
1 parent 8ff0b4a commit 7812607

File tree

61 files changed

+1875
-1800
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1875
-1800
lines changed

.changeset/public-jobs-open.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
"@gasket/plugin-dynamic-plugins": patch
3+
"@gasket/plugin-service-worker": patch
4+
"@gasket/plugin-docs-graphs": patch
5+
"@gasket/plugin-elastic-apm": patch
6+
"@gasket/plugin-https-proxy": patch
7+
"@gasket/plugin-docusaurus": patch
8+
"@gasket/plugin-middleware": patch
9+
"@gasket/plugin-typescript": patch
10+
"@gasket/plugin-happyfeet": patch
11+
"@gasket/typescript-tests": patch
12+
"@gasket/plugin-manifest": patch
13+
"@gasket/plugin-metadata": patch
14+
"@gasket/plugin-analyze": patch
15+
"@gasket/plugin-command": patch
16+
"@gasket/plugin-cypress": patch
17+
"@gasket/plugin-express": patch
18+
"@gasket/plugin-fastify": patch
19+
"@gasket/plugin-swagger": patch
20+
"@gasket/plugin-webpack": patch
21+
"@gasket/plugin-winston": patch
22+
"@gasket/plugin-workbox": patch
23+
"@gasket/plugin-logger": patch
24+
"@gasket/plugin-morgan": patch
25+
"@gasket/plugin-nextjs": patch
26+
"@gasket/preset-nextjs": patch
27+
"@gasket/plugin-https": patch
28+
"@gasket/plugin-mocha": patch
29+
"@gasket/plugin-redux": patch
30+
"@gasket/plugin-data": patch
31+
"@gasket/plugin-docs": patch
32+
"@gasket/plugin-intl": patch
33+
"@gasket/plugin-jest": patch
34+
"@gasket/plugin-lint": patch
35+
"generate-docs-index": patch
36+
"create-gasket-app": patch
37+
"@gasket/plugin-git": patch
38+
"@gasket/preset-api": patch
39+
"@gasket/react-intl": patch
40+
"@gasket/request": patch
41+
"@gasket/assets": patch
42+
"@gasket/nextjs": patch
43+
"@gasket/fetch": patch
44+
"@gasket/redux": patch
45+
"@gasket/utils": patch
46+
"@gasket/core": patch
47+
"@gasket/data": patch
48+
"@gasket/intl": patch
49+
---
50+
51+
Updates to support using syncpack.

.github/workflows/ci.yml

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
name: CI
22

33
on:
4+
workflow_run:
5+
workflows: ["Release"]
6+
types:
7+
- completed
48
pull_request:
59
push:
610
branches:
711
- main
812
- lts
913

14+
# Avoid redundant runs for same PRs
15+
concurrency:
16+
group: ci-${{ github.head_ref || github.ref }}
17+
cancel-in-progress: true
18+
1019
jobs:
1120
ci:
1221
runs-on: ubuntu-latest
@@ -28,11 +37,19 @@ jobs:
2837
node-version: ${{ matrix.node-version }}
2938
cache: pnpm
3039

40+
- name: Cache pnpm store
41+
uses: actions/cache@v3
42+
with:
43+
path: ~/.pnpm-store
44+
key: ${{ runner.os }}-pnpm-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
45+
restore-keys: |
46+
${{ runner.os }}-pnpm-${{ matrix.node-version }}-
47+
3148
- name: Install Dependencies
32-
run: pnpm install --frozen-lockfile
49+
run: pnpm install --frozen-lockfile --prefer-offline
3350

3451
- name: Build
3552
run: pnpm run build
3653

3754
- name: Run Tests & Lint
38-
run: pnpm test
55+
run: pnpm run test

.github/workflows/docs-deploy.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,19 @@ jobs:
3535
- name: Set up Node.js
3636
uses: actions/setup-node@v4
3737
with:
38-
node-version: 20
38+
node-version: 22
3939
cache: pnpm
40+
41+
- name: Cache pnpm store
42+
uses: actions/cache@v3
43+
with:
44+
path: ~/.pnpm-store
45+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
46+
restore-keys: |
47+
${{ runner.os }}-pnpm-
4048
4149
- name: Install dependencies
42-
run: pnpm install --frozen-lockfile
50+
run: pnpm install --frozen-lockfile --prefer-offline
4351

4452
- name: Build documentation
4553
run: pnpm run docs

.github/workflows/publish.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
repository_dispatch:
6+
types: [run-publish]
7+
8+
jobs:
9+
publish:
10+
name: Publish
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
19+
- name: Setup Node.js 22.x
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22.x
23+
cache: pnpm
24+
25+
- name: Cache pnpm store
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/.pnpm-store
29+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
30+
restore-keys: |
31+
${{ runner.os }}-pnpm-
32+
33+
- name: Install Dependencies
34+
run: pnpm install --frozen-lockfile --prefer-offline
35+
36+
- name: Release and Publish
37+
run: |
38+
pnpm run release
39+
if [ -n "$(git status --porcelain)" ]; then
40+
git push --follow-tags
41+
else
42+
echo "No changes to push."
43+
fi
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
# - name: Send a Slack notification if a publish happens
48+
# if: steps.changesets.outputs.published == 'true'
49+
# # You can do something when a publish happens.
50+
# run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!"

.github/workflows/release.yml

+17-13
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
branches:
66
- main
77

8-
concurrency: ${{ github.workflow }}-${{ github.ref }}
9-
108
jobs:
119
release:
1210
name: Release
@@ -18,26 +16,32 @@ jobs:
1816
- name: Install pnpm
1917
uses: pnpm/action-setup@v4
2018

21-
- name: Setup Node.js 20.x
19+
- name: Setup Node.js 22.x
2220
uses: actions/setup-node@v4
2321
with:
2422
node-version: 22.x
2523
cache: pnpm
2624

25+
- name: Cache pnpm store
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/.pnpm-store
29+
key: ${{ runner.os }}-pnpm-22-${{ hashFiles('**/pnpm-lock.yaml') }}
30+
restore-keys: |
31+
${{ runner.os }}-pnpm-22-
32+
2733
- name: Install Dependencies
28-
run: pnpm install --frozen-lockfile
34+
run: pnpm install --frozen-lockfile --prefer-offline
2935

30-
- name: Create Release Pull Request or Publish to npm
36+
- name: Create Release Pull Request
3137
id: changesets
3238
uses: changesets/action@v1
33-
with:
34-
# This expects you to have a script called release which does a build for your packages and calls changeset publish
35-
publish: pnpm run release
3639
env:
3740
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3941

40-
# - name: Send a Slack notification if a publish happens
41-
# if: steps.changesets.outputs.published == 'true'
42-
# # You can do something when a publish happens.
43-
# run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!"
42+
- name: Trigger Publish Workflow
43+
if: steps.changesets.outputs.hasChangesets == 'false'
44+
uses: peter-evans/repository-dispatch@v3
45+
with:
46+
token: ${{ secrets.GITHUB_TOKEN }}
47+
event-type: run-publish

.github/workflows/syncpack.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Syncpack
2+
3+
on:
4+
pull_request:
5+
6+
# Cancel in-flight syncpack runs for the same PR
7+
concurrency:
8+
group: syncpack-${{ github.head_ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
syncpack:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v4
21+
22+
- name: Use Node.js 22.x
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 22.x
26+
cache: pnpm
27+
28+
- name: Cache pnpm store
29+
uses: actions/cache@v3
30+
with:
31+
path: ~/.pnpm-store
32+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
33+
restore-keys: |
34+
${{ runner.os }}-pnpm-
35+
36+
- name: Install Dependencies
37+
run: pnpm install --frozen-lockfile --prefer-offline
38+
39+
- name: Run Syncpack
40+
run: pnpm run syncpack lint

docs/syncpack.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# syncpack
2+
3+
<https://github.com/JamieMason/syncpack>
4+
5+
## Why syncpack?
6+
7+
As of `PNPM@10.4.1`, we cannot use the `pnpm update` command on [Catalog versions](https://pnpm.io/catalogs#caveats). We will use syncpack for the following:
8+
9+
- Find and fix dependency version mismatches.
10+
- Enforce a single version policy.
11+
- Find and bump outdated versions from the npm registry.
12+
- Ban some dependencies from being used in specific places (ie. `@types/*` in prod dependencies).
13+
- Sort and format package.json files consistently.
14+
15+
### align-packages
16+
17+
We will continue to use the `scripts/align-packages.js` script for the following:
18+
19+
- Add/verify fixed properties to the package.json
20+
- Verify typechecking configuration; includes updating eslintConfig
21+
- Verify required npm scripts
22+
- Remove maintainers property
23+
- Verify homepage property
24+
25+
## Commands
26+
27+
[List issues](https://jamiemason.github.io/syncpack/command/list/)
28+
29+
```sh
30+
syncpack list
31+
```
32+
33+
[Fix auto-fixable issues](https://jamiemason.github.io/syncpack/command/fix-mismatches/)
34+
35+
```sh
36+
syncpack fix-mismatches
37+
```
38+
39+
[Format package.json](https://jamiemason.github.io/syncpack/command/format/)
40+
41+
```sh
42+
syncpack format
43+
```

0 commit comments

Comments
 (0)