Skip to content
This repository was archived by the owner on Dec 10, 2021. It is now read-only.

form8ion/javascript-scaffolder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c7c2d53 · Dec 9, 2021
Dec 7, 2021
May 4, 2021
Dec 3, 2021
Nov 22, 2021
Dec 7, 2021
Dec 23, 2020
Jul 20, 2019
Apr 16, 2018
Apr 16, 2018
Apr 16, 2018
Sep 10, 2019
Feb 10, 2020
Apr 16, 2018
Apr 16, 2018
Mar 1, 2020
Jan 20, 2021
Dec 7, 2021
Dec 6, 2019
Sep 24, 2021
Apr 16, 2018
Dec 9, 2021
Jun 11, 2021
Dec 7, 2021
Dec 9, 2021
Dec 9, 2021
Apr 30, 2020
Jul 20, 2020

Repository files navigation

javascript-scaffolder

opinionated scaffolder for JavaScript projects

REPLACED BY @form8ion/javascript

Codecov Node CI Workflow Status

Table of Contents

Features

  • Sets the node.js version to the latest or LTS version (your choice) using nvm
  • Scaffolds the package.json
    • Enables linting of:
  • Enables transpilation with Babel
  • Defines and enforces the commit message convention
  • Defines badges for inclusion in the README.md
  • Defines files to be ignored from git and npm
  • Scaffolds CI service config from the user choice of the provided scaffolders

Usage

npm node MIT license

Installation

$ npm install @travi/javascript-scaffolder --save-prod

As one of the languages for scaffolding a project

This scaffolder is intended to be used to scaffold the language specific details within the project-scaffolder.

Example

Dependencies:
const {dialects, projectTypes} = require('@form8ion/javascript-core');
const {scaffold: scaffoldJavaScript, questionNames} = require('./lib/index.cjs');
Execute
(async () => {
  const accountName = 'form8ion';

  await scaffoldJavaScript({
    projectRoot: process.cwd(),
    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`}
    },
    overrides: {npmAccount: accountName},
    ciServices: {},
    unitTestFrameworks: {},
    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]: 'you@domain.tld',
      [questionNames.AUTHOR_URL]: 'https://your.website.tld',
      [questionNames.UNIT_TESTS]: true,
      [questionNames.INTEGRATION_TESTS]: true
    }
  });
})();

Options

projectRoot string (required)

path to the root of the project

projectName string (required)

name of the project (w/o a scope)

visibility string (required)

visibility of the project (Public or Private)

license string (required)
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
description string (optional)

short summary of the project

configs object (optional)
  • eslint: object (optional) details about the shareable config to be used for the project

    • packageName string (required) name of the npm package
    • prefix string (required) name to be used when referring to the config within the .eslintrc files

    ⚠️ while i'm not confident that it is the recommended convention, it is assumed the defined config has a rules/ directory exposed from the package with rulesets defined for

    • es6.js
    • tests/base.js
    • tests/mocha.js
  • commitlint object (optional) details about the shareable config to be used for the project

    • packageName string (required) name of the npm package
    • name string (required) name to be used when referring to the config within the .commitlintrc.js file
  • babelPreset object (optional) details about the preset to be used for the project

    • packageName string (required) name of the npm package
    • name string (required) shorthand name to be used when referring to the config
overrides object (optional)
  • npmAccount string (optional) the account the package should be published under. used to suggest a scope. defaults to $ npm whoami

  • author object (optional) details about the package author

    • name string (required) defaults to $npm config get init.author.name
    • email string (optional) defaults to $npm config get init.author.email
    • url string (optional) defaults to $npm config get init.author.url
registries object (optional)
  • keys: string Scope of packages related to this registry (without the @)
  • values: string URL for the registry
ciServices object (optional)
  • keys: string Name of the service
  • values: object
    • scaffolder: function (required) scaffolds the ci service options
    • public: boolean (optional) whether this service should be presented as a public option
    • private: boolean (optional) whether this service should be presented as a private option
applicationTypes object (optional)
  • keys: string Name of the type of application
  • values: object
    • scaffolder function (required) scaffolds the application
unitTestFrameworks object (required)

frameworks to be passed to the unit-testing scaffolder

Contributing

Conventional Commits Commitizen friendly semantic-release PRs Welcome Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test

Related Projects