import{r as a,p as c,q as h,w as n,z as e,t as r,R as t}from"./vendor.8ed37afc.js";const u={class:"markdown-body"},d=t("This guide explains how to install the "),p=e("em",null,"Development",-1),_=t(" version of Directus locally so that you can work on the platform\u2019s source code. To install the "),m=e("em",null,"Production",-1),g=t(" version locally, please follow to our "),f=t("standard installation guides"),y=t("."),b=e("div",{class:"tip hint"},[e("div",{class:"hint-title"},"Minimum Requirements"),e("p",null,[t("You will need to have "),e("a",{href:"https://nodejs.org/en/download/current/",target:"_blank",rel:"noopener noreferrer"},"the latest version of Node"),t(" to "),e("em",null,"build"),t(" a Development version of Directus.")]),e("p",null,[t("You can use the JavaScript tool manager "),e("a",{href:"https://volta.sh/",target:"_blank",rel:"noopener noreferrer"},"volta"),t(" to automatically install the current node and npm versions.")])],-1),v=e("h2",{id:"1.-fork-the-directus-repository"},[t("1. Fork the Directus repository "),e("a",{class:"header-anchor",href:"#1.-fork-the-directus-repository"},"#")],-1),k=e("p",null,[t("Go to the "),e("a",{href:"https://github.com/directus/directus",target:"_blank",rel:"noopener noreferrer"},"repository"),t(" and fork it to your GitHub account. A fork is your copy of the Directus repository. Forking the repository allows you to freely experiment with changes without affecting the original project.")],-1),w=e("h2",{id:"2.-clone-from-your-repository"},[t("2. Clone from your repository "),e("a",{class:"header-anchor",href:"#2.-clone-from-your-repository"},"#")],-1),j=e("pre",null,[e("code",{class:"language-bash"},[t("git "),e("span",{class:"hljs-built_in"},"clone"),t(` git@github.com:YOUR-USERNAME/directus.git
`)])],-1),x=e("h2",{id:"3.-make-a-new-branch"},[t("3. Make a new branch "),e("a",{class:"header-anchor",href:"#3.-make-a-new-branch"},"#")],-1),D=e("pre",null,[e("code",{class:"language-bash"},`git checkout -b YOUR-BRANCH-NAME
`)],-1),T=e("h2",{id:"4.-install-the-dependencies-and-build-the-project"},[t("4. Install the dependencies and build the project "),e("a",{class:"header-anchor",href:"#4.-install-the-dependencies-and-build-the-project"},"#")],-1),A=e("pre",null,[e("code",{class:"language-bash"},`npm install
npm run build
`)],-1),C=e("h2",{id:"5.-create-a-.env-file"},[t("5. Create a "),e("code",null,".env"),t(" file "),e("a",{class:"header-anchor",href:"#5.-create-a-.env-file"},"#")],-1),R=e("p",null,[t("Create a "),e("code",null,".env"),t(" file under the "),e("code",null,"api"),t(" folder. You can use the "),e("code",null,"example.env"),t(" file provided under "),e("code",null,"api"),t(" as a starting point.")],-1),F=e("pre",null,[e("code",{class:"language-bash"},[e("span",{class:"hljs-comment"},"# To use the example file"),t(`
cp api/example.env api/.env
`)])],-1),E=e("h2",{id:"6.-initialize-the-database"},[t("6. Initialize the database "),e("a",{class:"header-anchor",href:"#6.-initialize-the-database"},"#")],-1),N=e("p",null,"For this step, you\u2019ll need to already have a SQL database up-and-running, except if you\u2019re using the SQLite driver, which will create the database (file) for you.",-1),S=e("p",null,"To start the initialization run the following command:",-1),Y=e("pre",null,[e("code",{class:"language-bash"},[e("span",{class:"hljs-comment"},"# From within the root of the project"),t(`
npm run cli bootstrap

`),e("span",{class:"hljs-comment"},"# For SQLite you need to run the command in the 'api' context (to ensure the database file is created in the right directory)"),t(`
npm run cli bootstrap --workspace=api
`)])],-1),q=e("p",null,"This will set-up the required tables for Directus and make sure all the migrations have run.",-1),z=e("h2",{id:"7.-start-the-development-server"},[t("7. Start the development server "),e("a",{class:"header-anchor",href:"#7.-start-the-development-server"},"#")],-1),B=e("p",null,[t("First you need to choose what packages you want to work on. Then, you should run the "),e("code",null,"dev"),t(" script on that package. You can see their names and list of scripts in their related "),e("code",null,"package.json"),t(". Example of running APP:")],-1),I=e("pre",null,[e("code",{class:"language-bash"},`npm run dev -w @directus/app
`)],-1),M=e("p",null,"If you want to work on multiple packages at once, you should create a new instance of your terminal for each package: Example of running Api, App:",-1),H=e("table",null,[e("tr",null,[e("th",null," Terminal 1 [Api] "),e("th",null," Terminal 2 [App] ")]),e("tr",null,[e("td",null,[e("pre",null,[e("code",{class:"language-bash"},`npm run dev -w directus
`)])]),e("td",null,[e("pre",null,[e("code",{class:"language-bash"},`npm run dev -w @directus/app
`)])])])],-1),L=e("hr",null,null,-1),G=e("p",null,[t("To work on the Documentation (public website version), you should navigate to the "),e("code",null,"docs"),t(" directory and run the following command:")],-1),P=e("pre",null,[e("code",{class:"language-bash"},`npm install
`)],-1),Q=e("p",null,[e("sup",null,"\u2139 This is necessary because the way vue-server-renderer imports vue")],-1),U=e("p",null,"Then you should run",-1),V=e("pre",null,[e("code",{class:"language-bash"},`npm run dev:site
`)],-1),W=e("div",{class:"tip hint"},[e("p",null,"If you encounter errors during this installation process, make sure your node version meets the minimum requirements")],-1),O=e("h2",{id:"8.-make-your-fixes%2Fchanges"},[t("8. Make your fixes/changes "),e("a",{class:"header-anchor",href:"#8.-make-your-fixes%2Fchanges"},"#")],-1),J=t("At this point you are ready to start working on Directus! Before diving in however, it\u2019s worth reading through the introduction to "),K=t("Contributing"),X=t("."),Z=e("div",{class:"tip hint"},[e("div",{class:"hint-title"},"Debugging"),e("p",null,[t("Check our Wiki for a "),e("a",{href:"https://github.com/directus/directus/wiki/debugging",target:"_blank",rel:"noopener noreferrer"},"guide"),t(" on debugging the app and api.")])],-1),$=e("h2",{id:"9.-running-tests"},[t("9. Running tests "),e("a",{class:"header-anchor",href:"#9.-running-tests"},"#")],-1),ee=e("p",null,"Tests run automatically through GitHub Actions. However you may wish to run the tests locally especially when you write tests.",-1),te=e("p",null,[t("Install "),e("a",{href:"https://docs.docker.com/get-docker/",target:"_blank",rel:"noopener noreferrer"},"Docker"),t(" and ensure that the service is running.")],-1),ne=e("pre",null,[e("code",{class:"language-bash"},[e("span",{class:"hljs-comment"},"# Ensure that you are testing on the lastest codebase"),t(`
npm run build

`),e("span",{class:"hljs-comment"},"# Clean up in case you ran the tests before"),t(`
docker compose -f tests/docker-compose.yml down -v

`),e("span",{class:"hljs-comment"},"# Start the necessary containers"),t(`
docker compose -f tests/docker-compose.yml up -d --`),e("span",{class:"hljs-built_in"},"wait"),t(`

`),e("span",{class:"hljs-comment"},"# Run the tests"),t(`
npm run `),e("span",{class:"hljs-built_in"},"test"),t(`:e2e
`)])],-1),le={setup(oe,{expose:l}){const o={title:"Running Locally",modularExtension:!1};return l({frontmatter:o}),(se,ae)=>{const s=a("router-link"),i=a("DocsWrapper");return c(),h(i,{frontmatter:o},{default:n(()=>[e("div",u,[e("blockquote",null,[e("p",null,[d,p,_,m,g,r(s,{to:"/docs/getting-started/installation/"},{default:n(()=>[f]),_:1}),y])]),b,v,k,w,j,x,D,T,A,C,R,F,E,N,S,Y,q,z,B,I,M,H,L,G,P,Q,U,V,W,O,e("p",null,[J,r(s,{to:"/docs/contributing/introduction"},{default:n(()=>[K]),_:1}),X]),Z,$,ee,te,ne])]),_:1})}}};export{le as default};
