Skip to content

Commit

Permalink
Merge pull request #596 from stephensli/fix/package-flatten
Browse files Browse the repository at this point in the history
fix: use npm run publish to release the dist folder directly
  • Loading branch information
chriseth committed Feb 3, 2022
2 parents f0c8b02 + 30a75e4 commit 08ae214
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
9 changes: 9 additions & 0 deletions build/pack-publish-block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This is meant to run in a hook before npm pack.
// Reporting an error from the hook interrupts the command.
if (process.env.BYPASS_SAFETY_CHECK === 'false' || process.env.BYPASS_SAFETY_CHECK === undefined) {
console.error('Run `npm run build:tarball` or `npm run publish:tarball` to pack or publish the package');
process.exit(1);
} else if (process.env.BYPASS_SAFETY_CHECK !== 'true') {
console.error('Invalid value of the BYPASS_SAFETY_CHECK variable. Must be "true", "false" or unset.');
process.exit(1);
}
27 changes: 15 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
"name": "solc",
"version": "0.8.11",
"description": "Solidity compiler",
"main": "dist/index.js",
"main": "index.js",
"bin": {
"solcjs": "dist/solc.js"
"solcjs": "solc.js"
},
"scripts": {
"build": "tsc",
"postbuild": "node build/postbuild.js",
"lint": "eslint --ext .js,.ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"updateBinary": "node build/clean.js && ts-node ./downloadCurrentVersion.ts && ts-node ./verifyVersion.ts",
"prepublishOnly": "npm run updateBinary npm && npm run build",
"prepack": "node build/pack-publish-block.js",
"build:tarball": "npm run updateBinary && npm run build && BYPASS_SAFETY_CHECK=true npm pack ./dist",
"publish:tarball": "tarball=$(npm run --silent tarballName) && ls \"$tarball\" && BYPASS_SAFETY_CHECK=true npm publish \"$tarball\"",
"tarballName": "jq --raw-output '.name + \"-\" + .version + \".tgz\"' package.json",
"copyTestFiles": "cp -r ./test/resources ./dist/test/",
"pretest": "npm run lint && npm run build && npm run copyTestFiles",
"test": "cd dist && tape ./test/index.js",
Expand All @@ -32,15 +35,15 @@
"node": ">=10.0.0"
},
"files": [
"dist/abi.js",
"dist/index.js",
"dist/linker.js",
"dist/smtchecker.js",
"dist/smtsolver.js",
"dist/solc.js",
"dist/soljson.js",
"dist/translate.js",
"dist/wrapper.js"
"abi.js",
"index.js",
"linker.js",
"smtchecker.js",
"smtsolver.js",
"solc.js",
"soljson.js",
"translate.js",
"wrapper.js"
],
"author": "chriseth",
"license": "MIT",
Expand Down

0 comments on commit 08ae214

Please sign in to comment.