GitHub

Helper utilities

These utilities can be imported and used within your own projects, as they are already used within kolay. This should allow users to build their own specific set of outputs using the same underlying tools that kolay uses.

gitRef

Returns the short git SHA of the current commit. Useful for displaying the deployed version somewhere in your app.

In an ESM environment:

import { gitRef } from "kolay/build";

// in some config
version: gitRef();

In a CJS environment (e.g. ember-cli-build.js):

const { gitRef } = require("kolay/build/legacy");

// in some config
version: gitRef();
gitRef
  • (
    ) =>
    string

    A build-time utulity, used for getting the short version of the git SHA.

    Could be used to hide somewhere in your app so that you know what specific version is deployed.

    In an ESM environment, you can import this module:

    import { gitRef } from 'kolay/build';
    
    // in some config
    version: gitRef()
    

    In a CJS environment, you'd require this module:

    const { gitRef } = require('kolay/build/legacy');
    
    // in some config
    version: gitRef()
    

packageTypes

packageTypes
  • (
    packageName
    string
    ) =>
    Promise
    <
    • dir
      string
    • manifest
      any
    • types
      Array of
      string
    >

    Gather the types entries from package.json#exports

virtualFile

virtualFile
  • (
    options
    VirtualFileOptions
    Array of
    VirtualFileOptions
    ) =>
    Omit
    <
    UnpluginOptions
    "name"
    >

    Create a virtual file in a rollup-based API by only specifying the desired import path and the content of the virtual file.

generateTypeDocJSON

generateTypeDocJSON
  • (
    options
    Options
    ) =>
    Promise
    <
    unknown
    >

    Generates APIDocs / TypeDoc from already built declarations. This is meant to use be very permissive and ignore errors so that likelihood of generating a TypeDoc json document increases. Over time, this'll probably need to be tweaked, and maybe one day will need an extension API, but for now the only option is specifying which packageName to try to generate types for.

    Package lookup occurs relative to the package at the current working directory, using require.resolve . So only packages declared as (dev)dependencies entries can be found.