npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

netepscript

v0.10.11

Published

Automate initial setup of Node.js projects with Express, TypeScript, ESLint, and Prettier

Downloads

97

Readme


netepScript 🚀

This script installs Node, Express, TypeScript, ESLint, and Prettier automatically. The idea behind this script is to execute all dependency installations and environment configurations with a single command, streamlining project setup from scratch.

Contents 📚

Prerequisites 🖥️

  • A computer running Windows 🪟 or Linux 🐧 or a Mac with MacOS 🍎
  • Git Bash or Windows Subsystem for Linux (WSL) (only for Windows)
  • A code editor, preferably Visual Studio Code
  • Administrator permissions (optional, for running the script with sudo on Linux)

Installation ⚙️

There are two ways to install netepScript:

Option 1: Using npm (recommended)

To install netepScript using npm, run the following command in your terminal:

npm install -g netepscript
netepscript

Or without installing the library by running:

npx netepscript

Option 2: Downloading the script and running it locally

To use this installation system, first create an empty folder where you will host your project. Download the zip file and unzip it inside that folder. Then, open the folder with your preferred text editor or access it from your operating system's terminal. After all dependencies are installed, you can remove the script file so that it is not included in the script.

On Windows 🪟

  • It's best to use a bash terminal, such as the one available within Visual Studio Code.

  • Open a new bash terminal and make sure you're in the folder where you extracted netepScript.

  • Next, make the script executable by typing in the console:

chmod +x netepScript.v0-9-01.sh
  • Now you're ready to run the script to start the installation process:
./netepScript.v0-9-01.sh

On Linux 🐧 or MacOS 🍎

  • You can access it from Visual Studio Code or directly from the Linux terminal in the folder where you extracted netepScript.

  • Similarly, make the script executable by typing in the console:

chmod +x netepScript.v0-9-01.sh
  • Now you're ready to run the script to start the installation process:
./netepScript.v0-9-01.sh

Scripts 📜

Several scripts have been configured in the package.json file in this project to facilitate development and production:

  • npm run dev # Starts the server in development mode using ts-node-dev.
  • npm run build # Compiles TypeScript code to JavaScript.
  • npm start # Starts the server using compiled code.
  • npm run lint # Runs ESLint to check code quality.
  • npm run format # Runs Prettier to format code.

Project Structure 🏗️

  • The project structure is as follows:
.
├── src
│ ├── config
│ ├── controllers
│ ├── interfaces
│ ├── middlewares
│ ├── models
│ ├── routes
│ ├── servicese
│ ├── index.ts
│ └── server.ts
├── .eslintrc.json
├── .prettierrc
├── .nodemon.json
├── package.json
├── package-lock.json
├── tsconfig.json
├── .env
├── .gitignore
└── README.md
  • src: Main source code folder.
  • config:
  • controllers: Controllers for handling HTTP requests.
  • interfaces: TypeScript interfaces.
  • middlewares: Custom middlewares.
  • models: Data models.
  • routes: Route definitions.
  • services: Application services.
  • index.ts: Main entry file.
  • server.ts: Server configuration file.
  • .eslintrc.json: ESLint configuration.
  • .prettierrc: Prettier configuration.
  • .nodemon.json: Nodemon configuration.
  • package.json: npm configuration file.
  • package-lock.json: npm version lock file.
  • tsconfig.json: TypeScript configuration.
  • .env: Environment variables.
  • .gitignore: gitignore configuration file.

## Database Configuration 🗄️ During the execution of the script, you will be prompted to choose the database configuration. Here are the available options:

  • PostgreSQL with Sequelize
  • PostgreSQL with TypeORM
  • MySQL with Sequelize
  • MongoDB with Mongoose
  • No database engine Depending on your choice, the corresponding dependencies will be installed, and the necessary environment variables will be configured.
  • Configuration Example If you choose PostgreSQL with Sequelize, the pg and sequelize dependencies will be installed, and the following configuration will be added to your .env file:
 #PostgreSQL Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=your_database
DB_USER=your_username
DB_PASSWORD=your_password
  • For MongoDB with Mongoose, the added configuration will be:
# MongoDB Configuration
MONGO_URI=mongodb://localhost:27017/your_database
  • For PostgreSQL with TypeORM, in addition to installing the dependencies, the tsconfig.json file will be updated, and the src/config/data-source.ts file will be created with the basic TypeORM configuration:

src/config/data-source.ts

import { DataSource } from "typeorm";

export const AppDataSource = new DataSource({
  type: "postgres",
  host: process.env.DB_HOST,
  port: Number(process.env.DB_PORT),
  username: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_NAME,
  synchronize: true,
  logging: false,
  entities: ["src/entity/**/*.ts"],
  migrations: ["src/migration/**/*.ts"],
  subscribers: ["src/subscriber/**/*.ts"],
});

AppDataSource.initialize()
  .then(() => {
    console.log("Data Source has been initialized!");
  })
  .catch((err) => {
    console.error("Error during Data Source initialization:", err);
  });

**Configuration ** 🔧

Below are the most important configurations for the project.

  • TypeScript

The tsconfig.json file contains TypeScript configuration. Here's an example of basic configuration:

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true
  },
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules"]
}
  • ESLint

The .eslintrc.json file contains ESLint configuration. Here's an example of basic configuration:

module.exports = {
  parser: "@typescript-eslint/parser",
  plugins: ["@typescript-eslint", "prettier"],
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:prettier/recommended",
  ],
  parserOptions: {
    ecmaVersion: "latest",
  },
  env: {
    es6: true,
  },
  rules: {
    "prettier/prettier": "error",
  },
};
  • Prettier

The .prettierrc file contains Prettier configuration. Here's an example of basic configuration:

{
  "singleQuote": true,
  "trailingComma": "all",
  "semi": true,
  "tabWidth": 2,
  "bracketSpacing": true,
  "arrowParens": "always",
  "endOfLine": "lf"
}
  • Nodemon

The nodemon.json file contains Nodemon configuration. Here's an example of basic configuration:

{
  "watch": ["src"],
  "ext": "ts,json",
  "ignore": ["src/tests/*", "node_modules"],
  "exec": "ts-node src/index.ts"
}

Contributions 💡

Contributions are welcome. If you have any suggestions or improvements, open an issue or pull request to discuss any changes you would like to make.

  • Our Mission

    • To drive the development of quality software, tackling technical challenges with creativity and dedication. We aim not only to solve problems but also to inspire and collaborate with other developers to build a more advanced and accessible digital future.
  • Experience and Collaboration

    • With a combined track record in diverse projects, from web applications to enterprise solutions, we have gained experience in designing robust architectures and implementing effective solutions that meet client needs.
  • Our Commitment

    • We are committed to technical excellence and continuous improvement. We believe in sharing our knowledge through open-source contributions, thus strengthening the global software development ecosystem.

Contact 📬

We are ready to hear your ideas and explore how we can work together to take them to the next level. Contact us today and let's start building the future!

Go to the top ↑


netepScript 🚀

Este script instala Node, Express, TypeScript, ESLint y Prettier automáticamente. La idea de este script es ejecutar todas las instalaciones de dependencias y configuraciones de entorno con un solo comando, agilizando el inicio de proyectos desde cero.

Contenido 📚

Requisitos previos 🖥️

  • Un ordenador con Windows 🪟 o Linux 🐧 o una Mac con MacOS 🍎
  • Git Bash o Windows Subsystem for Linux (WSL) (solo para Windows)
  • Un editor de código, preferentemente utilizar Visual Studio Code
  • Permisos de administrador (opcional, para ejecutar el script con sudo para Linux)

Instalación ⚙️

Hay dos formas de instalar netepScript:

Opción 1: Usando npm (recomendado)

Para instalar netepScript usando npm, ejecuta el siguiente comando en tu terminal:

npm install -g netepscript
netepscript

O sin instalar la librería ejecutando:

npx netepscript

Opción 2: Descargando el script y ejecutarlo localmente

Para utilizar este sistema de instalación, primero crea una carpeta vacía donde alojarás tu proyecto. Descarga el archivo comprimido y descomprímelo dentro de esa carpeta. A continuación, abre la carpeta con tu editor de texto preferido o accede a ella desde la terminal de tu sistema operativo. Después de instalar todas las dependencias, se puede eliminar el archivo del script para que no se incluya en el mismo.

En Windows 🪟

  • Lo ideal es utilizar una terminal de bash, como la que se encuentra disponible dentro de Visual Studio Code.

  • Accede a una nueva terminal de bash, y asegúrate de estar en la carpeta donde has descomprimido netepScript.

  • Luego vamos a convertir el script en ejecutable escribiendo en la consola:

chmod +x netepScript.v0-9-01.sh
  • Luego estamos en condiciones de ejecutar el script para que se inicie el proceso de instalación:
./netepScript.v0-9-01.sh

En Linux 🐧 o MacOS 🍎

  • Puedes acceder desde Visual Studio Code o directamente desde la terminal de Linux en la carpeta donde has descomprimido netepScript.

  • Luego vamos a convertir el script en ejecutable escribiendo en la consola:

chmod +x netepScript.v0-9-01.sh
  • Luego estamos en condiciones de ejecutar el script para que se inicie el proceso de instalación:
./netepScript.v0-9-01.sh

Scripts 📜

En este proyecto se han configurado varios scripts en el archivo package.json para facilitar el desarrollo y la producción:

  • npm run dev # Inicia el servidor en modo de desarrollo utilizando ts-node-dev.
  • npm run build # Compila el código TypeScript en JavaScript.
  • npm start # Inicia el servidor utilizando el código compilado.
  • npm run lint # Ejecuta ESLint para verificar la calidad del código.
  • npm run format# Ejecuta Prettier para formatear el código.

Estructura del Proyecto 🏗️

  • La estructura del proyecto es la siguiente:
.
├── src
│ ├── config
│ ├── controllers
│ ├── interfaces
│ ├── middlewares
│ ├── models
│ ├── routes
│ ├── servicese
│ ├── index.ts
│ └── server.ts
├── .eslintrc.json
├── .prettierrc
├── .nodemon.json
├── package.json
├── package-lock.json
├── tsconfig.json
├── .env
├── .gitignore
└── README.md
  • src: Carpeta principal del código fuente.
  • config:
  • controllers: Controladores para manejar las solicitudes HTTP.
  • interfaces: Interfaces TypeScript.
  • middlewares: Middlewares personalizados.
  • models: Modelos de datos.
  • routes: Definiciones de rutas.
  • services: Servicios de la aplicación.
  • index.ts: Archivo de entrada principal.
  • server.ts: Archivo de configuración del servidor
  • .eslintrc.json: Configuración de Elisnt.
  • .prettierrc: Configuración de Prettier.
  • .nodemon.json: Configuración de Nodemon.
  • package.json: Archivo de configuración de npm.
  • package-lock.json: Archivo de bloqueo de versiones de npm.
  • tsconfig.json: Configuración de TypeScript.
  • .env: Variables de entorno.
  • .gitignore: Archivo de configuración de gitignore.

Configuración de Bases de Datos 🗄️

Durante la ejecución del script, se te pedirá que elijas la configuración de base de datos. Aquí tienes las opciones disponibles:

  • PostgreSQL con Sequelize
  • PostgreSQL con TypeORM
  • MySQL con Sequelize
  • MongoDB con Mongoose
  • Sin motor de base de datos

Dependiendo de tu elección, se instalarán las dependencias correspondientes y se configurarán las variables de entorno necesarias.

  • Ejemplo de Configuración Si eliges PostgreSQL con Sequelize, las dependencias pg y sequelize se instalarán, y se añadirá la siguiente configuración a tu archivo .env:
 #PostgreSQL Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=your_database
DB_USER=your_username
DB_PASSWORD=your_password
  • Para MongoDB con Mongoose, la configuración añadida será:
# MongoDB Configuration
MONGO_URI=mongodb://localhost:27017/your_database
  • Para PostgreSQL con TypeORM, además de instalar las dependencias, se actualizará el archivo tsconfig.json y se creará el archivo src/config/data-source.ts con la configuración básica de TypeORM:

src/config/data-source.ts

import { DataSource } from "typeorm";

export const AppDataSource = new DataSource({
  type: "postgres",
  host: process.env.DB_HOST,
  port: Number(process.env.DB_PORT),
  username: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_NAME,
  synchronize: true,
  logging: false,
  entities: ["src/entity/**/*.ts"],
  migrations: ["src/migration/**/*.ts"],
  subscribers: ["src/subscriber/**/*.ts"],
});

AppDataSource.initialize()
  .then(() => {
    console.log("Data Source has been initialized!");
  })
  .catch((err) => {
    console.error("Error during Data Source initialization:", err);
  });

Configuración 🔧

A continuación se describen las configuraciones más importantes del proyecto.

  • TypeScript

El archivo tsconfig.json contiene la configuración de TypeScript. Aquí tienes un ejemplo de configuración básica:

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true
  },
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules"]
}
  • ESLint

El archivo .eslintrc.json contiene la configuración de ESLint. Aquí tienes un ejemplo de configuración básica:

module.exports = {
  parser: "@typescript-eslint/parser",
  plugins: ["@typescript-eslint", "prettier"],
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:prettier/recommended",
  ],
  parserOptions: {
    ecmaVersion: "latest",
  },
  env: {
    es6: true,
  },
  rules: {
    "prettier/prettier": "error",
  },
};
  • Prettier

El archivo .prettierrc contiene la configuración de Prettier. Aquí tienes un ejemplo de configuración básica:

{
  "singleQuote": true,
  "trailingComma": "all",
  "semi": true,
  "tabWidth": 2,
  "bracketSpacing": true,
  "arrowParens": "always",
  "endOfLine": "lf"
}
  • Nodemon

    El archivo nodemon.json contiene la configuracion de Nodemon. Aquí tienes un ejemplo de configuración básica:

{
  "watch": ["src"],
  "ext": "ts,json",
  "ignore": ["src/tests/*", "node_modules"],
  "exec": "ts-node src/index.ts"
}

Contribuciones 💡

Las contribuciones son bienvenidas. Si tienes alguna sugerencia o mejora, abre un issue o un pull request para discutir cualquier cambio que te gustaría hacer.

Sobre Nosotros 🌍

Somos un equipo de desarrolladores apasionados por la creación de soluciones innovadoras y robustas en el ámbito de la programación. Nos especializamos en el desarrollo de aplicaciones escalables y eficientes utilizando tecnologías modernas y buenas prácticas de ingeniería de software.

  • Nuestra Misión

    • Impulsar el desarrollo de software de calidad, abordando desafíos técnicos con creatividad y compromiso. Buscamos no solo resolver problemas, sino también inspirar y colaborar con otros desarrolladores para construir un futuro digital más avanzado y accesible.
  • Experiencia y Colaboración

    • Con una trayectoria combinada en proyectos diversos, desde aplicaciones web hasta soluciones empresariales, hemos adquirido experiencia en el diseño de arquitecturas sólidas y en la implementación de soluciones eficaces que cumplen con las necesidades del cliente.
  • Nuestro Compromiso

    • Estamos comprometidos con la excelencia técnica y la mejora continua. Creemos en compartir nuestro conocimiento a través de código abierto y contribuciones a la comunidad, fortaleciendo así el ecosistema de desarrollo de software global.

Contacto 📬

Estamos listos para escuchar tus ideas y explorar cómo podemos trabajar juntos para llevarlas al siguiente nivel. ¡Contáctanos hoy y comencemos a construir el futuro!

Ir arriba de todo ↑