This topic is not available in your language. Therefore, the original version (ja-jp) is displayed.

archive(args: ArchiveArgs): Promise<void>

Signature

type ArchiveArgs = {
  /**
   * actual file paths to archive (not `.meta` file path)
   */
  files: string[];
 
  /**
   * unity project root directory
   */
  root: string;
 
  /**
   * archive (`.unitypackage`) destination path
   */
  dest: string;
 
  // extras
 
  /**
   * transform input paths on write
   * @param path input file path (relative on root)
   * @returns input file path (relative on root)
   * @example filter: (path) => join("..", "Packages", "com.natsuneko.unitypackage", path); // Assets/MonoBehaviour.cs → Packages/com.natsuneko.unitypackage/MonoBehaviour.cs
   */
  transform?: (path: string) => string;
};
 
declare const archive: (args: ArchiveArgs) => Promise<void>;
ParameterTypeRequiredDescription
filesstring[]Yesアーカイブするファイル実態 (meta ではない) のパス
rootstringYesプロジェクトのルートディレクトリへのパス
deststringYes出力先の UnityPackage へのパス
transform(path: string) => stringNoアーカイブ書き込み時にパスを書き換える場合の transform callback

Description

指定されたパラメータから、 UnityPackage ファイルを作成します。

例外

Exception NameDescription
ErrorThrown if files is empty or root is not directory or dist is not file

import { archive } from "@natsuneko-laboratory/unitypackage";
 
await archive({
  files: ["Assets/Plugins/MyPlugin.cs"],
  root: "./",
  dest: "./output.unitypackage",
});
archive(args: ArchiveArgs): Promise<void> / unitypackage / Natsuneko Laboratory Docs