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

@form8ion/javascript-core

v12.3.0

Published

core logic for form8ion tools related to JavaScript, like javascript-scaffolder and lift-javascript

Downloads

37,821

Readme

coverageShouldBeReported# javascript-core

core logic for form8ion tools related to JavaScript, like javascript-scaffolder and lift-javascript

Node CI Workflow Status Codecov SLSA Level 2 OpenSSF Scorecard

Table of Contents

Usage

MIT license npm node Try @form8ion/javascript-core on RunKit

Installation

$ npm install @form8ion/javascript-core --save-prod

Example

Import

const {scaffoldChoice} = require('@form8ion/javascript-core');

Execute

(async () => {
  await scaffoldChoice(
    {foo: {scaffold: options => options}},
    'foo',
    {bar: 'baz'}
  );
})();

API

scaffoldChoice

A generic function that executes the scaffolder function from a provided map of options based on the chosen option name.

Takes three unnamed arguments:

choices object (required)
  • keys: string Name of the choice
  • values: object
    • scaffolder: function (required) scaffolds the choice options
choice string (required)

Name of the choice. SHOULD match a key from the choices object.

options object (optional)

options object to be passed as the only argument to the chosen scaffolder

installDependencies

A function that installs the provided package dependencies.

Takes four unnamed arguments:

dependencies list of strings (required)

The list of package names to be installed.

dependenciesType string (required)

Defines if the provided list of package names should be installed as prod or dev dependencies. If "dev" is provided, the list will be installed with the --save-exact flag.

projectRoot string (optional)

Filesystem path to the root of the project

packageManger string (optional)

Specifies the name of the package manager to be used for dependency installation. Defaults to npm

Dependency-types Constants

Constants to define the valid options for dependenciesType

  • PROD_DEPENDENCY_TYPE
  • DEV_DEPENDENCY_TYPE

projectTypes

Constants defining the types of possible JavaScript projects

  • APPLICATION
  • PACKAGE
  • CLI

packageManagers

Constants defining the available package managers

  • NPM
  • YARN

dialects

Constants defining the available JavaScript source dialects

  • COMMON_JS
  • BABEL
  • ESM
  • TYPESCRIPT

projectTypeShouldBePublished

Predicate function to determine if the project-type is one that should be published

Takes one argument:

projectType string (required)

Should be one of the project-type options

coverageShouldBeReported

Predicate function to determine if coverage should be reported

Takes two arguments:

visibility string (required)

visibility of the project (Public or Private)

tests object (required)
  • unit boolean (optional) Whether the project will be unit-tested

writePackageJson

Writes the provided config to the package.json for the project

Accepts an options object as the only argument, with the following properties:

projectRoot string (required)

Filesystem path to the root of the project

config object (required)

The config to be written to the package.json as the entire contents of the file

mergeIntoExistingPackageJson

Merges the provided config into the existing package.json for the project

Accepts an options object as the only argument, with the following properties:

projectRoot string (required)

Filesystem path to the root of the project

config object (required)

The config to be merged with the existing contents of the package.json

Node version categories

Helpers for determining supported node.js versions in categories defined by package support guidelines. Refer to the release schedule for current statuses.

determineLtsNodeMajorVersions

Returns a list of the major LTS versions currently in active or maintenance status, optionally filtered by a provided semver range.

Accepts an options object as the only argument, with the following properties:

withinRange string (optional)

A semver range, compatible with node-semver, to filter the list of active major LTS versions by.

determineSupportedNodeMajorVersions

Returns a list of the major versions currently not in end-of-life status, optionally filtered by a provided semver range.

Accepts an options object as the only argument, with the following properties:

withinRange string (optional)

A semver range, compatible with node-semver, to filter the list of active major LTS versions by.

Contributing

PRs Welcome Conventional Commits Commitizen friendly semantic-release Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test