refactor build tools, minor edits to fix types

use `npm run build` to build.