Explorar el Código

refactor(musare.sh): Use package.json lint scripts and autoremove markdown lint container

Owen Diffey hace 1 año
padre
commit
da4ab6e261

+ 4 - 2
backend/.eslintignore

@@ -1,2 +1,4 @@
-node_modules
-build
+.git/
+.parent_git/
+build/
+node_modules/

+ 4 - 1
backend/.prettierignore

@@ -1 +1,4 @@
-node_modules/
+.git/
+.parent_git/
+build/
+node_modules/

+ 2 - 3
backend/.prettierrc

@@ -4,6 +4,5 @@
     "useTabs": true,
     "trailingComma": "none",
     "arrowParens": "avoid",
-    "endOfLine":"auto",
-    "printWidth": 120
-}
+    "endOfLine": "lf"
+}

+ 3 - 7
backend/entrypoint.sh

@@ -2,13 +2,9 @@
 
 if [[ "${CONTAINER_MODE}" == "dev" ]]; then
     npm install --silent
-fi
-
-if [[ "${BACKEND_MODE}" == "prod" ]]; then
-    if [[ "${CONTAINER_MODE}" == "dev" ]]; then
+    if [[ "${BACKEND_MODE}" == "prod" ]]; then
         npm run build
     fi
-    npm run prod
-elif [ "${BACKEND_MODE}" == "dev" ]; then
-    npm run dev -- --legacy-watch --no-stdin
 fi
+
+npm run "${BACKEND_MODE}"

+ 1 - 1
backend/package.json

@@ -12,7 +12,7 @@
     "dev": "nodemon",
     "build": "tsc",
     "prod": "node build/src/main.js",
-    "lint": "eslint --cache logic src",
+    "lint": "eslint . --ext .js,.ts",
     "typescript": "tsc --noEmit"
   },
   "dependencies": {

+ 6 - 2
frontend/.eslintignore

@@ -1,2 +1,6 @@
-node_modules
-dist
+.git/
+.parent_git/
+build/
+dist/fonts/
+dist/assets/
+node_modules/

+ 6 - 2
frontend/.prettierignore

@@ -1,2 +1,6 @@
-node_modules/
-build/
+.git/
+.parent_git/
+build/
+dist/fonts/
+dist/assets/
+node_modules/

+ 8 - 8
frontend/.prettierrc

@@ -1,8 +1,8 @@
-{
-    "singleQuote": false,
-    "tabWidth": 4,
-    "useTabs": true,
-    "trailingComma": "none",
-    "arrowParens": "avoid",
-    "endOfLine":"auto"
-}
+{
+    "singleQuote": false,
+    "tabWidth": 4,
+    "useTabs": true,
+    "trailingComma": "none",
+    "arrowParens": "avoid",
+    "endOfLine": "lf"
+}

+ 1 - 1
frontend/package.json

@@ -12,7 +12,7 @@
   "license": "GPL-3.0",
   "repository": "https://github.com/Musare/Musare",
   "scripts": {
-    "lint": "eslint --cache src --ext .js,.ts,.vue",
+    "lint": "eslint . --ext .js,.ts,.vue",
     "dev": "vite",
     "prod": "vite build --emptyOutDir",
     "typescript": "vue-tsc --noEmit --skipLibCheck",

+ 3 - 3
musare.sh

@@ -301,17 +301,17 @@ case $1 in
         if [[ ${servicesString:0:1} == 1 ]]; then
             if [[ ${servicesString:2:4} == "all" || "${servicesString:2}" == *frontend* ]]; then
                 echo -e "${CYAN}Running frontend lint...${NC}"
-                ${dockerCompose} exec -T frontend npx eslint $cache src --ext .js,.ts,.vue $fix
+                ${dockerCompose} exec -T frontend npm run lint -- $cache $fix
                 frontendExitValue=$?
             fi
             if [[ ${servicesString:2:4} == "all" || "${servicesString:2}" == *backend* ]]; then
                 echo -e "${CYAN}Running backend lint...${NC}"
-                ${dockerCompose} exec -T backend npx eslint $cache logic src $fix
+                ${dockerCompose} exec -T backend npm run lint -- $cache $fix
                 backendExitValue=$?
             fi
             if [[ ${servicesString:2:4} == "all" || "${servicesString:2}" == *docs* ]]; then
                 echo -e "${CYAN}Running docs lint...${NC}"
-                ${docker} run -v "${scriptLocation}":/workdir ghcr.io/igorshubovych/markdownlint-cli:latest ".wiki" "*.md" $fix
+                ${docker} run --rm -v "${scriptLocation}":/workdir ghcr.io/igorshubovych/markdownlint-cli:latest ".wiki" "*.md" $fix
                 docsExitValue=$?
             fi
             if [[ ${frontendExitValue} -gt 0 || ${backendExitValue} -gt 0 || ${docsExitValue} -gt 0 ]]; then