Skip to content

Commit 440ffb1

Browse files
yeelali14Linearb CIMishaKavclaude
authored
refactor: freeze dependencies for plugins and move it to build time (#515)
* refactor: freeze dependencies for plugins and move it from runtime to build time * pre-bundle dependencies * "build: rebuild dist with Node 20.12.2" * add @wasm-fmt/ruff_fmt@0.14.14 to the vendor-plugins npm install script * docs: update README to include managing action and plugin dependencies * fix checks * fix dist * chore: update brace-expansion versions in package-lock.json and rebuild dist * chore: update vendor-plugins script to specify npm registry for dependency installation * chore: update package-lock.json to reflect changes in dependencies * chore: update vendor-plugins script to remove registry specification for dependency installation * ci: exclude .package-lock.json from dist diff check The auto-generated .package-lock.json format varies based on npm cache state, making it non-deterministic across environments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Linearb CI <linearb-ci@gmail.com> Co-authored-by: Misha Kav <misha.kav@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 22cbb9f commit 440ffb1

2,212 files changed

Lines changed: 345466 additions & 18111 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* text=auto eol=lf
22

33
dist/** -diff linguist-generated=true
4+
dist/node_modules/** binary

.github/workflows/check-dist.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
ls -la ./
4444
exit 1
4545
fi
46-
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
46+
if [ "$(git diff --ignore-space-at-eol --text dist/ ':!dist/node_modules/.package-lock.json' | wc -l)" -gt "0" ]; then
4747
echo "Detected uncommitted changes after build. See status below:"
48-
git diff --ignore-space-at-eol --text dist/
48+
git diff --ignore-space-at-eol --text dist/ ':!dist/node_modules/.package-lock.json'
4949
exit 1
5050
fi
5151

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,26 @@ help in improving gitStream!
3131
To add support for `.cm` files in your code editor, see our
3232
[FAQ](https://docs.gitstream.cm/faq/#is-there-cm-syntax-highlighting).
3333

34+
## Managing Dependencies
35+
36+
### Action dependencies (`package.json``dependencies`)
37+
38+
Imported by the action's source code. Must be listed in `package.json` for build time.
39+
40+
To add:
41+
42+
1. `npm install <package>` and import it in `src/`
43+
2. If it can't be bundled by ncc (WASM, native addons), add `--external <package>` to the `package` script and add it to `vendor-plugins` as well
44+
45+
### Plugin dependencies (`vendor-plugins` script in `package.json`)
46+
47+
Packages that user plugins can `require()` at runtime. Installed into `dist/node_modules/` at build time and committed to the repo.
48+
49+
To add:
50+
51+
1. Add with a pinned version to the `vendor-plugins` script in `package.json`
52+
2. Run `npm run package` and commit the updated `dist/node_modules/`
53+
3454
## License
3555

3656
The gitStream GitHub Action is licensed under the Apache License. See

action.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,11 @@ runs:
117117
shell: bash
118118
run: mv gitstream code
119119

120-
- name: Clear npm cache
121-
shell: bash
122-
run: npm cache clean --force
123-
124-
- name: Install Dependencies for plugins
125-
shell: bash
126-
continue-on-error: true
127-
run: npm i --ignore-scripts moment@2.30.1 lodash@4.18.1 axios@1.14.0 @octokit/rest@20.1.1
128-
129120
- name: Run RulesEngine
130121
shell: bash
131122
run: node ${{ github.action_path }}/dist/index.js
132123
env:
124+
NODE_PATH: ${{ github.action_path }}/dist/node_modules
133125
HEAD_REF: ${{ steps.safe-strings.outputs.head_ref }}
134126
BASE_REF: ${{ steps.safe-strings.outputs.base_ref }}
135127
CLIENT_PAYLOAD: ${{ steps.safe-strings.outputs.client_payload }}

dist/407.index.js

Lines changed: 0 additions & 261 deletions
This file was deleted.

0 commit comments

Comments
 (0)