From 8abb5d77a3ae5559da32fb33683c5cdf50c8cb89 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Sun, 27 Jan 2019 22:46:36 +0530 Subject: [PATCH 1/2] Add module.d.ts --- remix-url-resolver/README.md | 9 +++++++-- remix-url-resolver/package.json | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/remix-url-resolver/README.md b/remix-url-resolver/README.md index b79524bb21..18ef2f4d07 100644 --- a/remix-url-resolver/README.md +++ b/remix-url-resolver/README.md @@ -8,8 +8,8 @@ Returns `json` object with exact same path as `import` statement. ```json { content: 'pragma solidity ^0.5.0;\nimport "./mortal.sol";\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n', - cleanURL: '../greeter.sol', - type: 'local' + cleanURL: '../greeter.sol', + type: 'local' } ``` @@ -30,3 +30,8 @@ urlResolver.resolve(fileName, urlHandler) throw e }) ``` + +#### References + +* [TypeScript Publishing](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) +* [DefinitelyTyped 'Create a new package' guide](https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package) diff --git a/remix-url-resolver/package.json b/remix-url-resolver/package.json index 28336b0967..3d65657442 100644 --- a/remix-url-resolver/package.json +++ b/remix-url-resolver/package.json @@ -2,9 +2,10 @@ "name": "remix-url-resolver", "version": "0.0.2", "description": "Solidity import url resolver engine", - "main": "./dist/index.js", + "main": "dist", + "types": "dist/main.d.ts", "scripts": { - "build": "tsc", + "build": "tsc --declaration", "lint": "standard", "test": "standard && mocha --require ts-node/register tests/*.ts -t 300000" }, From f9c6f590f8396b07b06dca3ad704e777bb854e59 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Mon, 28 Jan 2019 18:47:16 +0530 Subject: [PATCH 2/2] update tsconfig to generate declaration --- remix-url-resolver/package.json | 4 ++-- remix-url-resolver/tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/remix-url-resolver/package.json b/remix-url-resolver/package.json index 3d65657442..f6add861f3 100644 --- a/remix-url-resolver/package.json +++ b/remix-url-resolver/package.json @@ -3,9 +3,9 @@ "version": "0.0.2", "description": "Solidity import url resolver engine", "main": "dist", - "types": "dist/main.d.ts", + "types": "dist/index.d.ts", "scripts": { - "build": "tsc --declaration", + "build": "tsc", "lint": "standard", "test": "standard && mocha --require ts-node/register tests/*.ts -t 300000" }, diff --git a/remix-url-resolver/tsconfig.json b/remix-url-resolver/tsconfig.json index 2e20354bf7..f33c2bad6b 100644 --- a/remix-url-resolver/tsconfig.json +++ b/remix-url-resolver/tsconfig.json @@ -5,7 +5,7 @@ "baseUrl": "./src", "outDir": "./dist", "sourceMap": true, - "declaration": false, + "declaration": true, "module": "commonjs", "strict": true, "noImplicitAny": false,