@taqueria/plugin-ligo 0.21.23 → 0.21.30
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/common.ts +20 -0
- package/compile.ts +4 -11
- package/index.js +22 -19
- package/index.js.map +1 -1
- package/ligo.ts +3 -7
- package/package.json +2 -2
- package/test.ts +3 -11
package/common.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RequestArgs } from '@taqueria/node-sdk/types';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
|
|
4
|
+
export interface CompileOpts extends RequestArgs.ProxyRequestArgs {
|
|
5
|
+
sourceFile: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface TestOpts extends RequestArgs.ProxyRequestArgs {
|
|
9
|
+
sourceFile: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type IntersectionOpts = CompileOpts & TestOpts;
|
|
13
|
+
|
|
14
|
+
type UnionOpts = CompileOpts | TestOpts;
|
|
15
|
+
|
|
16
|
+
// Points to the latest stable version. Needs to update this as part of our release process
|
|
17
|
+
export const LIGO_DOCKER_IMAGE = 'ligolang/ligo:0.51.0';
|
|
18
|
+
|
|
19
|
+
export const getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>
|
|
20
|
+
join(parsedArgs.config.contractsDir, sourceFile);
|
package/compile.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
|
|
2
|
-
import { RequestArgs } from '@taqueria/node-sdk/types';
|
|
3
2
|
import { access, readFile, writeFile } from 'fs/promises';
|
|
4
3
|
import { basename, extname, join } from 'path';
|
|
5
|
-
|
|
6
|
-
interface Opts extends RequestArgs.t {
|
|
7
|
-
sourceFile: string;
|
|
8
|
-
}
|
|
4
|
+
import { CompileOpts as Opts, getInputFilename, LIGO_DOCKER_IMAGE } from './common';
|
|
9
5
|
|
|
10
6
|
type TableRow = { contract: string; artifact: string };
|
|
11
7
|
|
|
@@ -35,9 +31,6 @@ const removeExt = (path: string): string => {
|
|
|
35
31
|
return path.replace(extRegex, '');
|
|
36
32
|
};
|
|
37
33
|
|
|
38
|
-
const getInputFilename = (parsedArgs: Opts, sourceFile: string): string =>
|
|
39
|
-
join(parsedArgs.config.contractsDir, sourceFile);
|
|
40
|
-
|
|
41
34
|
const getOutputFilename = (parsedArgs: Opts, sourceFile: string): string => {
|
|
42
35
|
const outputFile = basename(sourceFile, extname(sourceFile));
|
|
43
36
|
return join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);
|
|
@@ -68,7 +61,7 @@ const getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string =>
|
|
|
68
61
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
69
62
|
if (!projectDir) throw `No project directory provided`;
|
|
70
63
|
const baseCmd =
|
|
71
|
-
`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g)
|
|
64
|
+
`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} compile contract`;
|
|
72
65
|
const inputFile = getInputFilename(parsedArgs, sourceFile);
|
|
73
66
|
const outputFile = `-o ${getOutputFilename(parsedArgs, sourceFile)}`;
|
|
74
67
|
const cmd = `${baseCmd} ${inputFile} ${outputFile}`;
|
|
@@ -80,7 +73,7 @@ const getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprK
|
|
|
80
73
|
if (!projectDir) throw `No project directory provided`;
|
|
81
74
|
const compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';
|
|
82
75
|
const baseCmd =
|
|
83
|
-
`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g)
|
|
76
|
+
`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} compile ${compilerType}`;
|
|
84
77
|
const inputFile = getInputFilename(parsedArgs, sourceFile);
|
|
85
78
|
const outputFile = `-o ${getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;
|
|
86
79
|
const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;
|
|
@@ -224,7 +217,7 @@ const mergeArtifactsOutput = (sourceFile: string) =>
|
|
|
224
217
|
}];
|
|
225
218
|
};
|
|
226
219
|
|
|
227
|
-
|
|
220
|
+
const compile = (parsedArgs: Opts): Promise<void> => {
|
|
228
221
|
const sourceFile = parsedArgs.sourceFile;
|
|
229
222
|
let p: Promise<TableRow[]>;
|
|
230
223
|
if (isStoragesFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');
|
package/index.js
CHANGED
|
@@ -144,6 +144,11 @@ var $40622e3a438d0515$export$2e2bcd8739ae039 = $40622e3a438d0515$var$createContr
|
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
|
|
147
|
+
|
|
148
|
+
const $844cb58d66fbf6db$export$9bb5edf1683d4462 = "ligolang/ligo:0.51.0";
|
|
149
|
+
const $844cb58d66fbf6db$export$17f107107c3c82c6 = (parsedArgs, sourceFile)=>(0, $kQNfl$path.join)(parsedArgs.config.contractsDir, sourceFile);
|
|
150
|
+
|
|
151
|
+
|
|
147
152
|
const $24b2f47d8f306cb3$var$COMPILE_ERR_MSG = "Not compiled";
|
|
148
153
|
const $24b2f47d8f306cb3$var$isStorageKind = (exprKind)=>exprKind === "storage" || exprKind === "default_storage";
|
|
149
154
|
const $24b2f47d8f306cb3$var$isLIGOFile = (sourceFile)=>/.+\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
|
|
@@ -158,7 +163,6 @@ const $24b2f47d8f306cb3$var$removeExt = (path)=>{
|
|
|
158
163
|
const extRegex = new RegExp($24b2f47d8f306cb3$var$extractExt(path));
|
|
159
164
|
return path.replace(extRegex, "");
|
|
160
165
|
};
|
|
161
|
-
const $24b2f47d8f306cb3$var$getInputFilename = (parsedArgs, sourceFile)=>(0, $kQNfl$path.join)(parsedArgs.config.contractsDir, sourceFile);
|
|
162
166
|
const $24b2f47d8f306cb3$var$getOutputFilename = (parsedArgs, sourceFile)=>{
|
|
163
167
|
const outputFile = (0, $kQNfl$path.basename)(sourceFile, (0, $kQNfl$path.extname)(sourceFile));
|
|
164
168
|
return (0, $kQNfl$path.join)(parsedArgs.config.artifactsDir, `${outputFile}.tz`);
|
|
@@ -181,8 +185,8 @@ const $24b2f47d8f306cb3$var$getOutputExprFileName = (parsedArgs, sourceFile, exp
|
|
|
181
185
|
const $24b2f47d8f306cb3$var$getCompileContractCmd = (parsedArgs, sourceFile)=>{
|
|
182
186
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
183
187
|
if (!projectDir) throw `No project directory provided`;
|
|
184
|
-
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g)
|
|
185
|
-
const inputFile = $
|
|
188
|
+
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$9bb5edf1683d4462)} compile contract`;
|
|
189
|
+
const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
|
|
186
190
|
const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputFilename(parsedArgs, sourceFile)}`;
|
|
187
191
|
const cmd = `${baseCmd} ${inputFile} ${outputFile}`;
|
|
188
192
|
return cmd;
|
|
@@ -191,8 +195,8 @@ const $24b2f47d8f306cb3$var$getCompileExprCmd = (parsedArgs, sourceFile, exprKin
|
|
|
191
195
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
192
196
|
if (!projectDir) throw `No project directory provided`;
|
|
193
197
|
const compilerType = $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "storage" : "parameter";
|
|
194
|
-
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g)
|
|
195
|
-
const inputFile = $
|
|
198
|
+
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$9bb5edf1683d4462)} compile ${compilerType}`;
|
|
199
|
+
const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
|
|
196
200
|
const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;
|
|
197
201
|
const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;
|
|
198
202
|
return cmd;
|
|
@@ -225,8 +229,8 @@ const $24b2f47d8f306cb3$var$compileExpr = (parsedArgs, sourceFile, exprKind)=>(e
|
|
|
225
229
|
artifact: $24b2f47d8f306cb3$var$COMPILE_ERR_MSG
|
|
226
230
|
};
|
|
227
231
|
});
|
|
228
|
-
const $24b2f47d8f306cb3$var$compileExprs = (parsedArgs, sourceFile, exprKind)=>(0, $kQNfl$fspromises.readFile)($
|
|
229
|
-
if (!data.includes("#include")) (0, $kQNfl$fspromises.writeFile)($
|
|
232
|
+
const $24b2f47d8f306cb3$var$compileExprs = (parsedArgs, sourceFile, exprKind)=>(0, $kQNfl$fspromises.readFile)((0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile), "utf8").then((data)=>{
|
|
233
|
+
if (!data.includes("#include")) (0, $kQNfl$fspromises.writeFile)((0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile), `#include "${$24b2f47d8f306cb3$var$getContractNameForExpr(sourceFile, exprKind)}"\n` + data, "utf8");
|
|
230
234
|
return data;
|
|
231
235
|
}).then((data)=>data.match(/(?<=\s*(let|const)\s+)[a-zA-Z0-9_]+/g)).then((exprNames)=>{
|
|
232
236
|
if (!exprNames) return [];
|
|
@@ -256,8 +260,8 @@ const $24b2f47d8f306cb3$var$compileContractWithStorageAndParameter = async (pars
|
|
|
256
260
|
];
|
|
257
261
|
const storagesFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.storages${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
|
|
258
262
|
const parametersFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.parameters${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
|
|
259
|
-
const storagesFilename = $
|
|
260
|
-
const parametersFilename = $
|
|
263
|
+
const storagesFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, storagesFile);
|
|
264
|
+
const parametersFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, parametersFile);
|
|
261
265
|
const storageCompileResult = await (0, $kQNfl$fspromises.access)(storagesFilename).then(()=>$24b2f47d8f306cb3$var$compileExprs(parsedArgs, storagesFile, "storage")).catch(()=>{
|
|
262
266
|
// sendWarn(
|
|
263
267
|
// `Note: storage file associated with "${sourceFile}" can't be found. You should create a file "${storagesFile}" and define initial storage values as a list of LIGO variable definitions. e.g. "let STORAGE_NAME: storage = LIGO_EXPR" for CameLigo`,
|
|
@@ -303,7 +307,7 @@ e.g.
|
|
|
303
307
|
}
|
|
304
308
|
];
|
|
305
309
|
};
|
|
306
|
-
const $24b2f47d8f306cb3$
|
|
310
|
+
const $24b2f47d8f306cb3$var$compile = (parsedArgs)=>{
|
|
307
311
|
const sourceFile = parsedArgs.sourceFile;
|
|
308
312
|
let p;
|
|
309
313
|
if ($24b2f47d8f306cb3$var$isStoragesFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileExprs(parsedArgs, sourceFile, "storage");
|
|
@@ -312,17 +316,16 @@ const $24b2f47d8f306cb3$export$ef7acd7185315e22 = (parsedArgs)=>{
|
|
|
312
316
|
else return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`);
|
|
313
317
|
return p.then((0, $kQNfl$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $kQNfl$taquerianodesdk.sendAsyncErr)(err, false));
|
|
314
318
|
};
|
|
315
|
-
var $24b2f47d8f306cb3$export$2e2bcd8739ae039 = $24b2f47d8f306cb3$
|
|
319
|
+
var $24b2f47d8f306cb3$export$2e2bcd8739ae039 = $24b2f47d8f306cb3$var$compile;
|
|
316
320
|
|
|
317
321
|
|
|
318
322
|
|
|
319
323
|
|
|
320
|
-
const $8d09eb70c0505719$var$getInputFilename = (parsedArgs, sourceFile)=>(0, $kQNfl$path.join)(parsedArgs.config.contractsDir, sourceFile);
|
|
321
324
|
const $8d09eb70c0505719$var$getTestContractCmd = (parsedArgs, sourceFile)=>{
|
|
322
325
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
323
326
|
if (!projectDir) throw `No project directory provided`;
|
|
324
|
-
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g)
|
|
325
|
-
const inputFile = $
|
|
327
|
+
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$9bb5edf1683d4462)} run test`;
|
|
328
|
+
const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
|
|
326
329
|
const cmd = `${baseCmd} ${inputFile}`;
|
|
327
330
|
return cmd;
|
|
328
331
|
};
|
|
@@ -341,26 +344,26 @@ const $8d09eb70c0505719$var$testContract = (parsedArgs, sourceFile)=>(0, $kQNfl$
|
|
|
341
344
|
testResults: "Some tests failed :("
|
|
342
345
|
};
|
|
343
346
|
});
|
|
344
|
-
const $8d09eb70c0505719$
|
|
347
|
+
const $8d09eb70c0505719$var$test = (parsedArgs)=>{
|
|
345
348
|
const sourceFile = parsedArgs.sourceFile;
|
|
346
349
|
return $8d09eb70c0505719$var$testContract(parsedArgs, sourceFile).then((result)=>[
|
|
347
350
|
result
|
|
348
351
|
]).then((0, $kQNfl$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $kQNfl$taquerianodesdk.sendAsyncErr)(err, false));
|
|
349
352
|
};
|
|
350
|
-
var $8d09eb70c0505719$export$2e2bcd8739ae039 = $8d09eb70c0505719$
|
|
353
|
+
var $8d09eb70c0505719$export$2e2bcd8739ae039 = $8d09eb70c0505719$var$test;
|
|
351
354
|
|
|
352
355
|
|
|
353
|
-
const $0be740342372c80a$
|
|
356
|
+
const $0be740342372c80a$var$ligo = (parsedArgs)=>{
|
|
354
357
|
switch(parsedArgs.task){
|
|
355
358
|
case "compile":
|
|
356
359
|
return (0, $24b2f47d8f306cb3$export$2e2bcd8739ae039)(parsedArgs);
|
|
357
360
|
case "test":
|
|
358
|
-
return (0, $8d09eb70c0505719$export$
|
|
361
|
+
return (0, $8d09eb70c0505719$export$2e2bcd8739ae039)(parsedArgs);
|
|
359
362
|
default:
|
|
360
363
|
return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`${parsedArgs.task} is not an understood task by the LIGO plugin`);
|
|
361
364
|
}
|
|
362
365
|
};
|
|
363
|
-
var $0be740342372c80a$export$2e2bcd8739ae039 = $0be740342372c80a$
|
|
366
|
+
var $0be740342372c80a$export$2e2bcd8739ae039 = $0be740342372c80a$var$ligo;
|
|
364
367
|
|
|
365
368
|
|
|
366
369
|
(0, $kQNfl$taquerianodesdk.Plugin).create((i18n)=>({
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;ACAA;;ACAO,MAAM,yCAAc,GAAG,CAAC;;;;;;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,2BAA2B;gBACpC,WAAW,EAAE,8CAA8C;gBAC3D,WAAW,EAAE;oBACZ,CAAA,GAAA,oCAAa,CAAA,CAAC,MAAM,CAAC;wBACpB,WAAW,EAAE,gBAAgB;wBAC7B,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2CAA2C;qBACxD,CAAC;iBACF;gBACD,OAAO,EAAE;oBACR,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBAC9C,CAAC;iBACF;gBACD,OAAO,EAAE,CAAA,GAAA,wCAAc,CAAA;aACvB,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAI,CAAA;KACX,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/createContract.ts","taqueria-plugin-ligo/ligo_templates.ts","taqueria-plugin-ligo/ligo.ts","taqueria-plugin-ligo/compile.ts","taqueria-plugin-ligo/test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport ligo from './ligo';\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:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storages and parameters files if they are found',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\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\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: ligo,\n}), process.argv);\n","import { experimental, sendAsyncErr } from '@taqueria/node-sdk';\nimport * as RequestArgs from '@taqueria/protocol/RequestArgs';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst registerContract = (arg: Opts, contractName: string) => {\n\texperimental.registerContract(arg, contractName);\n};\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === 'ligo') return pascaligo_template;\n\tif (syntax === 'religo') return religo_template;\n\tif (syntax === 'jsligo') return jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return mligo_template;\n\t\tif (ext === 'ligo') return pascaligo_template;\n\t\tif (ext === 'religo') return religo_template;\n\t\tif (ext === 'jsligo') return jsligo_template;\n\t\treturn sendAsyncErr(\n\t\t\t`Unable to infer LIGO syntax from \"${contractName}\". Please specify a LIGO syntax via the --syntax option`,\n\t\t);\n\t} else {\n\t\treturn sendAsyncErr(`\"${syntax}\" is not a valid syntax. Please specify a valid LIGO syntax`);\n\t}\n};\n\nconst createContract = (arg: Opts) => {\n\tconst contractName = arg.sourceFileName as string;\n\tconst syntax = arg.syntax;\n\tconst contractsDir = `${arg.config.projectDir}/${arg.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template))\n\t\t.then(_ => registerContract(arg, contractName));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\n\ntype parameter =\n Increment of int\n| Decrement of int\n| Reset\n\ntype return = operation list * storage\n\n// Two entrypoints\n\nlet add (store, delta : storage * int) : storage = store + delta\nlet sub (store, delta : storage * int) : storage = store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nlet main (action, store : parameter * storage) : return =\n ([] : operation list), // No operations\n (match action with\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0)\n`;\n\nexport const pascaligo_template = `\ntype storage is int\n\ntype parameter is\n Increment of int\n| Decrement of int\n| Reset\n\ntype return is list (operation) * storage\n\n// Two entrypoints\n\nfunction add (const store : storage; const delta : int) : storage is \n store + delta\n\nfunction sub (const store : storage; const delta : int) : storage is \n store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nfunction main (const action : parameter; const store : storage) : return is\n ((nil : list (operation)), // No operations\n case action of [\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0\n ])\n`;\n\nexport const religo_template = `\ntype storage = int;\n\ntype parameter =\n Increment (int)\n| Decrement (int)\n| Reset;\n\ntype return = (list (operation), storage);\n\n// Two entrypoints\n\nlet add = ((store, delta) : (storage, int)) : storage => store + delta;\nlet sub = ((store, delta) : (storage, int)) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n \nlet main = ((action, store) : (parameter, storage)) : return => {\n (([] : list (operation)), // No operations\n (switch (action) {\n | Increment (n) => add ((store, n))\n | Decrement (n) => sub ((store, n))\n | Reset => 0}))\n};\n`;\n\nexport const jsligo_template = `\ntype storage = int;\n\ntype parameter =\n [\"Increment\", int]\n| [\"Decrement\", int]\n| [\"Reset\"];\n\ntype ret = [list<operation>, storage];\n\n// Two entrypoints\n\nconst add = ([store, delta] : [storage, int]) : storage => store + delta;\nconst sub = ([store, delta] : [storage, int]) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n\nconst main = ([action, store] : [parameter, storage]) : ret => {\n return [list([]) as list<operation>, // No operations\n match (action, {\n Increment:(n: int) => add ([store, n]),\n Decrement:(n: int) => sub ([store, n]),\n Reset :() => 0})]\n};\n`;\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk/types';\nimport compile from './compile';\nimport { test } from './test';\n\ninterface Opts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport const ligo = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'compile':\n\t\t\treturn compile(parsedArgs);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${parsedArgs.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk/types';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFile: string;\n}\n\ntype TableRow = { contract: string; artifact: string };\n\ntype ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nconst isLIGOFile = (sourceFile: string): boolean => /.+\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isStoragesFile = (sourceFile: string): boolean => /.+\\.storages\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isParametersFile = (sourceFile: string): boolean =>\n\t/.+\\.parameters\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isContractFile = (sourceFile: string): boolean =>\n\tisLIGOFile(sourceFile) && !isStoragesFile(sourceFile) && !isParametersFile(sourceFile);\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst getInputFilename = (parsedArgs: Opts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir, sourceFile);\n\nconst getOutputFilename = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst outputFile = basename(sourceFile, extname(sourceFile));\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);\n};\n\n// Get the contract name that the storage/parameter file is associated with\n// e.g. If sourceFile is token.storages.mligo, then it'll return token.mligo\nconst getContractNameForExpr = (sourceFile: string, exprKind: ExprKind): string => {\n\ttry {\n\t\treturn isStorageKind(exprKind)\n\t\t\t? sourceFile.match(/.+(?=\\.storages\\.(ligo|religo|mligo|jsligo))/)!.join('.')\n\t\t\t: sourceFile.match(/.+(?=\\.parameters\\.(ligo|religo|mligo|jsligo))/)!.join('.');\n\t} catch (err) {\n\t\tthrow new Error(`Something went wrong internally when dealing with filename format: ${err}`);\n\t}\n};\n\n// If sourceFile is token.storages.mligo, then it'll return token.storage.{storageName}.tz\nconst getOutputExprFileName = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage.tz`\n\t\t: `${contractName}.${exprKind}.${exprName}.tz`;\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}`);\n};\n\nconst getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\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`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputFilename(parsedArgs, sourceFile)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ligolang/ligo:next compile ${compilerType}`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;\n\treturn cmd;\n};\n\nconst compileContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getCompileContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: getOutputFilename(parsedArgs, sourceFile),\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t};\n\t\t});\n\nconst compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => {\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t\t};\n\t\t\t});\n\nconst compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>\n\treadFile(getInputFilename(parsedArgs, sourceFile), 'utf8')\n\t\t.then(data => {\n\t\t\tif (!data.includes('#include')) {\n\t\t\t\twriteFile(\n\t\t\t\t\tgetInputFilename(parsedArgs, sourceFile),\n\t\t\t\t\t`#include \"${getContractNameForExpr(sourceFile, exprKind)}\"\\n` + data,\n\t\t\t\t\t'utf8',\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn data;\n\t\t})\n\t\t.then(data => data.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g))\n\t\t.then(exprNames => {\n\t\t\tif (!exprNames) return [];\n\t\t\tconst firstExprName = exprNames.slice(0, 1)[0];\n\t\t\tconst restExprNames = exprNames.slice(1, exprNames.length);\n\t\t\tconst firstExprKind = isStorageKind(exprKind) ? 'default_storage' : 'parameter';\n\t\t\tconst restExprKind = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\t\t\tconst firstExprResult = compileExpr(parsedArgs, sourceFile, firstExprKind)(firstExprName);\n\t\t\tconst restExprResults = restExprNames.map(compileExpr(parsedArgs, sourceFile, restExprKind));\n\t\t\treturn Promise.all([firstExprResult].concat(restExprResults));\n\t\t})\n\t\t.catch(err => {\n\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message);\n\t\t\treturn [{\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storages' : 'parameters'} compiled`,\n\t\t\t}];\n\t\t})\n\t\t.then(mergeArtifactsOutput(sourceFile));\n\nconst compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFile: string): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\n\tconst storagesFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;\n\tconst parametersFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;\n\tconst storagesFilename = getInputFilename(parsedArgs, storagesFile);\n\tconst parametersFilename = getInputFilename(parsedArgs, parametersFile);\n\n\tconst storageCompileResult = await access(storagesFilename)\n\t\t.then(() => compileExprs(parsedArgs, storagesFile, 'storage'))\n\t\t.catch(() => {\n\t\t\t// sendWarn(\n\t\t\t// \t`Note: storage file associated with \"${sourceFile}\" can't be found. You should create a file \"${storagesFile}\" and define initial storage values as a list of LIGO variable definitions. e.g. \"let STORAGE_NAME: storage = LIGO_EXPR\" for CameLigo`,\n\t\t\t// )\n\t\t});\n\n\tconst parameterCompileResult = await access(parametersFilename)\n\t\t.then(() => compileExprs(parsedArgs, parametersFile, 'parameter'))\n\t\t.catch(() => {\n\t\t\t// sendWarn(\n\t\t\t// \t`Note: parameter file associated with \"${sourceFile}\" can't be found. You should create a file \"${parametersFile}\" and define parameter values as a list of LIGO variable definitions. e.g. \"let PARAMETER_NAME: parameter = LIGO_EXPR\" for CameLigo`,\n\t\t\t// )\n\t\t});\n\n\tlet compileResults: TableRow[] = [contractCompileResult];\n\tif (storageCompileResult) compileResults = compileResults.concat(storageCompileResult);\n\tif (parameterCompileResult) compileResults = compileResults.concat(parameterCompileResult);\n\treturn compileResults;\n};\n\n/*\nCompiling storage/parameter file amounts to compiling multiple expressions in that file,\nresulting in multiple rows with the same file name but different artifact names.\nThis will merge these rows into one row with just one mention of the file name.\ne.g.\n┌──────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├──────────────────────┼─────────────────────────────────────────────┤\n│ hello.storages.mligo │ artifacts/hello.default_storage.storage1.tz │\n├──────────────────────┼─────────────────────────────────────────────┤\n│ hello.storages.mligo │ artifacts/hello.storage.storage2.tz │\n└──────────────────────┴─────────────────────────────────────────────┘\n\t\t\t\t\t\t\t\tversus\n┌──────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├──────────────────────┼─────────────────────────────────────────────┤\n│ hello.storages.mligo │ artifacts/hello.default_storage.storage1.tz │\n│ │ artifacts/hello.storage.storage2.tz │\n└──────────────────────┴─────────────────────────────────────────────┘\n*/\nconst mergeArtifactsOutput = (sourceFile: string) =>\n\t(tableRows: TableRow[]): TableRow[] => {\n\t\tconst artifactsOutput = tableRows.reduce(\n\t\t\t(acc: string, row: TableRow) => row.artifact === COMPILE_ERR_MSG ? acc : `${acc}${row.artifact}\\n`,\n\t\t\t'',\n\t\t);\n\t\treturn [{\n\t\t\tcontract: sourceFile,\n\t\t\tartifact: artifactsOutput,\n\t\t}];\n\t};\n\nexport const compile = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tlet p: Promise<TableRow[]>;\n\tif (isStoragesFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');\n\telse if (isParametersFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');\n\telse if (isContractFile(sourceFile)) p = compileContractWithStorageAndParameter(parsedArgs, sourceFile);\n\telse {\n\t\treturn sendAsyncErr(\n\t\t\t`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`,\n\t\t);\n\t}\n\treturn p.then(sendJsonRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFile: string;\n}\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getInputFilename = (parsedArgs: Opts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir, sourceFile);\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ligolang/ligo:next run test`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nexport const test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
|
1
|
+
{"mappings":";;;;AAAA;ACAA;;ACAO,MAAM,yCAAc,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAwB/B,CAAC,AAAC;AAEK,MAAM,yCAAkB,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BnC,CAAC,AAAC;AAEK,MAAM,yCAAe,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBhC,CAAC,AAAC;AAEK,MAAM,yCAAe,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBhC,CAAC,AAAC;;;ADlGF,MAAM,sCAAgB,GAAG,CAAC,GAAS,EAAE,YAAoB,GAAK;IAC7D,CAAA,GAAA,mCAAY,CAAA,CAAC,gBAAgB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;CACjD,AAAC;AAEF,MAAM,qCAAe,GAAG,OAAO,YAAoB,EAAE,MAA0B,GAAsB;IACpG,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,YAAY,AAAC;IACnD,MAAM,GAAG,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,AAAC;IAE7D,IAAI,MAAM,KAAK,OAAO,EAAE,OAAO,GAAA,yCAAc,CAAC;IAC9C,IAAI,MAAM,KAAK,MAA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ligo/createContract.ts","taqueria-plugin-ligo/ligo_templates.ts","taqueria-plugin-ligo/ligo.ts","taqueria-plugin-ligo/compile.ts","taqueria-plugin-ligo/common.ts","taqueria-plugin-ligo/test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport ligo from './ligo';\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:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storages and parameters files if they are found',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\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\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: ligo,\n}), process.argv);\n","import { experimental, sendAsyncErr } from '@taqueria/node-sdk';\nimport * as RequestArgs from '@taqueria/protocol/RequestArgs';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst registerContract = (arg: Opts, contractName: string) => {\n\texperimental.registerContract(arg, contractName);\n};\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === 'ligo') return pascaligo_template;\n\tif (syntax === 'religo') return religo_template;\n\tif (syntax === 'jsligo') return jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return mligo_template;\n\t\tif (ext === 'ligo') return pascaligo_template;\n\t\tif (ext === 'religo') return religo_template;\n\t\tif (ext === 'jsligo') return jsligo_template;\n\t\treturn sendAsyncErr(\n\t\t\t`Unable to infer LIGO syntax from \"${contractName}\". Please specify a LIGO syntax via the --syntax option`,\n\t\t);\n\t} else {\n\t\treturn sendAsyncErr(`\"${syntax}\" is not a valid syntax. Please specify a valid LIGO syntax`);\n\t}\n};\n\nconst createContract = (arg: Opts) => {\n\tconst contractName = arg.sourceFileName as string;\n\tconst syntax = arg.syntax;\n\tconst contractsDir = `${arg.config.projectDir}/${arg.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template))\n\t\t.then(_ => registerContract(arg, contractName));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\n\ntype parameter =\n Increment of int\n| Decrement of int\n| Reset\n\ntype return = operation list * storage\n\n// Two entrypoints\n\nlet add (store, delta : storage * int) : storage = store + delta\nlet sub (store, delta : storage * int) : storage = store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nlet main (action, store : parameter * storage) : return =\n ([] : operation list), // No operations\n (match action with\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0)\n`;\n\nexport const pascaligo_template = `\ntype storage is int\n\ntype parameter is\n Increment of int\n| Decrement of int\n| Reset\n\ntype return is list (operation) * storage\n\n// Two entrypoints\n\nfunction add (const store : storage; const delta : int) : storage is \n store + delta\n\nfunction sub (const store : storage; const delta : int) : storage is \n store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nfunction main (const action : parameter; const store : storage) : return is\n ((nil : list (operation)), // No operations\n case action of [\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0\n ])\n`;\n\nexport const religo_template = `\ntype storage = int;\n\ntype parameter =\n Increment (int)\n| Decrement (int)\n| Reset;\n\ntype return = (list (operation), storage);\n\n// Two entrypoints\n\nlet add = ((store, delta) : (storage, int)) : storage => store + delta;\nlet sub = ((store, delta) : (storage, int)) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n \nlet main = ((action, store) : (parameter, storage)) : return => {\n (([] : list (operation)), // No operations\n (switch (action) {\n | Increment (n) => add ((store, n))\n | Decrement (n) => sub ((store, n))\n | Reset => 0}))\n};\n`;\n\nexport const jsligo_template = `\ntype storage = int;\n\ntype parameter =\n [\"Increment\", int]\n| [\"Decrement\", int]\n| [\"Reset\"];\n\ntype ret = [list<operation>, storage];\n\n// Two entrypoints\n\nconst add = ([store, delta] : [storage, int]) : storage => store + delta;\nconst sub = ([store, delta] : [storage, int]) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n\nconst main = ([action, store] : [parameter, storage]) : ret => {\n return [list([]) as list<operation>, // No operations\n match (action, {\n Increment:(n: int) => add ([store, n]),\n Decrement:(n: int) => sub ([store, n]),\n Reset :() => 0})]\n};\n`;\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport test from './test';\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'compile':\n\t\t\treturn compile(parsedArgs);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${parsedArgs.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport { CompileOpts as Opts, getInputFilename, LIGO_DOCKER_IMAGE } from './common';\n\ntype TableRow = { contract: string; artifact: string };\n\ntype ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nconst isLIGOFile = (sourceFile: string): boolean => /.+\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isStoragesFile = (sourceFile: string): boolean => /.+\\.storages\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isParametersFile = (sourceFile: string): boolean =>\n\t/.+\\.parameters\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isContractFile = (sourceFile: string): boolean =>\n\tisLIGOFile(sourceFile) && !isStoragesFile(sourceFile) && !isParametersFile(sourceFile);\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst getOutputFilename = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst outputFile = basename(sourceFile, extname(sourceFile));\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);\n};\n\n// Get the contract name that the storage/parameter file is associated with\n// e.g. If sourceFile is token.storages.mligo, then it'll return token.mligo\nconst getContractNameForExpr = (sourceFile: string, exprKind: ExprKind): string => {\n\ttry {\n\t\treturn isStorageKind(exprKind)\n\t\t\t? sourceFile.match(/.+(?=\\.storages\\.(ligo|religo|mligo|jsligo))/)!.join('.')\n\t\t\t: sourceFile.match(/.+(?=\\.parameters\\.(ligo|religo|mligo|jsligo))/)!.join('.');\n\t} catch (err) {\n\t\tthrow new Error(`Something went wrong internally when dealing with filename format: ${err}`);\n\t}\n};\n\n// If sourceFile is token.storages.mligo, then it'll return token.storage.{storageName}.tz\nconst getOutputExprFileName = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage.tz`\n\t\t: `${contractName}.${exprKind}.${exprName}.tz`;\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}`);\n};\n\nconst getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} compile contract`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputFilename(parsedArgs, sourceFile)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} compile ${compilerType}`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;\n\treturn cmd;\n};\n\nconst compileContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getCompileContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: getOutputFilename(parsedArgs, sourceFile),\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t};\n\t\t});\n\nconst compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => {\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t\t};\n\t\t\t});\n\nconst compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>\n\treadFile(getInputFilename(parsedArgs, sourceFile), 'utf8')\n\t\t.then(data => {\n\t\t\tif (!data.includes('#include')) {\n\t\t\t\twriteFile(\n\t\t\t\t\tgetInputFilename(parsedArgs, sourceFile),\n\t\t\t\t\t`#include \"${getContractNameForExpr(sourceFile, exprKind)}\"\\n` + data,\n\t\t\t\t\t'utf8',\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn data;\n\t\t})\n\t\t.then(data => data.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g))\n\t\t.then(exprNames => {\n\t\t\tif (!exprNames) return [];\n\t\t\tconst firstExprName = exprNames.slice(0, 1)[0];\n\t\t\tconst restExprNames = exprNames.slice(1, exprNames.length);\n\t\t\tconst firstExprKind = isStorageKind(exprKind) ? 'default_storage' : 'parameter';\n\t\t\tconst restExprKind = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\t\t\tconst firstExprResult = compileExpr(parsedArgs, sourceFile, firstExprKind)(firstExprName);\n\t\t\tconst restExprResults = restExprNames.map(compileExpr(parsedArgs, sourceFile, restExprKind));\n\t\t\treturn Promise.all([firstExprResult].concat(restExprResults));\n\t\t})\n\t\t.catch(err => {\n\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message);\n\t\t\treturn [{\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storages' : 'parameters'} compiled`,\n\t\t\t}];\n\t\t})\n\t\t.then(mergeArtifactsOutput(sourceFile));\n\nconst compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFile: string): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\n\tconst storagesFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;\n\tconst parametersFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;\n\tconst storagesFilename = getInputFilename(parsedArgs, storagesFile);\n\tconst parametersFilename = getInputFilename(parsedArgs, parametersFile);\n\n\tconst storageCompileResult = await access(storagesFilename)\n\t\t.then(() => compileExprs(parsedArgs, storagesFile, 'storage'))\n\t\t.catch(() => {\n\t\t\t// sendWarn(\n\t\t\t// \t`Note: storage file associated with \"${sourceFile}\" can't be found. You should create a file \"${storagesFile}\" and define initial storage values as a list of LIGO variable definitions. e.g. \"let STORAGE_NAME: storage = LIGO_EXPR\" for CameLigo`,\n\t\t\t// )\n\t\t});\n\n\tconst parameterCompileResult = await access(parametersFilename)\n\t\t.then(() => compileExprs(parsedArgs, parametersFile, 'parameter'))\n\t\t.catch(() => {\n\t\t\t// sendWarn(\n\t\t\t// \t`Note: parameter file associated with \"${sourceFile}\" can't be found. You should create a file \"${parametersFile}\" and define parameter values as a list of LIGO variable definitions. e.g. \"let PARAMETER_NAME: parameter = LIGO_EXPR\" for CameLigo`,\n\t\t\t// )\n\t\t});\n\n\tlet compileResults: TableRow[] = [contractCompileResult];\n\tif (storageCompileResult) compileResults = compileResults.concat(storageCompileResult);\n\tif (parameterCompileResult) compileResults = compileResults.concat(parameterCompileResult);\n\treturn compileResults;\n};\n\n/*\nCompiling storage/parameter file amounts to compiling multiple expressions in that file,\nresulting in multiple rows with the same file name but different artifact names.\nThis will merge these rows into one row with just one mention of the file name.\ne.g.\n┌──────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├──────────────────────┼─────────────────────────────────────────────┤\n│ hello.storages.mligo │ artifacts/hello.default_storage.storage1.tz │\n├──────────────────────┼─────────────────────────────────────────────┤\n│ hello.storages.mligo │ artifacts/hello.storage.storage2.tz │\n└──────────────────────┴─────────────────────────────────────────────┘\n\t\t\t\t\t\t\t\tversus\n┌──────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├──────────────────────┼─────────────────────────────────────────────┤\n│ hello.storages.mligo │ artifacts/hello.default_storage.storage1.tz │\n│ │ artifacts/hello.storage.storage2.tz │\n└──────────────────────┴─────────────────────────────────────────────┘\n*/\nconst mergeArtifactsOutput = (sourceFile: string) =>\n\t(tableRows: TableRow[]): TableRow[] => {\n\t\tconst artifactsOutput = tableRows.reduce(\n\t\t\t(acc: string, row: TableRow) => row.artifact === COMPILE_ERR_MSG ? acc : `${acc}${row.artifact}\\n`,\n\t\t\t'',\n\t\t);\n\t\treturn [{\n\t\t\tcontract: sourceFile,\n\t\t\tartifact: artifactsOutput,\n\t\t}];\n\t};\n\nconst compile = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tlet p: Promise<TableRow[]>;\n\tif (isStoragesFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');\n\telse if (isParametersFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');\n\telse if (isContractFile(sourceFile)) p = compileContractWithStorageAndParameter(parsedArgs, sourceFile);\n\telse {\n\t\treturn sendAsyncErr(\n\t\t\t`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`,\n\t\t);\n\t}\n\treturn p.then(sendJsonRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n","import { RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface CompileOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport interface TestOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport type IntersectionOpts = CompileOpts & TestOpts;\n\ntype UnionOpts = CompileOpts | TestOpts;\n\n// Points to the latest stable version. Needs to update this as part of our release process\nexport const LIGO_DOCKER_IMAGE = 'ligolang/ligo:0.51.0';\n\nexport const getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir, sourceFile);\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { getInputFilename, LIGO_DOCKER_IMAGE, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} run test`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
package/ligo.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { sendAsyncErr } from '@taqueria/node-sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { IntersectionOpts as Opts } from './common';
|
|
3
3
|
import compile from './compile';
|
|
4
|
-
import
|
|
4
|
+
import test from './test';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
sourceFile: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const ligo = (parsedArgs: Opts): Promise<void> => {
|
|
6
|
+
const ligo = (parsedArgs: Opts): Promise<void> => {
|
|
11
7
|
switch (parsedArgs.task) {
|
|
12
8
|
case 'compile':
|
|
13
9
|
return compile(parsedArgs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-ligo",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.30",
|
|
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.21.
|
|
44
|
+
"@taqueria/node-sdk": "^0.21.30",
|
|
45
45
|
"fast-glob": "^3.2.11"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
package/test.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
|
|
2
|
-
import {
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
|
|
5
|
-
interface Opts extends RequestArgs.t {
|
|
6
|
-
sourceFile: string;
|
|
7
|
-
}
|
|
2
|
+
import { getInputFilename, LIGO_DOCKER_IMAGE, TestOpts as Opts } from './common';
|
|
8
3
|
|
|
9
4
|
type TableRow = { contract: string; testResults: string };
|
|
10
5
|
|
|
11
|
-
const getInputFilename = (parsedArgs: Opts, sourceFile: string): string =>
|
|
12
|
-
join(parsedArgs.config.contractsDir, sourceFile);
|
|
13
|
-
|
|
14
6
|
const getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {
|
|
15
7
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
16
8
|
if (!projectDir) throw `No project directory provided`;
|
|
17
9
|
const baseCmd =
|
|
18
|
-
`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g)
|
|
10
|
+
`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} run test`;
|
|
19
11
|
const inputFile = getInputFilename(parsedArgs, sourceFile);
|
|
20
12
|
const cmd = `${baseCmd} ${inputFile}`;
|
|
21
13
|
return cmd;
|
|
@@ -42,7 +34,7 @@ const testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =
|
|
|
42
34
|
};
|
|
43
35
|
});
|
|
44
36
|
|
|
45
|
-
|
|
37
|
+
const test = (parsedArgs: Opts): Promise<void> => {
|
|
46
38
|
const sourceFile = parsedArgs.sourceFile;
|
|
47
39
|
return testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>
|
|
48
40
|
sendAsyncErr(err, false)
|