npm-parimpar-carlosesalinas
v1.0.0
Published
Permite determinar si un número es par o impar
Downloads
2
Maintainers
Readme
Aquí tienes el texto corregido y mejorado:
Create and Publish a New npm Package
Creating the Package
Initialize npm from the CLI with:
npm init
It will guide you through a series of steps where it will prompt you for the name (unique), version, description, entry point (index.js), test command, Git repository, keywords for search, author, and license.
Press Enter to accept that the information is correct and generate the package file.
- package.json
- Contains information about the module-project we are creating. It follows the Node standard for managing and sharing through [https://www.npmjs.com].
- The information is structured as a JavaScript object with JSON notation.
- package.json
Create a directory named
modules
where our scripts will reside.Inside the
modules
directory, create theparimimpr.js
file.Define the function in the script and export it using
export default
.Import the script from the
index.js
file using theimport + function + from + path with extension
syntax, and invoke the function with parameters.import determineOddEven from "./modules/parimpar.js";
Set up the
"type": "module"
in thepackage.json
file.Execute the program from the environment with:
node index.js
Publish Package on npm
Log in to npm from the CLI:
npm login
Provide the username, password, and email.
We'll received an email with password once, and add it and press enter.
Return to terminal and we'll see
logged in on npmjs.org
Publish the package with public access from CLI to npm
npm publis --access=public