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:
Francisco Giordano
2019-05-22 18:35:40 -03:00
committed by GitHub
parent 2ccc12b328
commit 036dd9bd6e
4 changed files with 11 additions and 12 deletions

View File

@ -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

View File

@ -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);