fast-outdated

Fast and Programmatically npm outdated --json implementatin that use pacote to achieve similar result.

Usage no npm install needed!

<script type="module">
  import fastOutdated from 'https://cdn.skypack.dev/fast-outdated';
</script>

README

Fast-outdated

version Maintenance MIT dep size Known Vulnerabilities

Fast and Programmatically npm outdated --json implementation that use pacote to achieve similar result.

Requirements

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i fast-outdated
# or
$ yarn add fast-outdated

Usage example

const { outdated, clearCache } = require("fast-outdated");

async function main() {
    clearCache();
    const data = await outdated(void 0, { devDependencies: true });
    console.log(JSON.stringify(data, null, 4));
}
main().catch(console.error);

API

declare namespace Outdated {
    interface Packages {
        [packageName: string]: {
            wanted: string;
            current: string;
            latest: string;
            location: string;
        }
    }

    interface Options {
        devDependencies?: boolean;
        token?: string;
    }

    export function outdated(cwd?: string, options?: Options): Promise<Packages>;
    export function clearCache(): any;
}

export as namespace Outdated;
export = Outdated;

outdated(cwd?: string, options?: Outdated.Options): Promise< Outdated.Packages >

Will give you equivalent result that the command npm outdated --json. The default cwd value will be equal to process.cwd().

Options:

name default value description
devDependencies false Include devDependencies
token undefined npm token for private packages

clearCache()

Call pacote.clearMemoized.

Roadmap

  • Improve test suite

License

MIT