Skip to content
章节目录

命令行接口 (CLI)

stencil build

生成一个 Stencil 项目。下面的标志是 build 命令的可用选项。

Flag描述别名
--ciRun a build using recommended settings for a Continuous Integration (CI) environment. Defaults the number of workers to 4, allows for extra time if taking screenshots via the tests and modifies the console logs.-
--configstenccil.config.ts 文件的路径。这个标志在大多数情况下是不需要的,因为 Stencil 会找到配置。另外,Stencil 配置不是必须的。-c
--debugAdds additional runtime code to help debug, and sets the log level for more verbose output.-
--dev运行开发构建
--docs-readme基于组件类型,prop,methods,events,JSDocs, css 变量等生成 readme.md 文档。-
--es5创建一个与 ES5 兼容的构建。默认情况下,在开发期间不会创建 ES5 构建,以缩短构建时间。然而,ES5 构建总是在生产构建期间创建的。在开发期间可以使用此标志创建 ES5 构建。-
--logstencil build 的日志写入 stencil-build.log 文件. log 文件的位置与配置文件的位置相-
--prerenderPrerender the application using the www output target after the build has completed.-
--prodRuns a production build which will optimize each file, improve bundling, remove unused code, minify, etc. A production build is the default, this flag is only used to override the --dev flag.-
--max-workersMax number of workers the compiler should use. Defaults to use the same number of CPUs the Operating System has available.-
--next选择加入以测试 "下一个版本" Stencil 编译器功能。-
--no-cache禁用使用缓存。-
--no-open默认情况下,--serve 命令将打开一个浏览器窗口。使用 --no-open 命令不会自动打开浏览器窗口。-
--port集成开发服务器 的端口. 默认是3333.-p
--serve启动 集成开发服务器.-
--stats将项目的统计信息写入 template-stats.json。stats 文件的位置与配置文件的位置相同。-
--verbose记录关于构建的每个步骤的附加信息。-
--watch在开发期间监视文件,并在文件更新时触发重新构建。-

stencil test

测试 Stencil 项目。下面的标志是 test 命令的可用选项。

Flag描述
--spec使用 Jest 执行 .spec.ts 文件.
--e2e使用 PuppeteerJest 执行 .e2e.ts 文件.
--no-build在运行测试之前跳过生成过程。(您需要事先构建它)。
--devtools在 Chrome 中打开开发工具面板进行端到端测试。设置此标志将禁用 --headless
--headless设置在 Chrome 中用于端到端测试的无头模式。——headless——headless=true 将在 Chrome 中启用“旧”的无头模式,这是 Chrome v112 之前默认使用的模式。——headless=new 将启用 Chrome v112 中引入的新的无头模式。有关 Chrome 新 headless 模式的更多信息,请参阅这篇文章

stencil

Flag描述别名
--help显示解释不同标志的帮助输出。-h
--version打印当前的 Stencil 版本。-v

stencil generate <sub-folder>

启动交互式组件生成器。您可以指定一个或多个子文件夹来生成组件。

此文档为非官方翻译版本