lab cli
1.0.0
Compositor實驗室的命令行實用程序和導出模塊
npm install @compositor/lab編譯lab.json以反應組件:
lab --out-dir dist/注意更改:
lab --out-dir dist/ --watch實驗室項目可以以允許將它們安裝並導入到應用程序的其他實驗室項目的方式發布。
導出index.js , lab.json和theme.json包裝實驗室項目:
lab --pkg --out-dir dist/ -d --out-dir Output directory
-w --watch Watch for changes
--pkg Include index.js, lab.json, and theme.json in output
Lab App使用節點API將實驗室組件導出為反應和其他格式。
lab(config, [options])
返回一系列以寫入文件的對象。
const fs = require ( 'fs' )
const path = require ( 'path' )
const lab = require ( '@compositor/lab' )
const config = require ( './lab.json' )
const modules = lab ( config )
modules . forEach ( mod => {
const filename = path . join ( __dirname , 'dist' , mod . name + '.js' )
fs . writeFile ( filename , mod . module , err => {
if ( err ) console . log ( err )
} )
} )library選擇輸出模式的字符串鍵,其中之一是:
styled-componentsglamorousemotionfelacxsvue (alpha) harmony布爾值以導出模板而無需轉移到ES5語法。
當前,該模塊使用模板輸出到不同格式。這些模板可以在lib/templates/ 。也可以將AST與Babel這樣的工具進行輸出,但使用模板是為了使該項目更容易為該項目做出貢獻。
請參閱docs/lab-json.md
由Compositor製作|麻省理工學院許可證