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

@gik/npm

v0.1.17

Published

Scripts for your ECMAScript workflow.

Downloads

18

Readme

@gik/npm 0.1.17

Scripts for your ECMAScript workflow.

Contributors
Supported platforms
  • linux
  • darwin

Table of contents

  • gik Centralizes and automates the management of projects based on ECMAScript.
  • Scripts The tasks available to run against your project.
  • build Transpiles the current project using babel.
  • docs Generates documentation using js-to-markdown.
  • lint Validates the code complies with certain rules.
  • start A watcher for your scripts using nodemon.
  • test Runs unit tests using Jest.
  • version Automates the versioning of your project using semver.
  • Configuration The default settings that control the behaviour of the scripts.

gik

Centralizes and automates the management of projects based on ECMAScript.

create-react-app inspired us to build this tool, it made our life way easier and so we decided to apply the same principle to our workflow: A single place where to put all the configuration and automation for our projects in ECMAScript (meaning Node, Cycle, Webpack, React, etc.)

Installation

Nothing special, just like every other tool in your arsenal, install as development dependency and you're good to go.

npm install --save-dev @gik/npm
Setup

Just add a reference to the "binary" gik and pass the needed arguments according to the task you wish to execute.

Parameters
Example package.json
{
    "scripts": {
        "build": "gik build",
        "ver": "gik version patch",
    }
}
Members

▲ Top


Scripts

The tasks available to run against your project.

To do
  • [ ] Add typedef for error codes and Observables.
Members

▲ Top


build

Transpiles the current project using babel.

Base (.babelrc)`
{
    "presets": [
        [
            "@babel/env",
            {
                "targets": {
                    "node": "current"
                },
                "modules": "commonjs",
                "useBuiltIns": false,
                "loose": false
            }
        ]
    ],
    "plugins": [
        // STAGE-2
        "@babel/plugin-proposal-class-properties",
        [
            "@babel/plugin-proposal-decorators",
            {
                "legacy": true
            }
        ],
        "@babel/plugin-proposal-export-namespace-from",
        "@babel/plugin-proposal-function-sent",
        "@babel/plugin-proposal-json-strings",
        "@babel/plugin-proposal-numeric-separator",
        "@babel/plugin-proposal-throw-expressions",
        "@babel/plugin-syntax-dynamic-import",
        "@babel/plugin-syntax-import-meta"
    ]
}

The following package.json properties are available to you in case you wish to modify the default behaviour.

Properties
Returns

gik.Types.Observable - An observable which gik will subscribe to in order to execute it.

▲ Top


docs

Generates documentation using js-to-markdown. The template used for the documentation is customised, you can see how it looks here, since this very documentation was generated by it. This is why even though this script uses js-to-markdown several of their configuration properties are not available due to the heavy customisation it was done to its original template. However the following ARE available.

Default jsdoc.json config
{
    "sourceType": "module",
    "recurseDepth": 10,
    "tags": {
        "allowUnknownTags": true,
        "dictionaries": ["jsdoc","closure"]
    },
    "templates": {
        "cleverLinks": false,
        "monospaceLinks": false
    },
    "plugins": [
        "node_modules/jsdoc-babel"
    ]
}
Properties
Returns

gik.Types.Observable - An observable which gik will subscribe to in order to execute it.

To do
  • [ ] Add documentation about how to customize the template and the available helpers.

▲ Top


lint

Validates the code complies with certain rules. It's recommended that you install one of the flavours of eslint-config to accompany this script. it will be as easy as to include an .eslintrc file extending the module.

Parameters
Returns

gik.Types.Observable - An observable which gik will subscribe to in order to execute it.

Example package.json
{
    "directories": {
        "example": './example'
    },
    "scripts": {
        "lint": "gik lint example"
    },
    "devDependencies": {
         "@gik/eslint-config-node": "x.x.x" // Pick a flavour according to your project
    }
}
Example .eslintrc
{
    "extends": "@gik/node" // Same as the module but without "eslint-config"
}

▲ Top


start

A watcher for your scripts using nodemon.

Below are the default properties that are being sent to the nodemon binary.

Parameters
Properties
Related
  • https://github.com/remy/nodemon#config-files
Returns

gik.Types.Observable - An observable which gik will subscribe to in order to execute it.

▲ Top


test

Runs unit tests using Jest. This script makes no assumptions for the jest configurations, it just transpiles the test files using the same configuration as the build script and uses Jest's defaults. Below is the configuration file used by the script.

Default configuration .jest.js
const PATH = require('path');

module.exports = {
    verbose: true,
    bail: true,
    collectCoverage: true,
    testMatch: ['**/__tests__/**/*.js?(x)'], // only files inside the __tests__ folder
    transform: {
        '^.+\\.jsx?$': PATH.join(__dirname, 'lib', 'test-transform'),
    },
};

you can customize the arguments sent to the jest cli interface by changing the following properties on package.json.

Properties
Returns

gik.Types.Observable - An observable which gik will subscribe to in order to execute it.

Example package.json
{
    "@gik/npm": {
         "jest": {
              "config": "path/to/your/config",
         }
     }
    "scripts": {
        "test": "gik test", // runs test on all files on "./test"
        "test:cover": "gik test cover", // runs test and generates coverage report
    }
}

▲ Top


version

Automates the versioning of your project using semver. internally uses npm version (avoiding tagging) and after modifying package.json adds it to git. This is specially useful if you add it to a precommit script (already available when using this library via husky), making the change available on that commit automatically.

Available semver types:
  • major 0.0.0 -> 1.0.0
  • minor 0.0.0 -> 0.1.0
  • patch 0.0.0 -> 0.0.1
  • prerelease
    • 0.0.0 -> 0.0.0-1
    • 0.0.0-beta -> v0.0.0-beta.0
    • 0.0.0-beta.0 -> 0.0.0-beta.1
Parameters
Returns

gik.Types.Observable - An observable which gik will subscribe to in order to execute it.

Example packge.json
{
    "scripts": {
        // builds, bumps package.json and generartes docs using the new version
        "precommit": "gik build && gik version patch && git-npm docs"
    }
}

▲ Top


Configuration

The default settings that control the behaviour of the scripts.

Properties
Example package.json
{
    "directories": {
         "src": "./src",
         "out": "./lib"
     },
    "scripts": {
         "example": "your-script $npm_package_directories_src"
     },
    "@gik/npm": {
        "doc": "./README.md"
    },
}

▲ Top