TSBB一个零配置 CLI
TSBB 是一个零配置 CLI,可帮助您开发,测试和发布现代 TypeScript Node.js 项目。
TypeScript + Babel = TSBB
Features
⏱ 快速初始化示例项目并快速进入开发模式。
♻️ 添加,删除或修改项目文件时重新编译代码。
📚 可读的源代码,鼓励学习和贡献
🚀 更快,更快的编译速度。
⚛️ 支持React组件编译。
⛑ Jest 测试运行,默认为 tsbb test
🔥 零配置,单一依赖。
快速开始
您将需要在系统上安装 Node.js 。
$ npx tsbb create my-project $ cd my-project $ npm run watch # Listen compile .ts files. $ npm run build # compile .ts files. $ npm start
或者
$ npm install tsbb -g # Create project $ tsbb create my-project --example=Express # --- Example name ----------------┴ˇˇˇˇˇˇ
实例
从其中一个示例初始化项目:
$ npx tsbb create my-app -e <Example Name> # --- E.g: ----------------┴ˇˇˇˇˇˇˇˇˇˇˇˇˇˇ # npx tsbb create my-app -e Basic
-
Basic- The Node.js base application example. -
Express- The Express base application example. -
Koa- The Koa base application example. -
Hapi- The Hapi base application example. -
react-component- The react component base application example.
命令帮助
以下是您可能会发现有用的命令的帮助。
tsbb
▶ tsbb --help Usage: tsbb [options] Commands: tsbb create <project-name> [options] Create a new project with TSBB tsbb build [options] Build your project once and exit. tsbb watch [options] Recompile files on changes. tsbb types [options] Create type files for the project. tsbb test [options] Run jest test runner in watch mode. Options: --version Show version number [boolean] --help Show help [boolean] Examples: $ tsbb build Build your project once and exit. $ tsbb watch Rebuilds on any change. $ tsbb test Run test suites related. $ tsbb test --coverage Test coverage information should be collected Copyright 2019
tsbb create
▶ tsbb create --help
tsbb create <project-name> [options]
Create a new project with TSBB
Options:
--version Show version number [boolean]
--help, -h Show help. [boolean]
--force, -f force create. [boolean] [default: false]
--example Example from
https://github.com/jaywcjlove/tsbb/tree/master/example
example-path. [string] [default: "basic"]
Examples:
$ tsbb create my-app Create my project.
$ tsbb create my-app --example express Create an Express example project.
tsbb build
▶ tsbb build --help
tsbb build [options]
Build your project once and exit.
Options:
--version Show version number [boolean]
--help, -h Show help. [boolean]
--source-root, -s The root from which all sources are relative.
[string] [default: "src"]
--copy-files When compiling a directory copy over non-compilable files.
[boolean] [default: true]
--source-maps Source Map options.
[string] [choices: true, "inline", "both", "none"] [default: true]
--output, -o Output directory. [string] [default: "lib"]
--target Specify your target environment.
[string] [choices: "react", "node"] [default: "node"]
--env-name The name of the 'env' to use when loading configs and
plugins. Defaults to the value of 'cjs esm'..
[array] [default: ["cjs","esm"]]
--comments decide whether a given comment should be included in the
output code. [boolean] [default: true]
Examples:
$ tsbb build Build your project.
$ tsbb build --no-comments Build your project and remove the comments.
tsbb watch
▶ tsbb watch --help
tsbb watch [options]
Recompile files on changes.
Options:
--version Show version number [boolean]
--help, -h Show help. [boolean]
--source-root, -s The root from which all sources are relative.
[string] [default: "src"]
--copy-files When compiling a directory copy over non-compilable files.
[boolean] [default: true]
--source-maps Source Map options.
[string] [choices: true, "inline", "both", "none"] [default: true]
--output, -o Output directory. [string] [default: "lib"]
--target Specify your target environment.
[string] [choices: "react", "node"] [default: "node"]
--env-name The name of the 'env' to use when loading configs and
plugins. Defaults to the value of 'cjs esm'..
[array] [default: ["cjs","esm"]]
--comments decide whether a given comment should be included in the
output code. [boolean] [default: true]
--timer, -t Compile interval. [number] [default: 300]
Examples:
$ tsbb watch Rebuilds on any change.
tsbb test
Runs the test watcher (Jest) in an interactive mode.
▶ tsbb test --help
tsbb test [options]
Run jest test runner in watch mode.
Options:
--version Show version number [boolean]
--help, -h Show help. [boolean]
--coverage Indicates that test coverage information should be collected and
reported in the output. [boolean] [default: false]
--env The test environment used for all tests.[string] [default: "node"]
--config The path to a Jest config file specifying how to find and execute
tests. [string]
Examples:
$ tsbb test Run test suites related
$ tsbb test --coverage Test coverage information should be collected
tsbb types
▶ tsbb types --help
tsbb types [options]
Create type files for the project.
Options:
--version Show version number [boolean]
--help, -h Show help. [boolean]
--project Compile the project given the path to its
configuration file, or to a folder with a
'tsconfig.json'. [string] [default: "./"]
--out-dir Redirect output structure to the directory.
[string] [default: "lib"]
--target Specify ECMAScript target version.
[string] [choices: "ES3", "ES5", "ES2015", "ES2016", "ES2017", "ES2018",
"ES2019", "ESNEXT"] [default: "ES2015"]
--watch Watch input files. [boolean] [default: false]
--emit-declaration-only to enable declarations only output
[boolean] [default: true]
--tsconf TypeScript other options. [string]
Examples:
$ tsbb types Create types your project.
$ tsbb types --watch Create type files for the project And to run in --watch
mode.
License
MIT © Kenny Wong
评论
