aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-compiler
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sol-compiler')
-rw-r--r--packages/sol-compiler/package.json19
-rw-r--r--packages/sol-compiler/src/compiler.ts1
-rw-r--r--packages/sol-compiler/src/index.ts10
-rw-r--r--packages/sol-compiler/src/monorepo_scripts/postpublish.ts8
-rw-r--r--packages/sol-compiler/src/monorepo_scripts/stage_docs.ts8
-rw-r--r--packages/sol-compiler/src/utils/types.ts44
6 files changed, 49 insertions, 41 deletions
diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json
index 7cb07e970..7f4168f00 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,16 @@
"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",
"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/"
- }
+ "shouldPublishDocs": true
}
},
"bin": {
@@ -54,7 +44,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",
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 3620a3ec1..2503f7315 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -67,6 +67,7 @@ export class Compiler {
private readonly _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER;
/**
* 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..89d529887 100644
--- a/packages/sol-compiler/src/index.ts
+++ b/packages/sol-compiler/src/index.ts
@@ -1,3 +1,9 @@
export { Compiler } from './compiler';
-export { CompilerOptions } from './utils/types';
-export { ContractArtifact, ContractNetworks } from './utils/types';
+
+export {
+ CompilerOptions,
+ ContractArtifact,
+ ContractNetworks,
+ GeneratedCompilerOptions,
+ ContractNetworkData,
+} from './utils/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/types.ts b/packages/sol-compiler/src/utils/types.ts
index 4321a2235..e2e7a4e53 100644
--- a/packages/sol-compiler/src/utils/types.ts
+++ b/packages/sol-compiler/src/utils/types.ts
@@ -7,22 +7,39 @@ export enum AbiType {
Fallback = 'fallback',
}
+/**
+ * This type defines the schema of the artifact.json file generated by Sol-compiler
+ * schemaVersion: The version of the artifact schema
+ * contractName: The contract name it represents
+ * networks: Network specific information by network (address, id, constructor args, etc...)
+ * compilerOutput: The Solidity compiler output generated from the specified compiler input
+ * description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
+ * compiler: The compiler settings used
+ * sourceCodes: The source code of the contract and all it's dependencies
+ * sources: A mapping from source filePath to sourceMap id
+ * sourceTreeHashHex: A unique hash generated from the contract source and that of it's dependencies.
+ * If any of the sources change, the hash would change notifying us that a re-compilation is necessary
+ */
export interface ContractArtifact extends ContractVersionData {
schemaVersion: string;
contractName: string;
networks: ContractNetworks;
}
+export interface GeneratedCompilerOptions {
+ name: 'solc';
+ version: string;
+ settings: solc.CompilerSettings;
+}
+
+export interface Source {
+ id: number;
+}
+
export interface ContractVersionData {
- compiler: {
- name: 'solc';
- version: string;
- settings: solc.CompilerSettings;
- };
+ compiler: GeneratedCompilerOptions;
sources: {
- [sourceName: string]: {
- id: number;
- };
+ [sourceName: string]: Source;
};
sourceCodes: {
[sourceName: string]: string;
@@ -47,6 +64,17 @@ export interface SolcErrors {
[key: string]: boolean;
}
+/**
+ * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler
+ * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories.
+ * artifactsDir: Directory where you want the generated artifacts.json written to
+ * compilerSettings: Desired settings to pass to the Solidity compiler during compilation.
+ * (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
+ * contracts: List of contract names you wish to compile, or alternatively ['*'] to compile all contracts in the
+ * specified directory.
+ * solcVersion: If you don't want to compile each contract with the Solidity version specified in-file, you can force all
+ * contracts to compile with the the version specified here.
+ */
export interface CompilerOptions {
contractsDir?: string;
artifactsDir?: string;