add-new-package
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAdd a new Remotion package
添加新的Remotion包
Steps
步骤
-
Createwith these files:
packages/<name>/- — copy from
package.jsonas template; update name, description, homepage, dependencies@remotion/light-leaks - — extends
tsconfig.json, uses tsgo with../tsconfig.settings.json,emitDeclarationOnly: true,outDir: "dist",module: "es2020",moduleResolution: "bundler"target: "ES2022" - — exports
src/index.ts - — Bun build script, externalize
bundle.ts,react,remotion,remotion/no-react,react/jsx-runtime,react/jsx-dev-runtimereact-dom - — use
eslint.config.mjsif React,remotionFlatConfig({react: true})otherwise{react: false} - — copy from
.npmignore@remotion/light-leaks - — package name, description, install command, link to docs
README.md
-
Register in monorepo:
- (root) — add
tsconfig.jsonto references{"path": "./packages/<name>"} - — add
packages/cli/src/list-of-remotion-packages.ts'@remotion/<name>' - — add
packages/create-video/src/list-of-remotion-packages.ts'@remotion/<name>' - — add to
packages/studio-shared/src/package-info.ts,packages,descriptions,installableMapapiDocs
-
Documentation ():
packages/docs/docs/<name>/- Add to
"@remotion/<name>": "workspace:*"dependencies (needed for twoslash snippets)packages/docs/package.json - — install tabs, table of contents, license
index.mdx - — TOCItem grid linking to component/function pages
table-of-contents.tsx - Individual component/function pages
.mdx - Edit — add category
packages/docs/sidebars.ts - Edit — import table of contents and add section
packages/docs/components/TableOfContents/api.tsx
- Add
See the skill for details on writing documentation.
writing-docs-
Example usage:
- Add to
"@remotion/<name>": "workspace:*"packages/example/package.json - Create
packages/example/src/<Name>/index.tsx - Register in
<Composition>packages/example/src/Root.tsx - Add to
{"path": "../<name>"}referencespackages/example/tsconfig.json
- Add
-
Runto install dependencies
bun i -
Build:
cd packages/<name> && bun run make
-
**创建**目录并包含以下文件:
packages/<name>/- — 以
package.json为模板复制;更新名称、描述、主页和依赖项@remotion/light-leaks - — 继承
tsconfig.json,使用tsgo并配置../tsconfig.settings.json、emitDeclarationOnly: true、outDir: "dist"、module: "es2020"、moduleResolution: "bundler"target: "ES2022" - — 导出内容
src/index.ts - — Bun构建脚本,将
bundle.ts、react、remotion、remotion/no-react、react/jsx-runtime、react/jsx-dev-runtime设为外部依赖react-dom - — 若涉及React则使用
eslint.config.mjs,否则使用remotionFlatConfig({react: true}){react: false} - — 复制
.npmignore中的配置@remotion/light-leaks - — 包含包名称、描述、安装命令及文档链接
README.md
-
在monorepo中注册:
- 根目录— 在references中添加
tsconfig.json{"path": "./packages/<name>"} - — 添加
packages/cli/src/list-of-remotion-packages.ts'@remotion/<name>' - — 添加
packages/create-video/src/list-of-remotion-packages.ts'@remotion/<name>' - — 将其添加到
packages/studio-shared/src/package-info.ts、packages、descriptions、installableMap中apiDocs
- 根目录
-
文档配置():
packages/docs/docs/<name>/- 在的依赖项中添加
packages/docs/package.json(用于twoslash代码片段)"@remotion/<name>": "workspace:*" - — 包含安装选项卡、目录、许可证
index.mdx - — 包含链接到组件/函数页面的TOCItem网格
table-of-contents.tsx - 单独的组件/函数页面
.mdx - 编辑— 添加分类
packages/docs/sidebars.ts - 编辑— 导入目录并添加章节
packages/docs/components/TableOfContents/api.tsx
- 在
有关文档编写的详细信息,请参考技能。
writing-docs-
示例用法:
- 在中添加
packages/example/package.json"@remotion/<name>": "workspace:*" - 创建
packages/example/src/<Name>/index.tsx - 在中注册
packages/example/src/Root.tsx<Composition> - 在的references中添加
packages/example/tsconfig.json{"path": "../<name>"}
- 在
-
**运行**以安装依赖项
bun i -
构建:
cd packages/<name> && bun run make
Version
版本
Use the current version from .
For the documentation version, increment the patch version by 1 as it will only be released with the next Remotion release.
packages/core/src/version.tsFor the documentation version, increment the patch version by 1 as it will only be released with the next Remotion release.
使用中的当前版本。
对于文档版本,将补丁版本号加1,因为它仅会随下一个Remotion版本一同发布。
packages/core/src/version.ts对于文档版本,将补丁版本号加1,因为它仅会随下一个Remotion版本一同发布。
Patterns
模式
- Use for internal dependencies
"workspace:*" - Use for shared external dependency versions
"catalog:" - The script is:
maketsgo && bun --env-file=../.env.bundle bundle.ts - Add to
"type": "module"package.json - Add to devDependencies
"@typescript/native-preview": "catalog:" - Types/main point to and
dist/index.d.ts(notdist/index.js)dist/cjs/ - Packages with React components need for
peerDependenciesandreactreact-dom
- 内部依赖使用
"workspace:*" - 共享外部依赖版本使用
"catalog:" - 脚本为:
maketsgo && bun --env-file=../.env.bundle bundle.ts - 在中添加
package.json"type": "module" - 在devDependencies中添加
"@typescript/native-preview": "catalog:" - Types/main指向和
dist/index.d.ts(而非dist/index.js)dist/cjs/ - 包含React组件的包需要在中声明
peerDependencies和reactreact-dom