Desarrollo y Mantenimiento de Sistemas Informáticos

4º. 1er cuatrimestre. Itinerario de Sistemas de la Información. Grado en Ingeniería Informática. ULL


Organization DMSI org   Github Classroom DMSI class   Campus Virtual DMSI campus   Profesor Casiano   Chat Chat

Clase del Lunes 2021/12/13

Práctica Publishing an npm module

  1. Publicaremos un módulo npm con el código js y el ejecutable en el ámbito del alumno
  2. Comenzaremos a aprender Vue.js
  3. Hablaremos del Trabajo Fin de Asignatura

gh-repo-rename-aluXXXX.js

➜  gh-cli-graphql-casiano-rodriguez-leon-alumnoudv5 git:(main) ✗ ./gh-repo-rename-aluXXXX -o ULL-ESIT-DMSI-1922 -r prueba-funciona  -n prueba
➜  gh-cli-graphql-casiano-rodriguez-leon-alumnoudv5 git:(main) ✗ ./gh-repo-rename-aluXXXX -o ULL-ESIT-DMSI-1922 -r prueba-funciona  -n prueba
gh: Could not resolve to a Repository with the name 'ULL-ESIT-DMSI-1922/prueba-funciona'.
➜  gh-cli-graphql-casiano-rodriguez-leon-alumnoudv5 git:(main) ✗ ./gh-repo-rename-aluXXXX -o ULL-ESIT-DMSI-1920 -r prueba  -n prueba-antonella
gh: Name already exists on this account

Package.json

bash script

#!/usr/bin/env bash

# Determine if an executable is in the PATH
if ! type -p node >/dev/null; then
   echo "Node not found on the system. Can't work" >&2
   exit 1
fi

# ${BASH_SOURCE[0]} (or, more simply, $BASH_SOURCE[1] ) contains the (potentially relative) path of the containing 
# script in all invocation scenarios, notably also when the script is sourced, which is not true for $0.
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

node ${SCRIPT_DIR}/gh-repo-rename-aluXXXX.js "$@"

Entendiendo el script:

#SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
SCRIPT_DIR="$( dirname -- "${BASH_SOURCE[0]}" )"
SCRIPT_DIR="$( dirname -- "${BASH_SOURCE[0]}" )"
WITH0="$( dirname -- "$0")"
echo $WITH0 $SCRIPT_DIR

Ejecuciones:

[~/campus-virtual/1920/dmsi1920/apuntes(master)]$ bash /tmp/bash_source 
/tmp/bash_source /tmp
[~/campus-virtual/1920/dmsi1920/apuntes(master)]$ bash /tmp/bash_source 
/tmp /tmp
[~/campus-virtual/1920/dmsi1920/apuntes(master)]$ . /tmp/bash_source 
. /tmp

GitHub GraphQL Explorer

Ejemplos

Referencias