diff --git a/packages/twenty-website/src/content/developers/backend-development/server-commands.mdx b/packages/twenty-website/src/content/developers/backend-development/server-commands.mdx index 949fbf58ec..075058132a 100644 --- a/packages/twenty-website/src/content/developers/backend-development/server-commands.mdx +++ b/packages/twenty-website/src/content/developers/backend-development/server-commands.mdx @@ -7,30 +7,30 @@ image: /images/user-guide/kanban-views/kanban.png ## Useful commands These commands should be executed from packages/twenty-server folder. -From any other folder you can run `npx nx ` twenty-server. +From any other folder you can run `npx nx twenty-server` (or `npx nx run twenty-server:`). ### First time setup ``` -npx nx database:reset # setup the database with dev seeds +npx nx database:reset twenty-server # setup the database with dev seeds ``` -### Starting the app +### Starting the server ``` -npx nx start +npx nx run twenty-server:start ``` ### Lint ``` -npx nx lint +npx nx run twenty-server:lint # pass --fix to fix lint errors ``` ### Test ``` -npx nx test:unit +npx nx run twenty-server:test:unit ``` ### Resetting the database @@ -38,7 +38,24 @@ npx nx test:unit If you want to reset the database, you can run the following command: ```bash -npx nx database:reset +npx nx run twenty-server:database:reset +``` + +### Migrations + +#### For objects in Core/Metadata schemas (TypeORM) + +```bash +npx nx run twenty-server:typeorm --migration:generate src/database/typeorm/metadata/migrations/nameOfYourMigration -d src/database/typeorm/metadata/metadata.datasource.ts # replace by core data source if necessary +``` + +#### For Workspace objects + +There are no migrations files, migration are generated automatically for each workspace, +stored in the database, and applied with this command + +```bash +npx nx run twenty-server:command workspace:sync-metadata -f ``` diff --git a/packages/twenty-website/src/content/developers/frontend-development/frontend-commands.mdx b/packages/twenty-website/src/content/developers/frontend-development/frontend-commands.mdx index eb1b02c2de..c7effad7b6 100644 --- a/packages/twenty-website/src/content/developers/frontend-development/frontend-commands.mdx +++ b/packages/twenty-website/src/content/developers/frontend-development/frontend-commands.mdx @@ -9,28 +9,32 @@ image: /images/user-guide/create-workspace/workspace-cover.png ### Starting the app ```bash - nx start twenty-front - ``` +npx nx start twenty-front +``` ### Regenerate graphql schema based on API graphql schema ```bash -nx graphql:generate twenty-front +npx nx run twenty-front:graphql:generate --configuration=metadata +``` +OR +```bash +npx nx run twenty-front:graphql:generate ``` ### Lint ```bash -nx lint twenty-front +npx nx run twenty-front:lint # pass --fix to fix lint errors ``` ### Test ```bash -nx test twenty-front# run jest tests -nx storybook:serve:dev twenty-front# run storybook -nx storybook:test twenty-front# run tests # (needs yarn storybook:serve:dev to be running) -nx storybook:coverage twenty-front # (needs yarn storybook:serve:dev to be running) +npx nx run twenty-front:test # run jest tests +npx nx run twenty-front:storybook:serve:dev # run storybook +npx nx run twenty-front:storybook:test # run tests # (needs yarn storybook:serve:dev to be running) +npx nx run twenty-front:storybook:coverage # (needs yarn storybook:serve:dev to be running) ``` ## Tech Stack diff --git a/packages/twenty-website/src/content/developers/local-setup.mdx b/packages/twenty-website/src/content/developers/local-setup.mdx index 5775b1a0b6..d54fd04e0a 100644 --- a/packages/twenty-website/src/content/developers/local-setup.mdx +++ b/packages/twenty-website/src/content/developers/local-setup.mdx @@ -5,7 +5,6 @@ image: /images/user-guide/fields/field.png info: Mostly for contributors or curious developers --- - Follow this guide if you would like to setup the project locally to contribute. ## Prerequisites @@ -115,6 +114,7 @@ You can access the database at [localhost:5432](localhost:5432), with user `twen ```bash psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;" ``` + Note: You might need to add `sudo -u postgres` to the command before `psql` to avoid permission errors. Option 2: If you have docker installed: ```bash @@ -143,6 +143,7 @@ You can access the database at [localhost:5432](localhost:5432), with user `twen ```bash psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;" ``` + Note: You might need to add `sudo -u postgres` to the command before `psql` to avoid permission errors. Option 2: If you have docker installed: Running Docker on WSL adds an extra layer of complexity. @@ -276,7 +277,7 @@ Make sure to run yarn in the root directory and then run `npx nx server:dev twen This should work out of the box with the eslint extension installed. If this doesn't work try adding this to your vscode setting (on the dev container scope): -#### While running `npx nx start` or `npx nx start twenty-front`, Out of memory is thrown +#### While running `npx nx start` or `npx nx start twenty-front`, Out of memory error is thrown In `packages/twenty-front/.env` uncomment `VITE_DISABLE_TYPESCRIPT_CHECKER=true` and `VITE_DISABLE_ESLINT_CHECKER=true` to disable background checks thus reducing amount of needed RAM.