AFFiNE/.devcontainer/build.sh

18 lines
761 B
Bash
Raw Normal View History

#!/bin/bash
# This is a script used by the devcontainer to build the project
#Enable yarn
corepack enable
corepack prepare yarn@stable --activate
# install dependencies
yarn install
# Build Server Dependencies
yarn workspace @affine/storage build
# Create database
chore: create default user for devcontainer (#5917) ## **Type** enhancement ___ ## **Description** - Added a command to `.devcontainer/build.sh` to create a default user (`affine`) in the database for development purposes. - Introduced error handling in `.devcontainer/setup-user.sh` to ensure the script stops on the first error. - Modified the git fetch command in `.devcontainer/setup-user.sh` to fetch the `canary` branch from `origin` with a depth of 1, optimizing the setup process. ___ ## **Changes walkthrough** <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>build.sh</strong><dd><code>Add Default User Creation to Dev Container Build Script</code>&nbsp; &nbsp; </dd></summary> <hr> .devcontainer/build.sh <li>Added command to create a default user with username and password <br>'affine'.<br> <li> Ensured database push command is followed by a newline.<br> </details> </td> <td><a href="https:/toeverything/AFFiNE/pull/5917/files#diff-165b66803397b501866b23a0532418e9ad3eb2ab642274f9679383c76d18136f">+4/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>setup-user.sh</strong><dd><code>Enhance User Setup Script with Error Handling and Specific Git Fetch</code></dd></summary> <hr> .devcontainer/setup-user.sh <li>Introduced error handling with 'set -e' to stop on first error.<br> <li> Modified 'git fetch' to specifically fetch 'canary' branch from <br>'origin' with depth of 1.<br> </details> </td> <td><a href="https:/toeverything/AFFiNE/pull/5917/files#diff-8c5e76719e2ff0a3bf2b59d108dc9cf88bdae00c317728454cfa5108f2fc76af">+3/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > ✨ **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
2024-02-27 06:32:03 +03:00
yarn workspace @affine/server prisma db push
# Create user username: affine, password: affine
echo "INSERT INTO \"users\"(\"id\",\"name\",\"email\",\"email_verified\",\"created_at\",\"password\") VALUES('99f3ad04-7c9b-441e-a6db-79f73aa64db9','affine','affine@affine.pro','2024-02-26 15:54:16.974','2024-02-26 15:54:16.974+00','\$argon2id\$v=19\$m=19456,t=2,p=1\$esDS3QCHRH0Kmeh87YPm5Q\$9S+jf+xzw2Hicj6nkWltvaaaXX3dQIxAFwCfFa9o38A');" | yarn workspace @affine/server prisma db execute --stdin