Update docs
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const cp = require('child_process');
|
||||
// const cp = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const format = require('./format-lines');
|
||||
@ -23,20 +23,27 @@ function generateFromTemplate(file, template, outputPrefix = '') {
|
||||
...(version ? [version + ` (${file})`] : []),
|
||||
`// This file was procedurally generated from ${input}.`,
|
||||
'',
|
||||
require(template),
|
||||
require(template).trimEnd(),
|
||||
);
|
||||
|
||||
fs.writeFileSync(output, content);
|
||||
cp.execFileSync('prettier', ['--write', output]);
|
||||
// cp.execFileSync('prettier', ['--write', output]);
|
||||
}
|
||||
|
||||
// Contracts
|
||||
for (const [file, template] of Object.entries({
|
||||
'utils/cryptography/MerkleProof.sol': './templates/MerkleProof.js',
|
||||
'utils/math/SafeCast.sol': './templates/SafeCast.js',
|
||||
'utils/structs/Checkpoints.sol': './templates/Checkpoints.js',
|
||||
'utils/structs/EnumerableSet.sol': './templates/EnumerableSet.js',
|
||||
'utils/structs/EnumerableMap.sol': './templates/EnumerableMap.js',
|
||||
'utils/structs/Checkpoints.sol': './templates/Checkpoints.js',
|
||||
'utils/SlotDerivation.sol': './templates/SlotDerivation.js',
|
||||
'utils/StorageSlot.sol': './templates/StorageSlot.js',
|
||||
'utils/TransientSlot.sol': './templates/TransientSlot.js',
|
||||
'utils/Arrays.sol': './templates/Arrays.js',
|
||||
'utils/Packing.sol': './templates/Packing.js',
|
||||
'mocks/StorageSlotMock.sol': './templates/StorageSlotMock.js',
|
||||
'mocks/TransientSlotMock.sol': './templates/TransientSlotMock.js',
|
||||
})) {
|
||||
generateFromTemplate(file, template, './contracts/');
|
||||
}
|
||||
@ -44,6 +51,8 @@ for (const [file, template] of Object.entries({
|
||||
// Tests
|
||||
for (const [file, template] of Object.entries({
|
||||
'utils/structs/Checkpoints.t.sol': './templates/Checkpoints.t.js',
|
||||
'utils/Packing.t.sol': './templates/Packing.t.js',
|
||||
'utils/SlotDerivation.t.sol': './templates/SlotDerivation.t.js',
|
||||
})) {
|
||||
generateFromTemplate(file, template, './test/');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user