1.0.12 • Published 4 years ago

@karantickets/common v1.0.12

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago
Common NPM custom registry

Custom NPM module to share common code across all the middlewares.

NOTE:

Check the package.json file.

npm login
npm publish --access public

These will be written in TS but published in JS.

dependencies
npm install typescript del-cli --save-dev
to convert TS to JS and build the project
  • add this to package.json
"scripts": {
    "clean": "del-cli ./build/*",
    "build": "npm run clean && tsc"
  },
  • uncomment below lines in tsconfig.json
    "declaration": true, /* Generates corresponding '.d.ts' file. */
    "outDir": "./build",
  • run :
npm run build

This will take the TS file we coded, convert it into JS and write it into the build directory

If we want to publish it, we want to make sure we make changes so that the use/us while importing this module get access to the built file in the build folder instead of the index.js file in the root directory. Therefore, package.json:

  "main": "./build/index.js", // main file
  "types": "./build/index.d.ts", // main type def file 
  "files": [
    "build/**/*" // files which will be included in the final published module
  ],

Further, if you make any changes to the source code and want to patch it as a new version, you can either manually change the version number in the package.json file or simply:

note: make sure you commit your changes to git first
npm version patch

This won't publish it! In order to do so:

npm run build 
npm publish
1.0.12

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago