發佈
這是一個層塔包(tower package) 的基本結構:
warriorjs-tower-got
├── index.js
└── package.json
index.js內含我們通過這指南所編寫的代理,而package.json則是npm包的資料:
{
  "name": "warriorjs-tower-got",
  "version": "0.1.0",
  "description": "There is only one war that matters: the Great War. And it is here.",
  "main": "index.js",
  "keywords": ["warriorjs-tower"],
  "dependencies": {
    "@warriorjs/geography": "^0.4.0"
  }
}
一些特別的考慮點:
- 包的名字必須以warriorjs-tower-開頭,方便WarriorJS自動載入層塔。
- warriorjs-tower需放在"關鍵字(keyword)"欄位中,這會讓你的層塔更容易被發現到。
在製作層塔的時候,你可以使用npm pack來製作tar文件包,然後將其安裝在你安裝@warriorjs/cli的地方,如下:
npm install <path/to/tarball>
完成後,執行warriorjs將會自動讀取你的層塔。