Skip to content

Commit

Permalink
Añadido: manu-http-server-simple con npm
Browse files Browse the repository at this point in the history
  • Loading branch information
neverkas committed Feb 9, 2023
1 parent 6ee17e6 commit 93fa3d6
Show file tree
Hide file tree
Showing 9 changed files with 1,015 additions and 0 deletions.
195 changes: 195 additions & 0 deletions manu-http-server-simple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# Created by https://www.toptal.com/developers/gitignore/api/emacs,node
# Edit at https://www.toptal.com/developers/gitignore?templates=emacs,node

### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# Org-mode
.org-id-locations
*_archive

# flymake-mode
*_flymake.*

# eshell files
/eshell/history
/eshell/lastdir

# elpa packages
/elpa/

# reftex files
*.rel

# AUCTeX auto folder
/auto/

# cask packages
.cask/
dist/

# Flycheck
flycheck_*.el

# server auth directory
/server/

# projectiles files
.projectile

# directory configuration
.dir-locals.el

# network security
/network-security.data


### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

# End of https://www.toptal.com/developers/gitignore/api/emacs,node
43 changes: 43 additions & 0 deletions manu-http-server-simple/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-include Makefile.cfg

.DEFAULT_GOAL=help

NPM_BIN_LOCAL_DIRECTORY = $$(npm bin)
NPM_BIN_LOCAL_DIRECTORY_ALTERNATIVE = node_modules/.bin

##@ Comandos
init: install-npm-packages ## Inicializar proyecto
$(info Proyecto npm inicializado)

check-npm-bin-directory:
ifneq ("$(wildcard $(NPM_BIN_LOCAL_DIRECTORY))", "")
$(error "No existe la carpeta de npm, intentá ejecutar make install-npm-packages")
endif

# Nota: el doble $ es para que NO lo evalué como una macro de GNU Make
r run: ## Ejecutar Servidor HTTP
@$(NPM_BIN_LOCAL_DIRECTORY)/$(PACKAGE_HTTP_SERVER) $(HTTP_SERVER_PARAMS)

# Nota: alternativa, si el otro target run no funcione
ra run-alternative: ## Ejecutar Servidor HTTP (Exportando ./node_modules/ como variable de entorno)
$(info Agregando la ruta node_modules/.bin como variable de entorno en $$PATH de ésta shell..)
@export PATH="$$PATH:$(NPM_BIN_LOCAL_DIRECTORY_ALTERNATIVE)" && \
$(PACKAGE_HTTP_SERVER) $(HTTP_SERVER_PARAMS)

##@ Comandos Extra
# Nota: con --yes en el npm init, nos evita completar los datos de package.json
i install-npm-packages: ## Instalar paquetes npm
@npm init --yes && npm install $(NPM_PACKAGES) --save-dev

u update-npm-packages: ## Actualizar paquetes npm
@npm install $(NPM_PACKAGES) --save-dev

##@ Utilidades
c clean: ## Limpiar recursos
@-rm -vf package*.json
@-rm -rvf node_modules/

h help: ## Mostrar menú de ayuda
@awk 'BEGIN {FS = ":.*##"; printf "\nOpciones para usar:\n make \033[36m\033[0m\n"} /^[$$()% 0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

.PHONY: h help init r run ra run-alternative c clean i install-npm-packages u update-npm-packages
5 changes: 5 additions & 0 deletions manu-http-server-simple/Makefile.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: usar nombre@version-especifica
PACKAGE_HTTP_SERVER = light-server
HTTP_SERVER_PARAMS = --serve public \
--port 8000
NPM_PACKAGES = $(PACKAGE_HTTP_SERVER)
10 changes: 10 additions & 0 deletions manu-http-server-simple/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#+TITLE: Manu Http Server Simple
* ¿Qué es?
- Simple servidor http que utiliza el paquete npm ~light-server~
* ¿Para qué sirve?
- Ejecutar paquetes npm del proyecto inicializado
- Evitar instalar paquetes npm de forma global con -g
* Requisitos
- Requiere tener instalado las siguientes tecnologías
1) npm
2) nodejs
Loading

0 comments on commit 93fa3d6

Please sign in to comment.