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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kconst

v1.0.23

Published

Mapping constants and their values to different languages. Useful for systems that need to share global constants between different technologies.

Downloads

2

Readme

KConst

Simple overview of use/purpose.

Description

An in-depth paragraph about your project and overview of use.

Getting Started

Installing

npm install kconst -g
npm link kconst --save-dev

Executing program

  • Terminal commands
kconst is a utility to initialize kconst config directory.

Usage:
  kconst init [-d consts dir] [OPTIONS]     This command initializes a new 
                                            constant repository 
  kconst init [-d consts dir] [OPTIONS]


Options:
  -h, --help                        Diplay help usage for kconst
  -v, --version                     Display the current version of kconst
init Options:
  -d, --dir                         Directory for kconst
  -b, --base                        Name for folder of kconst in directory
                                    default is "kconst"
  -B, --noBase                      Place necessary kconst files directly 
                                    into the specified directory outside 
                                    your home folder

Usage

  • Simple declarations
import { KConst, SelectorItem } from "kconst";
export const kconst = new KConst(args) 
export const K = kconst.K;
export const targets:any = {};


//start builds commads
kconst.collectCallbacks();          //collect all declared callbacks in files with recognized extensions
kconst.startDeclarations();         //Execute the collected callbacks according to the type and the standard and defined priorities
kconst.publish();                   //Publish the exported constants in their respective targets
  • Values for arguments
const args:{
    user:string,                    // current user name with run build default is sysyem user
    root:string,                    // root dir of kconst
    mode:BuildMode,                 // mode of build: "dev" | "prod" | "local" | "remote" | "build" | string;
    name?: string,                  // name for configs default is kconst
    exports?:string,                // directory of exports default is "exports"
    targets?:string,                // directory of targets default is "targets"
    triggers?:string,               // directory of triggers default is "triggers"
    events?:string                  // directory of events default is events
    formatter?: FormatterType,      // format for name of constants: 
                                        // FormatterType.REAL_NAME
                                        // FormatterType.UPPER
                                        // FormatterType.LOWER
    priorityOrder?:SelectorItem[],  // priority order: first run in first array possition : default is [ SelectorItem.DEFAULT, SelectorItem.MODE, SelectorItem.USER, SelectorItem.MODE_USER ]
    reverse?:boolean
} = { };
kconst.target(target => {
    targets.simpleNodeFile = target.nodeJs( { className: "K", typescript: true, dir: "./autogen/node", })
    targets.simpleJavaFile = target.java( { className: "K", packageName: "com.simple.kconst", dir: "./autogen/node" })
});
kconst.declares( (exports, override, SELF_NAME, props) => {
    K.SIMPLE_CONST = SELF_NAME; exports( targets.simpleNodeFile  ); //Use selfe name of constant as value
    K.SIMPLE_HELO_WORD = "HELLO WORD"; exports( targets.simpleNodeFile ); //Use a default value to constant
})
//Override all declaratin in this callback block
kconst.declares( (exports, override, SELF_NAME, props) => {
    props.overrideBlock(); 
    K.SIMPLE_HELLO_WORD = "Hello word override in block declaration"; exports( targets.simpleNodeFile );
}, { mode: "dev" })


//Override specific declaration
kconst.declares( (exports, override, SELF_NAME, props) => {

    props.override( () => K.SIMPLE_HELLO_WORD = "Hello word override specific declaration" );
}, { mode: "dev", user:"zootakuxy" });
kconst.trigger( TriggersMethod.DECLARE, TriggerEvent.BEFORE, () => {
    //TODO declare body trigger here
});
import {Declaration} from "kconst";

//Event for listem all constant declarations
kconst.on( ( key,  value, oldValue, replace) => {
    //TODO listener const change here
})

//Event for listem specifics declarations in override
kconst.on( ( key,  value, oldValue, replace) => {
    //TODO listener const change here
}, { applyOn: ["SIMPLE_HELLO_WORD", "SIMPLE_HELLO_WORD_2" ], declarations: Declaration.CREATE })
  • default selector to apply in (KConst.target(), KConst.declares(), KConst.trigger(), KConst.on() }
export type Selector = {
    user?:string|string[],          //Specific user to select
    mode?:BuildMode|BuildMode[],    //Specific mode to select
    label?:string                   //Auxiliar label to help in debug
}

A simple args config with Arguments dependency using command line args

index.ts

import {Arguments} from "zoo.util/lib/arguments";

const args = new Arguments<{ user:string, mode:string }>( true );
args.argument = { name: "user", alias: "u", value: os.userInfo().username, type: String };
args.argument = { name: "mode", alias: "m", value: "dev" };

export const kconst = new KConst({
    root: __dirname,
    user: args.values.user,
    mode: args.values.mode,
    name: "K",
    targets: "targets",
    triggers: "triggers",
    exports: "exports",
    events: "events",
    priorityOrder: [ SelectorItem.USER ]
});

Run using arguments

# using:
node index --user <<userName>> --mode <<buildMode>>
# or using:
node index -u <<userName>> -m <<buildMode>>

Help

Any advise for common problems or issues.

kconst --help

Authors

Contributors names and contact info

@zootakuxy @kadafi