aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-doc
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sol-doc')
-rw-r--r--packages/sol-doc/package.json10
-rw-r--r--packages/sol-doc/src/cli.ts26
2 files changed, 34 insertions, 2 deletions
diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json
index e3bc8753c..500b1cbde 100644
--- a/packages/sol-doc/package.json
+++ b/packages/sol-doc/package.json
@@ -11,7 +11,12 @@
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"lint": "tslint --project . --format stylish",
- "clean": "shx rm -rf lib"
+ "clean": "shx rm -rf lib",
+ "generate-v2-protocol-docs": "(cd ../contracts/src/2.0.0; node ../../../../node_modules/.bin/sol-doc --contracts-dir . --contracts $(cd protocol; ls -C1 */*.sol */interfaces/*.sol) ) > v2.0.0.json",
+ "deploy-v2-protocol-docs": "aws --profile 0xproject s3 cp --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json v2.0.0.json s3://staging-doc-jsons/contracts/"
+ },
+ "bin": {
+ "sol-doc": "bin/sol-doc.js"
},
"repository": "https://github.com/0xProject/0x-monorepo.git",
"author": "F. Eugene Aumson",
@@ -21,7 +26,8 @@
"@0xproject/types": "^1.0.1-rc.6",
"@0xproject/utils": "^1.0.5",
"ethereum-types": "^1.0.4",
- "lodash": "^4.17.10"
+ "lodash": "^4.17.10",
+ "yargs": "^12.0.2"
},
"devDependencies": {
"@0xproject/tslint-config": "^1.0.6",
diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts
new file mode 100644
index 000000000..59fc185de
--- /dev/null
+++ b/packages/sol-doc/src/cli.ts
@@ -0,0 +1,26 @@
+import 'source-map-support/register';
+import * as yargs from 'yargs';
+
+import { generateSolDocAsync } from './solidity_doc_generator';
+
+const JSON_TABWIDTH = 4;
+
+(async () => {
+ const argv = yargs
+ .option('contracts-dir', {
+ type: 'string',
+ description: 'path of contracts directory to compile',
+ })
+ .option('contracts', {
+ type: 'string',
+ description: 'comma separated list of contracts to compile',
+ })
+ .demandOption('contracts-dir')
+ .array('contracts')
+ .help().argv;
+ process.stdout.write(
+ JSON.stringify(await generateSolDocAsync(argv.contractsDir, argv.contracts), null, JSON_TABWIDTH),
+ );
+})().catch(err => {
+ throw err;
+});