All Projects → l-zoy → vitx

l-zoy / vitx

Licence: MIT license
😃 Simple transform tool

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Less
1899 projects

Projects that are alternatives of or similar to vitx

Zmi Nerd
😃 Simple transform tool
Stars: ✭ 139 (+1.46%)
Mutual labels:  lerna, miniapp
monorepo-utils
A collection of utilities for monorepo/lerna. Tools for TypeScript project references etc..
Stars: ✭ 143 (+4.38%)
Mutual labels:  lerna
Vue Monorepo Boilerplate
Vue Fullstack App Monorepo Boilerplate
Stars: ✭ 136 (-0.73%)
Mutual labels:  lerna
Lerna Yarn Workspaces Monorepo
🐉 A Monorepo with multiple packages and a shared build, test, and release process.
Stars: ✭ 201 (+46.72%)
Mutual labels:  lerna
Yerna
A Lerna-like tool for managing Javascript monorepos using Yarn
Stars: ✭ 140 (+2.19%)
Mutual labels:  lerna
pattern-library
AXA CH UI component library. Please share, comment, create issues and work with us!
Stars: ✭ 103 (-24.82%)
Mutual labels:  lerna
Sketchmine
Tools to validate, generate and analyse sketch files from web pages
Stars: ✭ 114 (-16.79%)
Mutual labels:  lerna
react-bones
💀 Dead simple content loading components for React and React-Native. 💀
Stars: ✭ 42 (-69.34%)
Mutual labels:  lerna
miniapp
使用 Rax 语法(类 React)编写跨多端的小程序应用。
Stars: ✭ 65 (-52.55%)
Mutual labels:  miniapp
Bolt
The Bolt Design System provides robust Twig and Web Component-powered UI components, reusable visual styles, and powerful tooling to help developers, designers, and content authors build, maintain, and scale best of class digital experiences.
Stars: ✭ 186 (+35.77%)
Mutual labels:  lerna
Monorepo Run
Run scripts in monorepo with colors, streaming and separated panes
Stars: ✭ 167 (+21.9%)
Mutual labels:  lerna
Daily Apps
Everything you see on Daily 👀
Stars: ✭ 141 (+2.92%)
Mutual labels:  lerna
vulcan-npm
The full-stack JavaScript App Framework
Stars: ✭ 26 (-81.02%)
Mutual labels:  lerna
Styleguide
🖌 Conjunction of design patterns, components and resources used across our products.
Stars: ✭ 162 (+18.25%)
Mutual labels:  lerna
echarts-for-svelte
📈 Baidu Echarts(v3.0 & v4.0) components for Svelte wrapper.
Stars: ✭ 25 (-81.75%)
Mutual labels:  lerna
Modern Monorepo Boilerplate
Modern Monorepo Boilerplate with Lerna, TypeScript, React/CRA, HMR, Jest, ESLint/TypeScript.
Stars: ✭ 127 (-7.3%)
Mutual labels:  lerna
Puppeteer Extra
💯 Teach puppeteer new tricks through plugins.
Stars: ✭ 3,397 (+2379.56%)
Mutual labels:  lerna
jgb
小程序渐进式编译框架
Stars: ✭ 21 (-84.67%)
Mutual labels:  miniapp
ViennaUI
Raiffeisenbank Design System
Stars: ✭ 32 (-76.64%)
Mutual labels:  lerna
stream
Monorepo for Resonate Coop player
Stars: ✭ 164 (+19.71%)
Mutual labels:  lerna

🔨 vitx

简单的编译工具

lerna GitHub license codecov <ORG_NAME>

文档功能开发中

Features

  • 支持 typescript
  • 支持 多目录workspaces编译
  • 支持 cjsesm
  • 支持 自定义 stream 扩展, 支持 gulp 插件
  • 支持 sourcemap
  • 支持 小程序编译
  • 支持 增量编译
  • 支持 支持vuereact 文件编译
  • 支持 支持less编译
  • 支持 支持路径别名alias
  • 支持 jest

Installation

Install vitx via yarn or npm.

$ yarn add vitx

Usage

# Bundle library
$ vitx build

# Watch dev
$ vitx build --watch
$ yarn add jest -D

# Bundle library
$ vitx test

注:

  • 目录下添加 jest.config.js 或者 jest.config.ts 配置即可, 如果是 node 应用直接运行即可
  • 默认配置可参考 jest-config

修改或覆盖:

import { IJestConfig } from 'vitx'

export default <IJestConfig>{
  // 如果是一个函数则会传入默认值最后返回新值
  // 如果是一个非函数值会进行直接覆盖
  collectCoverageFrom(memo) {
    return memo.concat([
      '!packages/vitx/src/jestConfig.ts',
      '!packages/vitx/src/cli.ts',
      '!packages/vitx/src/jestTransformer.ts',
      '!packages/vitx/src/jestRun.ts'
    ])
  }
}

Config

新建 .vitxrc.js or .vitxrc.ts 文件进行配置。

import { IConfig } from 'vitx'

export default {
  moduleType: 'cjs',
  target: 'node',
  alias: {
    '@': './src'
  }
} as IConfig

tsconfig.json

会自动读取 tsconfig.jsoncompilerOptions 的配置进行编译 ts or tsx

Options

moduleType

输出格式,打包方式等

  • Type: "cjs" | "esm" | "all"
  • Default: "esm"

all 会同时输出 cjsesm 的格式文件

extraBabelPresets

配置额外的 Babel presets。

  • Type: array
  • Default: []

extraBabelPlugins

添加 Babel Plugins

  • Type: array
  • Default: []

target

node 库 or browser 库,只作用于语法层。

  • Type: "node" | "browser"
  • Default: "browser"

node,兼容到 node@6 browser,兼容到 ['last 2 versions', 'IE 10']

frame

支持.vue单文件编译及vue jsx or tsx (只支持 vue3) 支持react jsx or tsx 注意目前必须要指定框架

  • Type: "vue" | "react"
  • Default: ``

alias

路径别名, 参考 webpack alias 参数, 支持大部分主流文件类型, 支持小程序

  • Type: object
  • Default: undefined
import path from 'path'
const root = path.join(__dirname, './src')

export default {
  alias: {
    '@': root,
    '@pkg': path.join(root, 'index'),
    '@utils': path.join(root, 'utils')
  }
}

browserFiles

target 为 node 时,配置例外文件走 browser target。

  • Type: [string]
  • Default: []

注:所有 .tsx.jsx 文件始终走 browser target。

nodeFiles

target 为 browser 时,配置例外文件走 node target。

  • Type: [string]
  • Default: []

runtimeHelpers

是否把 helper 方法提取到 @babel/runtime 里。

  • Type: boolean
  • Default: false

注:

  1. 配置了 runtimeHelpers,要在 dependencies 里安装 @babel/runtime 依赖
  2. runtimeHelpers 只对 esm 有效

disableTypes

是否禁用类型检测, 将不会生成 d.ts

  • Type: boolean
  • Default: false

beforeReadWriteStream

编译中 hook, 在没有进行任何处理之前

  • Type: function({ through, gulpIf }):NodeJS.ReadWriteStream
  • Default: undefined

注:

  1. 会传入两个参数
  2. 可以直接使用 gulp 插件
export default {
  beforeReadWriteStream({ through, gulpIf }) {
    return through.obj((chunk, _, cb) => {
      cb(null, chunk)
    })

    return gulpLess()
  }
}

afterReadWriteStream

编译中 hook, 在进行编译处理之后

  • Type: function({ through, gulpIf }):NodeJS.ReadWriteStream
  • Default: undefined

注:

  1. 会传入两个参数,
  2. 可以直接使用 gulp 插件
export default {
  beforeReadWriteStream({ through, gulpIf }) {
    return through.obj((chunk, _, cb) => {
      cb(null, chunk)
    })
  }
}

afterHook

编译中 hook, 在进行编译完成之后

  • Type: function():void
  • Default: undefined

packages

在多目录构建中,有可能出现组件间有构建先后的需求 packages 允许你自定义 packages 目录下的构建顺序, 当使用packages的时候没有在packages里面的目录不会进行编译

  • Type: string[]
  • Default: []
export default {
  packages: ['packagesA', 'packagesB']
}

注:

  1. 子目录的配置文件会继承最外层的配置

packageDirName

  • Type: string
  • Default: packages

entry

编译监听目录

  • Type: string
  • Default: src

output

编译输出目录

  • Type: string
  • Default: lib

lessOptions

  • Type: { modifyVars?: Record<string, any> paths?: string[] plugins?: any[] relativeUrls?: boolean }
  • Default: object

gulp-less

sourcemap

  • Type: boolean
  • Default: false

基于 gulp-sourcemaps

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].