Change prepack npm script to prepare (take 2) (#1755)
* update truffle to include bugfix * change prepack script to prepare * add npx in compile script * fix for older node * rename script file to prepare
This commit is contained in:
committed by
GitHub
parent
2ccc12b328
commit
036dd9bd6e
@ -4,7 +4,4 @@ if [ "$SOLC_NIGHTLY" = true ]; then
|
||||
docker pull ethereum/solc:nightly
|
||||
fi
|
||||
|
||||
# Necessary to avoid an error in Truffle
|
||||
rm -rf build/contracts
|
||||
|
||||
truffle compile
|
||||
npx truffle compile
|
||||
|
||||
@ -22,11 +22,13 @@ const pkgFiles = readJSON('package.json').files;
|
||||
// Get only negated patterns.
|
||||
const ignorePatterns = pkgFiles
|
||||
.filter(pat => pat.startsWith('!'))
|
||||
// Add **/* to ignore all files contained in the directories.
|
||||
.flatMap(pat => [pat, path.join(pat, '**/*')])
|
||||
// Remove the negation part. Makes micromatch usage more intuitive.
|
||||
.map(pat => pat.slice(1));
|
||||
|
||||
const ignorePatternsSubtrees = ignorePatterns
|
||||
// Add **/* to ignore all files contained in the directories.
|
||||
.concat(ignorePatterns.map(pat => path.join(pat, '**/*')));
|
||||
|
||||
const artifactsDir = 'build/contracts';
|
||||
|
||||
let n = 0;
|
||||
@ -36,7 +38,7 @@ for (const artifact of fs.readdirSync(artifactsDir)) {
|
||||
const { sourcePath: fullSourcePath } = readJSON(fullArtifactPath);
|
||||
const sourcePath = path.relative('.', fullSourcePath);
|
||||
|
||||
const ignore = match.any(sourcePath, ignorePatterns);
|
||||
const ignore = match.any(sourcePath, ignorePatternsSubtrees);
|
||||
|
||||
if (ignore) {
|
||||
fs.unlinkSync(fullArtifactPath);
|
||||
Reference in New Issue
Block a user