diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..065f4da --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +# Node modules +node_modules/ + +package-lock.json + +# Dependencias de desarrollo +npm-debug.log +yarn-debug.log* +yarn-error.log* + +# Carpeta de construcción +build/ +dist/ + +# Archivos de configuración +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Dependencias específicas de IDE +.vscode/ +.idea/ + +# Archivos de respaldo y temporales +*.log +*.tmp +*.bak +*.swp +*~ + +# Carpeta de almacenamiento de datos +.db/ + +# Archivos de caché +.cache/ + +# Archivos generados en la compilación +*.class +*.jar +*.war +*.ear +*.exe +*.dll +*.so +*.obj +*.o +*.a +*.lib +*.out +*.log + diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..d19bd1f --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,21 @@ +{ + "arrowParens": "always", + "bracketSameLine": false, + "bracketSpacing": true, + "semi": false, + "experimentalTernaries": true, + "singleQuote": true, + "jsxSingleQuote": true, + "quoteProps": "as-needed", + "trailingComma": "none", + "singleAttributePerLine": false, + "htmlWhitespaceSensitivity": "css", + "vueIndentScriptAndStyle": false, + "proseWrap": "preserve", + "insertPragma": false, + "printWidth": 80, + "requirePragma": false, + "tabWidth": 2, + "useTabs": false, + "embeddedLanguageFormatting": "auto" +} diff --git a/bin/index.js b/bin/index.js new file mode 100755 index 0000000..c1c1570 --- /dev/null +++ b/bin/index.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node + +const { execSync } = require('child_process') +const path = require('path') + +try { + const configPath = path.resolve(__dirname, '../.prettierrc.json') + let args = process.argv.slice(2).join(' ') + const result = execSync( + `prettier "{.,docs,src,bin,test,mocks,app}/**/*.{js,html,md}" --config ${configPath} --check ${args}`, + { stdio: 'inherit' } + ) + if (result !== null) console.log(result) +} catch (error) { + console.log('Run again Prettier with --write arg to fix code style') +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..7e735d8 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "@tinybox/code-format", + "version": "0.1.0", + "description": "", + "main": "./bin/index.js", + "bin": "./bin/index.js", + "scripts": { + "start": "./bin/index.js" + }, + "author": "Juan Martin Muda", + "license": "MIT", + "dependencies": { + "prettier": "^3.2.5" + } +}