kucherenko / blog

Test wordpress blog
MIT License
0 stars 0 forks source link

Implement task #82 - Add netlify deployment and configuration #83

Open brian-ai-assistant[bot] opened 1 year ago

brian-ai-assistant[bot] commented 1 year ago

To add Netlify deployment and configuration to the web app, we need to make some updates to the project files. Here are the steps to accomplish this:

  1. Add a netlify.toml file to the root of the project. This file is used to configure the Netlify deployment settings. The content of the netlify.toml file would look something like this:
[build]
  command = "npm run build"
  publish = "dist"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200
  1. Update the frontend/package.json file to include the necessary netlify-cli package as a development dependency. The updated content of the frontend/package.json file would look something like this:
{
  "name": "blog-frontend",
  "version": "1.0.0",
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "test": "vue-cli-service test:unit",
    "deploy": "netlify deploy --prod"
  },
  "dependencies": {
    "vue": "^2.6.11",
    "axios": "^0.21.1"
  },
  "devDependencies": {
    "@vue/test-utils": "^1.0.3",
    "jest": "^26.6.0",
    "babel-jest": "^26.6.0",
    "babel-core": "^7.0.0-bridge.0",
    "eslint-plugin-jest": "^23.13.2",
    "netlify-cli": "^3.30.0"
  }
}
  1. Run npm install or yarn install to install the newly added package.

  2. Commit the changes with an appropriate commit message, such as "Added Netlify deployment and configuration".

This setup will configure Netlify to use the npm run build command for building the Vue app and set the dist directory as the publish directory. Additionally, the netlify.toml file includes a redirect rule to ensure all requests are routed to the index.html file, allowing Vue Router to handle the routing on the client-side.