diff --git a/chanterelle-bin.js b/chanterelle-bin.js deleted file mode 100755 index 67c077a..0000000 --- a/chanterelle-bin.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('./output/ChanterelleMain/index.js').main(); \ No newline at end of file diff --git a/chanterelle-bin.sh b/chanterelle-bin.sh new file mode 100755 index 0000000..0800f28 --- /dev/null +++ b/chanterelle-bin.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + +if [ ! -d './output' ] +then + echo "No './output' directory, make sure to compile purescript project." + exit 1 +fi + + +if [ ! -f './output/ChanterelleMain/index.js' ] +then + echo "Make sure you have purescript-chantrelle in your purescript dependencies and it is compiled." + exit 1 +fi + +node -e "require('./output/ChanterelleMain/index.js').main();" -- "chanterelle" $* diff --git a/docs/installation.rst b/docs/installation.rst index d136425..11a95b9 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -16,3 +16,13 @@ Or if you would like to install specific version like `v9.9.9 for example do: .. code-block:: shell npm install -g f-o-a-m/chanterelle#v9.9.9 + +you can also install it locally for particular project too: + + +.. code-block:: shell + + npm install f-o-a-m/chanterelle + + +NOTE: The projects where CLI is used, must also have chanterelle in it's purescript dependencies and whole purescript project should be compiled already. \ No newline at end of file diff --git a/package.json b/package.json index a6cc9e6..335ba77 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,10 @@ "description": "A more functional truffle", "license": "ISC", "scripts": { - "postinstall": "bower install --production && pulp build", "build": "pulp build", "docs": "cd docs; make html;" }, - "dependencies": { + "devDependencies": { "purescript": "^0.12.0", "pulp": "^12.2.0", "purescript-psa": "^0.6.0", @@ -22,6 +21,6 @@ "solc": "^0.4.24" }, "bin": { - "chanterelle": "chanterelle-bin.js" + "chanterelle": "chanterelle-bin.sh" } } diff --git a/src/ChanterelleMain.js b/src/ChanterelleMain.js index afca514..d475a78 100644 --- a/src/ChanterelleMain.js +++ b/src/ChanterelleMain.js @@ -1,8 +1,14 @@ "use strict"; +var path = require('path') exports.loadDeployMFromScriptPath = function (filePath) { return function () { - return require(filePath).deploy; + var scriptPath = path.isAbsolute(filePath) ? filePath : path.join (process.cwd(), filePath); + var script = require(scriptPath).deploy + if (script == undefined) { + throw "Deploy script is invalid: " + scriptPath + } + return script; }; };