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

webpack-timetracker

v1.0.8

Published

Webpack plugin to track time spent working on a webpack project.

Downloads

21

Readme

What is it

Webpack plugin to track time spent working on a webpack project.

screenshot of simple console reporter

Install

npm install webpack-timetracker
yarn add webpack-timetracker

Usage

Simply import the plugin and use it in webpack config. No further configuration needed!

A new directory will be created in the root of your project called .webpacktime. Keep this directory and all files inside tracked by your VCS of choice.

// sample webpack.config.js
let path = require('path');
let TimeTracker = require('./src/main.js');

module.exports = {
	entry: './testapp/entry.js',
	output: {
		path: path.join(path.resolve(__dirname), 'out'),
		filename: 'bundle.js'
	},
	devServer: {
		publicPath: '/out/'
	},
	plugins: [new TimeTracker({ })]
};

Git dependency

If you are not using git as your tracking system, or does not have git command line tools installed, the plugin will fail to determine user name. You can choose to use other user name discovery strategy:

plugins: [new TimeTracker({
	usernameStrategy: 'unixuser'
})]

How it works

After every webpack compilation, a log file is written with timestamp and list of changed files. Every user gets their own file. By default, the plugin treats intervals larger than 15 minutes as stopped work. So as long as two separate compilations happened 15 minutes of each other, the difference will be counted to total time spent.

Development

Run these scripts:

// start typescript transpiler
npm run start:ts

// strat sample webpack project to test your plugin with
npm start

Then trigger webpack compilation with some changes in /testapp/*.js files.

The project is written in typescript and it is leveraging classes and interfaces in it's architecture. The layers are:

  • The plugin itself, connecting all the layers - Main.ts
  • Mappers(should find better name) - these persist and reads logs. Right now only one mapper is implemented - filesystem mapper. In the future, we can persist to mongo db or APIs. This will solve problem with git merges
  • Analyzer - reads data from mapper and does computations over it
  • Reporter - takes data from analyzer and does some visualisation over it (essentially displaying analyzed data to end user)

Todo

  • ~~reporting~~
    • improve reporting (by day, by file)
  • Username strategy can be a promise = implement smart username strategy runner
  • Username strategy can be automatically detected
    • make sure that username won't change during development though
    • implement mergeusernames in config to report multiple users as a single user
  • detect file changes by git checkout (and similar) to prevent tracking polution
  • dependency injection - so we can declare other writers / readers in config
    • ~~Reader is only model for Reporter~~
  • add mongo persistence