Skip to content

form8ion/javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

javascript

JavaScript language plugin for the @form8ion toolset

Node CI Workflow Status Codecov OpenSSF Scorecard SLSA Level 2

Table of Contents

Usage

MIT license npm node Try @form8ion/javascript on RunKit

Installation

$ npm install @form8ion/javascript --save

Example

Import

const {dialects, projectTypes} = require('@form8ion/javascript-core');
const {
  scaffold: scaffoldJavaScript,
  lift: liftJavascript,
  test: thisIsAJavaScriptProject,
  scaffoldUnitTesting,
  questionNames
} = require('@form8ion/javascript');

Execute

(async () => {
  const accountName = 'form8ion';
  const projectRoot = process.cwd();

  await scaffoldJavaScript({
    projectRoot,
    projectName: 'project-name',
    visibility: 'Public',
    license: 'MIT',
    configs: {
      eslint: {scope: `@${accountName}`},
      remark: `@${accountName}/remark-lint-preset`,
      babelPreset: {name: `@${accountName}`, packageName: `@${accountName}/babel-preset`},
      commitlint: {name: `@${accountName}`, packageName: `@${accountName}/commitlint-config`}
    },
    plugins: {
      unitTestFrameworks: {},
      applicationTypes: {},
      packageTypes: {},
      packageBundlers: {},
      ciServices: {}
    },
    decisions: {
      [questionNames.DIALECT]: dialects.BABEL,
      [questionNames.NODE_VERSION_CATEGORY]: 'LTS',
      [questionNames.PACKAGE_MANAGER]: 'npm',
      [questionNames.PROJECT_TYPE]: projectTypes.PACKAGE,
      [questionNames.SHOULD_BE_SCOPED]: true,
      [questionNames.SCOPE]: accountName,
      [questionNames.AUTHOR_NAME]: 'Your Name',
      [questionNames.AUTHOR_EMAIL]: '[email protected]',
      [questionNames.AUTHOR_URL]: 'https://your.website.tld',
      [questionNames.UNIT_TESTS]: true,
      [questionNames.INTEGRATION_TESTS]: true,
      [questionNames.PROVIDE_EXAMPLE]: true
    }
  });

  if (await thisIsAJavaScriptProject({projectRoot})) {
    await liftJavascript({
      projectRoot,
      configs: {eslint: {scope: '@foo'}},
      results: {
        dependencies: [],
        devDependencies: [],
        scripts: {},
        eslint: {configs: [], ignore: {directories: []}},
        packageManager: 'npm'
      },
      enhancers: {
        PluginName: {
          test: () => true,
          lift: () => ({})
        }
      }
    });
  }

  await scaffoldUnitTesting({
    projectRoot: process.cwd(),
    frameworks: {
      Mocha: {scaffold: options => options},
      Jest: {scaffold: options => options}
    },
    visibility: 'Public',
    vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
    decisions: {[questionNames.UNIT_TEST_FRAMEWORK]: 'Mocha'}
  });
})();

Documentation

Contributing

PRs Welcome Commitizen friendly Conventional Commits semantic-release Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test