diff --git a/package-lock.json b/package-lock.json index 14fcaefdd..a496637a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12996,9 +12996,9 @@ "dev": true }, "truffle": { - "version": "5.0.14", - "resolved": "https://registry.npmjs.org/truffle/-/truffle-5.0.14.tgz", - "integrity": "sha512-Mlf4S58NMyR8YZFvQLAzA+7eCaDZw6ZSa92NWXDQjy1RbUfpl08/VPa06KLT+LosQuOPZr/NSH9f0u2qxfo/Qw==", + "version": "5.0.18", + "resolved": "https://registry.npmjs.org/truffle/-/truffle-5.0.18.tgz", + "integrity": "sha512-aQPbWSskotSmylj4kiq73Di5X+tHl5ChlvlBAo5brHmsCzvMGIH29UA+t/rK8TRo7i7Kut0HxAgVR5i+bJteAQ==", "dev": true, "requires": { "app-module-path": "^2.2.0", diff --git a/package.json b/package.json index 8c2a9d1bc..06ab74b39 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "lint:js": "eslint .", "lint:js:fix": "eslint . --fix", "lint:sol": "solhint --max-warnings 0 \"contracts/**/*.sol\"", - "prepack": "node scripts/prepack.js", + "prepare": "node scripts/prepare.js", "release": "scripts/release/release.sh", "version": "scripts/release/update-changelog-release-date.js && scripts/release/update-ethpm-version.js", "test": "scripts/test.sh" @@ -62,6 +62,6 @@ "solhint": "^1.5.0", "solidity-coverage": "github:rotcivegaf/solidity-coverage#5875f5b7bc74d447f3312c9c0e9fc7814b482477", "solidity-docgen": "^0.2.0-alpha.0", - "truffle": "^5.0.14" + "truffle": "^5.0.18" } } diff --git a/scripts/compile.sh b/scripts/compile.sh index a3d853960..02eea1761 100755 --- a/scripts/compile.sh +++ b/scripts/compile.sh @@ -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 diff --git a/scripts/prepack.js b/scripts/prepare.js similarity index 86% rename from scripts/prepack.js rename to scripts/prepare.js index bb00b3ec9..7ba752346 100644 --- a/scripts/prepack.js +++ b/scripts/prepare.js @@ -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);