@taqueria/plugin-ligo 0.4.2 → 0.5.0-rc1

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/README.md CHANGED
@@ -5,7 +5,7 @@ The LIGO plugin provides a task to compile LIGO smart contracts to Michelson `.t
5
5
  ## Requirements
6
6
 
7
7
  - Taqueria v0.0.6 or later
8
- - Node.js v16 or later
8
+ - Node.js v16.3 or later
9
9
  - Docker v0.8.4 or later
10
10
 
11
11
  ## Installation
@@ -15,9 +15,6 @@ To install the LIGO plugin on a Taqueria project, navigate to the project folder
15
15
  taq install @taqueria/plugin-ligo
16
16
  ```
17
17
 
18
- > ### :page_with_curl: Note
19
- > At this time, all Taqueria projects must also be initialized as node projects by running `npm init -y` from the root of your project directory
20
-
21
18
  ## Configuration
22
19
 
23
20
  No additional configuration is available
package/_readme.eta CHANGED
@@ -7,7 +7,7 @@ The LIGO plugin provides a task to compile LIGO smart contracts to Michelson `.t
7
7
  ## Requirements
8
8
 
9
9
  - Taqueria v0.0.6 or later
10
- - Node.js v16 or later
10
+ - Node.js v16.3 or later
11
11
  - Docker v0.8.4 or later
12
12
 
13
13
  ## Installation
@@ -17,10 +17,6 @@ To install the LIGO plugin on a Taqueria project, navigate to the project folder
17
17
  taq install @taqueria/plugin-ligo
18
18
  ```
19
19
 
20
- <%~ it.noteOpenAdmonition %>
21
- At this time, all Taqueria projects must also be initialized as node projects by running `npm init -y` from the root of your project directory
22
- <%= it.closeAdmonition %>
23
-
24
20
  ## Configuration
25
21
 
26
22
  No additional configuration is available
package/compile.ts CHANGED
@@ -28,7 +28,7 @@ const getCompileCommand = (opts: Opts) =>
28
28
 
29
29
  const inputFile = getInputFilename(opts)(sourceFile);
30
30
  const baseCommand =
31
- `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`;
31
+ `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ligolang/ligo:next compile contract ${inputFile}`;
32
32
  const entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : '';
33
33
  const syntax = opts['syntax'] ? `-s ${opts['syntax']} : ""` : '';
34
34
  const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;
package/index.js CHANGED
@@ -17,7 +17,7 @@ const $24b2f47d8f306cb3$var$getCompileCommand = (opts)=>(sourceFile)=>{
17
17
  const projectDir = process.env.PROJECT_DIR ?? opts.projectDir;
18
18
  if (!projectDir) throw `No project directory provided`;
19
19
  const inputFile = $24b2f47d8f306cb3$var$getInputFilename(opts)(sourceFile);
20
- const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`;
20
+ const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ligolang/ligo:next compile contract ${inputFile}`;
21
21
  const entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : "";
22
22
  const syntax = opts["syntax"] ? `-s ${opts["syntax"]} : ""` : "";
23
23
  const outFile = `-o ${$24b2f47d8f306cb3$var$getContractArtifactFilename(opts)(sourceFile)}`;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;ACAA;;;AAWA,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAC9C,CAAC,UAAkB,GAAK;QACvB,MAAM,OAAO,GAAG,CAAA,GAAA,oBAAQ,CAAA,CAAC,UAAU,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,UAAU,CAAC,CAAC,AAAC;QAC1D,OAAO,CAAA,GAAA,gBAAI,CAAA,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KACvD,AAAC;AAEH,MAAM,sCAAgB,GA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EAAE,GAAG;wBACd,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBAC9C,CAAC;oBACF,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,OAAO;wBACb,WAAW,EAAE,uBAAuB;qBACpC,CAAC;iBACF;gBACD,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aAChB,CAAC;SACF;QACD,wBAAwB,EAAE,IACzB,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE;oBACP;wBAAE,IAAI,EAAE,MAAM;wBAAE,IAAI,EAAE,MAAM;wBAAE,OAAO,EAAE,UAAU;wBAAE,IAAI,EAAE,UAAU;wBAAE,GAAG,EAAE,IAAI;qBAAE;iBAChF;aACD,CAAC;QACH,0BAA0B,EAAE,IAC3B,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,iCAAiC;aACzC,CAAC;QACH,KAAK,EAAE,CAAA,GAAA,wCAAO,CAAA;KACd,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/compile.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport compile from './compile';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile [sourceFile]',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription: 'Compile a smart contract written in a Ligo syntax to Michelson code',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'e',\n\t\t\t\t\tflag: 'entrypoint',\n\t\t\t\t\tdescription: 'The entry point that will be compiled',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'i',\n\t\t\t\t\tflag: 'infer',\n\t\t\t\t\tdescription: 'Enable type inference',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t],\n\tcheckRuntimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\treport: [\n\t\t\t\t{ name: 'LIGO', path: 'ligo', version: '>=0.27.0', kind: 'required', met: true },\n\t\t\t],\n\t\t}),\n\tinstallRunTimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\toutput: 'LIGO was found in /usr/bin/ligo', // TODO this should use i18n\n\t\t}),\n\tproxy: compile,\n}), process.argv);\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport { LikeAPromise, PluginResponse, RequestArgs } from '@taqueria/node-sdk/types';\nimport { basename, extname, join } from 'path';\nimport glob = require('fast-glob');\n\ninterface Opts extends RequestArgs.t {\n\tentrypoint?: string;\n\tsyntax?: string;\n\tsourceFile?: string;\n}\n\nconst getContractArtifactFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst outFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.artifactsDir, `${outFile}.tz`);\n\t};\n\nconst getInputFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\treturn join(opts.config.contractsDir, sourceFile);\n\t};\n\nconst getCompileCommand = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? opts.projectDir;\n\n\t\tif (!projectDir) throw `No project directory provided`;\n\n\t\tconst inputFile = getInputFilename(opts)(sourceFile);\n\t\tconst baseCommand =\n\t\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`;\n\t\tconst entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : '';\n\t\tconst syntax = opts['syntax'] ? `-s ${opts['syntax']} : \"\"` : '';\n\t\tconst outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;\n\t\tconst cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`;\n\t\treturn cmd;\n\t};\n\nconst compileContract = (opts: Opts) =>\n\t(sourceFile: string): Promise<{ contract: string; artifact: string }> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileCommand(opts)(sourceFile))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => { // How should we output warnings?\n\t\t\t\tif (stderr.length > 0) sendErr(stderr);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getContractArtifactFilename(opts)(sourceFile),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tsendErr(' ');\n\t\t\t\tsendErr(err.message.split('\\n').slice(1).join('\\n'));\n\t\t\t\treturn Promise.resolve({\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: 'Not compiled',\n\t\t\t\t});\n\t\t\t});\n\nconst compileAll = (parsedArgs: Opts): Promise<{ contract: string; artifact: string }[]> => {\n\t// TODO: Fetch list of files from SDK\n\treturn glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{ cwd: parsedArgs.config.contractsDir, absolute: false },\n\t)\n\t\t.then(entries => entries.map(compileContract(parsedArgs)))\n\t\t.then(processes =>\n\t\t\tprocesses.length > 0\n\t\t\t\t? processes\n\t\t\t\t: [{ contract: 'None found', artifact: 'N/A' }]\n\t\t)\n\t\t.then(promises => Promise.all(promises));\n};\n\nexport const compile = (parsedArgs: Opts): Promise<PluginResponse> => {\n\tconst p = parsedArgs.sourceFile\n\t\t? compileContract(parsedArgs)(parsedArgs.sourceFile as string)\n\t\t\t.then(result => [result])\n\t\t: compileAll(parsedArgs)\n\t\t\t.then(results => {\n\t\t\t\tif (results.length === 0) sendErr('No contracts found to compile.');\n\t\t\t\treturn results;\n\t\t\t});\n\n\treturn p\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
1
+ {"mappings":";;;;AAAA;ACAA;;;AAWA,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAC9C,CAAC,UAAkB,GAAK;QACvB,MAAM,OAAO,GAAG,CAAA,GAAA,oBAAQ,CAAA,CAAC,UAAU,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,UAAU,CAAC,CAAC,AAAC;QAC1D,OAAO,CAAA,GAAA,gBAAI,CAAA,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KACvD,AAAC;AAEH,MAAM,sCAAgB,GAAG,CAAC,IAAU,GACnC,CAAC,UAAkB,GAAK;QACvB,OAAO,CAAA,GAAA,gBAAI,CAAA,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;KAClD,AAAC;AAEH,MAAM,uCAAiB,GAAG,CAAC,IAAU,GACpC,CAAC,UAAkB,GAAK;QACvB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,AAAC;QAE9D,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,6BAA6B,CAAC,CAAC;QAEvD,MAAM,SAAS,GAAG,sCAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,AAAC;QACrD,MAAM,WAAW,GAChB,CAAC,yDAAyD,EAAE,UAAU,CAAC,iFAAiF,EAAE,SAAS,CAAC,CAAC,AAAC;QACvK,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,C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CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,iCAAiC;aACzC,CAAC;QACH,KAAK,EAAE,CAAA,GAAA,wCAAO,CAAA;KACd,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/compile.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport compile from './compile';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile [sourceFile]',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription: 'Compile a smart contract written in a Ligo syntax to Michelson code',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'e',\n\t\t\t\t\tflag: 'entrypoint',\n\t\t\t\t\tdescription: 'The entry point that will be compiled',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'i',\n\t\t\t\t\tflag: 'infer',\n\t\t\t\t\tdescription: 'Enable type inference',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t],\n\tcheckRuntimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\treport: [\n\t\t\t\t{ name: 'LIGO', path: 'ligo', version: '>=0.27.0', kind: 'required', met: true },\n\t\t\t],\n\t\t}),\n\tinstallRunTimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\toutput: 'LIGO was found in /usr/bin/ligo', // TODO this should use i18n\n\t\t}),\n\tproxy: compile,\n}), process.argv);\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport { LikeAPromise, PluginResponse, RequestArgs } from '@taqueria/node-sdk/types';\nimport { basename, extname, join } from 'path';\nimport glob = require('fast-glob');\n\ninterface Opts extends RequestArgs.t {\n\tentrypoint?: string;\n\tsyntax?: string;\n\tsourceFile?: string;\n}\n\nconst getContractArtifactFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst outFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.artifactsDir, `${outFile}.tz`);\n\t};\n\nconst getInputFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\treturn join(opts.config.contractsDir, sourceFile);\n\t};\n\nconst getCompileCommand = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? opts.projectDir;\n\n\t\tif (!projectDir) throw `No project directory provided`;\n\n\t\tconst inputFile = getInputFilename(opts)(sourceFile);\n\t\tconst baseCommand =\n\t\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ligolang/ligo:next compile contract ${inputFile}`;\n\t\tconst entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : '';\n\t\tconst syntax = opts['syntax'] ? `-s ${opts['syntax']} : \"\"` : '';\n\t\tconst outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;\n\t\tconst cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`;\n\t\treturn cmd;\n\t};\n\nconst compileContract = (opts: Opts) =>\n\t(sourceFile: string): Promise<{ contract: string; artifact: string }> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileCommand(opts)(sourceFile))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => { // How should we output warnings?\n\t\t\t\tif (stderr.length > 0) sendErr(stderr);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getContractArtifactFilename(opts)(sourceFile),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tsendErr(' ');\n\t\t\t\tsendErr(err.message.split('\\n').slice(1).join('\\n'));\n\t\t\t\treturn Promise.resolve({\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: 'Not compiled',\n\t\t\t\t});\n\t\t\t});\n\nconst compileAll = (parsedArgs: Opts): Promise<{ contract: string; artifact: string }[]> => {\n\t// TODO: Fetch list of files from SDK\n\treturn glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{ cwd: parsedArgs.config.contractsDir, absolute: false },\n\t)\n\t\t.then(entries => entries.map(compileContract(parsedArgs)))\n\t\t.then(processes =>\n\t\t\tprocesses.length > 0\n\t\t\t\t? processes\n\t\t\t\t: [{ contract: 'None found', artifact: 'N/A' }]\n\t\t)\n\t\t.then(promises => Promise.all(promises));\n};\n\nexport const compile = (parsedArgs: Opts): Promise<PluginResponse> => {\n\tconst p = parsedArgs.sourceFile\n\t\t? compileContract(parsedArgs)(parsedArgs.sourceFile as string)\n\t\t\t.then(result => [result])\n\t\t: compileAll(parsedArgs)\n\t\t\t.then(results => {\n\t\t\t\tif (results.length === 0) sendErr('No contracts found to compile.');\n\t\t\t\treturn results;\n\t\t\t});\n\n\treturn p\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-ligo",
3
- "version": "0.4.2",
3
+ "version": "0.5.0-rc1",
4
4
  "description": "A taqueria plugin for compiling LIGO smart contracts",
5
5
  "targets": {
6
6
  "default": {
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "homepage": "https://github.com/ecadlabs/taqueria#readme",
43
43
  "dependencies": {
44
- "@taqueria/node-sdk": "^0.4.2",
44
+ "@taqueria/node-sdk": "^0.5.0-rc1",
45
45
  "fast-glob": "^3.2.11"
46
46
  },
47
47
  "devDependencies": {