npm-parimpar-carlosesalinas
v1.0.0
Published
Permite determinar si un número es par o impar
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 initIt 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
moduleswhere our scripts will reside.Inside the
modulesdirectory, create theparimimpr.jsfile.Define the function in the script and export it using
export default.Import the script from the
index.jsfile using theimport + function + from + path with extensionsyntax, and invoke the function with parameters.import determineOddEven from "./modules/parimpar.js";Set up the
"type": "module"in thepackage.jsonfile.Execute the program from the environment with:
node index.js
Publish Package on npm
Log in to npm from the CLI:
npm loginProvide 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.orgPublish the package with public access from CLI to npm
npm publis --access=public