@taqueria/plugin-ligo 0.0.0-pr-155-8d8b3d05 → 0.0.0-pr-149-70de2cae

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.
Files changed (3) hide show
  1. package/compile.js +7 -4
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/compile.js CHANGED
@@ -1,7 +1,8 @@
1
- const {exec} = require('child_process')
1
+ import {execCmd, getArch} from '@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)}`
@@ -43,7 +44,9 @@ const execCmd = cmd => new Promise((resolve, reject) => {
43
44
  })
44
45
 
45
46
  const compileContract = (opts) => (sourceFile) =>
46
- execCmd(getCompileCommand(opts) (sourceFile))
47
+ getArch()
48
+ .then(arch => getCompileCommand(opts, arch) (sourceFile))
49
+ .then(execCmd)
47
50
  .then(() => ({contract: sourceFile, artifact: getContractArtifactFilename(opts) (sourceFile)}))
48
51
 
49
52
  const compileAll = parsedArgs => {
package/index.js CHANGED
@@ -4,7 +4,7 @@ const compile = require('./compile')
4
4
  Plugin.create(i18n => ({
5
5
  schema: "1.0",
6
6
  version: "0.1",
7
- name: "taqueria-plugin-ligo",
7
+ alias: "ligo",
8
8
  tasks: [
9
9
  Task.create({
10
10
  task: "compile",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-ligo",
3
- "version": "0.0.0-pr-155-8d8b3d05",
3
+ "version": "0.0.0-pr-149-70de2cae",
4
4
  "description": "A taqueria plugin for compiling LIGO smart contracts",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",