ashish_ranjan_satyam_srivastava

Clone or download

Read-only

README.md

Publishing node module in openForge

commands to push

  1. init git
  2. set origin

Npm command

  1. npm init/ npm init -y (to init the npm and set package.json file)
  2. code the index or the main file of the project (index or the main file)
  3. run npm run build
  4. npm login
  5. npm whoami *check the id is correct or not
  6. npm publish

Note

I had used typescript hence:

  1. run npm i -D typescript in terminal after npm init

  2. add tsconfig.json file with configurations and :-

    • add "include": ["folder-name"] used to give the folde name to be compiled
    • add "exclude": ["not-required-folder-names"] like node_modules, test files name
  3. in package.json

  • change *scripts* :-
    • add "build":"tsc" for typescript
    • add "prepare": "npm run build" to prepare the package file for publishing
  • add at the end "files" : ["/lib/**/"] *for pushing only the lib file that was build after npm build on the npm registery
    • or can create a new file .npmignore
  • add "types" : " .d.ts", it tells where the decleration file is
  • Note Don't forget to check the index,js file path