Skip to content

Commit 16597ea

Browse files
feat(yarn-sdks): Add hook to generate Yarn SDKs
Ensure Yarn SDKs remain up-to-date. Run Prettier on VSCode settings within the same hook to prevent formatting conflicts with MegaLinter, which also runs Prettier. Define the hook as a script since system hooks don't support running multiple commands.
1 parent 9228b47 commit 16597ea

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@
120120
https://yarnpkg.com/cli/npm/audit for more details.
121121
args: [--all, --recursive]
122122

123+
- id: yarn-sdks
124+
name: Generate Yarn SDKs
125+
entry: src/yarn-sdks.sh
126+
language: script
127+
files: \.yarn/sdks/|yarn(-(\d+\.){2}\d+\.cjs|\.lock)
128+
pass_filenames: false
129+
description: >
130+
Generate SDKs and settings for editors specified in
131+
`.yarn/sdks/integrations.yml`. Format VSCode settings with Prettier to
132+
prevent formatting conflicts with MegaLinter. See
133+
https://yarnpkg.com/sdks/cli/default for more details.
134+
123135
- id: yarn-build
124136
name: Build the app
125137
entry: yarn run build

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Hooks for Use With the [pre-commit](https://pre-commit.com) Framework
2828
- [`yarn-install`](#yarn-install)
2929
- [`yarn-dedupe`](#yarn-dedupe)
3030
- [`yarn-audit`](#yarn-audit)
31+
- [`yarn-sdks`](#yarn-sdks)
3132
- [`yarn-build`](#yarn-build)
3233
- [`yarn-test`](#yarn-test)
3334
- [`megalinter-incremental`](#megalinter-incremental)
@@ -100,6 +101,14 @@ Deduplicate Yarn dependencies by running
100101
Perform security audit of Yarn dependencies by running
101102
[`yarn npm audit --all --recursive`](https://yarnpkg.com/cli/npm/audit).
102103

104+
### `yarn-sdks`
105+
106+
Generate SDKs and settings for editors specified in
107+
`.yarn/sdks/integrations.yml` by running
108+
[`yarn run sdks && yarn run prettier --write .vscode/settings.json`](https://yarnpkg.com/sdks/cli/default).
109+
Format VSCode settings with Prettier to prevent formatting conflicts with
110+
MegaLinter.
111+
103112
### `yarn-build`
104113

105114
Run the `"build"` script in `package.json` via

src/yarn-sdks.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit -o noglob -o pipefail -o nounset
4+
5+
yarn run sdks
6+
yarn run prettier --write .vscode/settings.json

0 commit comments

Comments
 (0)