Skip to content

Commit bfe2b05

Browse files
committed
fix generation script
1 parent f9d5222 commit bfe2b05

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/generate/run.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const cp = require('child_process');
3+
const cp = require('child_process');
44
const fs = require('fs');
55
const path = require('path');
66
const format = require('./format-lines');
@@ -13,7 +13,7 @@ function getVersion(path) {
1313
}
1414
}
1515

16-
function generateFromTemplate(file, template, outputPrefix = '') {
16+
function generateFromTemplate(file, template, outputPrefix = '', lint = false) {
1717
const script = path.relative(path.join(__dirname, '../..'), __filename);
1818
const input = path.join(path.dirname(script), template);
1919
const output = path.join(outputPrefix, file);
@@ -27,14 +27,17 @@ function generateFromTemplate(file, template, outputPrefix = '') {
2727
);
2828

2929
fs.writeFileSync(output, content);
30-
// cp.execFileSync('prettier', ['--write', output]);
30+
lint && cp.execFileSync('prettier', ['--write', output]);
3131
}
3232

33+
// Some templates needs to go through the linter after generation
34+
const needsLinter = ['utils/structs/CheckpointsConfidential.sol'];
35+
3336
// Contracts
3437
for (const [file, template] of Object.entries({
3538
'utils/structs/CheckpointsConfidential.sol': './templates/CheckpointsConfidential.js',
3639
})) {
37-
generateFromTemplate(file, template, './contracts/');
40+
generateFromTemplate(file, template, './contracts/', needsLinter.includes(file));
3841
}
3942

4043
// // Tests

0 commit comments

Comments
 (0)