npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

enetpulse-media-api

v1.3.21

Published

Media handler API.

Downloads

6

Readme

Media - API

Table of Contents

General Information

The API provides various media management features.

  • Resizing of images
  • Formatting of images
  • Formatting of videos

Setup

Before installing the application make sure you have the appropriate version of NodeJS installed. Check the package.json under engines. You can use this guide for nvm to setup multiple NodeJS versions on your machine.

npm install

Startup

This project uses typescript to make the development process more efficient. Therefore when this gets run in production the project has to be build. Normally this gets handled by the release pipelines. If you wish however to build and run the project simulating the release pipeline, use the following commands:

To build the project without running it:

npm run build

To build the project and run it (note server does not restart automatically on code change)

npm start

To run the project in development mode without building it (server restarts automatically on code change)

npm run dev

Note the above commands use tsconfig-paths to leverage the paths property from the tsconfig.json.

Important DevDependencies

Various dev dependencies are installed in order to improve the development live cycle. Here are some of the most important.

  • commitlint/cli is used to enforce conventional commit message formatting. Rules can be found in the link under the package name.
  • commit-and-tag-version is used to auto bump versions and create a changelog. Configuration can be found in .versionrc.json. It is meant to be used before a release by running one of the following commands:

For updating the second decimal version (mid tear release)

npm run release

For updating the third decimal version (minor level release)

 npm run release:minor

For updating the first decimal version (major release)

 npm run release: major

These might be integrated in to the gitlab pipelines.

  • eslint in combination with prettier are used to make sure the code is formatted and linted. Their true power shines when combined with husky and lint-staged to make sure that no code with linting and style mistakes gets pushed to the repository.

  • dotenv is used to store environment variables that might change based on the server stage. It also helps with security since it does not get pushed to gitlab.

Developing on the project

Importing functions between folders

In order to avoid long imports when importing between folders and reaching the point where your imports look like this:

import { functionName } from '../../../deeplyNestedParent/deeplyNestedChild/deeplyNestedGrandChild/deeplyNestedFile.ts'

We have leveraged typescripts ability to to declare absolute import paths. All you need to do is declare the shortened path and the folder/file it leads to, in the tsconfig.json under compilerOptions.paths. This will make your imports look like this:

import { ResponseHelper } from '@media-api-helpers'

!!!!NOTE When creating a new file and including it in the tsconfig paths, your IDE wont resolve the path untill you use the imported functions and build the project.

Read more about shortened imports here

Committing changes

As mentioned in the Important DevDependencies, there are several packages that take care of the integrity and maintainability of the codebase. The one that ties them together is husky. After initial install of the dependencies, husky creates a .husky folder, containing scripts ran before and during code commit. In order to add a new script run the following command:

npx husky add .husky/insert-your-commit-stage-here "insert your script here"

The existing scripts are:

pre-commit

npx --no-install lint-staged

runs the code linter trough all staged files. It is recommended to run this script yourself before attempting a commit for easier and faster fixes of linting mistakes.

check the commit message to make sure it is suitable for the automated generation of a changelog.

npx --no-install commitlint --edit