File: /var/www/linde-ai/README.md
# WordPress theme for linde
This project was bootstrapped using [borealis-cli](https://github.com/borealis-agency/cli)
## Requirements
- NodeJS
- local setup that can run WordPress such as WAMP, XAMPP, MAMP etc.
- npm (for JavaScript dependencies)
- Composer (for PHP dependencies)
## Structure
All code regarding frontend development is stored inside `/html` folder. If you are working on HTML/CSS/JS, this will be your working directory.
This was done in order not to clutter theme folder with unnecessary source files that might accidentally end up in production. Theme folder should only contain production ready frontend and WordPress theme files.
## Dependencies
### Frontend
_All commands in this sub-section should be ran inside `/html`, unless specified otherwise._
Run npm to install dependencies:
```bash
npm install
```
### PHP
_All commands in this sub-section should be ran inside `/wp-content/themes/linde`, unless specified otherwise._
```bash
composer install
```
## Development
### Frontend
_All commands in this sub-section should be ran inside `/html`, unless specified otherwise._
Run development script which will spin up Webpack and Webpack Dev Server in order to bundle and serve frontend files locally.
```bash
npm run dev
```
### PHP
*There is no development mode command that needs to be ran for PHP code.*
## Production
### Frontend
_All commands in this sub-section should be ran inside `/html`, unless specified otherwise._
Run production bundle script in order to bundle up all frontend assets for deployment to staging or production environment. This will run Webpack bundling with optimizations applied to CSS, JavaScript and static assets such as images.
```bash
npm run build
```
After bundling is finished, this process will automatically copy built files into `/wp-content/themes/linde/frontend`. Those assets will get used by the theme.
### PHP
*There is no production build step for PHP code.*
## Jenkins
This project contains Jenkinsfile that can be used to setup automatic deployment with Jenkins. Follow setup steps below to make this work.
### Setup steps
1. Create new Jenkins project and use Pipeline as type.
2. Check "Discard old builds"
2.1 Use 90 days and 10 builds.
3. Check "GitHub project"
3.1 Enter "Project url"
4. Check following checkboxes
4.1 Prepare an environment for the run
4.2 Keep Jenkins Environment Variables
4.3 Keep Jenkins Build Variables
5. Insert Enviroment variables under "Properties Content". Example below:
```env
BOREALIS_NODE_JS_VERSION=Name of Desired Nodejs Profile in Jenkins
BOREALIS_SERVER_ROOT_FOLDER=/var/www/linde
BOREALIS_SSH_SERVER=Name Of Desired SSH Profile in Jenkins
BOREALIS_SLACK_CHANNEL_ID=AABBCCDDEE
BOREALIS_PROJECT_URL=https://deployment.url.domain
```
6. Check "Poll SCM"
6.1 Enter "Schedule" (this polls GitHub every 10 minutes for changes)
```
H/10 * * * *
```
7. Under pipeline select "Pipeline script from SCM"
7.1 For SCM select Git
7.2 Enter "Repository URL" and select "Credentials"
7.3 Select branch for deploy. This should be eg. main for production.
8. Done!