质量
一种稍有倾向但无BS, 方便用于将TypeScript代码编入无害环境管理和A no BS, 方便用于将TypeScript代码编入无害环境管理和CJS两个目标,以及适当接通包件. json出口.
ts-duality 这将为你做全程的歌唱和舞蹈, 默认情况下,它将使CJS和无害环境管理.
您可以选择针对一个特定的输出, 或者你可以仅仅编译而不生成打字.
ts-duality 还将使社区司法分析和无害环境管理模块正确无误 .cjs 财务报告和审定财务报表 .esm 格式,同时确保您代码中使用的任何相对导入被重写为也指向 .cjs 财务报告和审定财务报表 .esm 文档.
TypeScript 检测到的每个文件,作为您来源的一部分,都将自动添加到您的 package.json#exports,如果有一个索引文件,此文件将作为您的 package.json#main 财务报告和审定财务报表 package.json#module。 。 。 .
举个例子,这看起来像什么, 检查一下 软件包.json 文件 页:1 ts-duality。 。 。 . ts-duality 自行编译.
开始
安装
安装 ts-duality 您最喜欢的软件包管理器 :
无
npm i @better-builds/ts-duality --save-dev
小时
pnpm i @better-builds/ts-duality -D
线条
yarn add @better-builds/ts-duality --dev
包头
bun add @better-builds/ts-duality -d
API 密码
国 际
运行 npx ts-duality (或相当于你选择的包管理者) 踢出一个建筑.
查看帮助菜单及其所有选项, 运行 npx ts-duality --help数字 :
Options:
--version Show version number [boolean]
--clean if set, will clean out the build dirs before compiling
anything [boolean] [default: false]
--copyOtherFiles if true, will copy any non source files (anything that
doesn't end with .js, .jsx, .cjs, .mts, .ts or .tsx)
to the output folder, while maintining the location of
the files
to match where they were in your source folder
[boolean] [default: false]
--cwd the CWD to use when building
[string] [default: "/Users/benjaminduran/dddddddd/opensource/ts-duality"]
--jsx the type of JSX runtime to use when compiling your code
[string] [choices: "automatic", "classic", "preserve"] [default: "automatic"]
--noCjs if true, will not build the CommonJS variant of this
package [boolean] [default: false]
--noDts if set, will not write typescript typings
[boolean] [default: false]
--noEsm if true, will not build the ESM variant of this package
[boolean] [default: false]
--noGenerateExports
if true, will NOT modify your package.json file
to generate main, module and exports fields.
Use this if you just want a simple transpiler that
strips your typescript types.
[boolean] [default: false]
--noStripLeading if set, will not strip the leading, last common portion
of your input file paths when writing output file paths.
if your code is located in a "src/" folder, you want to
leave this unset.
NOTE: this does *not* affect how typescript compiles
typings, so if your tsconfig#compilerOptions#rootDir is
misconfigured,
or you are mixing roots from across your package, your
typings might end up in a different folder than you
expect [boolean] [default: false]
--outDir the folder where the built files will be written
[string] [default: "dist"]
--tsconfig if provided, will explicitly use this tsconfig.json
location instead of searching for a tsconfig.build.json
or a plain tsconfig.json [string]
--watch if set, will automatically watch for any changes to this
library and rebuild, making it easier for you to consume
changes in the monorepo while doing local development
[boolean] [default: false]
--help Show help [boolean]
Java 脚本 API
如果你更愿意与 ts-duality 在 JavaScript 或 TypeScript 文件中,您可以导入其 API 如下 :
javascript
import { buildTsPackage } from '@better-builds/ts-duality';
await buildTsPackage({ /* accepts the same options as the CLI */ });
捐款
确保您在环境中安装了适当的工具版本 . 您可以在 . 工具转换 文档.
如果你喜欢,你可以使用 爱 用于快速启动, 只需克隆此寄存器, 然后运行 mise x -- bun ci 以安装所有依赖.
一旦安装了它们,就马上运行 bun ci 在这个项目中开始开发.