@taqueria/plugin-archetype 0.27.0-alpha → 0.27.0-rc
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 +1 -1
- package/_readme.eta +1 -1
- package/compile.ts +4 -2
- package/createContract.ts +2 -7
- package/index.d.ts +1 -0
- package/index.js +117 -124
- package/index.js.map +1 -1
- package/index.mjs +138 -0
- package/index.mjs.map +1 -0
- package/package.json +20 -4
package/README.md
CHANGED
package/_readme.eta
CHANGED
package/compile.ts
CHANGED
|
@@ -66,8 +66,9 @@ const compileContract = (opts: Opts) =>
|
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
const compileAll = (opts: Opts): Promise<{ contract: string; artifact: string }[]> =>
|
|
70
|
-
|
|
69
|
+
const compileAll = (opts: Opts): Promise<{ contract: string; artifact: string }[]> => {
|
|
70
|
+
const contracts = getContracts(/\.arl$/, opts.config);
|
|
71
|
+
return Promise.all(contracts)
|
|
71
72
|
.then(entries => entries.map(compileContract(opts)))
|
|
72
73
|
.then(processes =>
|
|
73
74
|
processes.length > 0
|
|
@@ -75,6 +76,7 @@ const compileAll = (opts: Opts): Promise<{ contract: string; artifact: string }[
|
|
|
75
76
|
: [{ contract: 'None found', artifact: 'N/A' }]
|
|
76
77
|
)
|
|
77
78
|
.then(promises => Promise.all(promises));
|
|
79
|
+
};
|
|
78
80
|
|
|
79
81
|
const compile = (parsedArgs: RequestArgs.t) => {
|
|
80
82
|
const unsafeOpts = parsedArgs as unknown as Opts;
|
package/createContract.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequestArgs, sendAsyncErr } from '@taqueria/node-sdk';
|
|
2
2
|
import { writeFile } from 'fs/promises';
|
|
3
3
|
import { arl_template } from './archetype_template';
|
|
4
4
|
|
|
@@ -6,10 +6,6 @@ interface Opts extends RequestArgs.t {
|
|
|
6
6
|
sourceFileName?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const registerContract = (arg: Opts, contractName: string) => {
|
|
10
|
-
experimental.registerContract(arg, contractName);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
9
|
const validateExtension = async (contractName: string) => {
|
|
14
10
|
const matchResult = contractName.match(/\.arl$/);
|
|
15
11
|
if (matchResult) return;
|
|
@@ -20,8 +16,7 @@ const createContract = (args: Opts) => {
|
|
|
20
16
|
const contractName = args.sourceFileName as string;
|
|
21
17
|
const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
|
|
22
18
|
return validateExtension(contractName)
|
|
23
|
-
.then(_ => writeFile(`${contractsDir}/${contractName}`, arl_template))
|
|
24
|
-
.then(_ => registerContract(args, contractName));
|
|
19
|
+
.then(_ => writeFile(`${contractsDir}/${contractName}`, arl_template));
|
|
25
20
|
};
|
|
26
21
|
|
|
27
22
|
export default createContract;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/index.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (results.length === 0) (0, $dTHpf$taquerianodesdk.sendErr)("No contracts found to compile.");
|
|
58
|
-
return results;
|
|
59
|
-
});
|
|
60
|
-
return p.then((0, $dTHpf$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $dTHpf$taquerianodesdk.sendAsyncErr)(err, false));
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// index.ts
|
|
4
|
+
var import_node_sdk3 = require("@taqueria/node-sdk");
|
|
5
|
+
|
|
6
|
+
// compile.ts
|
|
7
|
+
var import_node_sdk = require("@taqueria/node-sdk");
|
|
8
|
+
var import_path = require("path");
|
|
9
|
+
var import_ts_pattern = require("ts-pattern");
|
|
10
|
+
var ARCHETYPE_DEFAULT_IMAGE = "completium/archetype:1.2.12";
|
|
11
|
+
var ARCHETYPE_IMAGE_ENV_VAR = "TAQ_ARCHETYPE_IMAGE";
|
|
12
|
+
var getArchetypeDockerImage = () => (0, import_node_sdk.getDockerImage)(ARCHETYPE_DEFAULT_IMAGE, ARCHETYPE_IMAGE_ENV_VAR);
|
|
13
|
+
var getInputFilename = (opts) => (sourceFile) => {
|
|
14
|
+
const inputFile = (0, import_path.basename)(sourceFile, (0, import_path.extname)(sourceFile));
|
|
15
|
+
return (0, import_path.join)(opts.config.contractsDir ?? "contracts", `${inputFile}.arl`);
|
|
16
|
+
};
|
|
17
|
+
var getContractArtifactFilename = (opts) => (sourceFile) => {
|
|
18
|
+
const outFile = (0, import_path.basename)(sourceFile, (0, import_path.extname)(sourceFile));
|
|
19
|
+
return (0, import_path.join)(opts.config.artifactsDir ?? "contracts", `${outFile}.tz`);
|
|
20
|
+
};
|
|
21
|
+
var getCompileCommand = (opts) => (sourceFile) => {
|
|
22
|
+
const { projectDir } = opts;
|
|
23
|
+
const inputFile = getInputFilename(opts)(sourceFile);
|
|
24
|
+
const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -u $(id -u):$(id -g) -w /project ${getArchetypeDockerImage()} ${inputFile}`;
|
|
25
|
+
const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;
|
|
26
|
+
const cmd = `${baseCommand} ${outFile}`;
|
|
27
|
+
return cmd;
|
|
28
|
+
};
|
|
29
|
+
var compileContract = (opts) => (sourceFile) => (0, import_node_sdk.execCmd)(getCompileCommand(opts)(sourceFile)).then(({ stderr }) => {
|
|
30
|
+
if (stderr.length > 0)
|
|
31
|
+
(0, import_node_sdk.sendErr)(stderr);
|
|
32
|
+
return {
|
|
33
|
+
contract: sourceFile,
|
|
34
|
+
artifact: getContractArtifactFilename(opts)(sourceFile)
|
|
35
|
+
};
|
|
36
|
+
}).catch((err) => {
|
|
37
|
+
(0, import_node_sdk.sendErr)(" ");
|
|
38
|
+
(0, import_node_sdk.sendErr)(err.message.split("\n").slice(1).join("\n"));
|
|
39
|
+
return Promise.resolve({
|
|
40
|
+
contract: sourceFile,
|
|
41
|
+
artifact: "Not compiled"
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
var compileAll = (opts) => {
|
|
45
|
+
const contracts = (0, import_node_sdk.getContracts)(/\.arl$/, opts.config);
|
|
46
|
+
return Promise.all(contracts).then((entries) => entries.map(compileContract(opts))).then(
|
|
47
|
+
(processes) => processes.length > 0 ? processes : [{ contract: "None found", artifact: "N/A" }]
|
|
48
|
+
).then((promises) => Promise.all(promises));
|
|
49
|
+
};
|
|
50
|
+
var compile = (parsedArgs) => {
|
|
51
|
+
const unsafeOpts = parsedArgs;
|
|
52
|
+
return (0, import_ts_pattern.match)(unsafeOpts).when((unsafeOpts2) => unsafeOpts2.task === "get-image", () => (0, import_node_sdk.sendAsyncRes)(getArchetypeDockerImage())).otherwise(() => {
|
|
53
|
+
const p = unsafeOpts.sourceFile ? compileContract(unsafeOpts)(unsafeOpts.sourceFile).then((result) => [result]) : compileAll(unsafeOpts).then((results) => {
|
|
54
|
+
if (results.length === 0)
|
|
55
|
+
(0, import_node_sdk.sendErr)("No contracts found to compile.");
|
|
56
|
+
return results;
|
|
61
57
|
});
|
|
58
|
+
return p.then(import_node_sdk.sendJsonRes).catch((err) => (0, import_node_sdk.sendAsyncErr)(err, false));
|
|
59
|
+
});
|
|
62
60
|
};
|
|
63
|
-
var
|
|
61
|
+
var compile_default = compile;
|
|
64
62
|
|
|
63
|
+
// createContract.ts
|
|
64
|
+
var import_node_sdk2 = require("@taqueria/node-sdk");
|
|
65
|
+
var import_promises = require("fs/promises");
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const $94ea212fa0656741$export$fc3df5870c3ce31c = `
|
|
67
|
+
// archetype_template.ts
|
|
68
|
+
var arl_template = `
|
|
69
69
|
archetype hello
|
|
70
70
|
|
|
71
71
|
variable msg : string = "Hello"
|
|
@@ -75,65 +75,58 @@ entry input(name : string) {
|
|
|
75
75
|
}
|
|
76
76
|
`;
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (matchResult) return;
|
|
85
|
-
return (0, $dTHpf$taquerianodesdk.sendAsyncErr)(`"${contractName}" doesn't have extension "arl".`);
|
|
78
|
+
// createContract.ts
|
|
79
|
+
var validateExtension = async (contractName) => {
|
|
80
|
+
const matchResult = contractName.match(/\.arl$/);
|
|
81
|
+
if (matchResult)
|
|
82
|
+
return;
|
|
83
|
+
return (0, import_node_sdk2.sendAsyncErr)(`"${contractName}" doesn't have extension "arl".`);
|
|
86
84
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
var createContract = (args) => {
|
|
86
|
+
const contractName = args.sourceFileName;
|
|
87
|
+
const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
|
|
88
|
+
return validateExtension(contractName).then((_) => (0, import_promises.writeFile)(`${contractsDir}/${contractName}`, arl_template));
|
|
91
89
|
};
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
proxy: (0, $bb055a91efa18df7$export$2e2bcd8739ae039)
|
|
136
|
-
}), process.argv);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
//# sourceMappingURL=index.js.map
|
|
90
|
+
var createContract_default = createContract;
|
|
91
|
+
|
|
92
|
+
// index.ts
|
|
93
|
+
import_node_sdk3.Plugin.create((i18n) => ({
|
|
94
|
+
schema: "1.0",
|
|
95
|
+
version: "0.1",
|
|
96
|
+
alias: "archetype",
|
|
97
|
+
tasks: [
|
|
98
|
+
import_node_sdk3.Task.create({
|
|
99
|
+
task: "compile",
|
|
100
|
+
command: "compile [sourceFile]",
|
|
101
|
+
aliases: ["c", "compile-archetype"],
|
|
102
|
+
description: "Compile a smart contract written in a Archetype syntax to Michelson code",
|
|
103
|
+
options: [],
|
|
104
|
+
handler: "proxy",
|
|
105
|
+
encoding: "json"
|
|
106
|
+
}),
|
|
107
|
+
import_node_sdk3.Task.create({
|
|
108
|
+
task: "get-image",
|
|
109
|
+
command: "get-image",
|
|
110
|
+
description: "Gets the name of the image to be used",
|
|
111
|
+
handler: "proxy",
|
|
112
|
+
hidden: true
|
|
113
|
+
})
|
|
114
|
+
],
|
|
115
|
+
templates: [
|
|
116
|
+
import_node_sdk3.Template.create({
|
|
117
|
+
template: "archetypeContract",
|
|
118
|
+
command: "archetypeContract <sourceFileName>",
|
|
119
|
+
description: "Create a Archetype contract with boilerplate code",
|
|
120
|
+
positionals: [
|
|
121
|
+
import_node_sdk3.PositionalArg.create({
|
|
122
|
+
placeholder: "sourceFileName",
|
|
123
|
+
type: "string",
|
|
124
|
+
description: "The name of the Archetype contract to generate"
|
|
125
|
+
})
|
|
126
|
+
],
|
|
127
|
+
handler: createContract_default
|
|
128
|
+
})
|
|
129
|
+
],
|
|
130
|
+
proxy: compile_default
|
|
131
|
+
}), process.argv);
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"sources":["index.ts","compile.ts","createContract.ts","archetype_template.ts"],"sourcesContent":["import { Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport compile from './compile';\nimport createContract from './createContract';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'archetype',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile [sourceFile]',\n\t\t\taliases: ['c', 'compile-archetype'],\n\t\t\tdescription: 'Compile a smart contract written in a Archetype syntax to Michelson code',\n\t\t\toptions: [],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'archetypeContract',\n\t\t\tcommand: 'archetypeContract <sourceFileName>',\n\t\t\tdescription: 'Create a Archetype 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 Archetype contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: compile,\n}), process.argv);\n","import {\n\texecCmd,\n\tgetContracts,\n\tgetDockerImage,\n\tProxyTaskArgs,\n\tRequestArgs,\n\tsendAsyncErr,\n\tsendAsyncRes,\n\tsendErr,\n\tsendJsonRes,\n} from '@taqueria/node-sdk';\nimport { basename, extname, join } from 'path';\nimport { match } from 'ts-pattern';\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst ARCHETYPE_DEFAULT_IMAGE = 'completium/archetype:1.2.12';\n\nconst ARCHETYPE_IMAGE_ENV_VAR = 'TAQ_ARCHETYPE_IMAGE';\n\nexport const getArchetypeDockerImage = (): string => getDockerImage(ARCHETYPE_DEFAULT_IMAGE, ARCHETYPE_IMAGE_ENV_VAR);\n\ninterface Opts extends ProxyTaskArgs.t {\n\tsourceFile?: string;\n}\n\nconst getInputFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst inputFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.contractsDir ?? 'contracts', `${inputFile}.arl`);\n\t};\n\nconst getContractArtifactFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst outFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.artifactsDir ?? 'contracts', `${outFile}.tz`);\n\t};\n\nconst getCompileCommand = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst { projectDir } = opts;\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 -u $(id -u):$(id -g) -w /project ${getArchetypeDockerImage()} ${inputFile}`;\n\t\tconst outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;\n\t\tconst cmd = `${baseCommand} ${outFile}`;\n\t\treturn cmd;\n\t};\n\nconst compileContract = (opts: Opts) =>\n\t(sourceFile: string): Promise<{ contract: string; artifact: string }> =>\n\t\t// const sourceAbspath = join(opts.contractsDir, sourceFile)\n\t\texecCmd(getCompileCommand(opts)(sourceFile))\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 = (opts: Opts): Promise<{ contract: string; artifact: string }[]> => {\n\tconst contracts = getContracts(/\\.arl$/, opts.config);\n\treturn Promise.all(contracts)\n\t\t.then(entries => entries.map(compileContract(opts)))\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\nconst compile = (parsedArgs: RequestArgs.t) => {\n\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\treturn match(unsafeOpts)\n\t\t.when(unsafeOpts => unsafeOpts.task === 'get-image', () => sendAsyncRes(getArchetypeDockerImage()))\n\t\t.otherwise(() => {\n\t\t\tconst p = unsafeOpts.sourceFile\n\t\t\t\t? compileContract(unsafeOpts)(unsafeOpts.sourceFile)\n\t\t\t\t\t.then(result => [result])\n\t\t\t\t: compileAll(unsafeOpts)\n\t\t\t\t\t.then(results => {\n\t\t\t\t\t\tif (results.length === 0) sendErr('No contracts found to compile.');\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t});\n\n\t\t\treturn p\n\t\t\t\t.then(sendJsonRes)\n\t\t\t\t.catch(err => sendAsyncErr(err, false));\n\t\t});\n};\n\nexport default compile;\n","import { RequestArgs, sendAsyncErr } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport { arl_template } from './archetype_template';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n}\n\nconst validateExtension = async (contractName: string) => {\n\tconst matchResult = contractName.match(/\\.arl$/);\n\tif (matchResult) return;\n\treturn sendAsyncErr(`\"${contractName}\" doesn't have extension \"arl\".`);\n};\n\nconst createContract = (args: Opts) => {\n\tconst contractName = args.sourceFileName as string;\n\tconst contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;\n\treturn validateExtension(contractName)\n\t\t.then(_ => writeFile(`${contractsDir}/${contractName}`, arl_template));\n};\n\nexport default createContract;\n","export const arl_template = `\narchetype hello\n\nvariable msg : string = \"Hello\"\n\nentry input(name : string) {\n msg += \" \" + name\n}\n`;\n"],"mappings":";;;AAAA,IAAAA,mBAAsD;;;ACAtD,sBAUO;AACP,kBAAwC;AACxC,wBAAsB;AAGtB,IAAM,0BAA0B;AAEhC,IAAM,0BAA0B;AAEzB,IAAM,0BAA0B,UAAc,gCAAe,yBAAyB,uBAAuB;AAMpH,IAAM,mBAAmB,CAAC,SACzB,CAAC,eAAuB;AACvB,QAAM,gBAAY,sBAAS,gBAAY,qBAAQ,UAAU,CAAC;AAC1D,aAAO,kBAAK,KAAK,OAAO,gBAAgB,aAAa,GAAG,eAAe;AACxE;AAED,IAAM,8BAA8B,CAAC,SACpC,CAAC,eAAuB;AACvB,QAAM,cAAU,sBAAS,gBAAY,qBAAQ,UAAU,CAAC;AACxD,aAAO,kBAAK,KAAK,OAAO,gBAAgB,aAAa,GAAG,YAAY;AACrE;AAED,IAAM,oBAAoB,CAAC,SAC1B,CAAC,eAAuB;AACvB,QAAM,EAAE,WAAW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,aAAa;AAAA,MACb,aAAa;AAAA,QACZ,+BAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["import_node_sdk","unsafeOpts","import_node_sdk"]}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import { Plugin, PositionalArg, Task, Template } from "@taqueria/node-sdk";
|
|
3
|
+
|
|
4
|
+
// compile.ts
|
|
5
|
+
import {
|
|
6
|
+
execCmd,
|
|
7
|
+
getContracts,
|
|
8
|
+
getDockerImage,
|
|
9
|
+
sendAsyncErr,
|
|
10
|
+
sendAsyncRes,
|
|
11
|
+
sendErr,
|
|
12
|
+
sendJsonRes
|
|
13
|
+
} from "@taqueria/node-sdk";
|
|
14
|
+
import { basename, extname, join } from "path";
|
|
15
|
+
import { match } from "ts-pattern";
|
|
16
|
+
var ARCHETYPE_DEFAULT_IMAGE = "completium/archetype:1.2.12";
|
|
17
|
+
var ARCHETYPE_IMAGE_ENV_VAR = "TAQ_ARCHETYPE_IMAGE";
|
|
18
|
+
var getArchetypeDockerImage = () => getDockerImage(ARCHETYPE_DEFAULT_IMAGE, ARCHETYPE_IMAGE_ENV_VAR);
|
|
19
|
+
var getInputFilename = (opts) => (sourceFile) => {
|
|
20
|
+
const inputFile = basename(sourceFile, extname(sourceFile));
|
|
21
|
+
return join(opts.config.contractsDir ?? "contracts", `${inputFile}.arl`);
|
|
22
|
+
};
|
|
23
|
+
var getContractArtifactFilename = (opts) => (sourceFile) => {
|
|
24
|
+
const outFile = basename(sourceFile, extname(sourceFile));
|
|
25
|
+
return join(opts.config.artifactsDir ?? "contracts", `${outFile}.tz`);
|
|
26
|
+
};
|
|
27
|
+
var getCompileCommand = (opts) => (sourceFile) => {
|
|
28
|
+
const { projectDir } = opts;
|
|
29
|
+
const inputFile = getInputFilename(opts)(sourceFile);
|
|
30
|
+
const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -u $(id -u):$(id -g) -w /project ${getArchetypeDockerImage()} ${inputFile}`;
|
|
31
|
+
const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;
|
|
32
|
+
const cmd = `${baseCommand} ${outFile}`;
|
|
33
|
+
return cmd;
|
|
34
|
+
};
|
|
35
|
+
var compileContract = (opts) => (sourceFile) => execCmd(getCompileCommand(opts)(sourceFile)).then(({ stderr }) => {
|
|
36
|
+
if (stderr.length > 0)
|
|
37
|
+
sendErr(stderr);
|
|
38
|
+
return {
|
|
39
|
+
contract: sourceFile,
|
|
40
|
+
artifact: getContractArtifactFilename(opts)(sourceFile)
|
|
41
|
+
};
|
|
42
|
+
}).catch((err) => {
|
|
43
|
+
sendErr(" ");
|
|
44
|
+
sendErr(err.message.split("\n").slice(1).join("\n"));
|
|
45
|
+
return Promise.resolve({
|
|
46
|
+
contract: sourceFile,
|
|
47
|
+
artifact: "Not compiled"
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var compileAll = (opts) => {
|
|
51
|
+
const contracts = getContracts(/\.arl$/, opts.config);
|
|
52
|
+
return Promise.all(contracts).then((entries) => entries.map(compileContract(opts))).then(
|
|
53
|
+
(processes) => processes.length > 0 ? processes : [{ contract: "None found", artifact: "N/A" }]
|
|
54
|
+
).then((promises) => Promise.all(promises));
|
|
55
|
+
};
|
|
56
|
+
var compile = (parsedArgs) => {
|
|
57
|
+
const unsafeOpts = parsedArgs;
|
|
58
|
+
return match(unsafeOpts).when((unsafeOpts2) => unsafeOpts2.task === "get-image", () => sendAsyncRes(getArchetypeDockerImage())).otherwise(() => {
|
|
59
|
+
const p = unsafeOpts.sourceFile ? compileContract(unsafeOpts)(unsafeOpts.sourceFile).then((result) => [result]) : compileAll(unsafeOpts).then((results) => {
|
|
60
|
+
if (results.length === 0)
|
|
61
|
+
sendErr("No contracts found to compile.");
|
|
62
|
+
return results;
|
|
63
|
+
});
|
|
64
|
+
return p.then(sendJsonRes).catch((err) => sendAsyncErr(err, false));
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
var compile_default = compile;
|
|
68
|
+
|
|
69
|
+
// createContract.ts
|
|
70
|
+
import { sendAsyncErr as sendAsyncErr2 } from "@taqueria/node-sdk";
|
|
71
|
+
import { writeFile } from "fs/promises";
|
|
72
|
+
|
|
73
|
+
// archetype_template.ts
|
|
74
|
+
var arl_template = `
|
|
75
|
+
archetype hello
|
|
76
|
+
|
|
77
|
+
variable msg : string = "Hello"
|
|
78
|
+
|
|
79
|
+
entry input(name : string) {
|
|
80
|
+
msg += " " + name
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
// createContract.ts
|
|
85
|
+
var validateExtension = async (contractName) => {
|
|
86
|
+
const matchResult = contractName.match(/\.arl$/);
|
|
87
|
+
if (matchResult)
|
|
88
|
+
return;
|
|
89
|
+
return sendAsyncErr2(`"${contractName}" doesn't have extension "arl".`);
|
|
90
|
+
};
|
|
91
|
+
var createContract = (args) => {
|
|
92
|
+
const contractName = args.sourceFileName;
|
|
93
|
+
const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
|
|
94
|
+
return validateExtension(contractName).then((_) => writeFile(`${contractsDir}/${contractName}`, arl_template));
|
|
95
|
+
};
|
|
96
|
+
var createContract_default = createContract;
|
|
97
|
+
|
|
98
|
+
// index.ts
|
|
99
|
+
Plugin.create((i18n) => ({
|
|
100
|
+
schema: "1.0",
|
|
101
|
+
version: "0.1",
|
|
102
|
+
alias: "archetype",
|
|
103
|
+
tasks: [
|
|
104
|
+
Task.create({
|
|
105
|
+
task: "compile",
|
|
106
|
+
command: "compile [sourceFile]",
|
|
107
|
+
aliases: ["c", "compile-archetype"],
|
|
108
|
+
description: "Compile a smart contract written in a Archetype syntax to Michelson code",
|
|
109
|
+
options: [],
|
|
110
|
+
handler: "proxy",
|
|
111
|
+
encoding: "json"
|
|
112
|
+
}),
|
|
113
|
+
Task.create({
|
|
114
|
+
task: "get-image",
|
|
115
|
+
command: "get-image",
|
|
116
|
+
description: "Gets the name of the image to be used",
|
|
117
|
+
handler: "proxy",
|
|
118
|
+
hidden: true
|
|
119
|
+
})
|
|
120
|
+
],
|
|
121
|
+
templates: [
|
|
122
|
+
Template.create({
|
|
123
|
+
template: "archetypeContract",
|
|
124
|
+
command: "archetypeContract <sourceFileName>",
|
|
125
|
+
description: "Create a Archetype contract with boilerplate code",
|
|
126
|
+
positionals: [
|
|
127
|
+
PositionalArg.create({
|
|
128
|
+
placeholder: "sourceFileName",
|
|
129
|
+
type: "string",
|
|
130
|
+
description: "The name of the Archetype contract to generate"
|
|
131
|
+
})
|
|
132
|
+
],
|
|
133
|
+
handler: createContract_default
|
|
134
|
+
})
|
|
135
|
+
],
|
|
136
|
+
proxy: compile_default
|
|
137
|
+
}), process.argv);
|
|
138
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts","compile.ts","createContract.ts","archetype_template.ts"],"sourcesContent":["import { Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport compile from './compile';\nimport createContract from './createContract';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'archetype',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile [sourceFile]',\n\t\t\taliases: ['c', 'compile-archetype'],\n\t\t\tdescription: 'Compile a smart contract written in a Archetype syntax to Michelson code',\n\t\t\toptions: [],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'archetypeContract',\n\t\t\tcommand: 'archetypeContract <sourceFileName>',\n\t\t\tdescription: 'Create a Archetype 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 Archetype contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: compile,\n}), process.argv);\n","import {\n\texecCmd,\n\tgetContracts,\n\tgetDockerImage,\n\tProxyTaskArgs,\n\tRequestArgs,\n\tsendAsyncErr,\n\tsendAsyncRes,\n\tsendErr,\n\tsendJsonRes,\n} from '@taqueria/node-sdk';\nimport { basename, extname, join } from 'path';\nimport { match } from 'ts-pattern';\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst ARCHETYPE_DEFAULT_IMAGE = 'completium/archetype:1.2.12';\n\nconst ARCHETYPE_IMAGE_ENV_VAR = 'TAQ_ARCHETYPE_IMAGE';\n\nexport const getArchetypeDockerImage = (): string => getDockerImage(ARCHETYPE_DEFAULT_IMAGE, ARCHETYPE_IMAGE_ENV_VAR);\n\ninterface Opts extends ProxyTaskArgs.t {\n\tsourceFile?: string;\n}\n\nconst getInputFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst inputFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.contractsDir ?? 'contracts', `${inputFile}.arl`);\n\t};\n\nconst getContractArtifactFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst outFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.artifactsDir ?? 'contracts', `${outFile}.tz`);\n\t};\n\nconst getCompileCommand = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst { projectDir } = opts;\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 -u $(id -u):$(id -g) -w /project ${getArchetypeDockerImage()} ${inputFile}`;\n\t\tconst outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;\n\t\tconst cmd = `${baseCommand} ${outFile}`;\n\t\treturn cmd;\n\t};\n\nconst compileContract = (opts: Opts) =>\n\t(sourceFile: string): Promise<{ contract: string; artifact: string }> =>\n\t\t// const sourceAbspath = join(opts.contractsDir, sourceFile)\n\t\texecCmd(getCompileCommand(opts)(sourceFile))\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 = (opts: Opts): Promise<{ contract: string; artifact: string }[]> => {\n\tconst contracts = getContracts(/\\.arl$/, opts.config);\n\treturn Promise.all(contracts)\n\t\t.then(entries => entries.map(compileContract(opts)))\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\nconst compile = (parsedArgs: RequestArgs.t) => {\n\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\treturn match(unsafeOpts)\n\t\t.when(unsafeOpts => unsafeOpts.task === 'get-image', () => sendAsyncRes(getArchetypeDockerImage()))\n\t\t.otherwise(() => {\n\t\t\tconst p = unsafeOpts.sourceFile\n\t\t\t\t? compileContract(unsafeOpts)(unsafeOpts.sourceFile)\n\t\t\t\t\t.then(result => [result])\n\t\t\t\t: compileAll(unsafeOpts)\n\t\t\t\t\t.then(results => {\n\t\t\t\t\t\tif (results.length === 0) sendErr('No contracts found to compile.');\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t});\n\n\t\t\treturn p\n\t\t\t\t.then(sendJsonRes)\n\t\t\t\t.catch(err => sendAsyncErr(err, false));\n\t\t});\n};\n\nexport default compile;\n","import { RequestArgs, sendAsyncErr } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport { arl_template } from './archetype_template';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n}\n\nconst validateExtension = async (contractName: string) => {\n\tconst matchResult = contractName.match(/\\.arl$/);\n\tif (matchResult) return;\n\treturn sendAsyncErr(`\"${contractName}\" doesn't have extension \"arl\".`);\n};\n\nconst createContract = (args: Opts) => {\n\tconst contractName = args.sourceFileName as string;\n\tconst contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;\n\treturn validateExtension(contractName)\n\t\t.then(_ => writeFile(`${contractsDir}/${contractName}`, arl_template));\n};\n\nexport default createContract;\n","export const arl_template = `\narchetype hello\n\nvariable msg : string = \"Hello\"\n\nentry input(name : string) {\n msg += \" \" + name\n}\n`;\n"],"mappings":";AAAA,SAAS,QAAQ,eAAe,MAAM,gBAAgB;;;ACAtD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU,SAAS,YAAY;AACxC,SAAS,aAAa;AAGtB,IAAM,0BAA0B;AAEhC,IAAM,0BAA0B;AAEzB,IAAM,0BAA0B,MAAc,eAAe,yBAAyB,uBAAuB;AAMpH,IAAM,mBAAmB,CAAC,SACzB,CAAC,eAAuB;AACvB,QAAM,YAAY,SAAS,YAAY,QAAQ,UAAU,CAAC;AAC1D,SAAO,KAAK,KAAK,OAAO,gBAAgB,aAAa,G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;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACV,SAAS,OAAO;AAAA,MACf,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACZ,cAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["unsafeOpts","sendAsyncErr","sendAsyncErr"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-archetype",
|
|
3
|
-
"version": "0.27.0-
|
|
3
|
+
"version": "0.27.0-rc",
|
|
4
4
|
"description": "A taqueria plugin for compiling Archetype smart contracts",
|
|
5
5
|
"targets": {
|
|
6
6
|
"default": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
|
-
"build": "npx tsc -noEmit && npx
|
|
15
|
+
"build": "npx tsc -noEmit -p ./tsconfig.json && npx tsup",
|
|
16
16
|
"pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}",
|
|
17
17
|
"compile": "node index.js --taqRun proxy --task compile --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
|
|
18
18
|
"debugPluginInfo": "node --inspect index.js --taqRun pluginInfo --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\"}' --projectDir ../test-project --configDir ./.taq"
|
|
@@ -40,12 +40,28 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/ecadlabs/taqueria#readme",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@taqueria/node-sdk": "^0.27.0-
|
|
43
|
+
"@taqueria/node-sdk": "^0.27.0-rc",
|
|
44
44
|
"fast-glob": "^3.2.11",
|
|
45
45
|
"ts-pattern": "^3.3.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"
|
|
48
|
+
"tsup": "^6.5.0",
|
|
49
49
|
"typescript": "^4.7.2"
|
|
50
|
+
},
|
|
51
|
+
"tsup": {
|
|
52
|
+
"entry": [
|
|
53
|
+
"index.ts"
|
|
54
|
+
],
|
|
55
|
+
"sourcemap": true,
|
|
56
|
+
"target": "node16",
|
|
57
|
+
"outDir": "./",
|
|
58
|
+
"dts": true,
|
|
59
|
+
"clean": false,
|
|
60
|
+
"skipNodeModulesBundle": true,
|
|
61
|
+
"platform": "node",
|
|
62
|
+
"format": [
|
|
63
|
+
"esm",
|
|
64
|
+
"cjs"
|
|
65
|
+
]
|
|
50
66
|
}
|
|
51
67
|
}
|