@taqueria/plugin-ligo 0.0.0-pr-392-3ec46dee → 0.0.0-pr-465-a31ca320
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compile.js +15 -23
- package/index.js +2 -1
- package/package.json +2 -2
package/compile.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {execCmd, getArch} = require('@taqueria/node-sdk')
|
|
1
|
+
const {execCmd, getArch, sendAsyncErr, sendJsonRes, sendErr} = require('@taqueria/node-sdk')
|
|
2
2
|
const {extname, basename, join} = require('path')
|
|
3
3
|
const glob = require('fast-glob')
|
|
4
4
|
|
|
@@ -22,21 +22,21 @@ const getCompileCommand = (opts, _arch) => (sourceFile) => {
|
|
|
22
22
|
return cmd
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const getLigoCompilationError = (stderr) => {
|
|
26
|
-
const err = stderr.split("\n").slice(1).join("\n")
|
|
27
|
-
return `There was a compilation error.\n\n${err}`
|
|
28
|
-
}
|
|
29
|
-
|
|
30
25
|
const compileContract = (opts) => (sourceFile) =>
|
|
31
26
|
getArch()
|
|
32
27
|
.then(arch => getCompileCommand(opts, arch) (sourceFile))
|
|
33
28
|
.then(execCmd)
|
|
34
|
-
.then(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
.then(({stderr}) => { // How should we output warnings?
|
|
30
|
+
if (stderr.length > 0) sendErr(stderr)
|
|
31
|
+
return {
|
|
32
|
+
contract: sourceFile,
|
|
33
|
+
artifact: getContractArtifactFilename(opts) (sourceFile)
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.catch(err => Promise.resolve({
|
|
37
|
+
contract: sourceFile,
|
|
38
|
+
artifact: err.message
|
|
39
|
+
}))
|
|
40
40
|
|
|
41
41
|
const compileAll = parsedArgs => {
|
|
42
42
|
// TODO: Fetch list of files from SDK
|
|
@@ -44,7 +44,7 @@ const compileAll = parsedArgs => {
|
|
|
44
44
|
['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],
|
|
45
45
|
{cwd: parsedArgs.contractsDir, absolute: false}
|
|
46
46
|
)
|
|
47
|
-
.then(entries => entries.map(compileContract(parsedArgs)))
|
|
47
|
+
.then(entries => entries.map(sourceFile => compileContract(parsedArgs) (sourceFile)))
|
|
48
48
|
.then(processes => processes.length > 0
|
|
49
49
|
? processes
|
|
50
50
|
: [{contract: "None found", artifact: "N/A"}]
|
|
@@ -59,16 +59,8 @@ const compile = parsedArgs => {
|
|
|
59
59
|
: compileAll(parsedArgs)
|
|
60
60
|
|
|
61
61
|
return p
|
|
62
|
-
.then(
|
|
63
|
-
|
|
64
|
-
stdout: results,
|
|
65
|
-
stderr: "",
|
|
66
|
-
render: 'table'
|
|
67
|
-
}))
|
|
68
|
-
.catch(err => err.errCode
|
|
69
|
-
? Promise.resolve({status: 'failed', stdout: '', stderr: err.errMsg, previous: err})
|
|
70
|
-
: Promise.resolve({status: 'failed', stderr: err.getMessage(), stdout: '', previous: err})
|
|
71
|
-
)
|
|
62
|
+
.then(sendJsonRes)
|
|
63
|
+
.catch(err => sendAsyncErr(err, false))
|
|
72
64
|
}
|
|
73
65
|
|
|
74
66
|
module.exports = compile
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-ligo",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-465-a31ca320",
|
|
4
4
|
"description": "A taqueria plugin for compiling LIGO smart contracts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"homepage": "https://github.com/ecadlabs/taqueria#readme",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"fast-glob": "^3.2.7",
|
|
37
|
-
"@taqueria/node-sdk": "^0.
|
|
37
|
+
"@taqueria/node-sdk": "^1.0.0"
|
|
38
38
|
}
|
|
39
39
|
}
|