How to use foy - 10 common examples

To help you get started, we’ve selected a few foy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zaaack / htmls-webpack-plugin / Foyfile.ts View on Github external
import { task, desc, option, fs } from 'foy'

task('build', async ctx => {
  // Your build tasks
  await ctx.exec('tsc')
  await fs.rmrf('lib/test')
})

task('test', async ctx => {
  await ctx.exec(`mocha --timeout 100000 -r ts-node/register -r tsconfig-paths/register ./src/test/**/*.test.ts`)
})
github hydux / hydux / Foyfile.ts View on Github external
task('build:dist', async (ctx) => {
  await ctx.exec(`webpack -p --progress --profile`)
})

const MochaCli = `mocha --exit -r tsconfig-paths/register -r ts-node/register`

task('test:e2e', async ctx => {
  await ctx.exec(`ts-node ./src/test/e2e/prepare.ts && ${MochaCli} \"src/test/**/*.test.ts\"`)
})

task('test:watch', async (ctx) => {
  await ctx.exec(`${MochaCli} -w --watch-extensions ts,tsx`)
})

task('doc', async ctx => {
  await ctx.exec([
    `typedoc --theme default --mode file --exclude \"**/test/**/*.ts\"  --excludeNotExported --excludePrivate --out ./docs/api ./src`
  ])
})

task('flow', async ctx => {
  await ctx.exec(`flow check`)
})

setOption({ loading: false })
task<{ version: string }>(
  'preversion', [
    // { name: 'flow', async: true },
    { name: 'test', async: true },
    { name: 'build:all', async: true },
  ],
github zaaack / htmls-webpack-plugin / Foyfile.ts View on Github external
import { task, desc, option, fs } from 'foy'

task('build', async ctx => {
  // Your build tasks
  await ctx.exec('tsc')
  await fs.rmrf('lib/test')
})

task('test', async ctx => {
  await ctx.exec(`mocha --timeout 100000 -r ts-node/register -r tsconfig-paths/register ./src/test/**/*.test.ts`)
})
github zaaack / htmls-webpack-plugin / Foyfile.ts View on Github external
task('build', async ctx => {
  // Your build tasks
  await ctx.exec('tsc')
  await fs.rmrf('lib/test')
})
github hydux / hydux / Foyfile.ts View on Github external
],
)

option('-t, --type ', 'Semver versions, patch | major | minor')
task<{ type: 'patch' | 'major' | 'minor' }>('publish', async ctx => {
  await ctx.run('preversion', { options: { version: ctx.options.type } })
  await ctx.exec(`npm version ${ctx.options.type}`)
  await fs.rmrf('./lib/test')
  await fs.rmrf('./es/test')
  await Promise.all([
    ctx.exec(`git push origin master --tags`),
    ctx.exec(`npm --registry https://registry.npmjs.org/ publish`),
  ])
})

task('test', async ctx => {
  await ctx.exec(`${MochaCli} \"src/test/unit/*.test.ts\"`)
})

task('test:all', ['test'.async(), 'test:e2e'.async(), 'flow'.async()])
github hydux / hydux / Foyfile.ts View on Github external
await ctx.fs.rmrf('./lib')
  await ctx.exec(`tsc -d`)
  let cwd = process.cwd()
  await ctx.fs.iter(`./src`, async (file, stat) => {
    if (file.endsWith('.js.flow')) {
      await ctx.fs.copy(
        file,
        pathLib
          .relative(cwd, file)
          .replace('src', 'lib'),
      )
    }
  })
})

task('build:es', async ctx => {
  await ctx.fs.rmrf(`es`)
  await ctx.exec(`tsc -d -m es6 --outDir ./es`)
})

task('build:dist', async (ctx) => {
  await ctx.exec(`webpack -p --progress --profile`)
})

const MochaCli = `mocha --exit -r tsconfig-paths/register -r ts-node/register`

task('test:e2e', async ctx => {
  await ctx.exec(`ts-node ./src/test/e2e/prepare.ts && ${MochaCli} \"src/test/**/*.test.ts\"`)
})

task('test:watch', async (ctx) => {
  await ctx.exec(`${MochaCli} -w --watch-extensions ts,tsx`)
github hydux / hydux / Foyfile.ts View on Github external
task('build:es', async ctx => {
  await ctx.fs.rmrf(`es`)
  await ctx.exec(`tsc -d -m es6 --outDir ./es`)
})

task('build:dist', async (ctx) => {
  await ctx.exec(`webpack -p --progress --profile`)
})

const MochaCli = `mocha --exit -r tsconfig-paths/register -r ts-node/register`

task('test:e2e', async ctx => {
  await ctx.exec(`ts-node ./src/test/e2e/prepare.ts && ${MochaCli} \"src/test/**/*.test.ts\"`)
})

task('test:watch', async (ctx) => {
  await ctx.exec(`${MochaCli} -w --watch-extensions ts,tsx`)
})

task('doc', async ctx => {
  await ctx.exec([
    `typedoc --theme default --mode file --exclude \"**/test/**/*.ts\"  --excludeNotExported --excludePrivate --out ./docs/api ./src`
  ])
})

task('flow', async ctx => {
  await ctx.exec(`flow check`)
})

setOption({ loading: false })
task<{ version: string }>(
  'preversion', [
github teamhola / holakit / docs / Foyfile.js View on Github external
const { task, fs, setGlobalOptions } = require('foy')
const glob = require('glob')

if (process.env.NETLIFY_BUILD_BASE) setGlobalOptions({ loading: false })

task('collect', async ctx => {
  const sidebar = {}
  const sidebarCfg = []
  const componentReadmes = glob.sync('../packages/@(core|app)/src/components/*/readme.md')

  componentReadmes.forEach(async path => {
    const scope = path.match(/\/packages\/([a-z]+)\//)[1]
    const name = path.match(/\/([a-z\-]+)\/readme.md/)[1]
    if (!Array.isArray(sidebar[scope])) sidebar[scope] = []
    sidebar[scope].push(name)
    await fs.copy(path, `components/${scope}/${name}.md`)
  })

  Object.keys(sidebar).forEach(scope => {
    const uppercase = str => str.charAt(0).toUpperCase() + str.slice(1)

    const children = []
github hydux / hydux / Foyfile.ts View on Github external
await ctx.fs.copy(
        file,
        pathLib
          .relative(cwd, file)
          .replace('src', 'lib'),
      )
    }
  })
})

task('build:es', async ctx => {
  await ctx.fs.rmrf(`es`)
  await ctx.exec(`tsc -d -m es6 --outDir ./es`)
})

task('build:dist', async (ctx) => {
  await ctx.exec(`webpack -p --progress --profile`)
})

const MochaCli = `mocha --exit -r tsconfig-paths/register -r ts-node/register`

task('test:e2e', async ctx => {
  await ctx.exec(`ts-node ./src/test/e2e/prepare.ts && ${MochaCli} \"src/test/**/*.test.ts\"`)
})

task('test:watch', async (ctx) => {
  await ctx.exec(`${MochaCli} -w --watch-extensions ts,tsx`)
})

task('doc', async ctx => {
  await ctx.exec([
    `typedoc --theme default --mode file --exclude \"**/test/**/*.ts\"  --excludeNotExported --excludePrivate --out ./docs/api ./src`
github hydux / hydux / Foyfile.ts View on Github external
import { task, fs, option, setOption, setGlobalOptions } from 'foy'
import * as pathLib from 'path'

setGlobalOptions({ loading: false, strict: true })

task('build', async ctx => {
  await ctx.fs.rmrf('./lib')
  await ctx.exec(`tsc -d`)
  let cwd = process.cwd()
  await ctx.fs.iter(`./src`, async (file, stat) => {
    if (file.endsWith('.js.flow')) {
      await ctx.fs.copy(
        file,
        pathLib
          .relative(cwd, file)
          .replace('src', 'lib'),
      )
    }
  })
})

task('build:es', async ctx => {

foy

A simple, light-weight and modern task runner for general purpose.

MIT
Latest version published 6 days ago

Package Health Score

68 / 100
Full package analysis