scripts-dev

Tools and utilities for node js developmen with babel

Usage no npm install needed!

<script type="module">
  import scriptsDev from 'https://cdn.skypack.dev/scripts-dev';
</script>

README

Development tools for Node JS applications

This is a small package for doing some task when we are developing node apps. It provides three scrips that we can use in our package.json

Scripts includes:

  • build
  • dev
  • start

Installation

We install the package with npm command

npm i --save scripts-dev

Configuration

Add in your package.json file the following lines inside "scripts"

"scripts": {
    "start": "app start",
    "dev": "app dev",
    "build": "app build"
  },

Usage

dev

If we are working in our maching with the code and we need to run the application for testing the code, we can use the run dev command.

npm run dev

This command execute nodemon with the file in src/index.js.

If we have some file like:

  • .env
  • .env.development
  • .env.production

when we run dev command it uses internally two packages, 'dotenv' and 'dotenv-expand', and we will have all enviroment available in our project.

build

As a mentioned before, we use this package when we use babel in our application. If we are ready for compiling the app, execute the following command:

npm run build

After compiling the app, the script will create a dist folder where, using babel, all files in src folde will be compiling in dist folder.

start

npm run start

using this command, the app will be started in production mode, using the file in dist/index.js