@taqueria/plugin-archetype 0.0.0-pr-746-b1a2fe75 → 0.0.0-pr-829-20439d01

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +45 -57
  2. package/index.js.map +1 -1
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -10,15 +10,13 @@ function $parcel$interopDefault(a) {
10
10
 
11
11
 
12
12
  const $bb055a91efa18df7$var$getInputFilename = (opts)=>(sourceFile)=>{
13
- const inputFile = $dTHpf$path.basename(sourceFile, $dTHpf$path.extname(sourceFile));
14
- return $dTHpf$path.join(opts.config.contractsDir, `${inputFile}.arl`);
15
- }
16
- ;
13
+ const inputFile = (0, $dTHpf$path.basename)(sourceFile, (0, $dTHpf$path.extname)(sourceFile));
14
+ return (0, $dTHpf$path.join)(opts.config.contractsDir, `${inputFile}.arl`);
15
+ };
17
16
  const $bb055a91efa18df7$var$getContractArtifactFilename = (opts)=>(sourceFile)=>{
18
- const outFile = $dTHpf$path.basename(sourceFile, $dTHpf$path.extname(sourceFile));
19
- return $dTHpf$path.join(opts.config.artifactsDir, `${outFile}.tz`);
20
- }
21
- ;
17
+ const outFile = (0, $dTHpf$path.basename)(sourceFile, (0, $dTHpf$path.extname)(sourceFile));
18
+ return (0, $dTHpf$path.join)(opts.config.artifactsDir, `${outFile}.tz`);
19
+ };
22
20
  const $bb055a91efa18df7$var$getCompileCommand = (opts)=>(sourceFile)=>{
23
21
  const { projectDir: projectDir } = opts;
24
22
  const inputFile = $bb055a91efa18df7$var$getInputFilename(opts)(sourceFile);
@@ -26,94 +24,84 @@ const $bb055a91efa18df7$var$getCompileCommand = (opts)=>(sourceFile)=>{
26
24
  const outFile = `-o ${$bb055a91efa18df7$var$getContractArtifactFilename(opts)(sourceFile)}`;
27
25
  const cmd = `${baseCommand} ${outFile}`;
28
26
  return cmd;
29
- }
30
- ;
27
+ };
31
28
  const $bb055a91efa18df7$var$compileContract = (opts)=>(sourceFile)=>// const sourceAbspath = join(opts.contractsDir, sourceFile)
32
- $dTHpf$taquerianodesdk.execCmd($bb055a91efa18df7$var$getCompileCommand(opts)(sourceFile)).then(({ stderr: stderr })=>{
33
- if (stderr.length > 0) $dTHpf$taquerianodesdk.sendErr(stderr);
29
+ (0, $dTHpf$taquerianodesdk.execCmd)($bb055a91efa18df7$var$getCompileCommand(opts)(sourceFile)).then(({ stderr: stderr })=>{
30
+ if (stderr.length > 0) (0, $dTHpf$taquerianodesdk.sendErr)(stderr);
34
31
  return {
35
32
  contract: sourceFile,
36
33
  artifact: $bb055a91efa18df7$var$getContractArtifactFilename(opts)(sourceFile)
37
34
  };
38
35
  }).catch((err)=>{
39
- $dTHpf$taquerianodesdk.sendErr(' ');
40
- $dTHpf$taquerianodesdk.sendErr(err.message.split('\n').slice(1).join('\n'));
36
+ (0, $dTHpf$taquerianodesdk.sendErr)(" ");
37
+ (0, $dTHpf$taquerianodesdk.sendErr)(err.message.split("\n").slice(1).join("\n"));
41
38
  return Promise.resolve({
42
39
  contract: sourceFile,
43
- artifact: 'Not compiled'
40
+ artifact: "Not compiled"
44
41
  });
45
- })
46
- ;
42
+ });
47
43
  const $bb055a91efa18df7$var$compileAll = (opts)=>{
48
44
  // TODO: Fetch list of files from SDK
49
- return ($parcel$interopDefault($dTHpf$fastglob))([
50
- '**/*.arl'
45
+ return (0, ($parcel$interopDefault($dTHpf$fastglob)))([
46
+ "**/*.arl"
51
47
  ], {
52
48
  cwd: opts.config.contractsDir,
53
49
  absolute: false
54
- }).then((entries)=>entries.map($bb055a91efa18df7$var$compileContract(opts))
55
- ).then((processes)=>processes.length > 0 ? processes : [
50
+ }).then((entries)=>entries.map($bb055a91efa18df7$var$compileContract(opts))).then((processes)=>processes.length > 0 ? processes : [
56
51
  {
57
- contract: 'None found',
58
- artifact: 'N/A'
52
+ contract: "None found",
53
+ artifact: "N/A"
59
54
  }
60
- ]
61
- ).then((promises)=>Promise.all(promises)
62
- );
55
+ ]).then((promises)=>Promise.all(promises));
63
56
  };
64
57
  const $bb055a91efa18df7$var$compile = (parsedArgs)=>{
65
58
  const p = parsedArgs.sourceFile ? $bb055a91efa18df7$var$compileContract(parsedArgs)(parsedArgs.sourceFile).then((result)=>[
66
59
  result
67
- ]
68
- ) : $bb055a91efa18df7$var$compileAll(parsedArgs).then((results)=>{
69
- if (results.length === 0) $dTHpf$taquerianodesdk.sendErr('No contracts found to compile.');
60
+ ]) : $bb055a91efa18df7$var$compileAll(parsedArgs).then((results)=>{
61
+ if (results.length === 0) (0, $dTHpf$taquerianodesdk.sendErr)("No contracts found to compile.");
70
62
  return results;
71
63
  });
72
- return p.then($dTHpf$taquerianodesdk.sendJsonRes).catch((err)=>$dTHpf$taquerianodesdk.sendAsyncErr(err, false)
73
- );
64
+ return p.then((0, $dTHpf$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $dTHpf$taquerianodesdk.sendAsyncErr)(err, false));
74
65
  };
75
66
  var $bb055a91efa18df7$export$2e2bcd8739ae039 = $bb055a91efa18df7$var$compile;
76
67
 
77
68
 
78
- $dTHpf$taquerianodesdk.Plugin.create((i18n)=>({
79
- schema: '1.0',
80
- version: '0.1',
81
- alias: 'archetype',
69
+ (0, $dTHpf$taquerianodesdk.Plugin).create((i18n)=>({
70
+ schema: "1.0",
71
+ version: "0.1",
72
+ alias: "archetype",
82
73
  tasks: [
83
- $dTHpf$taquerianodesdk.Task.create({
84
- task: 'compile',
85
- command: 'compile [sourceFile]',
74
+ (0, $dTHpf$taquerianodesdk.Task).create({
75
+ task: "compile",
76
+ command: "compile [sourceFile]",
86
77
  aliases: [
87
- 'c',
88
- 'compile-archetype'
78
+ "c",
79
+ "compile-archetype"
89
80
  ],
90
- description: 'Compile a smart contract written in a Archetype syntax to Michelson code',
81
+ description: "Compile a smart contract written in a Archetype syntax to Michelson code",
91
82
  options: [],
92
- handler: 'proxy',
93
- encoding: 'json'
83
+ handler: "proxy",
84
+ encoding: "json"
94
85
  }),
95
86
  ],
96
87
  checkRuntimeDependencies: ()=>Promise.resolve({
97
- status: 'success',
88
+ status: "success",
98
89
  report: [
99
90
  {
100
- name: 'Archetype',
101
- path: 'archetype',
102
- version: '>=1.2.12',
103
- kind: 'required',
91
+ name: "Archetype",
92
+ path: "archetype",
93
+ version: ">=1.2.12",
94
+ kind: "required",
104
95
  met: true
105
96
  },
106
97
  ]
107
- })
108
- ,
98
+ }),
109
99
  installRunTimeDependencies: ()=>Promise.resolve({
110
- status: 'success',
111
- output: 'Archetype was found in /usr/bin/archetype'
112
- })
113
- ,
114
- proxy: $bb055a91efa18df7$export$2e2bcd8739ae039
115
- })
116
- , process.argv);
100
+ status: "success",
101
+ output: "Archetype was found in /usr/bin/archetype"
102
+ }),
103
+ proxy: (0, $bb055a91efa18df7$export$2e2bcd8739ae039)
104
+ }), process.argv);
117
105
 
118
106
 
119
107
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;ACAA;;;AAUA,MAAM,sCAAgB,GAAG,CAAC,IAAU,GACnC,CAAC,UAAkB,GAAK;QACvB,MAAM,SAAS,GAAG,oBAAQ,CAAC,UAAU,EAAE,mBAAO,CAAC,UAAU,CAAC,CAAC,AAAC;QAC5D,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;KAC1D;AAAC;AAEH,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAC9C,CAAC,UAAkB,GAAK;QACvB,MAAM,OAAO,GAAG,oBAAQ,CAAC,UAAU,EAAE,mBAAO,CAAC,UAAU,CAAC,CAAC,AAAC;QAC1D,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KACvD;AAAC;AAEH,MAAM,uCAAiB,GAAG,CAAC,IAAU,GACpC,CAAC,UAAkB,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QACd,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE;YACN,2BAAI,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,sBAAsB;gBAC/B,OAAO,EAAE;oBAAC,GAAG;oBAAE,mBAAmB;iBAAC;gBACnC,WAAW,EAAE,0EAA0E;gBACvF,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aAChB,CAAC;SACF;QACD,wBAAwB,EAAE,IACzB,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE;oBACP;wBAAE,IAAI,EAAE,WAAW;wBAAE,IAAI,EAAE,WAAW;wBAAE,OAAO,EAAE,UAAU;wBAAE,IAAI,EAAE,UAAU;wBAAE,GAAG,EAAE,IAAI;qBAAE;iBAC1F;aACD,CAAC;QAAA;QACH,0BAA0B,EAAE,IAC3B,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,2CAA2C;aACnD,CAAC;QAAA;QACH,KAAK,EAAE,wCAAO;KACd,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-archetype/index.ts","taqueria-plugin-archetype/compile.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport compile from './compile';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: '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],\n\tcheckRuntimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\treport: [\n\t\t\t\t{ name: 'Archetype', path: 'archetype', version: '>=1.2.12', kind: 'required', met: true },\n\t\t\t],\n\t\t}),\n\tinstallRunTimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\toutput: 'Archetype was found in /usr/bin/archetype', // TODO this should use i18n\n\t\t}),\n\tproxy: compile,\n}), process.argv);\n","import { execCmd, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport { LikeAPromise, PluginResponse, RequestArgs, TaqError } from '@taqueria/node-sdk/types';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\n\ninterface Opts extends RequestArgs.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, `${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, `${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 -w /project completium/archetype:1.2.12 ${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\t// TODO: Fetch list of files from SDK\n\treturn glob(\n\t\t['**/*.arl'],\n\t\t{ cwd: opts.config.contractsDir, absolute: false },\n\t)\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 = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, TaqError.t> => {\n\tconst p = parsedArgs.sourceFile\n\t\t? compileContract(parsedArgs)(parsedArgs.sourceFile)\n\t\t\t.then(result => [result])\n\t\t: compileAll(parsedArgs)\n\t\t\t.then(results => {\n\t\t\t\tif (results.length === 0) sendErr('No contracts found to compile.');\n\t\t\t\treturn results;\n\t\t\t});\n\n\treturn p\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
1
+ {"mappings":";;;;;;;AAAA;ACAA;;;AAUA,MAAM,sCAAgB,GAAG,CAAC,IAAU,GACnC,CAAC,UAAkB,GAAK;QACvB,MAAM,SAAS,GAAG,CAAA,GAAA,oBAAQ,CAAA,CAAC,UAAU,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,UAAU,CAAC,CAAC,AAAC;QAC5D,OAAO,CAAA,GAAA,gBAAI,CAAA,C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AAM,EAAE,SAAS;gBACjB,MAAM,EAAE,2CAA2C;aACnD,CAAC;QACH,KAAK,EAAE,CAAA,GAAA,wCAAO,CAAA;KACd,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-archetype/index.ts","taqueria-plugin-archetype/compile.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport compile from './compile';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: '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],\n\tcheckRuntimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\treport: [\n\t\t\t\t{ name: 'Archetype', path: 'archetype', version: '>=1.2.12', kind: 'required', met: true },\n\t\t\t],\n\t\t}),\n\tinstallRunTimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\toutput: 'Archetype was found in /usr/bin/archetype', // TODO this should use i18n\n\t\t}),\n\tproxy: compile,\n}), process.argv);\n","import { execCmd, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport { LikeAPromise, PluginResponse, RequestArgs, TaqError } from '@taqueria/node-sdk/types';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\n\ninterface Opts extends RequestArgs.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, `${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, `${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 -w /project completium/archetype:1.2.12 ${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\t// TODO: Fetch list of files from SDK\n\treturn glob(\n\t\t['**/*.arl'],\n\t\t{ cwd: opts.config.contractsDir, absolute: false },\n\t)\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 = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, TaqError.t> => {\n\tconst p = parsedArgs.sourceFile\n\t\t? compileContract(parsedArgs)(parsedArgs.sourceFile)\n\t\t\t.then(result => [result])\n\t\t: compileAll(parsedArgs)\n\t\t\t.then(results => {\n\t\t\t\tif (results.length === 0) sendErr('No contracts found to compile.');\n\t\t\t\treturn results;\n\t\t\t});\n\n\treturn p\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-archetype",
3
- "version": "0.0.0-pr-746-b1a2fe75",
3
+ "version": "0.0.0-pr-829-20439d01",
4
4
  "description": "A taqueria plugin for compiling Archetype smart contracts",
5
5
  "targets": {
6
6
  "default": {
@@ -44,7 +44,7 @@
44
44
  "fast-glob": "^3.2.11"
45
45
  },
46
46
  "devDependencies": {
47
- "parcel": "^2.5.0",
47
+ "parcel": "^2.6.0",
48
48
  "typescript": "^4.7.2"
49
49
  }
50
50
  }