mirror of
https://github.com/vector-im/element-call.git
synced 2026-01-18 02:32:27 +00:00
Add docs and git hooks
This commit is contained in:
11
.githooks/post-commit
Executable file
11
.githooks/post-commit
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
FILE=.links.disabled.yaml
|
||||
if test -f "$FILE"; then
|
||||
# echo "$FILE exists. -> moving to .links.disabled.yaml"
|
||||
mv .links.disabled.yaml .links.yaml
|
||||
# echo "running yarn"
|
||||
yarnLog=$(yarn)
|
||||
echo "The post-commit hook enabled the links again: moved .links.disabled.yaml to .links.yaml and ran yarn."
|
||||
exit 1
|
||||
fi
|
||||
12
.githooks/pre-commit
Executable file
12
.githooks/pre-commit
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
FILE=".links.yaml"
|
||||
if test -f "$FILE"; then
|
||||
# echo "$FILE exists. -> moving to .links.disabled.yaml"
|
||||
mv .links.yaml .links.disabled.yaml
|
||||
# echo "running yarn"
|
||||
x=$(yarn)
|
||||
y=$(git add yarn.lock)
|
||||
echo "YARN-LINKER-HOOK: We do not allow to commit with local links in the yarn.lock file. The pre-commit hook MODIFIED the yarn.lock file with disabled .links.yaml. Check the new git status (the hook added yarn.lock, was this desired?). The post-commit hook enables the links again. It moves .links.disabled.yaml to .links.yaml and runs yarn. Run \`git commit\` again!"
|
||||
exit 1
|
||||
fi
|
||||
@@ -169,6 +169,10 @@ You're now ready to launch the development server:
|
||||
yarn dev
|
||||
```
|
||||
|
||||
See also:
|
||||
|
||||
- [Developing with linked packages](./linking.md)
|
||||
|
||||
### Backend
|
||||
|
||||
A docker compose file `dev-backend-docker-compose.yml` is provided to start the
|
||||
|
||||
@@ -10,3 +10,30 @@ matrix-js-sdk: ../path/to/matrix-js-sdk
|
||||
```
|
||||
|
||||
Then run `yarn install`.
|
||||
|
||||
## Hooks
|
||||
|
||||
Changes in `.links.yaml` will also update `yarn.lock` when `yarn` is executed. The lockfile will then contain the local
|
||||
version of the package which would not work on others dev setups or the github CI.
|
||||
One always needs to run:
|
||||
|
||||
```bash
|
||||
mv .links.yaml .links.disabled.yaml
|
||||
yarn
|
||||
```
|
||||
|
||||
before committing a change.
|
||||
|
||||
To make it more convenient to work with this linking system we added git hooks for your conviniece.
|
||||
A `pre-commit` hook will run `mv .links.yaml .links.disabled.yaml`, `yarn` and `git add yarn.lock` if it detects
|
||||
a `.links.yaml` file and abort the commit.
|
||||
You will than need to check if the resulting changes are appropriate and commit again.
|
||||
|
||||
A `post-commit` hook will setup the linking as it was
|
||||
before if a `.links.disabled.yaml` is present. It runs `mv .links.disabled.yaml .links.yaml` and `yarn`.
|
||||
|
||||
To activate the hooks automatically configure git with
|
||||
|
||||
```bash
|
||||
git config --local core.hooksPath .githooks/
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user