Developing
This page gives an introduction on setting up your development environment, required if you wish to contribute to Squidex or write custom extensions for it.
To work with the source code you need the following tools.
We recommend using Docker on your developer machine. It makes your live much easier.
Personally I was not able to run newer versions of Docker on Windows 10 Home. If you do not have a Windows 10 PRO license, I recommend not to invest the money. Get a cheap build server for a few bucks per month or just install MongoDB manually. It takes around 15 minutes only.
We provide ready to use docker configurations for development at https://github.com/squidex/squidex-docker.
Execute the following commands to get a MongoDB installation for development.
git clone https://github.com/squidex/squidex-docker
cd squidex-docker/development
docker-compose up -d
Usually newer versions are better but the newer versions of NodeJS are known to consume a lot of memory during build or when running webpack dev server.
You can use any editor you want, but our recommendation is to use:
You have to run both frontend and backend independently. It may feel redundant and annoying at first (we also had some code to run the webpack dev server automatically when the application is started), but it only takes a minute for the webpack dev server to start . We have decoupled the commands so that you can keep the webpack dev server running, even when you have to restart the backend application.
Before you start, ensure that the certificates for the test environment are installed. They can be found under
/dev
in the Squidex folder.The frontend is written with Angular and webpack. Therefore you have to run the webpack web dev server. It is a server application that builds the website and watches the file system. Whenever you make a change to a file, the server will run the build process and reload the website automatically. It tries to compile only the files that have changed and can even reload the style sheets without reloading the site in some cases.
cd frontend # Go to the frontend
npm i # Install all dependencies, only needed the first time
npm start
Installing the dependencies is only needed once or when the project.json file has changed.
Optionally:
- 1.
npm rebuild node-sass --force
(Only if you have issues with node-sass) - 2.
npm test
(Runs the unit tests and listens for changes) - 3.
npm run test:coverage
(Runs the unit tests and calculates the test coverage).
As the name webpack dev server indicates, it is only used for development. For production we bundle and minimize all typescript, html and sass files and add the bundles to the deployment package. So it is normal when the frontend downloads hundred of files during development.
cd backend
cd src/Squidex
dotnet restore # Install all dependencies
dotnet run
Ensure that the
ASPNETCORE_ENVIRONMENT
environment variable is set to Development
, either through a launchSettings.json
or through your IDE's settings.You can also run and debug the backend with Visual Studio 2019. Here are some recommended things you should do before you start your debug session:
- 1.Ensure that you run the
Squidex
project, which means that you use the integrated Kestrel web server, which starts faster than IIS Express. - 2.Uncheck the
Launch browser
setting. You just want to keep Squidex open during development and not close and open the window all the time to make debugging the frontend with your browser easier.
Last modified 25d ago