const formProps = require('./formProps'); let tmpl = ''; // 用于将config的表单格式展开成字段,以便二开 formProps.schemas.forEach((prop) => { let schema = `schemaMap['${prop.key}']`; tmpl += ` `; }); //write to file const fs = require('fs'); fs.writeFile('./template.txt', tmpl, (err) => { if (err) throw err; console.log('The file has been saved!'); });