Browse Source

feat: add description into nodeFns at first line

master
qilei0529 4 years ago
parent
commit
1d64fcf38e
  1. 7
      packages/cli/src/cmd/dev/extractCodes.js

7
packages/cli/src/cmd/dev/extractCodes.js

@ -24,11 +24,14 @@ const writeNodeCodes = async (basePath, dsl) => {
const nodes = cells.filter((cell) => cell.shape !== 'edge');
for (const {
id,
data: { code },
shape,
data: { label, code },
} of nodes) {
fileIds.push(id);
const filePath = path.join(basePath, id + '.js');
await fs.outputFile(filePath, code, { encoding: 'utf8', flag: 'w' });
const preData = `// ${shape}: ${label}\n`;
const saveData = `${preData}\n${code}`;
await fs.outputFile(filePath, saveData, { encoding: 'utf8', flag: 'w' });
}
return fileIds;
};

Loading…
Cancel
Save