@taqueria/plugin-ligo 0.0.0-pr-704-b4e4d8ec → 0.0.0-pr-575-5c09fedd

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
@@ -24,8 +24,46 @@ To install the LIGO plugin on a Taqueria project, navigate to the project folder
24
24
  taq install @taqueria/plugin-ligo
25
25
  ```
26
26
 
27
+ > ### :page_with_curl: Note
28
+ > 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
29
+
30
+ ## Configuration
31
+
32
+ No additional configuration is available
33
+ ## Usage
34
+
35
+ The LIGO plugin exposes a `compile` task in Taqueria which can target one, or all the LIGO contracts in the `contracts` folder and compile them to Michelson `.tz` files output to the `artifacts` folder
36
+
37
+ ### Running the Compile Task
38
+
39
+ The LIGO plugin's `taq compile` task can be run with or without arguments. The basic syntax for the task is `taq compile <file-name>`
40
+
41
+ Running the `compile` task with no options will result in any source LIGO smart contracts in the `contracts` folder being compiled to Michelson files in the `artifacts` folder. If you speficy an optional filename, only LIGO contracts matching the specified filename in the `contracts` folder will be compiled
42
+
43
+ > ### :warning: CAUTION
44
+ > The `compile` task can be implemented by more than one compiler plugin installed on a project (LIGO, SmartPY). If this is the case, you must use the `--plugin ligo` flag to specify a particular compiler
45
+
46
+ ### Options
47
+
48
+ The LIGO `compile` task will accept the following optional parameters:
49
+
50
+ | flag | name | description |
51
+ |:-----:|:------------|---------------------------------------|
52
+ | -e | entry-point | The entry point that will be compiled |
53
+ | -s | syntax | The syntax used in the contract |
54
+ | -i | infer | Enable type inference |
55
+
56
+
27
57
  ## Plugin Architecture
28
58
 
29
- This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK and distributed via NPM
59
+ This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
60
+
61
+ Docker is used under the hood to provide a self contained environment for LIGO to prevent the need for it to be installed on the user's local machine
62
+
63
+ The plugin provides a single task `compile`, used for compiling LIGO smart contracts to Michelson:
30
64
 
31
- For detailed usage and configuration information, view the LIGO plugin documentation on the Taqueria website [here](https://taqueria.io/docs/plugins/plugin-ligo)
65
+ | attribute | value |
66
+ |------------|:------------------------:|
67
+ | task | 'compile' |
68
+ | command | 'compile [sourceFile] |
69
+ | aliases | ['c', 'compile-ligo'] |
package/_readme.eta ADDED
@@ -0,0 +1,73 @@
1
+ <% if (it.output == "github") { %>
2
+ # Taqueria LIGO Plugin
3
+ <% } %>
4
+
5
+ This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK and distributed via NPM
6
+
7
+ The LIGO plugin exposes a compile task in Taqueria which can target one, or all the LIGO contracts in the contracts folder and compile them to Michelson code output to the artifacts folder
8
+
9
+ ## Tasks
10
+
11
+ The LIGO plugin provides the following tasks to Taqueria:
12
+ - `compile`
13
+
14
+ ## Requirements
15
+
16
+ - Taqueria v0.0.6 or later
17
+ - Node.js v16 or later
18
+ - Docker v0.8.4 or later
19
+
20
+ ## Installation
21
+
22
+ The LIGO plugin is distributed as an NPM package that can be installed and uninstalled on a project from the Taqueria CLI
23
+
24
+ To install the LIGO plugin on a Taqueria project, navigate to the project folder and run:
25
+ ```shell
26
+ taq install @taqueria/plugin-ligo
27
+ ```
28
+
29
+ <%~ it.noteOpenAdmonition %>
30
+ 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
31
+ <%= it.closeAdmonition %>
32
+
33
+ ## Configuration
34
+
35
+ No additional configuration is available
36
+ ## Usage
37
+
38
+ The LIGO plugin exposes a `compile` task in Taqueria which can target one, or all the LIGO contracts in the `contracts` folder and compile them to Michelson `.tz` files output to the `artifacts` folder
39
+
40
+ ### Running the Compile Task
41
+
42
+ The LIGO plugin's `taq compile` task can be run with or without arguments. The basic syntax for the task is `taq compile <file-name>`
43
+
44
+ Running the `compile` task with no options will result in any source LIGO smart contracts in the `contracts` folder being compiled to Michelson files in the `artifacts` folder. If you speficy an optional filename, only LIGO contracts matching the specified filename in the `contracts` folder will be compiled
45
+
46
+ <%~ it.cautionOpenAdmonition %>
47
+ The `compile` task can be implemented by more than one compiler plugin installed on a project (LIGO, SmartPY). If this is the case, you must use the `--plugin ligo` flag to specify a particular compiler
48
+ <%= it.closeAdmonition %>
49
+
50
+ ### Options
51
+
52
+ The LIGO `compile` task will accept the following optional parameters:
53
+
54
+ | flag | name | description |
55
+ |:-----:|:------------|---------------------------------------|
56
+ | -e | entry-point | The entry point that will be compiled |
57
+ | -s | syntax | The syntax used in the contract |
58
+ | -i | infer | Enable type inference |
59
+
60
+
61
+ ## Plugin Architecture
62
+
63
+ This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
64
+
65
+ Docker is used under the hood to provide a self contained environment for LIGO to prevent the need for it to be installed on the user's local machine
66
+
67
+ The plugin provides a single task `compile`, used for compiling LIGO smart contracts to Michelson:
68
+
69
+ | attribute | value |
70
+ |------------|:------------------------:|
71
+ | task | 'compile' |
72
+ | command | 'compile [sourceFile] |
73
+ | aliases | ['c', 'compile-ligo'] |
package/compile.ts CHANGED
@@ -15,13 +15,9 @@ const getInputFilename = (opts: Opts) => (sourceFile: string) => {
15
15
  }
16
16
 
17
17
  const getCompileCommand = (opts: Opts) => (sourceFile: string) => {
18
- var {projectDir} = opts
19
- // if process.env.PROJECT_DIR is not null
20
- if (process.env.PROJECT_DIR && process.env.PROJECT_DIR?.length > 0) {
21
- projectDir = process.env.PROJECT_DIR
22
- }
18
+ const {projectDir} = opts
23
19
  const inputFile = getInputFilename (opts) (sourceFile)
24
- const baseCommand = `$DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:0.41.0 compile contract ${inputFile}`
20
+ const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`
25
21
  const entryPoint = opts.e ? `-e ${opts.e}` : ""
26
22
  const syntax = opts["-s"] ? `s ${opts['s']} : ""` : ""
27
23
  const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`
package/index.js CHANGED
@@ -16,11 +16,9 @@ const $24b2f47d8f306cb3$var$getInputFilename = (opts)=>(sourceFile)=>{
16
16
  }
17
17
  ;
18
18
  const $24b2f47d8f306cb3$var$getCompileCommand = (opts)=>(sourceFile)=>{
19
- var { projectDir: projectDir } = opts;
20
- // if process.env.PROJECT_DIR is not null
21
- if (process.env.PROJECT_DIR && process.env.PROJECT_DIR?.length > 0) projectDir = process.env.PROJECT_DIR;
19
+ const { projectDir: projectDir } = opts;
22
20
  const inputFile = $24b2f47d8f306cb3$var$getInputFilename(opts)(sourceFile);
23
- const baseCommand = `$DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:0.41.0 compile contract ${inputFile}`;
21
+ const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`;
24
22
  const entryPoint = opts.e ? `-e ${opts.e}` : "";
25
23
  const syntax = opts["-s"] ? `s ${opts['s']} : ""` : "";
26
24
  const outFile = `-o ${$24b2f47d8f306cb3$var$getContractArtifactFilename(opts)(sourceFile)}`;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;ACAA;;;AAOA,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QACxE,MAAM,OAAO,GAAG,oBAAQ,CAAC,UAAU,EAAE,mBAAO,CAAC,UAAU,CAAC,CAAC;QACzD,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;KACzD;AAAA;AAED,MAAM,sCAAgB,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QAC7D,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,C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gBAC5C,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE;oBACJ;wBAAC,IAAI,EAAE,MAAM;wBAAE,IAAI,EAAE,MAAM;wBAAE,OAAO,EAAE,UAAU;wBAAE,IAAI,EAAE,UAAU;wBAAE,GAAG,EAAE,IAAI;qBAAC;iBACjF;aACJ,CAAC;QAAA;QACF,0BAA0B,EAAE,IAAM,OAAO,CAAC,OAAO,CAAC;gBAC9C,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,iCAAiC,CAAC,4BAA4B;aACzE,CAAC;QAAA;QACF,KAAK,EAAE,wCAAO;KACjB,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/compile.ts"],"sourcesContent":["import {Plugin, Task, Option} from '@taqueria/node-sdk'\nimport compile from './compile'\n\nPlugin.create(i18n => ({\n schema: \"1.0\",\n version: \"0.1\",\n alias: \"ligo\",\n tasks: [\n Task.create({\n task: \"compile\",\n command: \"compile [sourceFile]\",\n aliases: [\"c\", \"compile-ligo\"],\n description: \"Compile a smart contract written in a Ligo syntax to Michelson code\",\n options: [\n Option.create({\n shortFlag: \"e\",\n flag: \"entry-point\",\n description: \"The entry point that will be compiled\"\n }),\n Option.create({\n shortFlag: \"s\",\n flag: \"syntax\",\n description: \"The syntax used in the contract\"\n }),\n Option.create({\n shortFlag: \"i\",\n flag: \"infer\",\n description: \"Enable type inference\"\n })\n ],\n handler: 'proxy',\n encoding: 'json'\n })\n ],\n checkRuntimeDependencies: () => Promise.resolve({\n status: \"success\",\n report: [\n {name: \"LIGO\", path: \"ligo\", version: \">=0.27.0\", kind: \"required\", met: true}\n ]\n }),\n installRunTimeDependencies: () => Promise.resolve({\n status: \"success\",\n output: \"LIGO was found in /usr/bin/ligo\" // TODO this should use i18n\n }),\n proxy: compile\n}), process.argv)","import {execCmd, getArch, sendAsyncErr, sendJsonRes, sendErr} from '@taqueria/node-sdk'\nimport {SanitizedArgs, PluginResponse, Failure, LikeAPromise} from \"@taqueria/node-sdk/types\";\nimport {extname, basename, join} from 'path'\nimport glob = require('fast-glob')\n\ntype Opts = SanitizedArgs & Record<string, unknown>\n\nconst getContractArtifactFilename = (opts: Opts) => (sourceFile: string) => {\n const outFile = basename(sourceFile, extname(sourceFile))\n return join(opts.config.artifactsDir, `${outFile}.tz`)\n}\n\nconst getInputFilename = (opts: Opts) => (sourceFile: string) => {\n return join(opts.config.contractsDir, sourceFile)\n}\n\nconst getCompileCommand = (opts: Opts) => (sourceFile: string) => {\n var {projectDir} = opts\n // if process.env.PROJECT_DIR is not null \n if (process.env.PROJECT_DIR && process.env.PROJECT_DIR?.length > 0) {\n projectDir = process.env.PROJECT_DIR\n }\n const inputFile = getInputFilename (opts) (sourceFile)\n const baseCommand = `$DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project ligolang/ligo:0.41.0 compile contract ${inputFile}`\n const entryPoint = opts.e ? `-e ${opts.e}` : \"\"\n const syntax = opts[\"-s\"] ? `s ${opts['s']} : \"\"` : \"\"\n const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`\n const cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`\n return cmd\n}\n\nconst compileContract = (opts: Opts) => (sourceFile: string): Promise<{contract: string, artifact: string}> =>\n getArch()\n .then(() => getCompileCommand (opts) (sourceFile))\n .then(execCmd)\n .then(({stderr}) => { // How should we output warnings?\n if (stderr.length > 0) sendErr(stderr)\n return {\n contract: sourceFile,\n artifact: getContractArtifactFilename (opts) (sourceFile)\n }\n })\n .catch(err => {\n sendErr(\" \")\n sendErr(err.message.split(\"\\n\").slice(1).join(\"\\n\"))\n return Promise.resolve({\n contract: sourceFile,\n artifact: \"Not compiled\"\n })\n })\n\nconst compileAll = (parsedArgs: Opts): Promise<{contract: string, artifact: string}[]> => {\n // TODO: Fetch list of files from SDK\n return glob(\n ['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n {cwd: parsedArgs.contractsDir, absolute: false}\n )\n .then(entries => entries.map(compileContract (parsedArgs)))\n .then(processes => processes.length > 0\n ? processes\n : [{contract: \"None found\", artifact: \"N/A\"}]\n )\n .then(promises => Promise.all(promises))\n}\n\nexport const compile = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n const p = parsedArgs.sourceFile\n ? compileContract (parsedArgs) (parsedArgs.sourceFile as string)\n .then(result => [result])\n : compileAll(parsedArgs)\n .then(results => {\n if (results.length === 0) sendErr(\"No contracts found to compile.\")\n return results\n })\n \n return p\n .then(sendJsonRes)\n .catch(err => sendAsyncErr(err, false))\n}\n\nexport default compile"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
1
+ {"mappings":";;;;AAAA;ACAA;;;AAOA,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QACxE,MAAM,OAAO,GAAG,oBAAQ,CAAC,UAAU,EAAE,mBAAO,CAAC,UAAU,CAAC,CAAC;QACzD,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;KACzD;AAAA;AAED,MAAM,sCAAgB,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QAC7D,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;KACpD;AAAA;AAED,MAAM,uCAAiB,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QAC9D,MAAM,EAjBV,YAiBW,UAAU,CAAA,EAAC,GAAG,IAAI;QACzB,MAAM,SAAS,GAAG,sCAAgB,CAAE,IAAI,CAAC,CAAE,UAAU,CAAC;QACtD,MAAM,WAAW,GAAG,CAAC,yDAAyD,EAAE,UAAU,CAAC,4DAA4D,EAAE,SAAS,CAAC,CAAC;QACpK,MAAM,UAAU,GAAG,IAAI,CAAC,C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@taqueria/node-sdk'\nimport compile from './compile'\n\nPlugin.create(i18n => ({\n schema: \"1.0\",\n version: \"0.1\",\n alias: \"ligo\",\n tasks: [\n Task.create({\n task: \"compile\",\n command: \"compile [sourceFile]\",\n aliases: [\"c\", \"compile-ligo\"],\n description: \"Compile a smart contract written in a Ligo syntax to Michelson code\",\n options: [\n Option.create({\n shortFlag: \"e\",\n flag: \"entry-point\",\n description: \"The entry point that will be compiled\"\n }),\n Option.create({\n shortFlag: \"s\",\n flag: \"syntax\",\n description: \"The syntax used in the contract\"\n }),\n Option.create({\n shortFlag: \"i\",\n flag: \"infer\",\n description: \"Enable type inference\"\n })\n ],\n handler: 'proxy',\n encoding: 'json'\n })\n ],\n checkRuntimeDependencies: () => Promise.resolve({\n status: \"success\",\n report: [\n {name: \"LIGO\", path: \"ligo\", version: \">=0.27.0\", kind: \"required\", met: true}\n ]\n }),\n installRunTimeDependencies: () => Promise.resolve({\n status: \"success\",\n output: \"LIGO was found in /usr/bin/ligo\" // TODO this should use i18n\n }),\n proxy: compile\n}), process.argv)","import {execCmd, getArch, sendAsyncErr, sendJsonRes, sendErr} from '@taqueria/node-sdk'\nimport {SanitizedArgs, PluginResponse, Failure, LikeAPromise} from \"@taqueria/node-sdk/types\";\nimport {extname, basename, join} from 'path'\nimport glob = require('fast-glob')\n\ntype Opts = SanitizedArgs & Record<string, unknown>\n\nconst getContractArtifactFilename = (opts: Opts) => (sourceFile: string) => {\n const outFile = basename(sourceFile, extname(sourceFile))\n return join(opts.config.artifactsDir, `${outFile}.tz`)\n}\n\nconst getInputFilename = (opts: Opts) => (sourceFile: string) => {\n return join(opts.config.contractsDir, sourceFile)\n}\n\nconst getCompileCommand = (opts: Opts) => (sourceFile: string) => {\n const {projectDir} = opts\n const inputFile = getInputFilename (opts) (sourceFile)\n const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`\n const entryPoint = opts.e ? `-e ${opts.e}` : \"\"\n const syntax = opts[\"-s\"] ? `s ${opts['s']} : \"\"` : \"\"\n const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`\n const cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`\n return cmd\n}\n\nconst compileContract = (opts: Opts) => (sourceFile: string): Promise<{contract: string, artifact: string}> =>\n getArch()\n .then(() => getCompileCommand (opts) (sourceFile))\n .then(execCmd)\n .then(({stderr}) => { // How should we output warnings?\n if (stderr.length > 0) sendErr(stderr)\n return {\n contract: sourceFile,\n artifact: getContractArtifactFilename (opts) (sourceFile)\n }\n })\n .catch(err => {\n sendErr(\" \")\n sendErr(err.message.split(\"\\n\").slice(1).join(\"\\n\"))\n return Promise.resolve({\n contract: sourceFile,\n artifact: \"Not compiled\"\n })\n })\n\nconst compileAll = (parsedArgs: Opts): Promise<{contract: string, artifact: string}[]> => {\n // TODO: Fetch list of files from SDK\n return glob(\n ['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n {cwd: parsedArgs.contractsDir, absolute: false}\n )\n .then(entries => entries.map(compileContract (parsedArgs)))\n .then(processes => processes.length > 0\n ? processes\n : [{contract: \"None found\", artifact: \"N/A\"}]\n )\n .then(promises => Promise.all(promises))\n}\n\nexport const compile = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n const p = parsedArgs.sourceFile\n ? compileContract (parsedArgs) (parsedArgs.sourceFile as string)\n .then(result => [result])\n : compileAll(parsedArgs)\n .then(results => {\n if (results.length === 0) sendErr(\"No contracts found to compile.\")\n return results\n })\n \n return p\n .then(sendJsonRes)\n .catch(err => sendAsyncErr(err, false))\n}\n\nexport default compile"],"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.0.0-pr-704-b4e4d8ec",
3
+ "version": "0.0.0-pr-575-5c09fedd",
4
4
  "description": "A taqueria plugin for compiling LIGO smart contracts",
5
5
  "targets": {
6
6
  "default": {