add procedure on README

This commit is contained in:
Jordan Blasenhauer 2024-05-18 23:03:36 +02:00
parent 5171c5f6fb
commit 886ecd8990
2 changed files with 16 additions and 6 deletions

View file

@ -1,15 +1,17 @@
# Vuejs
# Vuejs
## Principle
We can develop the front-end using Vue and Vite framework.
We can develop the front-end using Vue and Vite framework.
I have all my front-end logic inside `client` folder.
We can use all the facilities of the framework, for this example you have :
- `component` folder : create a component to use in your page
- `pages` folder : contains each pages to render, we have only one page test ATM
Inside `pages` folder, you have 3 files :
Inside `pages` folder, you have 3 files :
- `index.html` that is entry point, we define entry point for Vue app and a div with attribut data-flask to store futur data from template
- `test.js` is js entry point that define the Vue components, plugins and settings to use for this page
- `Test.vue` is the page (global context) where we are importing components, executing logic... For example, we are retrieving data-flask from here
@ -23,4 +25,12 @@ We need to work on the front-end here, then build and move to flask app the reso
- Need to install `node.js` and `npm` on computer
- Go inside `vuejs` folder and run `node build.js`
- Run `flask --app main.py run` then access `/test` to get Vue.js rendering app using flask data `Title from Flask !`
- `/test2` is case with no flask data (can be handle on a div or directly on Vue app)
- `/test2` is case with no flask data (can be handle on a div or directly on Vue app)
# jsdoc
We can create a markdown documentation for components.
- `npm install -g documentation` will add lib that format js to doc
- set input and output folder in `vue2md.js`
- once done, run `node vue2md.js`, this will format .vue to .js, run subprocess to render .js to .md for each file, and finally script will merge in order and by path all .md files

View file

@ -1,6 +1,7 @@
const fs = require("fs");
const path = require("path");
const finalFile = "COMPONENTS.md";
const inputFolder = path.join(__dirname, "components");
const ouputFolder = path.join(__dirname, "output");
@ -109,7 +110,7 @@ function formatMd() {
});
// Create a md file to merge
const merge = path.join(ouputFolder, "COMPONENTS.md");
const merge = path.join(ouputFolder, finalFile);
fs.writeFileSync(merge, "", "utf8");
// Append each file in the order
order.forEach((item) => {
@ -131,7 +132,6 @@ function formatMd() {
}
tag += " ";
console.log(tag);
// Each time, get the first level title and add it to the titles array
data.split("\n").forEach((line) => {
if (line.startsWith(tag) && line.includes("/")) {