<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          foy輕量級的項目 build 工具

          聯(lián)合創(chuàng)作 · 2023-09-23 15:50

          福伊(foy) 是一個輕量級的基于 nodejs 和 promise 的通用 build 工具

          特點:

          • 基于 promise 的任務和內置工具函數(shù)(fs/shell), 無縫支持 async/await

          • 類似于 shelljs 的跨平臺 shell dsl, 人人都會寫 shell

          • 易學易用,無需為寫僅僅幾個build命令而花費幾個小時去尋找和學習第三方包

          • 很小的安裝成本

            • foy: 831KB

            • gulp:4.82MB 

            • grunt:4.19MB 

          •    無縫和第三方支持 promise 的工具包整合,不需要封裝成插件就能用

          使用:

          安裝

          yarn add -D foy # or npm i -D foy
          
          # Or Install globally with
          
          yarn add -g foy # or npm i -g foy

           在項目根目錄下增加一個 Foyfile.js (或者 Foyfile.ts, 需要安裝 ts-node)

          import { task, desc, option, strict, fs } from 'foy'
          
          task('build', async ctx => {
            await ctx.exec('tsc')
          })
          
          desc('Build ts files with tsc')
          option('-w, --watch', 'watch file changes')
          strict() // This will throw an error if you passed some options that doesn't defined via `option()`
          task('build2', async ctx => {
            await ctx.exec(`tsc ${ctx.options.watch ? '-w' : ''}`)
          })
          
          task('task', async ctx => {
            await fs.rmrf('/some/dir/or/file') // Remove directory or file
            await fs.copy('/src', '/dist') // Copy folder or file
            let json = await fs.readJson('./xx.json')
            await ctx.env('NODE_ENV', 'production')
            await ctx.cd('./src')
            await ctx.exec('some command') // Execute an command
            let { stdout } = await ctx.exec('ls', { stdio: 'pipe' }) // Get the stdout, default is empty because it's redirected to current process via `stdio: 'inherit'`.
          })

          然后就可以運行任務了 

          # 安裝在本地 node_modules 目錄下
          npx foy build
          npx foy build1
          npx foy task 
          
          # 安裝在全局
          
          foy build
          foy build1

          瀏覽 24
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  深夜操逼视频 | 免费大鸡巴视频 | 欧美操骚逼 | 91aaa国产精品 | 逼特逼网站在线观看 |