By now I know what the format of the generator is, the only question is I don't know where the 'goog' comes from.
Here is the partial code from my 'generator/arduino.js'
import * as Blockly from 'blockly/core'
// goog.provide('Blockly.Arduino')
// goog.require('Blockly.Generator')
/*
* Arduino generator
* @type {!Blockly.Generator}
* */
Blockly.Arduino = new Blockly.Generator('Arduino')
// ... the rest
I don't know where to import goog and I can't find 'closure/goog/base.js' in node_modules
When I try to manually add goog in package.json, there goes the error "import the same project repeatedly"