Add `categoryMap` and cleanup `buildTemplate`, `getCategoryDependencies`, `getCategory`, `getMethodsByCategory` in build.js.