@taqueria/plugin-archetype 0.0.0-pr-682-e2e4474c → 0.0.0-pr-680-0b8e884a
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/compile.ts +1 -1
- package/index.js +4 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
package/compile.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {execCmd, sendErr, sendJsonRes, sendAsyncErr} from "@taqueria/node-sdk"
|
|
2
2
|
import { Failure, LikeAPromise, ParsedArgs, PluginResponse, SanitizedArgs } from "@taqueria/node-sdk/types";
|
|
3
|
-
import glob
|
|
3
|
+
import glob from 'fast-glob'
|
|
4
4
|
import { extname, join, basename } from 'path'
|
|
5
5
|
import { readFile } from 'fs/promises'
|
|
6
6
|
|
package/index.js
CHANGED
|
@@ -2,6 +2,9 @@ var $dTHpf$taquerianodesdk = require("@taqueria/node-sdk");
|
|
|
2
2
|
var $dTHpf$fastglob = require("fast-glob");
|
|
3
3
|
var $dTHpf$path = require("path");
|
|
4
4
|
|
|
5
|
+
function $parcel$interopDefault(a) {
|
|
6
|
+
return a && a.__esModule ? a.default : a;
|
|
7
|
+
}
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
|
|
@@ -43,7 +46,7 @@ const $bb055a91efa18df7$var$compileContract = (opts)=>(sourceFile)=>// const sou
|
|
|
43
46
|
;
|
|
44
47
|
const $bb055a91efa18df7$var$compileAll = (opts)=>{
|
|
45
48
|
// TODO: Fetch list of files from SDK
|
|
46
|
-
return $dTHpf$fastglob([
|
|
49
|
+
return ($parcel$interopDefault($dTHpf$fastglob))([
|
|
47
50
|
'**/*.arl'
|
|
48
51
|
], {
|
|
49
52
|
cwd: opts.contractsDir,
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;AAAA;ACAA;;;AAQA,MAAM,sCAAgB,GAAG,CAAC,IAAU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AAO;KACjB,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-archetype/index.ts","taqueria-plugin-archetype/compile.ts"],"sourcesContent":["import {Plugin, Task, Option} from '@taqueria/node-sdk'\nimport compile from './compile'\n\nPlugin.create(i18n => ({\n schema: \"1.0\",\n version: \"0.1\",\n alias: \"archetype\",\n tasks: [\n Task.create({\n task: \"compile\",\n command: \"compile [sourceFile]\",\n aliases: [\"c\", \"compile-archetype\"],\n description: \"Compile a smart contract written in a Archetype syntax to Michelson code\",\n options: [],\n handler: \"proxy\",\n encoding: \"json\"\n })\n ],\n checkRuntimeDependencies: () => Promise.resolve({\n status: \"success\",\n report: [\n {name: \"Archetype\", path: \"archetype\", version: \">=1.2.12\", kind: \"required\", met: true}\n ]\n }),\n installRunTimeDependencies: () => Promise.resolve({\n status: \"success\",\n output: \"Archetype was found in /usr/bin/archetype\" // TODO this should use i18n\n }),\n proxy: compile\n}), process.argv)","import {execCmd, sendErr, sendJsonRes, sendAsyncErr} from \"@taqueria/node-sdk\"\nimport { Failure, LikeAPromise, ParsedArgs, PluginResponse, SanitizedArgs } from \"@taqueria/node-sdk/types\";\nimport glob from 'fast-glob'\nimport { extname, join, basename } from 'path'\nimport { readFile } from 'fs/promises'\n\ntype Opts = SanitizedArgs & {sourceFile: string}\n\nconst getInputFilename = (opts: Opts) => (sourceFile: string) => {\n const inputFile = basename(sourceFile, extname(sourceFile))\n return join(opts.config.contractsDir, `${inputFile}.arl`)\n}\n\nconst getContractArtifactFilename = (opts: Opts) => (sourceFile: string) => {\n const outFile = basename(sourceFile, extname(sourceFile))\n return join(opts.config.artifactsDir, `${outFile}.tz`)\n}\n\nconst getCompileCommand = (opts: Opts) => (sourceFile: string) => {\n const { projectDir } = opts\n const inputFile = getInputFilename(opts)(sourceFile)\n const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project completium/archetype:1.2.12 ${inputFile}`\n const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`\n const cmd = `${baseCommand} ${outFile}`\n return cmd\n}\n\nconst compileContract = (opts: Opts) => (sourceFile: string): Promise<{ contract: string, artifact: string }> =>\n // const sourceAbspath = join(opts.contractsDir, sourceFile)\n execCmd(getCompileCommand(opts)(sourceFile))\n .then(({stderr}) => { // How should we output warnings?\n if (stderr.length > 0) sendErr(stderr)\n return {\n contract: sourceFile,\n artifact: getContractArtifactFilename(opts) (sourceFile)\n }\n })\n .catch(err => {\n sendErr(\" \")\n sendErr(err.message.split(\"\\n\").slice(1).join(\"\\n\"))\n return Promise.resolve({\n contract: sourceFile,\n artifact: \"Not compiled\"\n })\n })\n\nconst compileAll = (opts: Opts): Promise<{ contract: string, artifact: string }[]> => {\n // TODO: Fetch list of files from SDK\n return glob(\n ['**/*.arl'],\n { cwd: opts.contractsDir, absolute: false }\n )\n .then(entries => entries.map(compileContract(opts)))\n .then(processes => processes.length > 0\n ? processes\n : [{contract: \"None found\", artifact: \"N/A\"}]\n )\n .then(promises => Promise.all(promises))\n}\n\nconst compile = <T>(parsedArgs: SanitizedArgs): LikeAPromise<PluginResponse, Failure<T>> => {\n const params = parsedArgs as Opts\n const p = parsedArgs.sourceFile\n ? compileContract(params) (params.sourceFile)\n .then(result => [result])\n : compileAll(params)\n .then(results => {\n if (results.length === 0) sendErr(\"No contracts found to compile.\")\n return results\n })\n \n return p\n .then(sendJsonRes)\n .catch(err => sendAsyncErr(err, false))\n}\n\nexport default compile"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-archetype",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-680-0b8e884a",
|
|
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
|
|
15
|
+
"build": "npx parcel build --no-cache 2>&1",
|
|
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"
|