Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@form8ion/javascript-core

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@form8ion/javascript-core

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

  • 2.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.8K
decreased by-47.61%
Maintainers
2
Weekly downloads
 
Created
Source

javascript-core

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

Build Status

Table of Contents

Usage

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

Installation

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

Example

Import
import {scaffoldUnitTesting, scaffoldChoice, installDependencies, PROD_DEPENDENCY_TYPE} from '@form8ion/javascript-core';
Execute
(async () => {
  await scaffoldUnitTesting({
    projectRoot: process.cwd(),
    frameworks: {
      Mocha: {scaffolder: () => undefined},
      Jest: {scaffolder: () => undefined}
    },
    visibility: 'Public',
    vcs: {host: 'GitHub', owner: 'foo', name: 'bar'}
  });

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

  await installDependencies(['foo', 'bar'], PROD_DEPENDENCY_TYPE);
})();

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

scaffoldUnitTesting

Scaffolder for enabling unit-testing in a project with the ability to choose a desired framework from provided options.

Takes a single options object as an argument, containing:

projectRoot string (required)

path to the root of the project

frameworks object (required)

A choices object for defining unit-testing framework options

decisions object (optional)

Answers for prompt questions so that the prompt is skipped at execution time

  • keys: string Name of the prompt question
  • values: Hard-coded answer for the prompt question
visibility string (required)

visibility of the project (Public or Private)

vcs object (required)
  • host string (required) VCS hosting service
  • owner string (required) account name on the host service for the repository
  • name string (required) repository name
unitTestFrameworksSchema

joi schema for the choices required for the unit-testing scaffolder

installDependencies

A function that installs the provided package dependencies.

Takes two 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.

Dependency-types Constants

Constants to define the valid options for dependenciesType

  • PROD_DEPENDENCY_TYPE
  • DEV_DEPENDENCY_TYPE
questionNames

Constants defining the question names for the prompts implemented in this package

projectTypes

Constants defining the types of possible JavaScript projects

  • APPLICATION
  • PACKAGE
  • CLI
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

Contributing

PRs Welcome Conventional Commits Commitizen friendly semantic-release Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test

FAQs

Package last updated on 29 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc