From fb6636ed877ac959e5ed4c3289d885b1df415334 Mon Sep 17 00:00:00 2001 From: Gabriel Pastori <58153955+gabrielpastori1@users.noreply.github.com> Date: Fri, 1 Dec 2023 01:27:23 -0300 Subject: [PATCH] Update doc load and add nvm doc --- docs/en/cli.md | 2 ++ docs/en/general/node-install.md | 58 ++++++++++++++++++++++++++++++ docs/en/index.md | 2 ++ docs/pt_br/cli.md | 2 ++ docs/pt_br/general/node-install.md | 58 ++++++++++++++++++++++++++++++ docs/pt_br/index.md | 3 ++ src/layouts/doc/AppBar.vue | 13 ++++--- src/store/doc.js | 32 ++++++++++++++--- src/views/Doc.vue | 4 +-- 9 files changed, 161 insertions(+), 13 deletions(-) create mode 100644 docs/en/general/node-install.md create mode 100644 docs/pt_br/general/node-install.md diff --git a/docs/en/cli.md b/docs/en/cli.md index d35db9e..127a7de 100644 --- a/docs/en/cli.md +++ b/docs/en/cli.md @@ -1,3 +1,5 @@ +[title]: \\ "CLI" + # Evolution-Manager CLI ## Description diff --git a/docs/en/general/node-install.md b/docs/en/general/node-install.md new file mode 100644 index 0000000..e04b4bc --- /dev/null +++ b/docs/en/general/node-install.md @@ -0,0 +1,58 @@ +[title]: \\ "Installing Node Using NVM" + +# Installing Node.js with NVM + +This guide provides step-by-step instructions on how to install Node.js on Linux using NVM (Node Version Manager). + +## Prerequisites + +- Access to a terminal in Linux. +- Permissions to execute installation commands (usually as a root user or with `sudo`). + +## Step 1: Install NVM + +NVM is a tool that allows you to manage multiple versions of Node.js. To install it, execute the following command in your terminal: + +```bash +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash +``` + +*Note: You can check the latest version of NVM on their [GitHub page](https://github.com/nvm-sh/nvm).* + +After installation, close and reopen the terminal, and then run the following command to check if NVM was installed correctly: + +```bash +nvm --version +``` + +## Step 2: Install Node.js + +With NVM installed, you can now install Node.js. To install the latest version, use the command: + +```bash +nvm install node +``` + +To install a specific version of Node.js, you can do: + +```bash +nvm install 18 +``` + +After installation, verify the Node.js version with: + +```bash +node -v +``` + +## Step 3: Use a Specific Version of Node.js + +You can switch between installed versions of Node.js with the `nvm use` command: + +```bash +nvm use 18 # replace 18 with the version you want to use +``` + +## Conclusion + +You now have NVM installed on your Linux system, allowing you to install and manage multiple versions of Node.js. This is particularly useful for developers working on multiple projects that may require different versions of Node.js. diff --git a/docs/en/index.md b/docs/en/index.md index a32c681..4f050b6 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -1,3 +1,5 @@ +[title]: \\ "About" + # Evolution Manager ## Introduction diff --git a/docs/pt_br/cli.md b/docs/pt_br/cli.md index 2465f5f..9d81ea1 100644 --- a/docs/pt_br/cli.md +++ b/docs/pt_br/cli.md @@ -1,3 +1,5 @@ +[title]: \\ "CLI" + # Evolution-Manager CLI ## Instalação diff --git a/docs/pt_br/general/node-install.md b/docs/pt_br/general/node-install.md new file mode 100644 index 0000000..42e1e18 --- /dev/null +++ b/docs/pt_br/general/node-install.md @@ -0,0 +1,58 @@ +[title]: \\ "Instalar Node usando NVM" + +# Instalando Node.js com NVM + +Este guia fornece instruções passo a passo sobre como instalar o Node.js no Linux usando o NVM (Node Version Manager). + +## Pré-requisitos + +- Acesso a um terminal no Linux. +- Permissões para executar comandos de instalação (geralmente como usuário root ou com `sudo`). + +## Passo 1: Instalar NVM + +NVM é uma ferramenta que permite gerenciar múltiplas versões do Node.js. Para instalá-lo, execute o seguinte comando no seu terminal: + +```bash +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash +``` + +*Nota: Você pode verificar a versão mais recente do NVM na [página do GitHub](https://github.com/nvm-sh/nvm).* + +Após a instalação, feche e reabra o terminal, e então execute o seguinte comando para verificar se o NVM foi instalado corretamente: + +```bash +nvm --version +``` + +## Passo 2: Instalar Node.js + +Com o NVM instalado, você pode instalar o Node.js. Para instalar a versão mais recente, use o comando: + +```bash +nvm install node +``` + +Para instalar uma versão específica do Node.js, você pode fazer: + +```bash +nvm install 18 # substitua 18 pela versão que você quer instalar +``` + +Após a instalação, verifique a versão do Node.js com: + +```bash +node -v +``` + +## Passo 3: Usar uma Versão Específica do Node.js + +Você pode alternar entre as versões instaladas do Node.js com o comando `nvm use`: + +```bash +nvm use 18 # substitua 18 pela versão que você quer usar +``` + +## Conclusão + +Agora você tem o NVM instalado no seu sistema Linux, permitindo que você instale e gerencie múltiplas versões do Node.js. Isso é especialmente útil para desenvolvedores trabalhando em múltiplos projetos que podem requerer diferentes versões do Node.js. diff --git a/docs/pt_br/index.md b/docs/pt_br/index.md index 3dcbed6..fbe214e 100644 --- a/docs/pt_br/index.md +++ b/docs/pt_br/index.md @@ -1,3 +1,6 @@ +[title]: \\ "Sobre" + + # Evolution Manager ## Introdução diff --git a/src/layouts/doc/AppBar.vue b/src/layouts/doc/AppBar.vue index 6b34266..feccbae 100644 --- a/src/layouts/doc/AppBar.vue +++ b/src/layouts/doc/AppBar.vue @@ -15,7 +15,7 @@ - + @@ -67,12 +67,11 @@ export default { return this.DocStore.lang; }, docs() { - return Object.keys(this.DocStore.docs).filter((doc) => doc !== "index"); + return Object.values(this.DocStore.docs).map((doc) => doc[this.lang]).filter((doc) => doc); }, dark() { return this.theme.global.current.dark; }, - files() {}, }, mounted() { this.DocStore.loadDocs(); diff --git a/src/store/doc.js b/src/store/doc.js index 5aedf15..d1c7f2d 100644 --- a/src/store/doc.js +++ b/src/store/doc.js @@ -20,7 +20,7 @@ export const useDocStore = defineStore('doc', { try { const { languages, docs } = getFileTree(); this.languages = languages; - this.docs = docs; + this.docs = docs; } catch (error) { console.log(error); } @@ -29,7 +29,7 @@ export const useDocStore = defineStore('doc', { try { const { language } = this; const doc = this.docs[path] - const content = await doc[language](); + const content = doc[language].content return { content, language, @@ -44,7 +44,7 @@ export const useDocStore = defineStore('doc', { // Function to get the file tree from @doc function getFileTree() { - const tree = import.meta.glob('@docs/**/*.{md,mdx}', { as: 'raw'}) + const tree = import.meta.glob('@docs/**/*.{md,mdx}', { as: 'raw', eager: true }) const docsFiles = {} const languages = new Set() @@ -54,7 +54,15 @@ function getFileTree() { const filename = rest.join('/').replace(/\.mdx?$/, '') docsFiles[filename] = docsFiles[filename] || {} - docsFiles[filename][lang] = imprt + + const vars = extractVars(imprt); + + docsFiles[filename][lang] = { + path, + filename, + content: imprt, + ...vars, + } }) return { @@ -62,3 +70,19 @@ function getFileTree() { docs: docsFiles, } } + + +function extractVars(content) { + const regex = /\[([a-zA-Z]+)\]: \\\\ "(.*)"/g; + const vars = {}; + let m; + + while ((m = regex.exec(content)) !== null) { + if (m.index === regex.lastIndex) { + regex.lastIndex++; + } + + vars[m[1]] = m[2]; + } + return vars; +} \ No newline at end of file diff --git a/src/views/Doc.vue b/src/views/Doc.vue index c2e4c5e..e42f4be 100644 --- a/src/views/Doc.vue +++ b/src/views/Doc.vue @@ -76,8 +76,8 @@ export default { \ No newline at end of file +