@algorandfoundation/algokit-client-generator 5.0.1-beta.9 → 6.0.0-beta.1
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/cli.js +1 -1
- package/cli.js.map +1 -1
- package/cli.mjs +1 -1
- package/cli.mjs.map +1 -1
- package/package.json +1 -2
package/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ function cli(workingDirectory, args) {
|
|
|
33
33
|
.description('Generates a TypeScript client for the given application.json file')
|
|
34
34
|
.requiredOption('-a --application <path>', 'Specifies the application.json file')
|
|
35
35
|
.requiredOption('-o --output <path>', 'Specifies the output file path')
|
|
36
|
-
.option('
|
|
36
|
+
.option('--pn --preserve-names', 'Preserve names from application.json spec instead of sanitizing them')
|
|
37
37
|
.action(async ({ application, output, preserveNames }) => {
|
|
38
38
|
await generateClientCommand({
|
|
39
39
|
application,
|
package/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["import { Command } from 'commander'\nimport { loadApplicationJson } from './schema/load'\nimport * as path from 'path'\nimport { generate } from './client/generate'\nimport { writeDocumentPartsToStream } from './output/writer'\nimport { colorConsole } from './util/color-console'\n\nexport function cli(workingDirectory: string, args: string[]) {\n const program = new Command()\n program\n .command('generate')\n .description('Generates a TypeScript client for the given application.json file')\n .requiredOption('-a --application <path>', 'Specifies the application.json file')\n .requiredOption('-o --output <path>', 'Specifies the output file path')\n .option('
|
|
1
|
+
{"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["import { Command } from 'commander'\nimport { loadApplicationJson } from './schema/load'\nimport * as path from 'path'\nimport { generate } from './client/generate'\nimport { writeDocumentPartsToStream } from './output/writer'\nimport { colorConsole } from './util/color-console'\n\nexport function cli(workingDirectory: string, args: string[]) {\n const program = new Command()\n program\n .command('generate')\n .description('Generates a TypeScript client for the given application.json file')\n .requiredOption('-a --application <path>', 'Specifies the application.json file')\n .requiredOption('-o --output <path>', 'Specifies the output file path')\n .option('--pn --preserve-names', 'Preserve names from application.json spec instead of sanitizing them')\n .action(\n async ({ application, output, preserveNames }: { application: string; output: string; preserveNames?: boolean }): Promise<void> => {\n await generateClientCommand({\n application,\n output,\n preserveNames: Boolean(preserveNames),\n workingDirectory,\n })\n colorConsole.success`Operation completed successfully`\n },\n )\n .configureOutput({\n writeErr(str: string) {\n colorConsole.error`${str}`\n },\n })\n try {\n program.parse(args)\n } catch (err) {\n if (err instanceof Error) {\n colorConsole.error`Unhandled error: \\n\\n${err.stack}`\n } else {\n colorConsole.error`Unhandled error: \\n\\n${err}`\n }\n process.exit(-1)\n }\n}\n\nexport async function generateClientCommand({\n application,\n output,\n preserveNames,\n workingDirectory,\n}: {\n application: string\n output: string\n preserveNames: boolean\n workingDirectory: string\n}) {\n const fs = await import('fs')\n\n const resolvedAppJsonPath = path.resolve(workingDirectory, application)\n const resolvedOutPath = path.resolve(workingDirectory, output)\n const resolvedOutDir = path.dirname(resolvedOutPath)\n colorConsole.info`Reading application.json file from path ${resolvedAppJsonPath}`\n const spec = await loadApplicationJson(resolvedAppJsonPath)\n colorConsole.info`Generating TS client for ${spec.name}`\n const parts = generate(spec, { preserveNames })\n if (!fs.existsSync(resolvedOutDir)) {\n colorConsole.warn`Output directory ${resolvedOutDir} does not exist and will be created.`\n fs.mkdirSync(resolvedOutDir, { recursive: true })\n }\n colorConsole.info`Writing TS client to ${resolvedOutPath}`\n const file = await createAwaitableWriteStream(resolvedOutPath)\n writeDocumentPartsToStream(parts, file)\n await file.finish()\n}\n\nasync function createAwaitableWriteStream(path: string) {\n const fs = await import('fs')\n const stream = fs.createWriteStream(path, {\n flags: 'w',\n })\n const finish = new Promise<void>((resolve, reject) => {\n stream.on('error', (err) => {\n reject(err)\n })\n stream.on('finish', () => {\n resolve()\n })\n })\n return {\n write(chunk: string): void {\n stream.write(chunk)\n },\n finish() {\n stream.end()\n return finish\n },\n }\n}\n"],"names":["Command","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C;IACF,MAAM,MAAM,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,KAAI;QACnD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,KAAI;YACzB,MAAM,CAAC,GAAG,CAAC;AACb,SAAC,CAAC;AACF,QAAA,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAK;AACvB,YAAA,OAAO,EAAE;AACX,SAAC,CAAC;AACJ,KAAC,CAAC;IACF,OAAO;AACL,QAAA,KAAK,CAAC,KAAa,EAAA;AACjB,YAAA,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;SACpB;QACD,MAAM,GAAA;YACJ,MAAM,CAAC,GAAG,EAAE;AACZ,YAAA,OAAO,MAAM;SACd;KACF;AACH;;;;;"}
|
package/cli.mjs
CHANGED
|
@@ -12,7 +12,7 @@ function cli(workingDirectory, args) {
|
|
|
12
12
|
.description('Generates a TypeScript client for the given application.json file')
|
|
13
13
|
.requiredOption('-a --application <path>', 'Specifies the application.json file')
|
|
14
14
|
.requiredOption('-o --output <path>', 'Specifies the output file path')
|
|
15
|
-
.option('
|
|
15
|
+
.option('--pn --preserve-names', 'Preserve names from application.json spec instead of sanitizing them')
|
|
16
16
|
.action(async ({ application, output, preserveNames }) => {
|
|
17
17
|
await generateClientCommand({
|
|
18
18
|
application,
|
package/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["import { Command } from 'commander'\nimport { loadApplicationJson } from './schema/load'\nimport * as path from 'path'\nimport { generate } from './client/generate'\nimport { writeDocumentPartsToStream } from './output/writer'\nimport { colorConsole } from './util/color-console'\n\nexport function cli(workingDirectory: string, args: string[]) {\n const program = new Command()\n program\n .command('generate')\n .description('Generates a TypeScript client for the given application.json file')\n .requiredOption('-a --application <path>', 'Specifies the application.json file')\n .requiredOption('-o --output <path>', 'Specifies the output file path')\n .option('
|
|
1
|
+
{"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["import { Command } from 'commander'\nimport { loadApplicationJson } from './schema/load'\nimport * as path from 'path'\nimport { generate } from './client/generate'\nimport { writeDocumentPartsToStream } from './output/writer'\nimport { colorConsole } from './util/color-console'\n\nexport function cli(workingDirectory: string, args: string[]) {\n const program = new Command()\n program\n .command('generate')\n .description('Generates a TypeScript client for the given application.json file')\n .requiredOption('-a --application <path>', 'Specifies the application.json file')\n .requiredOption('-o --output <path>', 'Specifies the output file path')\n .option('--pn --preserve-names', 'Preserve names from application.json spec instead of sanitizing them')\n .action(\n async ({ application, output, preserveNames }: { application: string; output: string; preserveNames?: boolean }): Promise<void> => {\n await generateClientCommand({\n application,\n output,\n preserveNames: Boolean(preserveNames),\n workingDirectory,\n })\n colorConsole.success`Operation completed successfully`\n },\n )\n .configureOutput({\n writeErr(str: string) {\n colorConsole.error`${str}`\n },\n })\n try {\n program.parse(args)\n } catch (err) {\n if (err instanceof Error) {\n colorConsole.error`Unhandled error: \\n\\n${err.stack}`\n } else {\n colorConsole.error`Unhandled error: \\n\\n${err}`\n }\n process.exit(-1)\n }\n}\n\nexport async function generateClientCommand({\n application,\n output,\n preserveNames,\n workingDirectory,\n}: {\n application: string\n output: string\n preserveNames: boolean\n workingDirectory: string\n}) {\n const fs = await import('fs')\n\n const resolvedAppJsonPath = path.resolve(workingDirectory, application)\n const resolvedOutPath = path.resolve(workingDirectory, output)\n const resolvedOutDir = path.dirname(resolvedOutPath)\n colorConsole.info`Reading application.json file from path ${resolvedAppJsonPath}`\n const spec = await loadApplicationJson(resolvedAppJsonPath)\n colorConsole.info`Generating TS client for ${spec.name}`\n const parts = generate(spec, { preserveNames })\n if (!fs.existsSync(resolvedOutDir)) {\n colorConsole.warn`Output directory ${resolvedOutDir} does not exist and will be created.`\n fs.mkdirSync(resolvedOutDir, { recursive: true })\n }\n colorConsole.info`Writing TS client to ${resolvedOutPath}`\n const file = await createAwaitableWriteStream(resolvedOutPath)\n writeDocumentPartsToStream(parts, file)\n await file.finish()\n}\n\nasync function createAwaitableWriteStream(path: string) {\n const fs = await import('fs')\n const stream = fs.createWriteStream(path, {\n flags: 'w',\n })\n const finish = new Promise<void>((resolve, reject) => {\n stream.on('error', (err) => {\n reject(err)\n })\n stream.on('finish', () => {\n resolve()\n })\n })\n return {\n write(chunk: string): void {\n stream.write(chunk)\n },\n finish() {\n stream.end()\n return finish\n },\n }\n}\n"],"names":[],"mappings":";;;;;;;AAOgB,SAAA,GAAG,CAAC,gBAAwB,EAAE,IAAc,EAAA;AAC1D,IAAA,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;IAC7B;SACG,OAAO,CAAC,UAAU;SAClB,WAAW,CAAC,mEAAmE;AAC/E,SAAA,cAAc,CAAC,yBAAyB,EAAE,qCAAqC;AAC/E,SAAA,cAAc,CAAC,oBAAoB,EAAE,gCAAgC;AACrE,SAAA,MAAM,CAAC,uBAAuB,EAAE,sEAAsE;SACtG,MAAM,CACL,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAoE,KAAmB;AAChI,QAAA,MAAM,qBAAqB,CAAC;YAC1B,WAAW;YACX,MAAM;AACN,YAAA,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC;YACrC,gBAAgB;AACjB,SAAA,CAAC;AACF,QAAA,YAAY,CAAC,OAAO,CAAA,CAAA,gCAAA,CAAkC;AACxD,KAAC;AAEF,SAAA,eAAe,CAAC;AACf,QAAA,QAAQ,CAAC,GAAW,EAAA;AAClB,YAAA,YAAY,CAAC,KAAK,CAAA,CAAG,EAAA,GAAG,EAAE;SAC3B;AACF,KAAA,CAAC;AACJ,IAAA,IAAI;AACF,QAAA,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;;IACnB,OAAO,GAAG,EAAE;AACZ,QAAA,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,YAAY,CAAC,KAAK,CAAA,CAAA,qBAAA,EAAwB,GAAG,CAAC,KAAK,EAAE;;aAChD;AACL,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,IAAY,EAAA;AACpD,IAAA,MAAM,EAAE,GAAG,MAAM,OAAO,IAAI,CAAC;AAC7B,IAAA,MAAM,MAAM,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE;AACxC,QAAA,KAAK,EAAE,GAAG;AACX,KAAA,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,KAAI;QACnD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,KAAI;YACzB,MAAM,CAAC,GAAG,CAAC;AACb,SAAC,CAAC;AACF,QAAA,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAK;AACvB,YAAA,OAAO,EAAE;AACX,SAAC,CAAC;AACJ,KAAC,CAAC;IACF,OAAO;AACL,QAAA,KAAK,CAAC,KAAa,EAAA;AACjB,YAAA,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;SACpB;QACD,MAAM,GAAA;YACJ,MAAM,CAAC,GAAG,EAAE;AACZ,YAAA,OAAO,MAAM;SACd;KACF;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-client-generator",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "6.0.0-beta.1",
|
|
10
10
|
"description": "Generates a TypeScript client for interacting with, and deploying ARC-0032 smart contracts on the Algorand Blockchain.",
|
|
11
11
|
"module": "index.mjs",
|
|
12
12
|
"private": false,
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"overrides": {
|
|
24
24
|
"semver": "7.5.2",
|
|
25
25
|
"micromatch": "4.0.8",
|
|
26
|
-
"rollup": "^4.22.5",
|
|
27
26
|
"cross-spawn": "^7.0.6",
|
|
28
27
|
"esbuild": "0.25.0"
|
|
29
28
|
},
|