@taqueria/plugin-ligo 0.0.0-pr-155-8d8b3d05 → 0.0.0-pr-156-df8a8003
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 +7 -24
- package/index.js +1 -1
- package/package.json +1 -1
package/compile.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {execCmd, getArch} = require('@taqueria/node-sdk')
|
|
2
2
|
const {extname, basename, join} = require('path')
|
|
3
3
|
const glob = require('fast-glob')
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
const getContractArtifactFilename = (opts) => (sourceFile) => {
|
|
6
7
|
const outFile = basename(sourceFile, extname(sourceFile))
|
|
7
8
|
return join(opts.config.artifactsDir, `${outFile}.tz`)
|
|
@@ -11,10 +12,10 @@ const getInputFilename = (opts) => sourceFile => {
|
|
|
11
12
|
return join(opts.config.contractsDir, sourceFile)
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const getCompileCommand = (opts) => (sourceFile) => {
|
|
15
|
+
const getCompileCommand = (opts, arch) => (sourceFile) => {
|
|
15
16
|
const {projectDir} = opts
|
|
16
17
|
const inputFile = getInputFilename (opts) (sourceFile)
|
|
17
|
-
const baseCommand = `docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`
|
|
18
|
+
const baseCommand = `docker run --platform ${arch} --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`
|
|
18
19
|
const entryPoint = opts.e ? `-e ${opts.e}` : ""
|
|
19
20
|
const syntax = opts["-s"] ? `s ${opts['s']} : ""` : ""
|
|
20
21
|
const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`
|
|
@@ -22,28 +23,10 @@ const getCompileCommand = (opts) => (sourceFile) => {
|
|
|
22
23
|
return cmd
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
const execCmd = cmd => new Promise((resolve, reject) => {
|
|
26
|
-
exec(cmd, (err, stdout, stderr) => {
|
|
27
|
-
if (err) reject({
|
|
28
|
-
status: 'failed',
|
|
29
|
-
stdout: "",
|
|
30
|
-
stderr: err
|
|
31
|
-
})
|
|
32
|
-
else if (stderr) reject({
|
|
33
|
-
status: 'failed',
|
|
34
|
-
stdout,
|
|
35
|
-
stderr
|
|
36
|
-
})
|
|
37
|
-
else resolve({
|
|
38
|
-
status: 'success',
|
|
39
|
-
stdout,
|
|
40
|
-
stderr
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
|
|
45
26
|
const compileContract = (opts) => (sourceFile) =>
|
|
46
|
-
|
|
27
|
+
getArch()
|
|
28
|
+
.then(arch => getCompileCommand(opts, arch) (sourceFile))
|
|
29
|
+
.then(execCmd)
|
|
47
30
|
.then(() => ({contract: sourceFile, artifact: getContractArtifactFilename(opts) (sourceFile)}))
|
|
48
31
|
|
|
49
32
|
const compileAll = parsedArgs => {
|
package/index.js
CHANGED
package/package.json
CHANGED