Git Product home page Git Product logo

http-logger's Introduction

Http Logger

A Http logger for Nodejs applications.

Version Documentation Maintenance License: MIT

The project file system tree:

├── .github
│   ├── workflows
│   │   ├── ci.yaml
│   │   └── npm.yaml
├── .husky
│   ├── _
│   │   ├── .gitignore
│   │   └── husky.sh
│   ├── pre-commit
│   └── pre-push
├── src
│   └── index.ts
├── test
│   └── index.test.ts
├── .eslintrc
├── .gitignore
├── .prettierrc
├── .releaserc
├── babel.config.js
├── jest.config.ts
├── LICENSE
├── package-lock.json
├── package.json
├── README.md
├── tsconfig.base.json
├── tsconfig.cjs.json
└── tsconfig.esm.json

The project infrastructure (dev dependencies)

  • Typescript,
  • ESLint - a static code analysis tool,
  • prettier - a code formatter,
  • jest - a testing framework,
  • husky - a tool that allows to use Git hooks,
  • rimraf - a deep deletion module for node.
  • move-file-cli - a cross-platform alternative to mv for build scripts, etc.
  • cz-conventional-changelog" - Prompts for conventional changelog standard.
  • semantic-release - automates the whole package release workflow including:
    • determining the next version number,
    • generating the release notes,
    • publishing the package.

The project dependencies

Local testing

1. Prepare the package archive

  npm run build
  npm pack

2. Use the package archive for testing in a project:

From the root folder of the project install locally

  npm install <abs path to the archive>/ekarpovs-http-logger-0.0.0-development.tgz 

Prepare to publish the package:

2. Sign in with your npm account in the terminal:
```bash
npm login 
follow the on-screen instructions
```

Publish the package:

1. Manual publishing:
  • Check the contents that will be included in the published version of the package:
    npx npm-packlist-cli
  • See what would be done when actually running the command:
    npm publish --dry-run
  • publish the package to npm:
    npm publish --access=public
    Note: --access=public is needed for scoped package (@scope/<package-name>) as it's private by default. If it's not scoped and doesn't have the private field set to true in package.json it will be public as well.
2 Automated publishing:
The publishing process is defined via Github Actions:
- ci.yaml - build and tests.
- npm.yaml - publish the package to the npm registry.
- github.yaml - make package link to the Github registry.
The actions runs automatically after each push and pull-request.
Note: Before running the GitHub Actions, set this two environment variables:
    GITHUB_TOKEN – go to GitHub and select your repository. Then go to Settings/Actions/General. You should find a section called “Workflow permissions.” Ensure that “Read and write permissions” is selected for the GITHUB_TOKEN. We need this to push the newly generated package version to the repository.
    NPM_TOKEN – in your NPM account, go to the “Access Tokens” page and create a new classic token. The type of the new access token should be “Automation”. Copy the token and go to GitHub. In your repository, navigate to “Settings” and “Secrets”. Add a new repository secret named NPM_TOKEN and paste the access token you created in NPM.

Usage the commands from the command line during the development:

Linting:

npm run lint
npm run lint:fix

Commit (use the command instead of git commit for write a conventional message):

npm run commit

Testing:

npm run test

Clean build output:

npm run clean

Build:

npm run build:esm
npm run build:cjs
npm run build

Prepack:

npm run prepack

Pack for local installation:

npm run pack:local

Prepare:

npm run prepare

Git client hooks:

.husky/pre-commit
.husky/pre-push

http-logger's People

Contributors

ekarpovs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.