@taqueria/plugin-archetype 0.0.0-pr-825-0ffcf17b → 0.0.0-pr-730-784c1afb

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 +57 -45
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -10,13 +10,15 @@ function $parcel$interopDefault(a) {
10
10
 
11
11
 
12
12
  const $bb055a91efa18df7$var$getInputFilename = (opts)=>(sourceFile)=>{
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
- };
13
+ const inputFile = $dTHpf$path.basename(sourceFile, $dTHpf$path.extname(sourceFile));
14
+ return $dTHpf$path.join(opts.config.contractsDir, `${inputFile}.arl`);
15
+ }
16
+ ;
16
17
  const $bb055a91efa18df7$var$getContractArtifactFilename = (opts)=>(sourceFile)=>{
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
- };
18
+ const outFile = $dTHpf$path.basename(sourceFile, $dTHpf$path.extname(sourceFile));
19
+ return $dTHpf$path.join(opts.config.artifactsDir, `${outFile}.tz`);
20
+ }
21
+ ;
20
22
  const $bb055a91efa18df7$var$getCompileCommand = (opts)=>(sourceFile)=>{
21
23
  const { projectDir: projectDir } = opts;
22
24
  const inputFile = $bb055a91efa18df7$var$getInputFilename(opts)(sourceFile);
@@ -24,84 +26,94 @@ const $bb055a91efa18df7$var$getCompileCommand = (opts)=>(sourceFile)=>{
24
26
  const outFile = `-o ${$bb055a91efa18df7$var$getContractArtifactFilename(opts)(sourceFile)}`;
25
27
  const cmd = `${baseCommand} ${outFile}`;
26
28
  return cmd;
27
- };
29
+ }
30
+ ;
28
31
  const $bb055a91efa18df7$var$compileContract = (opts)=>(sourceFile)=>// const sourceAbspath = join(opts.contractsDir, sourceFile)
29
- (0, $dTHpf$taquerianodesdk.execCmd)($bb055a91efa18df7$var$getCompileCommand(opts)(sourceFile)).then(({ stderr: stderr })=>{
30
- if (stderr.length > 0) (0, $dTHpf$taquerianodesdk.sendErr)(stderr);
32
+ $dTHpf$taquerianodesdk.execCmd($bb055a91efa18df7$var$getCompileCommand(opts)(sourceFile)).then(({ stderr: stderr })=>{
33
+ if (stderr.length > 0) $dTHpf$taquerianodesdk.sendErr(stderr);
31
34
  return {
32
35
  contract: sourceFile,
33
36
  artifact: $bb055a91efa18df7$var$getContractArtifactFilename(opts)(sourceFile)
34
37
  };
35
38
  }).catch((err)=>{
36
- (0, $dTHpf$taquerianodesdk.sendErr)(" ");
37
- (0, $dTHpf$taquerianodesdk.sendErr)(err.message.split("\n").slice(1).join("\n"));
39
+ $dTHpf$taquerianodesdk.sendErr(' ');
40
+ $dTHpf$taquerianodesdk.sendErr(err.message.split('\n').slice(1).join('\n'));
38
41
  return Promise.resolve({
39
42
  contract: sourceFile,
40
- artifact: "Not compiled"
43
+ artifact: 'Not compiled'
41
44
  });
42
- });
45
+ })
46
+ ;
43
47
  const $bb055a91efa18df7$var$compileAll = (opts)=>{
44
48
  // TODO: Fetch list of files from SDK
45
- return (0, ($parcel$interopDefault($dTHpf$fastglob)))([
46
- "**/*.arl"
49
+ return ($parcel$interopDefault($dTHpf$fastglob))([
50
+ '**/*.arl'
47
51
  ], {
48
52
  cwd: opts.config.contractsDir,
49
53
  absolute: false
50
- }).then((entries)=>entries.map($bb055a91efa18df7$var$compileContract(opts))).then((processes)=>processes.length > 0 ? processes : [
54
+ }).then((entries)=>entries.map($bb055a91efa18df7$var$compileContract(opts))
55
+ ).then((processes)=>processes.length > 0 ? processes : [
51
56
  {
52
- contract: "None found",
53
- artifact: "N/A"
57
+ contract: 'None found',
58
+ artifact: 'N/A'
54
59
  }
55
- ]).then((promises)=>Promise.all(promises));
60
+ ]
61
+ ).then((promises)=>Promise.all(promises)
62
+ );
56
63
  };
57
64
  const $bb055a91efa18df7$var$compile = (parsedArgs)=>{
58
65
  const p = parsedArgs.sourceFile ? $bb055a91efa18df7$var$compileContract(parsedArgs)(parsedArgs.sourceFile).then((result)=>[
59
66
  result
60
- ]) : $bb055a91efa18df7$var$compileAll(parsedArgs).then((results)=>{
61
- if (results.length === 0) (0, $dTHpf$taquerianodesdk.sendErr)("No contracts found to compile.");
67
+ ]
68
+ ) : $bb055a91efa18df7$var$compileAll(parsedArgs).then((results)=>{
69
+ if (results.length === 0) $dTHpf$taquerianodesdk.sendErr('No contracts found to compile.');
62
70
  return results;
63
71
  });
64
- return p.then((0, $dTHpf$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $dTHpf$taquerianodesdk.sendAsyncErr)(err, false));
72
+ return p.then($dTHpf$taquerianodesdk.sendJsonRes).catch((err)=>$dTHpf$taquerianodesdk.sendAsyncErr(err, false)
73
+ );
65
74
  };
66
75
  var $bb055a91efa18df7$export$2e2bcd8739ae039 = $bb055a91efa18df7$var$compile;
67
76
 
68
77
 
69
- (0, $dTHpf$taquerianodesdk.Plugin).create((i18n)=>({
70
- schema: "1.0",
71
- version: "0.1",
72
- alias: "archetype",
78
+ $dTHpf$taquerianodesdk.Plugin.create((i18n)=>({
79
+ schema: '1.0',
80
+ version: '0.1',
81
+ alias: 'archetype',
73
82
  tasks: [
74
- (0, $dTHpf$taquerianodesdk.Task).create({
75
- task: "compile",
76
- command: "compile [sourceFile]",
83
+ $dTHpf$taquerianodesdk.Task.create({
84
+ task: 'compile',
85
+ command: 'compile [sourceFile]',
77
86
  aliases: [
78
- "c",
79
- "compile-archetype"
87
+ 'c',
88
+ 'compile-archetype'
80
89
  ],
81
- description: "Compile a smart contract written in a Archetype syntax to Michelson code",
90
+ description: 'Compile a smart contract written in a Archetype syntax to Michelson code',
82
91
  options: [],
83
- handler: "proxy",
84
- encoding: "json"
92
+ handler: 'proxy',
93
+ encoding: 'json'
85
94
  }),
86
95
  ],
87
96
  checkRuntimeDependencies: ()=>Promise.resolve({
88
- status: "success",
97
+ status: 'success',
89
98
  report: [
90
99
  {
91
- name: "Archetype",
92
- path: "archetype",
93
- version: ">=1.2.12",
94
- kind: "required",
100
+ name: 'Archetype',
101
+ path: 'archetype',
102
+ version: '>=1.2.12',
103
+ kind: 'required',
95
104
  met: true
96
105
  },
97
106
  ]
98
- }),
107
+ })
108
+ ,
99
109
  installRunTimeDependencies: ()=>Promise.resolve({
100
- status: "success",
101
- output: "Archetype was found in /usr/bin/archetype"
102
- }),
103
- proxy: (0, $bb055a91efa18df7$export$2e2bcd8739ae039)
104
- }), process.argv);
110
+ status: 'success',
111
+ output: 'Archetype was found in /usr/bin/archetype'
112
+ })
113
+ ,
114
+ proxy: $bb055a91efa18df7$export$2e2bcd8739ae039
115
+ })
116
+ , process.argv);
105
117
 
106
118
 
107
119
  //# 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,CAAA,GAAA,oBAAQ,CAAA,CAAC,UAAU,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,UAAU,CAAC,CAAC,AAAC;QAC5D,OAAO,CAAA,GAAA,gBAAI,CAAA,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,CAAA,GAAA,oBAAQ,CAAA,CAAC,UAAU,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,UAAU,CAAC,CAAC,AAAC;QAC1D,OAAO,CAAA,GAAA,gBAAI,CAAA,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,E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,GAAI,CAAA,GAAA,mCAAY,CAAA,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;CACzC,AAAC;IAEF,wCAAuB,GAAR,6BAAO;;;ADhFtB,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC,CAAA,IAAI,GAAK,CAAA;QACtB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE;YACN,CAAA,GAAA,2BAAI,CAAA,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;QACH,0BAA0B,EAAE,IAC3B,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,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":"../"}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,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":"../"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-archetype",
3
- "version": "0.0.0-pr-825-0ffcf17b",
3
+ "version": "0.0.0-pr-730-784c1afb",
4
4
  "description": "A taqueria plugin for compiling Archetype smart contracts",
5
5
  "targets": {
6
6
  "default": {