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

Latest commit

 

History

History
133 lines (79 loc) · 4.09 KB

README.md

File metadata and controls

133 lines (79 loc) · 4.09 KB

@talon/sip

Sip is a suite of Gulp tasks that make developing JavaScript less painful 🕊

Table of Contents

Sip

In three simple Gulp tasks Sip will drive your JavaScript development to new productive heights! 📈

Type: object

Properties

  • test TaskFunction check dependencies, check types, generate a README and run Jest
  • develop TaskFunction all the above and also watch for changes
  • build TaskFunction all the above and also formats your files and compiles your lib into dist with Babel

setup

Sip.setup will return an object of Tasks that you can use in your gulpfile.js 🥂

import * as Sip from "@talon/sip"

// for individual projects you can use the __dirname as the root
Object.assign(exports, Sip.setup(__dirname))

// lerna exec provides LERNA_PACKAGE_NAME as an environment variable
const pkg = process.env.LERNA_PACKAGE_NAME.split("/").slice(-1)

// which can be used to apply the package root for each package on the fly
Object.assign(exports, Sip.setup(`${__dirname}/packages/${pkg}`))

Parameters

  • root string the root path of the package to operate on

Returns Sip initalized Gulp tasks

test

  • ✅ adds and removes dependencies from package.json as they are used in lib using depcheck
  • ✅ lints lib for JSDoc comments, fixes what it can automatically
  • ✅ typechecks lib from the JSDoc comments using TypeScript
  • ✅ generates a README from the lib JSDoc comments with documentation.js
  • ✅ runs Jest
describe("readme driven development", () => {
  it("is lit! 🔥", () => expect(true).toBeTruthy())
})

You can configure documentation.js to tweak the README generation and/or also configure Jest as you please

ESLint is used as part of the JSDoc typechecker, you can override the rules with your own eslintrc file

Parameters

  • root string the root path of the package to operate on
  • options object task options
    • options.fix boolean whether or not to write changes for automatically fixable issues

Returns TaskFunction the initialized gulp task

build

Everything that test does and also formats your code then compiles it with Babel to dist

Babel may be configured in many ways and/or if you have prettier preferences they can be configured as well

this is the one you run in CI 🔁

Parameters

  • root string the root path of the package to operate on
  • $1 Object
    • $1.fix

Returns TaskFunction the initialized gulp task

develop

Everything that build does but also watches lib and runs again on file changes 👀

Note: automatic JSDoc fixing is turned off to avoid infinite looping of this task.

Parameters

  • root string the root path of the package to operate on

Returns TaskFunction the initialized gulp task