1.0.0 • Published 5 months ago

npm-parimpar-carlosesalinas v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Aquí tienes el texto corregido y mejorado:


Create and Publish a New npm Package

Creating the Package

  1. 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.

  2. 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.
  3. Create a directory named modules where our scripts will reside.

  4. Inside the modules directory, create the parimimpr.js file.

  5. Define the function in the script and export it using export default.

  6. Import the script from the index.js file using the import + function + from + path with extension syntax, and invoke the function with parameters.

    import determineOddEven from "./modules/parimpar.js";
  7. Set up the "type": "module" in the package.json file.

  8. Execute the program from the environment with:

    node index.js

Publish Package on npm

  1. Log in to npm from the CLI:

    npm login
  2. Provide the username, password, and email.

  3. We'll received an email with password once, and add it and press enter.
  4. Return to terminal and we'll see logged in on npmjs.org
  5. Publish the package with public access from CLI to npm
npm publis --access=public
1.0.0

5 months ago