@taqueria/plugin-ligo 0.0.1-test.33 → 0.0.2
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 +5 -11
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
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-ligo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "A taqueria plugin for compiling LIGO smart contracts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
-
"build": "echo 'Nothing to build.'",
|
|
7
|
+
"build": "echo 'Nothing to build.' && exit 0",
|
|
8
|
+
"build-ci": "npm run build",
|
|
8
9
|
"pluginInfo": "node index.js --taqRun pluginInfo --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
|
|
9
10
|
"compile": "node index.js --taqRun proxy --task compile --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
|
|
10
|
-
"debugPluginInfo": "node --inspect index.js --taqRun pluginInfo --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\"}' --projectDir ../test-project --configDir ./.taq"
|
|
11
|
-
"get-sdk-version": "cd ../taqueria-sdk && node -e 'console.log(require(\"./package.json\").version)'",
|
|
12
|
-
"backup-config": "cp package.json package.json.orig && cp package-lock.json package-lock.json.orig",
|
|
13
|
-
"restore-config": "mv package.json.orig package.json && mv package-lock.json.orig package-lock.json",
|
|
14
|
-
"update-sdk-version": "sed -I -e \"s/file:\\.\\.\\/taqueria-sdk/`npm run get-sdk-version | tail -1`/\" package.json",
|
|
15
|
-
"update-sdk-version-lock": "sed -I -e \"s/file:\\.\\.\\/taqueria-sdk/`npm run get-sdk-version | tail -1`/\" package-lock.json",
|
|
16
|
-
"prod-config": "npm run backup-config && npm run update-sdk-version && npm run update-sdk-version-lock",
|
|
17
|
-
"build-prod": "npm run backup-config && npm run prod-config && npm run build && npm run restore-config"
|
|
11
|
+
"debugPluginInfo": "node --inspect index.js --taqRun pluginInfo --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\"}' --projectDir ../test-project --configDir ./.taq"
|
|
18
12
|
},
|
|
19
13
|
"keywords": [
|
|
20
14
|
"taqueria",
|
|
@@ -41,6 +35,6 @@
|
|
|
41
35
|
"homepage": "https://github.com/ecadlabs/taqueria#readme",
|
|
42
36
|
"dependencies": {
|
|
43
37
|
"fast-glob": "^3.2.7",
|
|
44
|
-
"@taqueria/node-sdk": "
|
|
38
|
+
"@taqueria/node-sdk": "^0.0.1"
|
|
45
39
|
}
|
|
46
40
|
}
|