diff options
Diffstat (limited to 'packages/sol-compiler')
-rw-r--r-- | packages/sol-compiler/CHANGELOG.json | 8 | ||||
-rw-r--r-- | packages/sol-compiler/package.json | 22 | ||||
-rw-r--r-- | packages/sol-compiler/src/compiler.ts | 3 | ||||
-rw-r--r-- | packages/sol-compiler/src/index.ts | 9 | ||||
-rw-r--r-- | packages/sol-compiler/src/monorepo_scripts/postpublish.ts | 8 | ||||
-rw-r--r-- | packages/sol-compiler/src/monorepo_scripts/stage_docs.ts | 8 | ||||
-rw-r--r-- | packages/sol-compiler/src/utils/compiler.ts | 2 | ||||
-rw-r--r-- | packages/sol-compiler/src/utils/types.ts | 46 | ||||
-rw-r--r-- | packages/sol-compiler/test/compiler_test.ts | 4 |
9 files changed, 25 insertions, 85 deletions
diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index 34326e434..a723ea12e 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -6,6 +6,14 @@ "note": "Quicken compilation by sending multiple contracts to the same solcjs invocation, batching them together based on compiler version requirements.", "pr": 965 + }, + { + "note": "Stop exporting types: `ContractArtifact`, `ContractNetworks`", + "pr": 924 + }, + { + "note": "Export types: `CompilerSettings`, `OutputField`", + "pr": 924 } ] }, diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 98c2242dc..ee7dffe30 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -9,7 +9,7 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "build": "yarn pre_build && tsc", "pre_build": "run-s update_contract_fixtures", "update_contract_fixtures": "copyfiles 'test/fixtures/contracts/**/*' ./lib", "test": "yarn run_mocha", @@ -17,26 +17,15 @@ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/*_test.js --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", - "clean": "shx rm -rf lib scripts", + "clean": "shx rm -rf lib generated_docs", "migrate": "npm run build; node lib/src/cli.js migrate", "lint": "tslint --project .", "test:circleci": "yarn test:coverage", - "docs:stage": "node scripts/stage_docs.js", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", - "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { - "assets": [], - "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], - "s3BucketPath": "s3://doc-jsons/sol-compiler/", - "s3StagingBucketPath": "s3://staging-doc-jsons/sol-compiler/" - } + "assets": [] } }, "bin": { @@ -54,7 +43,6 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "devDependencies": { "@0xproject/dev-utils": "^1.0.4", - "@0xproject/monorepo-scripts": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", "@types/mkdirp": "^0.5.2", "@types/require-from-string": "^1.2.0", @@ -70,7 +58,7 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "0xProject/typedoc", + "typedoc": "0.12.0", "types-bn": "^0.0.1", "typescript": "3.0.1", "web3-typescript-typings": "^0.10.2", diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index 2e7120361..7c76f3e52 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -10,6 +10,7 @@ import { } from '@0xproject/sol-resolver'; import { fetchAsync, logUtils } from '@0xproject/utils'; import chalk from 'chalk'; +import { CompilerOptions, ContractArtifact, ContractVersionData } from 'ethereum-types'; import * as ethUtil from 'ethereumjs-util'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -29,7 +30,6 @@ import { } from './utils/compiler'; import { constants } from './utils/constants'; import { fsWrapper } from './utils/fs_wrapper'; -import { CompilerOptions, ContractArtifact, ContractVersionData } from './utils/types'; import { utils } from './utils/utils'; type TYPE_ALL_FILES_IDENTIFIER = '*'; @@ -112,6 +112,7 @@ export class Compiler { } /** * Instantiates a new instance of the Compiler class. + * @param opts Optional compiler options * @return An instance of the Compiler class. */ constructor(opts?: CompilerOptions) { diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index 15c166992..f8c2b577a 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -1,3 +1,8 @@ export { Compiler } from './compiler'; -export { CompilerOptions } from './utils/types'; -export { ContractArtifact, ContractNetworks } from './utils/types'; +export { + CompilerOptions, + CompilerSettings, + OutputField, + CompilerSettingsMetadata, + OptimizerSettings, +} from 'ethereum-types'; diff --git a/packages/sol-compiler/src/monorepo_scripts/postpublish.ts b/packages/sol-compiler/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/sol-compiler/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { postpublishUtils } from '@0xproject/monorepo-scripts'; - -import * as packageJSON from '../package.json'; -import * as tsConfigJSON from '../tsconfig.json'; - -const cwd = `${__dirname}/..`; -// tslint:disable-next-line:no-floating-promises -postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/sol-compiler/src/monorepo_scripts/stage_docs.ts b/packages/sol-compiler/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/sol-compiler/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { postpublishUtils } from '@0xproject/monorepo-scripts'; - -import * as packageJSON from '../package.json'; -import * as tsConfigJSON from '../tsconfig.json'; - -const cwd = `${__dirname}/..`; -// tslint:disable-next-line:no-floating-promises -postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/sol-compiler/src/utils/compiler.ts b/packages/sol-compiler/src/utils/compiler.ts index 968fcc5b2..c918ed1f3 100644 --- a/packages/sol-compiler/src/utils/compiler.ts +++ b/packages/sol-compiler/src/utils/compiler.ts @@ -1,10 +1,10 @@ import { ContractSource } from '@0xproject/sol-resolver'; import { logUtils } from '@0xproject/utils'; +import { ContractArtifact } from 'ethereum-types'; import * as _ from 'lodash'; import * as path from 'path'; import { fsWrapper } from './fs_wrapper'; -import { ContractArtifact } from './types'; /** * Gets contract data on network or returns if an artifact does not exist. diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts index 4321a2235..b211cfcbc 100644 --- a/packages/sol-compiler/src/utils/types.ts +++ b/packages/sol-compiler/src/utils/types.ts @@ -1,5 +1,3 @@ -import * as solc from 'solc'; - export enum AbiType { Function = 'function', Constructor = 'constructor', @@ -7,54 +5,10 @@ export enum AbiType { Fallback = 'fallback', } -export interface ContractArtifact extends ContractVersionData { - schemaVersion: string; - contractName: string; - networks: ContractNetworks; -} - -export interface ContractVersionData { - compiler: { - name: 'solc'; - version: string; - settings: solc.CompilerSettings; - }; - sources: { - [sourceName: string]: { - id: number; - }; - }; - sourceCodes: { - [sourceName: string]: string; - }; - sourceTreeHashHex: string; - compilerOutput: solc.StandardContractOutput; -} - -export interface ContractNetworks { - [networkId: number]: ContractNetworkData; -} - -export interface ContractNetworkData { - address: string; - links: { - [linkName: string]: string; - }; - constructorArgs: string; -} - export interface SolcErrors { [key: string]: boolean; } -export interface CompilerOptions { - contractsDir?: string; - artifactsDir?: string; - compilerSettings?: solc.CompilerSettings; - contracts?: string[] | '*'; - solcVersion?: string; -} - export interface ContractSourceData { [contractName: string]: ContractSpecificSourceData; } diff --git a/packages/sol-compiler/test/compiler_test.ts b/packages/sol-compiler/test/compiler_test.ts index 003d863e7..464aa8bb6 100644 --- a/packages/sol-compiler/test/compiler_test.ts +++ b/packages/sol-compiler/test/compiler_test.ts @@ -1,11 +1,11 @@ import { join } from 'path'; import * as chai from 'chai'; +import { CompilerOptions, ContractArtifact } from 'ethereum-types'; import 'mocha'; import { Compiler } from '../src/compiler'; import { fsWrapper } from '../src/utils/fs_wrapper'; -import { CompilerOptions, ContractArtifact } from '../src/utils/types'; import { exchange_binary } from './fixtures/exchange_bin'; import { chaiSetup } from './util/chai_setup'; @@ -80,7 +80,7 @@ describe('#Compiler', function(): void { it('recompilation should update artifact when source has changed', async () => { // append some meaningless data to the contract, so that its hash // will change, so that the compiler will decide to recompile it. - fsWrapper.appendFileAsync(join(contractsDir, `${contract}.sol`), ' '); + await fsWrapper.appendFileAsync(join(contractsDir, `${contract}.sol`), ' '); await new Compiler(compilerOpts).compileAsync(); |