Merge pull request #1747 from 0xProject/feature/cut-the-package-fat

Cut the package fat! Part 1: Unwanted files
This commit is contained in:
Jacob Evans
2019-04-04 14:26:23 +01:00
committed by GitHub
45 changed files with 303 additions and 1108 deletions

View File

@@ -119,6 +119,7 @@ jobs:
- repo-{{ .Environment.CIRCLE_SHA1 }} - repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-test-utils - run: yarn wsrun test:circleci @0x/contracts-test-utils
- run: yarn wsrun test:circleci @0x/abi-gen - run: yarn wsrun test:circleci @0x/abi-gen
- run: yarn wsrun test:circleci @0x/contract-artifacts
- run: yarn wsrun test:circleci @0x/assert - run: yarn wsrun test:circleci @0x/assert
- run: yarn wsrun test:circleci @0x/base-contract - run: yarn wsrun test:circleci @0x/base-contract
- run: yarn wsrun test:circleci @0x/connect - run: yarn wsrun test:circleci @0x/connect

View File

@@ -1,10 +1,10 @@
# Blacklist all files
.* .*
tsconfig.json *
webpack.config.js # Whitelist lib
yarn-error.log !lib/**/*
test/ # Blacklist tests and publish scripts
/src/ /lib/test/*
/abi-gen-templates/ /lib/monorepo_scripts/
/generated_docs/ # Package specific ignore
/scripts/ !_bundles/**/*
/lib/src/monorepo_scripts/

View File

@@ -0,0 +1,9 @@
# Blacklist all files
.*
*
# Whitelist lib
!lib/**/*
# Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,10 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore
!bin/**/*

View File

@@ -1,7 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
test/ # Blacklist tests and publish scripts
tsconfig.json /lib/test/*
/lib/src/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,8 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
/schemas/ # Blacklist tests and publish scripts
test/ /lib/test/*
tsconfig.json /lib/monorepo_scripts/
/lib/src/monorepo_scripts/ # Package specific ignore

View File

@@ -1,6 +1,10 @@
# Blacklist all files
.* .*
yarn-error.log *
/scripts/ # Whitelist lib
/src/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,8 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
/generated_docs/ # Blacklist tests and publish scripts
test/ /lib/test/*
tsconfig.json /lib/monorepo_scripts/
/lib/src/monorepo_scripts/ # Package specific ignore

View File

@@ -0,0 +1,9 @@
# Blacklist all files
.*
*
# Whitelist lib
!lib/**/*
# Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/
# Package specific ignore

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -121,65 +121,9 @@
"evm": { "evm": {
"bytecode": { "bytecode": {
"linkReferences": {}, "linkReferences": {},
"object": "0x", "object": "0x"
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"linkReferences": {},
"object": "0x",
"opcodes": "",
"sourceMap": ""
} }
} }
}, },
"sources": {
"src/interfaces/IAssetProxy.sol": {
"id": 2
},
"src/interfaces/IAuthorizable.sol": {
"id": 3
},
"@0x/contracts-utils/contracts/src/interfaces/IOwnable.sol": {
"id": 6
}
},
"sourceCodes": {
"src/interfaces/IAssetProxy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\n\nimport \"./IAuthorizable.sol\";\n\n\ncontract IAssetProxy is\n IAuthorizable\n{\n /// @dev Transfers assets. Either succeeds or throws.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param from Address to transfer asset from.\n /// @param to Address to transfer asset to.\n /// @param amount Amount of asset to transfer.\n function transferFrom(\n bytes assetData,\n address from,\n address to,\n uint256 amount\n )\n external;\n \n /// @dev Gets the proxy id associated with the proxy address.\n /// @return Proxy id.\n function getProxyId()\n external\n pure\n returns (bytes4);\n}\n",
"src/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\n\nimport \"@0x/contracts-utils/contracts/src/interfaces/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n",
"@0x/contracts-utils/contracts/src/interfaces/IOwnable.sol": "pragma solidity ^0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n"
},
"sourceTreeHashHex": "0x4fe33d3b00ae85e5c1d5478eeb1bf17fdc637fa0501dc1ff6fd1f871f87c83ca",
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Linux.g++",
"settings": {
"optimizer": {
"enabled": true,
"runs": 1000000,
"details": {
"yul": true,
"deduplicate": true,
"cse": true,
"constantOptimizer": true
}
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode.object",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.object",
"evm.deployedBytecode.sourceMap"
]
}
},
"evmVersion": "byzantium",
"remappings": [
"@0x/contracts-utils=/Users/jacob/projects/ethdev/0x/0x.js/contracts/asset-proxy/node_modules/@0x/contracts-utils"
]
}
},
"networks": {} "networks": {}
} }

View File

@@ -12,6 +12,9 @@
"scripts": { "scripts": {
"build": "yarn tsc -b", "build": "yarn tsc -b",
"build:ci": "yarn build", "build:ci": "yarn build",
"test": "yarn run_mocha",
"test:circleci": "yarn test",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit",
"clean": "shx rm -rf lib" "clean": "shx rm -rf lib"
}, },
"repository": { "repository": {
@@ -25,7 +28,10 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-artifacts/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-artifacts/README.md",
"devDependencies": { "devDependencies": {
"shx": "^0.2.2", "shx": "^0.2.2",
"typescript": "3.0.1" "typescript": "3.0.1",
"chai": "^4.0.1",
"mocha": "^4.1.0",
"lodash": "^4.17.11"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@@ -0,0 +1,32 @@
import * as chai from 'chai';
import { get } from 'lodash';
import 'mocha';
import * as artifacts from '../src/index';
const expect = chai.expect;
describe('Contract Artifacts', () => {
const forbiddenProperties = [
'compilerOutput.evm.bytecode.sourceMap',
'compilerOutput.evm.bytecode.opcodes',
'sourceCodes',
'sources',
'compiler',
];
it('should not include forbidden attributes', () => {
const forbiddenPropertiesByArtifact: { [name: string]: string[] } = {};
for (const [artifactName, artifact] of Object.entries(artifacts)) {
for (const forbiddenProperty of forbiddenProperties) {
const rejectedValue = get(artifact, forbiddenProperty);
if (rejectedValue) {
const previousForbidden = forbiddenPropertiesByArtifact[artifactName];
forbiddenPropertiesByArtifact[artifactName] = previousForbidden
? [...previousForbidden, forbiddenProperty]
: [forbiddenProperty];
}
}
}
expect(forbiddenPropertiesByArtifact).to.eql({});
});
});

View File

@@ -5,7 +5,7 @@
"rootDir": ".", "rootDir": ".",
"resolveJsonModule": true "resolveJsonModule": true
}, },
"include": ["./src/**/*"], "include": ["./src/**/*", "./test/**/*"],
"files": [ "files": [
"./artifacts/AssetProxyOwner.json", "./artifacts/AssetProxyOwner.json",
"./artifacts/DutchAuction.json", "./artifacts/DutchAuction.json",

View File

@@ -1,11 +1,9 @@
# Blacklist all files
.* .*
tsconfig.json *
webpack.config.js # Whitelist lib
yarn-error.log !lib/**/*
test/ # Blacklist tests and publish scripts
/src/ /lib/test/*
/_bundles/ /lib/monorepo_scripts/
/abi-gen-templates/ # Package specific ignore
/generated_docs/
/scripts/
/lib/src/monorepo_scripts/

View File

@@ -1,6 +1,10 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore
!bin/**/*

View File

@@ -1,7 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
test/ # Blacklist tests and publish scripts
tsconfig.json /lib/test/*
/lib/src/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/scripts/ # Whitelist lib
/src/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,10 @@
# Blacklist all files
.* .*
yarn-error.log *
/scripts/ # Whitelist lib
/src/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,11 @@
# Blacklist all files
.* .*
* *
*/ # Whitelist lib
!lib/**/* !lib/**/*
# Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/
# Package specific ignore
!umd/**/* !umd/**/*
.env .env

View File

@@ -1,8 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
/schemas/ # Blacklist tests and publish scripts
test/ /lib/test/*
tsconfig.json /lib/monorepo_scripts/
/lib/src/monorepo_scripts/ # Package specific ignore

View File

@@ -0,0 +1,10 @@
# Blacklist all files
.*
*
# Whitelist lib
!lib/**/*
# Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/
# Package specific ignore
!bin/**/*

View File

@@ -1,7 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/scripts/ # Whitelist lib
/generated_docs/ !lib/**/*
/src/ # Blacklist tests and publish scripts
tsconfig.json /lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,9 +1,9 @@
# Blacklist all files
.* .*
tsconfig.json *
webpack.config.js # Whitelist lib
yarn-error.log !lib/**/*
test/ # Blacklist tests and publish scripts
/src/ /lib/test/*
/_bundles/ /lib/monorepo_scripts/
/generated_docs/ # Package specific ignore
/scripts/

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,7 +1,11 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
test/ # Blacklist tests and publish scripts
tsconfig.json /lib/test/*
/lib/src/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore
!bin/**/*
!solc_bin/.gitkeep

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/src/monorepo_scripts/ /lib/test/*
/lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/src/monorepo_scripts/ /lib/test/*
/lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/src/monorepo_scripts/ /lib/test/*
/lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,10 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/src/monorepo_scripts/ /lib/test/*
/lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,7 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/src/ # Whitelist lib
/scripts/ !lib/**/*
test/ # Blacklist tests and publish scripts
tsconfig.json /lib/test/*
/lib/src/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,7 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
node_modules/ # Whitelist lib
/scripts/ !lib/**/*
/rules/ # Blacklist tests and publish scripts
tsconfig.json /lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/scripts/ # Whitelist lib
/src/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,4 +1,11 @@
# Blacklist all files
.* .*
yarn-error.log *
/scripts/ # Whitelist lib
!lib/**/*
# Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore
!types/**/*

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/scripts/ # Whitelist lib
/src/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

View File

@@ -1,6 +1,9 @@
# Blacklist all files
.* .*
yarn-error.log *
/scripts/ # Whitelist lib
/src/ !lib/**/*
tsconfig.json # Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/ /lib/monorepo_scripts/
# Package specific ignore

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -121,65 +121,9 @@
"evm": { "evm": {
"bytecode": { "bytecode": {
"linkReferences": {}, "linkReferences": {},
"object": "0x", "object": "0x"
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"linkReferences": {},
"object": "0x",
"opcodes": "",
"sourceMap": ""
} }
} }
}, },
"sources": {
"src/interfaces/IAssetProxy.sol": {
"id": 2
},
"src/interfaces/IAuthorizable.sol": {
"id": 3
},
"@0x/contracts-utils/contracts/src/interfaces/IOwnable.sol": {
"id": 6
}
},
"sourceCodes": {
"src/interfaces/IAssetProxy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\n\nimport \"./IAuthorizable.sol\";\n\n\ncontract IAssetProxy is\n IAuthorizable\n{\n /// @dev Transfers assets. Either succeeds or throws.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param from Address to transfer asset from.\n /// @param to Address to transfer asset to.\n /// @param amount Amount of asset to transfer.\n function transferFrom(\n bytes assetData,\n address from,\n address to,\n uint256 amount\n )\n external;\n \n /// @dev Gets the proxy id associated with the proxy address.\n /// @return Proxy id.\n function getProxyId()\n external\n pure\n returns (bytes4);\n}\n",
"src/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\n\nimport \"@0x/contracts-utils/contracts/src/interfaces/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n",
"@0x/contracts-utils/contracts/src/interfaces/IOwnable.sol": "pragma solidity ^0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n"
},
"sourceTreeHashHex": "0x4fe33d3b00ae85e5c1d5478eeb1bf17fdc637fa0501dc1ff6fd1f871f87c83ca",
"compiler": {
"name": "solc",
"version": "0.4.25+commit.59dbf8f1.Linux.g++",
"settings": {
"optimizer": {
"enabled": true,
"runs": 1000000,
"details": {
"yul": true,
"deduplicate": true,
"cse": true,
"constantOptimizer": true
}
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode.object",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.object",
"evm.deployedBytecode.sourceMap"
]
}
},
"evmVersion": "byzantium",
"remappings": [
"@0x/contracts-utils=/Users/jacob/projects/ethdev/0x/0x.js/contracts/asset-proxy/node_modules/@0x/contracts-utils"
]
}
},
"networks": {} "networks": {}
} }