1.0.2-alpha • Published 3 years ago

vitals-create-app v1.0.2-alpha

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
3 years ago

Vitals create app

NPM script for create and start with new vitals app.

Crate node cli software

Run app: node index.js

Dev mode

For run dev mode: npm run dev

Opzioni cli

  1. -- no-run - Not start application when installation is ended
  2. -- template - Github template url NB: Deprecata per ora
  3. -- use-yarn - Force npm use instead of yarn
  4. -- debug - Show database connection error

Databsae params (required):

  1. -- dbclient - Database type: "sqlite", "mysql", "postgres", "mongo". Just mongo allow in V1 - NB: Viene anche richiesto da CLI
  2. -- mongoString - Use one string for connect Mongo db
  3. -- dbhost - Host address for databsae

Only for mongo 2. -- dbssl - SSL is enable 3. -- dbauth - Authentication for db

Comandi di default non specificati comuni a tutti i software CLI:

  1. --help - Ritorna l'elenco dei parametri disponibili
  2. --version - Show version (in this case is the same package.json)

Plugin per gestire la Cli: meow – Simple command-line helper. chalk – Terminal string styling. yargs – Command-line opt-string parser.

Multi NodeJS package (NPM) Development and debug

For this starter package we have need ability to deep track all errors and error content. Very good solution is @sentry/node - node library for track error.

Next we have decided to dev a custom node package as helper library for error tracking (always based on sentry). In essence are a simple Typescript class that init Sentry and provid some error tracking function.

The ultimate need is the development and his debug of the new package, at the same time I have to be able to test it integrated into this package. First of read readme.md of Vitals-track-event, publish a very simple version of Node library.

NB: Attenzione alla corretta esportazione del modulo e dei suoi tipi. (Consigliamo di vedere la documentazione relativa al package node-template).

Once published, we proceed to install it in this package (or in the one that requires it), we import the main class and we initialize the library.

When base template works next step is open a new Visual Code window and open "Vitals-track-event" from node_modules folder in this package.

Now we can develop package and test in real time on main importation. We can use npm run dev or npm run build. NB: Changes in the src folder must also be reported on the official repo

BIN file

Attention! This is a npx CLI script. We need to tell to node the start script is binary. In entry poin file ./src/index.ts add as first line this:

#!/usr/bin/env node

Todo

Move this code to typescript with webpack Inserire ssenty per node