Technologies | How To Use | How to Deploy | Original design | Structure | Hooks | Scripts | Preview
This project was developed using the following technologies:
- Vue.js
- Vue CLI is a full system for rapid Vue.js development
- Vuex
- Vue Router
- Css modules
- Axios
- Post-css
- Immer
- Vue Test Utils
- Husky hooks
- Css Grid Layout
- Json-server
- Prettier, Babel, Eslint. Options for Vue CLI
To clone and run this application, you'll need Git, Node.js v10.16 or higher + npm 6.14.8 or higher installed on your computer. From your command line:
# Clone this repository
$ git clone https://github.com/Batyodie/pizza-vue.git
# Go into the repository
$ cd pizza-vue
# Install dependencies
$ npm install
# Run the app
$ npm run dev
The example deployment will take place on the heroku platform, because it has the ability to work with node.js and for the application it is necessary.
- Register on heroku
- We create a new project (new-vue-pizza)
- Linking your github profile to a new project
- Add a cloned repository with a project Choose which branch heroku will deploy (by default, this is master.) Turn on automatic deployment
- Create a file called
server.js
at the root of the cloned project
# server.js
# our back-end in the role of json-server
const jsonServer = require("json-server");
const server = jsonServer.create();
# router path to our database
const router = jsonServer.router("./public/db.json");
# static files
const middlewares = jsonServer.defaults({
static: "./dist"
});
# Port to which heroku will refer
const PORT = process.env.PORT || 3001;
server.use(middlewares);
server.use(router);
server.listen(PORT, () => {
console.log("Server is running");
});
- Create a file called
Procfile
. He explains to heroku what he needs to start to work correctly
# Procfile file
#heroku run server.js file
web: node server.js
- Save changes and update master branch
git add . / git commit / git push
Make some change in the files
$ git add . # add all the changes made
$ git commit -m "keep clam and commit" # create commit
# then there is a check and autofix with a linter. Next, run tests. If no errors are found, run a post-commit which will push the changes to github
# if you want to send a commit without any checks use --no-verify
$ git commit -m "keep clam and commit" --no-verify
# Hooks can be changed or removed in package.json
"husky": {
"hooks": {
"pre-commit": "npm run lint && npm run test:unit",
"post-commit": "git push"
}
},
$ npm run serve # running vue app
$ npm run build # starting application build
$ npm run test:unit # running unit tests. If during separate work with tests, you will need to keep them on at all times. Add the --watch flag
$ npm run lint # lint check runs
$ npm run json-server # back-end server launch
$ npm run dev # simultaneous launch of vue application and back-end server for convenient work and full-fledged application work
├── src
│ ├── api # api for communicate to fake json-server through axios
│ │ ├── __tests__
│ │ ├── **/*.api.js
│ ├── assets # static asstes
│ │ ├── fonts/img
│ ├── components # component catalog
│ │ ├── Button
│ │ │ ├── __tests__
│ │ │ │ ├── Button.spec.js
│ │ │ │ ├── __snapshots__
│ │ │ ├── Button.css
│ │ │ ├── Button.vue
│ ├── func # exported functions for working in the store
│ │ ├── __tests__
│ │ ├── getCardData.js
│ ├── Layout # Layouts directory
│ │ ├── TheGrid
│ │ │ ├── __tests__
│ │ │ │ ├── LayoutTheGrid.spec.js
│ │ │ │ ├── __snapshots__
│ │ │ ├── LayoutTheGrid.css
│ │ │ ├── LayoutTheGrid.vue
│ ├── router
│ │ ├── index.js # master file for routers
│ ├── store # Store catalog
│ │ ├── modules # subsection with modules
│ │ │ ├── cart
│ │ │ │ ├── __tests__
│ │ │ │ │ ├── cart.spec.js
│ │ │ │ ├── basket # basket sub-module responsible for the basket operation on the Basket page
│ │ │ │ │ ├── action.js
│ │ │ │ │ ├── index.js
│ │ │ │ │ ├── mutation.js
│ │ │ │ │ ├── __tests__.js
│ │ │ │ ├── cart.js # basic basket module
│ │ ├── index.js # main store file
│ │ ├── mutation-types.js # imported mutation types
│ ├── style
│ │ ├── Base # base styles
│ │ │ ├── App
│ │ │ │ ├── BaseApp.css # basic styles for the application
│ │ │ ├── Extend # styles for extend
│ │ │ ├── Fonts # styles for fonts
│ │ │ ├── Reset # styles to reset
│ │ │ ├── Vars # styles for variables
│ │ │ ├── import.css # file for importing base styles
│ │ ├── main.css # main css file
│ ├── views # directory where application pages are located
│ │ ├── Basket
│ │ │ ├── Basket.css
│ │ │ ├── Basket.vue
│ │ ├── Market
│ ├── App.vue # root vue app
│ └── Main.js # main js app
├── dist (or build)
├── node_modules
├── public
│ │ ├── db.json # database products
│ │ ├── index.html
├── .eslintrc.js
├── README.md
├── package.json
├── babel.config.js
├── jest.config.js
├── postcss.config.js
├── Procfile # heroku config
├── server.js # node server for deploy
├── vue.config.js
├── .browserslistrc
└── .gitignore