@platforma-sdk/bootstrap 3.5.19 → 3.5.20

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 (171) hide show
  1. package/dist/block.cjs +172 -0
  2. package/dist/block.cjs.map +1 -0
  3. package/dist/block.d.ts +0 -1
  4. package/dist/block.js +151 -0
  5. package/dist/block.js.map +1 -0
  6. package/dist/cmd-opts.cjs +205 -0
  7. package/dist/cmd-opts.cjs.map +1 -0
  8. package/dist/cmd-opts.d.ts +36 -38
  9. package/dist/cmd-opts.js +181 -0
  10. package/dist/cmd-opts.js.map +1 -0
  11. package/dist/commands/create-block.cjs +22 -0
  12. package/dist/commands/create-block.cjs.map +1 -0
  13. package/dist/commands/create-block.d.ts +1 -3
  14. package/dist/commands/create-block.js +20 -0
  15. package/dist/commands/create-block.js.map +1 -0
  16. package/dist/commands/reset.cjs +23 -0
  17. package/dist/commands/reset.cjs.map +1 -0
  18. package/dist/commands/reset.d.ts +1 -3
  19. package/dist/commands/reset.js +21 -0
  20. package/dist/commands/reset.js.map +1 -0
  21. package/dist/commands/start/docker/s3.cjs +69 -0
  22. package/dist/commands/start/docker/s3.cjs.map +1 -0
  23. package/dist/commands/start/docker/s3.d.ts +21 -23
  24. package/dist/commands/start/docker/s3.js +67 -0
  25. package/dist/commands/start/docker/s3.js.map +1 -0
  26. package/dist/commands/start/docker.cjs +69 -0
  27. package/dist/commands/start/docker.cjs.map +1 -0
  28. package/dist/commands/start/docker.d.ts +21 -23
  29. package/dist/commands/start/docker.js +67 -0
  30. package/dist/commands/start/docker.js.map +1 -0
  31. package/dist/commands/start/local/s3.cjs +135 -0
  32. package/dist/commands/start/local/s3.cjs.map +1 -0
  33. package/dist/commands/start/local/s3.d.ts +25 -27
  34. package/dist/commands/start/local/s3.js +114 -0
  35. package/dist/commands/start/local/s3.js.map +1 -0
  36. package/dist/commands/start/local.cjs +122 -0
  37. package/dist/commands/start/local.cjs.map +1 -0
  38. package/dist/commands/start/local.d.ts +23 -25
  39. package/dist/commands/start/local.js +101 -0
  40. package/dist/commands/start/local.js.map +1 -0
  41. package/dist/commands/start.cjs +23 -0
  42. package/dist/commands/start.cjs.map +1 -0
  43. package/dist/commands/start.d.ts +1 -3
  44. package/dist/commands/start.js +21 -0
  45. package/dist/commands/start.js.map +1 -0
  46. package/dist/commands/stop.cjs +29 -0
  47. package/dist/commands/stop.cjs.map +1 -0
  48. package/dist/commands/stop.d.ts +1 -3
  49. package/dist/commands/stop.js +27 -0
  50. package/dist/commands/stop.js.map +1 -0
  51. package/dist/commands/svc/create/docker/s3.cjs +75 -0
  52. package/dist/commands/svc/create/docker/s3.cjs.map +1 -0
  53. package/dist/commands/svc/create/docker/s3.d.ts +22 -24
  54. package/dist/commands/svc/create/docker/s3.js +73 -0
  55. package/dist/commands/svc/create/docker/s3.js.map +1 -0
  56. package/dist/commands/svc/create/docker.cjs +72 -0
  57. package/dist/commands/svc/create/docker.cjs.map +1 -0
  58. package/dist/commands/svc/create/docker.d.ts +22 -24
  59. package/dist/commands/svc/create/docker.js +70 -0
  60. package/dist/commands/svc/create/docker.js.map +1 -0
  61. package/dist/commands/svc/create/local/s3.cjs +121 -0
  62. package/dist/commands/svc/create/local/s3.cjs.map +1 -0
  63. package/dist/commands/svc/create/local/s3.d.ts +26 -28
  64. package/dist/commands/svc/create/local/s3.js +100 -0
  65. package/dist/commands/svc/create/local/s3.js.map +1 -0
  66. package/dist/commands/svc/create/local.cjs +117 -0
  67. package/dist/commands/svc/create/local.cjs.map +1 -0
  68. package/dist/commands/svc/create/local.d.ts +24 -26
  69. package/dist/commands/svc/create/local.js +96 -0
  70. package/dist/commands/svc/create/local.js.map +1 -0
  71. package/dist/commands/svc/delete.cjs +40 -0
  72. package/dist/commands/svc/delete.cjs.map +1 -0
  73. package/dist/commands/svc/delete.d.ts +3 -5
  74. package/dist/commands/svc/delete.js +38 -0
  75. package/dist/commands/svc/delete.js.map +1 -0
  76. package/dist/commands/svc/down.cjs +32 -0
  77. package/dist/commands/svc/down.cjs.map +1 -0
  78. package/dist/commands/svc/down.d.ts +2 -4
  79. package/dist/commands/svc/down.js +30 -0
  80. package/dist/commands/svc/down.js.map +1 -0
  81. package/dist/commands/svc/list.cjs +31 -0
  82. package/dist/commands/svc/list.cjs.map +1 -0
  83. package/dist/commands/svc/list.d.ts +0 -1
  84. package/dist/commands/svc/list.js +29 -0
  85. package/dist/commands/svc/list.js.map +1 -0
  86. package/dist/commands/svc/up.cjs +51 -0
  87. package/dist/commands/svc/up.cjs.map +1 -0
  88. package/dist/commands/svc/up.d.ts +2 -4
  89. package/dist/commands/svc/up.js +49 -0
  90. package/dist/commands/svc/up.js.map +1 -0
  91. package/dist/core.cjs +742 -0
  92. package/dist/core.cjs.map +1 -0
  93. package/dist/core.d.ts +0 -1
  94. package/dist/core.js +737 -0
  95. package/dist/core.js.map +1 -0
  96. package/dist/index.cjs +42 -0
  97. package/dist/index.cjs.map +1 -0
  98. package/dist/index.d.ts +0 -1
  99. package/dist/index.js +39 -126
  100. package/dist/index.js.map +1 -1
  101. package/dist/package.cjs +27 -0
  102. package/dist/package.cjs.map +1 -0
  103. package/dist/package.d.ts +0 -1
  104. package/dist/package.js +22 -0
  105. package/dist/package.js.map +1 -0
  106. package/dist/platforma.cjs +169 -0
  107. package/dist/platforma.cjs.map +1 -0
  108. package/dist/platforma.d.ts +0 -1
  109. package/dist/platforma.js +141 -0
  110. package/dist/platforma.js.map +1 -0
  111. package/dist/run.cjs +68 -0
  112. package/dist/run.cjs.map +1 -0
  113. package/dist/run.d.ts +0 -1
  114. package/dist/run.js +64 -0
  115. package/dist/run.js.map +1 -0
  116. package/dist/state.cjs +143 -0
  117. package/dist/state.cjs.map +1 -0
  118. package/dist/state.d.ts +0 -1
  119. package/dist/state.js +141 -0
  120. package/dist/state.js.map +1 -0
  121. package/dist/templates/compose.cjs +67 -0
  122. package/dist/templates/compose.cjs.map +1 -0
  123. package/dist/templates/compose.d.ts +0 -1
  124. package/dist/templates/compose.js +65 -0
  125. package/dist/templates/compose.js.map +1 -0
  126. package/dist/templates/pl-config.cjs +264 -0
  127. package/dist/templates/pl-config.cjs.map +1 -0
  128. package/dist/templates/pl-config.d.ts +0 -1
  129. package/dist/templates/pl-config.js +260 -0
  130. package/dist/templates/pl-config.js.map +1 -0
  131. package/dist/templates/types.cjs +31 -0
  132. package/dist/templates/types.cjs.map +1 -0
  133. package/dist/templates/types.d.ts +0 -1
  134. package/dist/templates/types.js +28 -0
  135. package/dist/templates/types.js.map +1 -0
  136. package/dist/util.cjs +98 -0
  137. package/dist/util.cjs.map +1 -0
  138. package/dist/util.d.ts +0 -1
  139. package/dist/util.js +89 -0
  140. package/dist/util.js.map +1 -0
  141. package/package.json +10 -13
  142. package/dist/block.d.ts.map +0 -1
  143. package/dist/cmd-opts.d.ts.map +0 -1
  144. package/dist/commands/create-block.d.ts.map +0 -1
  145. package/dist/commands/reset.d.ts.map +0 -1
  146. package/dist/commands/start/docker/s3.d.ts.map +0 -1
  147. package/dist/commands/start/docker.d.ts.map +0 -1
  148. package/dist/commands/start/local/s3.d.ts.map +0 -1
  149. package/dist/commands/start/local.d.ts.map +0 -1
  150. package/dist/commands/start.d.ts.map +0 -1
  151. package/dist/commands/stop.d.ts.map +0 -1
  152. package/dist/commands/svc/create/docker/s3.d.ts.map +0 -1
  153. package/dist/commands/svc/create/docker.d.ts.map +0 -1
  154. package/dist/commands/svc/create/local/s3.d.ts.map +0 -1
  155. package/dist/commands/svc/create/local.d.ts.map +0 -1
  156. package/dist/commands/svc/delete.d.ts.map +0 -1
  157. package/dist/commands/svc/down.d.ts.map +0 -1
  158. package/dist/commands/svc/list.d.ts.map +0 -1
  159. package/dist/commands/svc/up.d.ts.map +0 -1
  160. package/dist/core.d.ts.map +0 -1
  161. package/dist/index.d.ts.map +0 -1
  162. package/dist/index.mjs +0 -1945
  163. package/dist/index.mjs.map +0 -1
  164. package/dist/package.d.ts.map +0 -1
  165. package/dist/platforma.d.ts.map +0 -1
  166. package/dist/run.d.ts.map +0 -1
  167. package/dist/state.d.ts.map +0 -1
  168. package/dist/templates/compose.d.ts.map +0 -1
  169. package/dist/templates/pl-config.d.ts.map +0 -1
  170. package/dist/templates/types.d.ts.map +0 -1
  171. package/dist/util.d.ts.map +0 -1
package/dist/block.cjs ADDED
@@ -0,0 +1,172 @@
1
+ 'use strict';
2
+
3
+ var fs$1 = require('node:fs');
4
+ var fs = require('node:fs/promises');
5
+ var path = require('node:path');
6
+ var node_stream = require('node:stream');
7
+ var os = require('node:os');
8
+ var readlineSync = require('readline-sync');
9
+ var zod = require('zod');
10
+ var decompress = require('decompress');
11
+
12
+ function _interopNamespaceDefault(e) {
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
30
+
31
+ const blockPlatformsToChoose = ['Python'];
32
+ const allPlatforms = ['Tengo', 'Python'];
33
+ const CreateBlockPlatforms = zod.z.union([zod.z.literal('Tengo'), zod.z.literal('Python')]);
34
+ const CreateBlockOptions = zod.z.object({
35
+ npmOrgName: zod.z.string().min(1),
36
+ orgName: zod.z.string().min(1, { message: `Organization name must be provided` }),
37
+ blockName: zod.z.string().min(1, { message: `Block name must be provided` }),
38
+ softwarePlatforms: zod.z.array(CreateBlockPlatforms).refine((p) => new Set(p).size === p.length, {
39
+ message: 'Must be an array of unique software platforms',
40
+ }),
41
+ });
42
+ /** Creates a block by cloning block-boilerplate repository. */
43
+ async function createBlock(logger) {
44
+ const { npmOrgName, orgName, blockName, softwarePlatforms } = askForOptions();
45
+ const targetPath = path.join(process.cwd(), blockName);
46
+ logger.info(`Downloading boilerplate code...`);
47
+ await downloadAndUnzip(
48
+ // 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/software_platforms.zip',
49
+ // 'platforma-block-boilerplate-software_platforms',
50
+ 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip', 'platforma-block-boilerplate-main', targetPath);
51
+ const platformsToRemove = allPlatforms.filter((p) => softwarePlatforms.indexOf(p) < 0);
52
+ const noPlatforms = blockPlatformsToChoose.length == platformsToRemove.length;
53
+ logger.info(`Keep platforms '${softwarePlatforms}', remove: '${platformsToRemove}'. Will remove all platforms? ${noPlatforms}`);
54
+ for (const p of platformsToRemove) {
55
+ await removePlatform(targetPath, p);
56
+ }
57
+ if (noPlatforms) {
58
+ await removePlatformsCompletely(targetPath);
59
+ }
60
+ logger.info(`Replace everything in the template with provided options...`);
61
+ replaceRegexInAllFiles(targetPath, [
62
+ // '@' literal ensures only npm org name will be renamed,
63
+ // as public registry for software also is called platforma-open, but without '@'.
64
+ // Also, don't rename an organization for runenv-python-3 package.
65
+ { from: /@platforma-open(?!.*runenv-python-3)/g, to: `@${npmOrgName}` },
66
+ { from: /my-org/g, to: orgName },
67
+ { from: /block-boilerplate/g, to: blockName },
68
+ ]);
69
+ }
70
+ function askForOptions() {
71
+ let npmOrgName = readlineSync.question('Write an organization name for npm. Default is "platforma-open": ');
72
+ if (npmOrgName === '') {
73
+ npmOrgName = 'platforma-open';
74
+ }
75
+ let orgName = '';
76
+ while (orgName.length < 1)
77
+ orgName = readlineSync.question('Write an organization name, e.g. "my-org": ');
78
+ let blockName = '';
79
+ while (blockName.length < 1)
80
+ blockName = readlineSync.question('Write a name of the block, e.g. "hello-world": ');
81
+ const needSoftware = readlineSync.keyInYN('Create package for block\'s software?');
82
+ let softwarePlatforms = ['Tengo'];
83
+ if (needSoftware) {
84
+ while (softwarePlatforms.length < allPlatforms.length) {
85
+ const index = readlineSync.keyInSelect(blockPlatformsToChoose, 'Choose software platform:');
86
+ if (index < 0)
87
+ break;
88
+ softwarePlatforms.push(blockPlatformsToChoose[index]);
89
+ }
90
+ }
91
+ softwarePlatforms = Array.from(new Set(softwarePlatforms)).sort();
92
+ const result = CreateBlockOptions.safeParse({ npmOrgName, orgName, blockName, softwarePlatforms });
93
+ if (!result.success && result.error.issues.length) {
94
+ throw new Error(result.error.issues.map(i => i.message).join('; '));
95
+ }
96
+ return result.data;
97
+ }
98
+ async function downloadAndUnzip(url, pathInArchive, outputPath) {
99
+ const response = await fetch(url);
100
+ const content = await response.blob();
101
+ const tmpDir = await fs__namespace.mkdtemp(path.join(os.tmpdir(), 'create-repo'));
102
+ const tmpFile = path.join(tmpDir, 'packed-repo.zip');
103
+ const f = node_stream.Writable.toWeb(fs$1.createWriteStream(tmpFile));
104
+ await content.stream().pipeTo(f);
105
+ const tmpRepo = path.join(tmpDir, 'unpacked-repo');
106
+ await fs__namespace.mkdir(tmpRepo);
107
+ await decompress(tmpFile, tmpRepo);
108
+ await fs__namespace.cp(path.join(tmpRepo, pathInArchive), outputPath, { recursive: true });
109
+ }
110
+ /** Removes a bunch of dependencies to the platform. */
111
+ async function removePlatform(dir, platform) {
112
+ const p = platform.toLowerCase();
113
+ // Remove <PlAlert> line from MainPage.vue
114
+ // https://regex101.com/r/oCTyHk/1
115
+ await deleteRegexInFile(path.join(dir, 'ui', 'src', 'pages', 'MainPage.vue'), new RegExp(`.*${p}Message.*\\n`, 'g'));
116
+ // Remove an output from the model.
117
+ await deleteRegexInFile(path.join(dir, 'model', 'src', 'index.ts'), new RegExp(`.*${p}Message.*\\n\\n`, 'g'));
118
+ // This regexp represents a block of code until the empty line.
119
+ // https://regex101.com/r/Os8kX1/1
120
+ await deleteRegexInFile(path.join(dir, 'workflow', 'src', 'main.tpl.tengo'), new RegExp(`.*${p}.*exec.builder.*[\\s\\S]*?\\n\\n`, 'g'));
121
+ // Remove a line from the workflow output.
122
+ // https://regex101.com/r/PkHwQ8/1
123
+ await deleteRegexInFile(path.join(dir, 'workflow', 'src', 'main.tpl.tengo'), new RegExp(`.*${p}Message.*\\n`, 'g'));
124
+ // Remove 2 lines: the one with the language message and the one with expect
125
+ await deleteRegexInFile(path.join(dir, 'workflow', 'src', 'wf.test.ts'), new RegExp(`.*${p}Message.*\\n.*expect.*\\n\\n`, 'g'));
126
+ await fs__namespace.rm(path.join(dir, 'software', `src_${p}`), { recursive: true });
127
+ await replaceInFile(path.join(dir, 'software', 'package.json'), (content) => {
128
+ const json = JSON.parse(content);
129
+ delete json['block-software']['artifacts'][`hello-${p}-artifact`];
130
+ delete json['block-software']['entrypoints'][`hello-world-${p}`];
131
+ return JSON.stringify(json, null, 2);
132
+ });
133
+ }
134
+ /** Removes software directory completely and all references to it from the workspace. */
135
+ async function removePlatformsCompletely(dir) {
136
+ await fs__namespace.rm(path.join(dir, 'software'), { recursive: true });
137
+ await replaceInFile(path.join(dir, 'workflow', 'package.json'), (content) => {
138
+ const json = JSON.parse(content);
139
+ delete json['dependencies']['@platforma-open/my-org.block-boilerplate.software'];
140
+ return JSON.stringify(json, null, 2);
141
+ });
142
+ await deleteRegexInFile(path.join(dir, 'pnpm-workspace.yaml'), /.*- software$\n/gm);
143
+ }
144
+ async function replaceRegexInAllFiles(dir, patterns) {
145
+ const files = await getAllFiles(dir);
146
+ for (const { from, to } of patterns) {
147
+ for (const fPath of files) {
148
+ await replaceRegexInFile(fPath, from, to);
149
+ }
150
+ }
151
+ }
152
+ async function getAllFiles(dir) {
153
+ const allDirents = await fs__namespace.readdir(dir, {
154
+ withFileTypes: true,
155
+ recursive: true,
156
+ });
157
+ return allDirents.filter((f) => f.isFile()).map((f) => path.join(f.parentPath, f.name));
158
+ }
159
+ async function replaceInFile(fPath, replacer) {
160
+ const content = await fs__namespace.readFile(fPath);
161
+ const newContent = replacer(content.toString());
162
+ await fs__namespace.writeFile(fPath, newContent);
163
+ }
164
+ async function replaceRegexInFile(fPath, from, to) {
165
+ return await replaceInFile(fPath, (content) => content.replaceAll(from, to));
166
+ }
167
+ async function deleteRegexInFile(fPath, what) {
168
+ return await replaceRegexInFile(fPath, what, '');
169
+ }
170
+
171
+ exports.createBlock = createBlock;
172
+ //# sourceMappingURL=block.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.cjs","sources":["../src/block.ts"],"sourcesContent":["import { createWriteStream } from 'node:fs';\nimport * as fs from 'node:fs/promises';\nimport path from 'node:path';\nimport type winston from 'winston';\nimport { Writable, Transform } from 'node:stream';\nimport os from 'node:os';\nimport readlineSync from 'readline-sync';\nimport { z } from 'zod';\nimport decompress from 'decompress';\nimport yaml from 'yaml';\n\nconst blockPlatformsToChoose = ['Python'];\nconst allPlatforms = ['Tengo', 'Python'] as const;\nconst CreateBlockPlatforms = z.union([z.literal('Tengo'), z.literal('Python')]);\nexport type CreateBlockPlatform = z.infer<typeof CreateBlockPlatforms>;\n\nconst CreateBlockOptions = z.object({\n npmOrgName: z.string().min(1),\n orgName: z.string().min(1, { message: `Organization name must be provided` }),\n blockName: z.string().min(1, { message: `Block name must be provided` }),\n softwarePlatforms: z.array(CreateBlockPlatforms).refine((p) => new Set(p).size === p.length, {\n message: 'Must be an array of unique software platforms',\n }),\n});\nexport type CreateBlockOptions = z.infer<typeof CreateBlockOptions>;\n\n/** Creates a block by cloning block-boilerplate repository. */\nexport async function createBlock(logger: winston.Logger) {\n const { npmOrgName, orgName, blockName, softwarePlatforms } = askForOptions();\n const targetPath = path.join(process.cwd(), blockName);\n\n logger.info(`Downloading boilerplate code...`);\n await downloadAndUnzip(\n // 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/software_platforms.zip',\n // 'platforma-block-boilerplate-software_platforms',\n 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip',\n 'platforma-block-boilerplate-main',\n targetPath,\n );\n\n const platformsToRemove = allPlatforms.filter((p) => softwarePlatforms.indexOf(p) < 0);\n const noPlatforms = blockPlatformsToChoose.length == platformsToRemove.length;\n logger.info(`Keep platforms '${softwarePlatforms}', remove: '${platformsToRemove}'. Will remove all platforms? ${noPlatforms}`);\n for (const p of platformsToRemove) {\n await removePlatform(targetPath, p);\n }\n if (noPlatforms) {\n await removePlatformsCompletely(targetPath);\n }\n\n logger.info(`Replace everything in the template with provided options...`);\n replaceRegexInAllFiles(targetPath, [\n // '@' literal ensures only npm org name will be renamed,\n // as public registry for software also is called platforma-open, but without '@'.\n // Also, don't rename an organization for runenv-python-3 package.\n { from: /@platforma-open(?!.*runenv-python-3)/g, to: `@${npmOrgName}` },\n\n { from: /my-org/g, to: orgName },\n\n { from: /block-boilerplate/g, to: blockName },\n ]);\n}\n\nfunction askForOptions(): CreateBlockOptions {\n let npmOrgName = readlineSync.question(\n 'Write an organization name for npm. Default is \"platforma-open\": ',\n );\n if (npmOrgName === '') {\n npmOrgName = 'platforma-open';\n }\n\n let orgName = '';\n while (orgName.length < 1)\n orgName = readlineSync.question('Write an organization name, e.g. \"my-org\": ');\n\n let blockName = '';\n while (blockName.length < 1)\n blockName = readlineSync.question('Write a name of the block, e.g. \"hello-world\": ');\n\n const needSoftware = readlineSync.keyInYN('Create package for block\\'s software?');\n let softwarePlatforms = ['Tengo'];\n if (needSoftware) {\n while (softwarePlatforms.length < allPlatforms.length) {\n const index = readlineSync.keyInSelect(blockPlatformsToChoose, 'Choose software platform:');\n if (index < 0) break;\n softwarePlatforms.push(blockPlatformsToChoose[index]);\n }\n }\n softwarePlatforms = Array.from(new Set(softwarePlatforms)).sort();\n\n const result = CreateBlockOptions.safeParse({ npmOrgName, orgName, blockName, softwarePlatforms });\n if (!result.success && result.error.issues.length) {\n throw new Error(result.error.issues.map(i => i.message).join('; '));\n }\n\n return result.data!;\n}\n\nasync function downloadAndUnzip(url: string, pathInArchive: string, outputPath: string) {\n const response = await fetch(url);\n const content = await response.blob();\n\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'create-repo'));\n\n const tmpFile = path.join(tmpDir, 'packed-repo.zip');\n const f = Writable.toWeb(createWriteStream(tmpFile));\n await content.stream().pipeTo(f);\n\n const tmpRepo = path.join(tmpDir, 'unpacked-repo');\n await fs.mkdir(tmpRepo);\n await decompress(tmpFile, tmpRepo);\n\n await fs.cp(path.join(tmpRepo, pathInArchive), outputPath, { recursive: true });\n}\n\n/** Removes a bunch of dependencies to the platform. */\nasync function removePlatform(dir: string, platform: CreateBlockPlatform) {\n const p = platform.toLowerCase();\n\n // Remove <PlAlert> line from MainPage.vue\n // https://regex101.com/r/oCTyHk/1\n await deleteRegexInFile(\n path.join(dir, 'ui', 'src', 'pages', 'MainPage.vue'),\n new RegExp(`.*${p}Message.*\\\\n`, 'g'),\n );\n\n // Remove an output from the model.\n await deleteRegexInFile(\n path.join(dir, 'model', 'src', 'index.ts'),\n new RegExp(`.*${p}Message.*\\\\n\\\\n`, 'g'),\n );\n\n // This regexp represents a block of code until the empty line.\n // https://regex101.com/r/Os8kX1/1\n await deleteRegexInFile(\n path.join(dir, 'workflow', 'src', 'main.tpl.tengo'),\n new RegExp(`.*${p}.*exec.builder.*[\\\\s\\\\S]*?\\\\n\\\\n`, 'g'),\n );\n\n // Remove a line from the workflow output.\n // https://regex101.com/r/PkHwQ8/1\n await deleteRegexInFile(\n path.join(dir, 'workflow', 'src', 'main.tpl.tengo'),\n new RegExp(`.*${p}Message.*\\\\n`, 'g'),\n );\n\n // Remove 2 lines: the one with the language message and the one with expect\n await deleteRegexInFile(\n path.join(dir, 'workflow', 'src', 'wf.test.ts'),\n new RegExp(`.*${p}Message.*\\\\n.*expect.*\\\\n\\\\n`, 'g'),\n );\n\n await fs.rm(path.join(dir, 'software', `src_${p}`), { recursive: true });\n\n await replaceInFile(\n path.join(dir, 'software', 'package.json'),\n (content) => {\n const json = JSON.parse(content);\n delete json['block-software']['artifacts'][`hello-${p}-artifact`];\n delete json['block-software']['entrypoints'][`hello-world-${p}`];\n return JSON.stringify(json, null, 2);\n },\n );\n}\n\n/** Removes software directory completely and all references to it from the workspace. */\nasync function removePlatformsCompletely(dir: string) {\n await fs.rm(path.join(dir, 'software'), { recursive: true });\n\n await replaceInFile(\n path.join(dir, 'workflow', 'package.json'),\n (content) => {\n const json = JSON.parse(content);\n delete json['dependencies']['@platforma-open/my-org.block-boilerplate.software'];\n return JSON.stringify(json, null, 2);\n },\n );\n\n await deleteRegexInFile(\n path.join(dir, 'pnpm-workspace.yaml'),\n /.*- software$\\n/gm,\n );\n}\n\nasync function replaceRegexInAllFiles(\n dir: string,\n patterns: { from: RegExp; to: string }[],\n) {\n const files = await getAllFiles(dir);\n for (const { from, to } of patterns) {\n for (const fPath of files) {\n await replaceRegexInFile(fPath, from, to);\n }\n }\n}\n\nasync function getAllFiles(dir: string): Promise<string[]> {\n const allDirents = await fs.readdir(dir, {\n withFileTypes: true,\n recursive: true,\n });\n\n return allDirents.filter((f: any) => f.isFile()).map((f: any) => path.join(f.parentPath, f.name));\n}\n\nasync function replaceInFile(fPath: string, replacer: (content: string) => any) {\n const content = await fs.readFile(fPath);\n const newContent = replacer(content.toString());\n await fs.writeFile(fPath, newContent);\n}\n\nasync function replaceRegexInFile(fPath: string, from: RegExp, to: string) {\n return await replaceInFile(fPath, (content) => content.replaceAll(from, to));\n}\n\nasync function deleteRegexInFile(fPath: string, what: RegExp) {\n return await replaceRegexInFile(fPath, what, '');\n}\n"],"names":["z","fs","Writable","createWriteStream"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,sBAAsB,GAAG,CAAC,QAAQ,CAAC;AACzC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAU;AACjD,MAAM,oBAAoB,GAAGA,KAAC,CAAC,KAAK,CAAC,CAACA,KAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAEA,KAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AAG/E,MAAM,kBAAkB,GAAGA,KAAC,CAAC,MAAM,CAAC;IAClC,UAAU,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7B,IAAA,O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AE,CAAC,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC9E;AAEA,eAAe,iBAAiB,CAAC,KAAa,EAAE,IAAY,EAAA;IAC1D,OAAO,MAAM,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;AAClD;;;;"}
package/dist/block.d.ts CHANGED
@@ -22,4 +22,3 @@ export type CreateBlockOptions = z.infer<typeof CreateBlockOptions>;
22
22
  /** Creates a block by cloning block-boilerplate repository. */
23
23
  export declare function createBlock(logger: winston.Logger): Promise<void>;
24
24
  export {};
25
- //# sourceMappingURL=block.d.ts.map
package/dist/block.js ADDED
@@ -0,0 +1,151 @@
1
+ import { createWriteStream } from 'node:fs';
2
+ import * as fs from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { Writable } from 'node:stream';
5
+ import os__default from 'node:os';
6
+ import readlineSync from 'readline-sync';
7
+ import { z } from 'zod';
8
+ import decompress from 'decompress';
9
+
10
+ const blockPlatformsToChoose = ['Python'];
11
+ const allPlatforms = ['Tengo', 'Python'];
12
+ const CreateBlockPlatforms = z.union([z.literal('Tengo'), z.literal('Python')]);
13
+ const CreateBlockOptions = z.object({
14
+ npmOrgName: z.string().min(1),
15
+ orgName: z.string().min(1, { message: `Organization name must be provided` }),
16
+ blockName: z.string().min(1, { message: `Block name must be provided` }),
17
+ softwarePlatforms: z.array(CreateBlockPlatforms).refine((p) => new Set(p).size === p.length, {
18
+ message: 'Must be an array of unique software platforms',
19
+ }),
20
+ });
21
+ /** Creates a block by cloning block-boilerplate repository. */
22
+ async function createBlock(logger) {
23
+ const { npmOrgName, orgName, blockName, softwarePlatforms } = askForOptions();
24
+ const targetPath = path.join(process.cwd(), blockName);
25
+ logger.info(`Downloading boilerplate code...`);
26
+ await downloadAndUnzip(
27
+ // 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/software_platforms.zip',
28
+ // 'platforma-block-boilerplate-software_platforms',
29
+ 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip', 'platforma-block-boilerplate-main', targetPath);
30
+ const platformsToRemove = allPlatforms.filter((p) => softwarePlatforms.indexOf(p) < 0);
31
+ const noPlatforms = blockPlatformsToChoose.length == platformsToRemove.length;
32
+ logger.info(`Keep platforms '${softwarePlatforms}', remove: '${platformsToRemove}'. Will remove all platforms? ${noPlatforms}`);
33
+ for (const p of platformsToRemove) {
34
+ await removePlatform(targetPath, p);
35
+ }
36
+ if (noPlatforms) {
37
+ await removePlatformsCompletely(targetPath);
38
+ }
39
+ logger.info(`Replace everything in the template with provided options...`);
40
+ replaceRegexInAllFiles(targetPath, [
41
+ // '@' literal ensures only npm org name will be renamed,
42
+ // as public registry for software also is called platforma-open, but without '@'.
43
+ // Also, don't rename an organization for runenv-python-3 package.
44
+ { from: /@platforma-open(?!.*runenv-python-3)/g, to: `@${npmOrgName}` },
45
+ { from: /my-org/g, to: orgName },
46
+ { from: /block-boilerplate/g, to: blockName },
47
+ ]);
48
+ }
49
+ function askForOptions() {
50
+ let npmOrgName = readlineSync.question('Write an organization name for npm. Default is "platforma-open": ');
51
+ if (npmOrgName === '') {
52
+ npmOrgName = 'platforma-open';
53
+ }
54
+ let orgName = '';
55
+ while (orgName.length < 1)
56
+ orgName = readlineSync.question('Write an organization name, e.g. "my-org": ');
57
+ let blockName = '';
58
+ while (blockName.length < 1)
59
+ blockName = readlineSync.question('Write a name of the block, e.g. "hello-world": ');
60
+ const needSoftware = readlineSync.keyInYN('Create package for block\'s software?');
61
+ let softwarePlatforms = ['Tengo'];
62
+ if (needSoftware) {
63
+ while (softwarePlatforms.length < allPlatforms.length) {
64
+ const index = readlineSync.keyInSelect(blockPlatformsToChoose, 'Choose software platform:');
65
+ if (index < 0)
66
+ break;
67
+ softwarePlatforms.push(blockPlatformsToChoose[index]);
68
+ }
69
+ }
70
+ softwarePlatforms = Array.from(new Set(softwarePlatforms)).sort();
71
+ const result = CreateBlockOptions.safeParse({ npmOrgName, orgName, blockName, softwarePlatforms });
72
+ if (!result.success && result.error.issues.length) {
73
+ throw new Error(result.error.issues.map(i => i.message).join('; '));
74
+ }
75
+ return result.data;
76
+ }
77
+ async function downloadAndUnzip(url, pathInArchive, outputPath) {
78
+ const response = await fetch(url);
79
+ const content = await response.blob();
80
+ const tmpDir = await fs.mkdtemp(path.join(os__default.tmpdir(), 'create-repo'));
81
+ const tmpFile = path.join(tmpDir, 'packed-repo.zip');
82
+ const f = Writable.toWeb(createWriteStream(tmpFile));
83
+ await content.stream().pipeTo(f);
84
+ const tmpRepo = path.join(tmpDir, 'unpacked-repo');
85
+ await fs.mkdir(tmpRepo);
86
+ await decompress(tmpFile, tmpRepo);
87
+ await fs.cp(path.join(tmpRepo, pathInArchive), outputPath, { recursive: true });
88
+ }
89
+ /** Removes a bunch of dependencies to the platform. */
90
+ async function removePlatform(dir, platform) {
91
+ const p = platform.toLowerCase();
92
+ // Remove <PlAlert> line from MainPage.vue
93
+ // https://regex101.com/r/oCTyHk/1
94
+ await deleteRegexInFile(path.join(dir, 'ui', 'src', 'pages', 'MainPage.vue'), new RegExp(`.*${p}Message.*\\n`, 'g'));
95
+ // Remove an output from the model.
96
+ await deleteRegexInFile(path.join(dir, 'model', 'src', 'index.ts'), new RegExp(`.*${p}Message.*\\n\\n`, 'g'));
97
+ // This regexp represents a block of code until the empty line.
98
+ // https://regex101.com/r/Os8kX1/1
99
+ await deleteRegexInFile(path.join(dir, 'workflow', 'src', 'main.tpl.tengo'), new RegExp(`.*${p}.*exec.builder.*[\\s\\S]*?\\n\\n`, 'g'));
100
+ // Remove a line from the workflow output.
101
+ // https://regex101.com/r/PkHwQ8/1
102
+ await deleteRegexInFile(path.join(dir, 'workflow', 'src', 'main.tpl.tengo'), new RegExp(`.*${p}Message.*\\n`, 'g'));
103
+ // Remove 2 lines: the one with the language message and the one with expect
104
+ await deleteRegexInFile(path.join(dir, 'workflow', 'src', 'wf.test.ts'), new RegExp(`.*${p}Message.*\\n.*expect.*\\n\\n`, 'g'));
105
+ await fs.rm(path.join(dir, 'software', `src_${p}`), { recursive: true });
106
+ await replaceInFile(path.join(dir, 'software', 'package.json'), (content) => {
107
+ const json = JSON.parse(content);
108
+ delete json['block-software']['artifacts'][`hello-${p}-artifact`];
109
+ delete json['block-software']['entrypoints'][`hello-world-${p}`];
110
+ return JSON.stringify(json, null, 2);
111
+ });
112
+ }
113
+ /** Removes software directory completely and all references to it from the workspace. */
114
+ async function removePlatformsCompletely(dir) {
115
+ await fs.rm(path.join(dir, 'software'), { recursive: true });
116
+ await replaceInFile(path.join(dir, 'workflow', 'package.json'), (content) => {
117
+ const json = JSON.parse(content);
118
+ delete json['dependencies']['@platforma-open/my-org.block-boilerplate.software'];
119
+ return JSON.stringify(json, null, 2);
120
+ });
121
+ await deleteRegexInFile(path.join(dir, 'pnpm-workspace.yaml'), /.*- software$\n/gm);
122
+ }
123
+ async function replaceRegexInAllFiles(dir, patterns) {
124
+ const files = await getAllFiles(dir);
125
+ for (const { from, to } of patterns) {
126
+ for (const fPath of files) {
127
+ await replaceRegexInFile(fPath, from, to);
128
+ }
129
+ }
130
+ }
131
+ async function getAllFiles(dir) {
132
+ const allDirents = await fs.readdir(dir, {
133
+ withFileTypes: true,
134
+ recursive: true,
135
+ });
136
+ return allDirents.filter((f) => f.isFile()).map((f) => path.join(f.parentPath, f.name));
137
+ }
138
+ async function replaceInFile(fPath, replacer) {
139
+ const content = await fs.readFile(fPath);
140
+ const newContent = replacer(content.toString());
141
+ await fs.writeFile(fPath, newContent);
142
+ }
143
+ async function replaceRegexInFile(fPath, from, to) {
144
+ return await replaceInFile(fPath, (content) => content.replaceAll(from, to));
145
+ }
146
+ async function deleteRegexInFile(fPath, what) {
147
+ return await replaceRegexInFile(fPath, what, '');
148
+ }
149
+
150
+ export { createBlock };
151
+ //# sourceMappingURL=block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.js","sources":["../src/block.ts"],"sourcesContent":["import { createWriteStream } from 'node:fs';\nimport * as fs from 'node:fs/promises';\nimport path from 'node:path';\nimport type winston from 'winston';\nimport { Writable, Transform } from 'node:stream';\nimport os from 'node:os';\nimport readlineSync from 'readline-sync';\nimport { z } from 'zod';\nimport decompress from 'decompress';\nimport yaml from 'yaml';\n\nconst blockPlatformsToChoose = ['Python'];\nconst allPlatforms = ['Tengo', 'Python'] as const;\nconst CreateBlockPlatforms = z.union([z.literal('Tengo'), z.literal('Python')]);\nexport type CreateBlockPlatform = z.infer<typeof CreateBlockPlatforms>;\n\nconst CreateBlockOptions = z.object({\n npmOrgName: z.string().min(1),\n orgName: z.string().min(1, { message: `Organization name must be provided` }),\n blockName: z.string().min(1, { message: `Block name must be provided` }),\n softwarePlatforms: z.array(CreateBlockPlatforms).refine((p) => new Set(p).size === p.length, {\n message: 'Must be an array of unique software platforms',\n }),\n});\nexport type CreateBlockOptions = z.infer<typeof CreateBlockOptions>;\n\n/** Creates a block by cloning block-boilerplate repository. */\nexport async function createBlock(logger: winston.Logger) {\n const { npmOrgName, orgName, blockName, softwarePlatforms } = askForOptions();\n const targetPath = path.join(process.cwd(), blockName);\n\n logger.info(`Downloading boilerplate code...`);\n await downloadAndUnzip(\n // 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/software_platforms.zip',\n // 'platforma-block-boilerplate-software_platforms',\n 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip',\n 'platforma-block-boilerplate-main',\n targetPath,\n );\n\n const platformsToRemove = allPlatforms.filter((p) => softwarePlatforms.indexOf(p) < 0);\n const noPlatforms = blockPlatformsToChoose.length == platformsToRemove.length;\n logger.info(`Keep platforms '${softwarePlatforms}', remove: '${platformsToRemove}'. Will remove all platforms? ${noPlatforms}`);\n for (const p of platformsToRemove) {\n await removePlatform(targetPath, p);\n }\n if (noPlatforms) {\n await removePlatformsCompletely(targetPath);\n }\n\n logger.info(`Replace everything in the template with provided options...`);\n replaceRegexInAllFiles(targetPath, [\n // '@' literal ensures only npm org name will be renamed,\n // as public registry for software also is called platforma-open, but without '@'.\n // Also, don't rename an organization for runenv-python-3 package.\n { from: /@platforma-open(?!.*runenv-python-3)/g, to: `@${npmOrgName}` },\n\n { from: /my-org/g, to: orgName },\n\n { from: /block-boilerplate/g, to: blockName },\n ]);\n}\n\nfunction askForOptions(): CreateBlockOptions {\n let npmOrgName = readlineSync.question(\n 'Write an organization name for npm. Default is \"platforma-open\": ',\n );\n if (npmOrgName === '') {\n npmOrgName = 'platforma-open';\n }\n\n let orgName = '';\n while (orgName.length < 1)\n orgName = readlineSync.question('Write an organization name, e.g. \"my-org\": ');\n\n let blockName = '';\n while (blockName.length < 1)\n blockName = readlineSync.question('Write a name of the block, e.g. \"hello-world\": ');\n\n const needSoftware = readlineSync.keyInYN('Create package for block\\'s software?');\n let softwarePlatforms = ['Tengo'];\n if (needSoftware) {\n while (softwarePlatforms.length < allPlatforms.length) {\n const index = readlineSync.keyInSelect(blockPlatformsToChoose, 'Choose software platform:');\n if (index < 0) break;\n softwarePlatforms.push(blockPlatformsToChoose[index]);\n }\n }\n softwarePlatforms = Array.from(new Set(softwarePlatforms)).sort();\n\n const result = CreateBlockOptions.safeParse({ npmOrgName, orgName, blockName, softwarePlatforms });\n if (!result.success && result.error.issues.length) {\n throw new Error(result.error.issues.map(i => i.message).join('; '));\n }\n\n return result.data!;\n}\n\nasync function downloadAndUnzip(url: string, pathInArchive: string, outputPath: string) {\n const response = await fetch(url);\n const content = await response.blob();\n\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'create-repo'));\n\n const tmpFile = path.join(tmpDir, 'packed-repo.zip');\n const f = Writable.toWeb(createWriteStream(tmpFile));\n await content.stream().pipeTo(f);\n\n const tmpRepo = path.join(tmpDir, 'unpacked-repo');\n await fs.mkdir(tmpRepo);\n await decompress(tmpFile, tmpRepo);\n\n await fs.cp(path.join(tmpRepo, pathInArchive), outputPath, { recursive: true });\n}\n\n/** Removes a bunch of dependencies to the platform. */\nasync function removePlatform(dir: string, platform: CreateBlockPlatform) {\n const p = platform.toLowerCase();\n\n // Remove <PlAlert> line from MainPage.vue\n // https://regex101.com/r/oCTyHk/1\n await deleteRegexInFile(\n path.join(dir, 'ui', 'src', 'pages', 'MainPage.vue'),\n new RegExp(`.*${p}Message.*\\\\n`, 'g'),\n );\n\n // Remove an output from the model.\n await deleteRegexInFile(\n path.join(dir, 'model', 'src', 'index.ts'),\n new RegExp(`.*${p}Message.*\\\\n\\\\n`, 'g'),\n );\n\n // This regexp represents a block of code until the empty line.\n // https://regex101.com/r/Os8kX1/1\n await deleteRegexInFile(\n path.join(dir, 'workflow', 'src', 'main.tpl.tengo'),\n new RegExp(`.*${p}.*exec.builder.*[\\\\s\\\\S]*?\\\\n\\\\n`, 'g'),\n );\n\n // Remove a line from the workflow output.\n // https://regex101.com/r/PkHwQ8/1\n await deleteRegexInFile(\n path.join(dir, 'workflow', 'src', 'main.tpl.tengo'),\n new RegExp(`.*${p}Message.*\\\\n`, 'g'),\n );\n\n // Remove 2 lines: the one with the language message and the one with expect\n await deleteRegexInFile(\n path.join(dir, 'workflow', 'src', 'wf.test.ts'),\n new RegExp(`.*${p}Message.*\\\\n.*expect.*\\\\n\\\\n`, 'g'),\n );\n\n await fs.rm(path.join(dir, 'software', `src_${p}`), { recursive: true });\n\n await replaceInFile(\n path.join(dir, 'software', 'package.json'),\n (content) => {\n const json = JSON.parse(content);\n delete json['block-software']['artifacts'][`hello-${p}-artifact`];\n delete json['block-software']['entrypoints'][`hello-world-${p}`];\n return JSON.stringify(json, null, 2);\n },\n );\n}\n\n/** Removes software directory completely and all references to it from the workspace. */\nasync function removePlatformsCompletely(dir: string) {\n await fs.rm(path.join(dir, 'software'), { recursive: true });\n\n await replaceInFile(\n path.join(dir, 'workflow', 'package.json'),\n (content) => {\n const json = JSON.parse(content);\n delete json['dependencies']['@platforma-open/my-org.block-boilerplate.software'];\n return JSON.stringify(json, null, 2);\n },\n );\n\n await deleteRegexInFile(\n path.join(dir, 'pnpm-workspace.yaml'),\n /.*- software$\\n/gm,\n );\n}\n\nasync function replaceRegexInAllFiles(\n dir: string,\n patterns: { from: RegExp; to: string }[],\n) {\n const files = await getAllFiles(dir);\n for (const { from, to } of patterns) {\n for (const fPath of files) {\n await replaceRegexInFile(fPath, from, to);\n }\n }\n}\n\nasync function getAllFiles(dir: string): Promise<string[]> {\n const allDirents = await fs.readdir(dir, {\n withFileTypes: true,\n recursive: true,\n });\n\n return allDirents.filter((f: any) => f.isFile()).map((f: any) => path.join(f.parentPath, f.name));\n}\n\nasync function replaceInFile(fPath: string, replacer: (content: string) => any) {\n const content = await fs.readFile(fPath);\n const newContent = replacer(content.toString());\n await fs.writeFile(fPath, newContent);\n}\n\nasync function replaceRegexInFile(fPath: string, from: RegExp, to: string) {\n return await replaceInFile(fPath, (content) => content.replaceAll(from, to));\n}\n\nasync function deleteRegexInFile(fPath: string, what: RegExp) {\n return await replaceRegexInFile(fPath, what, '');\n}\n"],"names":["os"],"mappings":";;;;;;;;;AAWA,MAAM,sBAAsB,GAAG,CAAC,QAAQ,CAAC;AACzC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAU;AACjD,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AAG/E,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7B,IAAA,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,CAAA,kCAAA,CAAoC,EAAE,CAAC;AAC7E,IAAA,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,CAAA,2BAAA,CAA6B,EAAE,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
+ var core = require('@oclif/core');
4
+
5
+ const GlobalFlags = {
6
+ 'log-level': core.Flags.string({
7
+ description: 'logging level',
8
+ default: 'info',
9
+ options: ['error', 'warn', 'info', 'debug'],
10
+ required: false,
11
+ }),
12
+ };
13
+ ({
14
+ name: core.Flags.string({
15
+ description: 'name of instance',
16
+ required: false,
17
+ }),
18
+ });
19
+ const ImageFlag = {
20
+ image: core.Flags.string({
21
+ description: 'use custom docker image to run platforma',
22
+ }),
23
+ };
24
+ const VersionFlag = {
25
+ version: core.Flags.string({
26
+ description: 'use custom platforma release (official docker image or binary package)',
27
+ }),
28
+ };
29
+ const ArchFlag = {
30
+ arch: core.Flags.string({
31
+ description: 'override architecture. You can start amd64 linux image on arm-based host (say, Apple M family processor). I.e. arm64, amd64, amd64/v2',
32
+ }),
33
+ };
34
+ const LicenseFlags = {
35
+ 'license': core.Flags.string({
36
+ description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".',
37
+ }),
38
+ 'license-file': core.Flags.file({
39
+ exists: true,
40
+ description: 'specify a path to the file with a license. The license can be got from \'https://licensing.milaboratories.com\'.',
41
+ }),
42
+ };
43
+ const AddressesFlags = {
44
+ 'grpc-port': core.Flags.integer({
45
+ description: 'port for Platforma Backend gRPC API. Default is 6345',
46
+ env: 'PLATFORMA_GRPC_PORT',
47
+ }),
48
+ 'grpc-listen': core.Flags.string({
49
+ description: 'full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345',
50
+ env: 'PLATFORMA_GRPC_LISTEN',
51
+ }),
52
+ 'monitoring-port': core.Flags.integer({
53
+ description: 'port for Platforma Backend monitoring API. Default is 9090',
54
+ env: 'PLATFORMA_MONITORING_PORT',
55
+ }),
56
+ 'monitoring-listen': core.Flags.string({
57
+ description: 'full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090',
58
+ env: 'PLATFORMA_MONITORING_LISTEN',
59
+ }),
60
+ 'debug-port': core.Flags.integer({
61
+ description: 'port for Platforma Backend debug API. Default is 9091',
62
+ env: 'PLATFORMA_DEBUG_PORT',
63
+ }),
64
+ 'debug-listen': core.Flags.string({
65
+ description: 'full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091',
66
+ env: 'PLATFORMA_DEBUG_LISTEN',
67
+ }),
68
+ };
69
+ const S3AddressesFlags = {
70
+ 's3-port': core.Flags.integer({
71
+ description: 'port that S3 will listen, default is 9000',
72
+ default: 9000,
73
+ env: 'PLATFORMA_S3_PORT',
74
+ }),
75
+ 's3-console-port': core.Flags.integer({
76
+ description: 'port that a console of S3 will listen, default is 9001',
77
+ default: 9001,
78
+ env: 'PLATFORMA_S3_CONSOLE_PORT',
79
+ }),
80
+ };
81
+ const StorageFlag = {
82
+ storage: core.Flags.string({
83
+ description: 'specify path on host to be used as storage for all Platforma Backend data',
84
+ }),
85
+ };
86
+ const MinioPresignHostFlag = {
87
+ ['minio-presign-host']: core.Flags.boolean({
88
+ description: 'use \'minio\' host instead of \'localhost\' in presign URLs',
89
+ }),
90
+ };
91
+ const MountFlag = {
92
+ mount: core.Flags.string({
93
+ multiple: true,
94
+ description: 'things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths',
95
+ }),
96
+ };
97
+ const PlLogFileFlag = {
98
+ ['pl-log-file']: core.Flags.file({
99
+ description: 'specify path for Platforma Backend log file',
100
+ }),
101
+ };
102
+ const PlWorkdirFlag = {
103
+ ['pl-workdir']: core.Flags.file({
104
+ description: 'specify working directory for Platforma Backend process',
105
+ }),
106
+ };
107
+ const PlBinaryFlag = {
108
+ ['pl-binary']: core.Flags.file({
109
+ description: 'start given Platforma Backend binary instead of automatically downloaded version',
110
+ }),
111
+ };
112
+ const PlSourcesFlag = {
113
+ ['pl-sources']: core.Flags.file({
114
+ description: 'path to pl repository root: build Platforma Backend from sources and start the resulting binary',
115
+ }),
116
+ };
117
+ const ConfigFlag = {
118
+ config: core.Flags.string({
119
+ description: 'use custom Platforma Backend config',
120
+ }),
121
+ };
122
+ ({
123
+ 'storage-primary': core.Flags.file({
124
+ description: 'specify path on host to be used as \'primary\' storage',
125
+ }),
126
+ });
127
+ const StorageWorkPathFlag = {
128
+ 'storage-work': core.Flags.file({
129
+ description: 'specify path on host to be used as \'work\' storage',
130
+ }),
131
+ };
132
+ ({
133
+ 'storage-primary': core.Flags.file({
134
+ description: 'specify path on host to be used as \'library\' storage',
135
+ }),
136
+ });
137
+ const StoragePrimaryURLFlag = {
138
+ 'storage-primary': core.Flags.string({
139
+ description: 'specify \'primary\' storage destination URL.\n'
140
+ + '\tfile:/path/to/dir for directory on local FS\n'
141
+ + '\ts3://<bucket>/?region=<name> for real AWS bucket\n'
142
+ + '\ts3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http\n'
143
+ + '\ts3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https',
144
+ }),
145
+ };
146
+ const StorageLibraryURLFlag = {
147
+ 'storage-library': core.Flags.string({
148
+ description: 'specify \'library\' storage destination URL.\n'
149
+ + '\tfile:/path/to/dir for directory on local FS\n'
150
+ + '\ts3://<bucket>/?region=<name> for real AWS bucket\n'
151
+ + '\ts3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http\n'
152
+ + '\ts3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https',
153
+ }),
154
+ };
155
+ const AuthEnabledFlag = {
156
+ 'auth-enabled': core.Flags.boolean({
157
+ description: 'enable authorization',
158
+ }),
159
+ };
160
+ const HTPasswdFileFlag = {
161
+ 'auth-htpasswd-file': core.Flags.file({
162
+ description: 'path to .htpasswd file with Platforma users (static user DB auth source)',
163
+ }),
164
+ };
165
+ const LDAPAddressFlag = {
166
+ 'auth-ldap-server': core.Flags.string({
167
+ description: 'address of LDAP server to use for auth in Platforma (auth source)',
168
+ }),
169
+ };
170
+ const LDAPDefaultDNFlag = {
171
+ 'auth-ldap-default-dn': core.Flags.string({
172
+ description: 'DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com',
173
+ }),
174
+ };
175
+ const AuthFlags = {
176
+ ...AuthEnabledFlag,
177
+ ...HTPasswdFileFlag,
178
+ ...LDAPAddressFlag,
179
+ ...LDAPDefaultDNFlag,
180
+ };
181
+
182
+ exports.AddressesFlags = AddressesFlags;
183
+ exports.ArchFlag = ArchFlag;
184
+ exports.AuthEnabledFlag = AuthEnabledFlag;
185
+ exports.AuthFlags = AuthFlags;
186
+ exports.ConfigFlag = ConfigFlag;
187
+ exports.GlobalFlags = GlobalFlags;
188
+ exports.HTPasswdFileFlag = HTPasswdFileFlag;
189
+ exports.ImageFlag = ImageFlag;
190
+ exports.LDAPAddressFlag = LDAPAddressFlag;
191
+ exports.LDAPDefaultDNFlag = LDAPDefaultDNFlag;
192
+ exports.LicenseFlags = LicenseFlags;
193
+ exports.MinioPresignHostFlag = MinioPresignHostFlag;
194
+ exports.MountFlag = MountFlag;
195
+ exports.PlBinaryFlag = PlBinaryFlag;
196
+ exports.PlLogFileFlag = PlLogFileFlag;
197
+ exports.PlSourcesFlag = PlSourcesFlag;
198
+ exports.PlWorkdirFlag = PlWorkdirFlag;
199
+ exports.S3AddressesFlags = S3AddressesFlags;
200
+ exports.StorageFlag = StorageFlag;
201
+ exports.StorageLibraryURLFlag = StorageLibraryURLFlag;
202
+ exports.StoragePrimaryURLFlag = StoragePrimaryURLFlag;
203
+ exports.StorageWorkPathFlag = StorageWorkPathFlag;
204
+ exports.VersionFlag = VersionFlag;
205
+ //# sourceMappingURL=cmd-opts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd-opts.cjs","sources":["../src/cmd-opts.ts"],"sourcesContent":["import { Flags } from '@oclif/core';\n\nexport const GlobalFlags = {\n 'log-level': Flags.string({\n description: 'logging level',\n default: 'info',\n options: ['error', 'warn', 'info', 'debug'],\n required: false,\n }),\n};\n\nexport const InstanceName = {\n name: Flags.string({\n description: 'name of instance',\n required: false,\n }),\n};\n\nexport const ImageFlag = {\n image: Flags.string({\n description: 'use custom docker image to run platforma',\n }),\n};\n\nexport const VersionFlag = {\n version: Flags.string({\n description: 'use custom platforma release (official docker image or binary package)',\n }),\n};\n\nexport const ArchFlag = {\n arch: Flags.string({\n description: 'override architecture. You can start amd64 linux image on arm-based host (say, Apple M family processor). I.e. arm64, amd64, amd64/v2',\n }),\n};\n\nexport const LicenseFlags = {\n 'license': Flags.string({\n description: 'pass a license code. The license can be got from \"https://licensing.milaboratories.com\".',\n }),\n 'license-file': Flags.file({\n exists: true,\n description:\n 'specify a path to the file with a license. The license can be got from \\'https://licensing.milaboratories.com\\'.',\n }),\n};\n\nexport const AddressesFlags = {\n 'grpc-port': Flags.integer({\n description: 'port for Platforma Backend gRPC API. Default is 6345',\n env: 'PLATFORMA_GRPC_PORT',\n }),\n\n 'grpc-listen': Flags.string({\n description: 'full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345',\n env: 'PLATFORMA_GRPC_LISTEN',\n }),\n\n 'monitoring-port': Flags.integer({\n description: 'port for Platforma Backend monitoring API. Default is 9090',\n env: 'PLATFORMA_MONITORING_PORT',\n }),\n\n 'monitoring-listen': Flags.string({\n description: 'full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090',\n env: 'PLATFORMA_MONITORING_LISTEN',\n }),\n\n 'debug-port': Flags.integer({\n description: 'port for Platforma Backend debug API. Default is 9091',\n env: 'PLATFORMA_DEBUG_PORT',\n }),\n\n 'debug-listen': Flags.string({\n description: 'full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091',\n env: 'PLATFORMA_DEBUG_LISTEN',\n }),\n};\n\nexport const S3AddressesFlags = {\n 's3-port': Flags.integer({\n description: 'port that S3 will listen, default is 9000',\n default: 9000,\n env: 'PLATFORMA_S3_PORT',\n }),\n\n 's3-console-port': Flags.integer({\n description: 'port that a console of S3 will listen, default is 9001',\n default: 9001,\n env: 'PLATFORMA_S3_CONSOLE_PORT',\n }),\n};\n\nexport const StorageFlag = {\n storage: Flags.string({\n description: 'specify path on host to be used as storage for all Platforma Backend data',\n }),\n};\n\nexport const MinioPresignHostFlag = {\n ['minio-presign-host']: Flags.boolean({\n description: 'use \\'minio\\' host instead of \\'localhost\\' in presign URLs',\n }),\n};\n\nexport const MountFlag = {\n mount: Flags.string({\n multiple: true,\n description: 'things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths',\n }),\n};\n\nexport const PlLogFileFlag = {\n ['pl-log-file']: Flags.file({\n description: 'specify path for Platforma Backend log file',\n }),\n};\n\nexport const PlWorkdirFlag = {\n ['pl-workdir']: Flags.file({\n description: 'specify working directory for Platforma Backend process',\n }),\n};\n\nexport const PlBinaryFlag = {\n ['pl-binary']: Flags.file({\n description: 'start given Platforma Backend binary instead of automatically downloaded version',\n }),\n};\n\nexport const PlSourcesFlag = {\n ['pl-sources']: Flags.file({\n description: 'path to pl repository root: build Platforma Backend from sources and start the resulting binary',\n }),\n};\n\nexport const ConfigFlag = {\n config: Flags.string({\n description: 'use custom Platforma Backend config',\n }),\n};\n\nexport const StoragePrimaryPathFlag = {\n 'storage-primary': Flags.file({\n description: 'specify path on host to be used as \\'primary\\' storage',\n }),\n};\n\nexport const StorageWorkPathFlag = {\n 'storage-work': Flags.file({\n description: 'specify path on host to be used as \\'work\\' storage',\n }),\n};\n\nexport const StorageLibraryPathFlag = {\n 'storage-primary': Flags.file({\n description: 'specify path on host to be used as \\'library\\' storage',\n }),\n};\n\nexport const StoragePrimaryURLFlag = {\n 'storage-primary': Flags.string({\n description:\n 'specify \\'primary\\' storage destination URL.\\n'\n + '\\tfile:/path/to/dir for directory on local FS\\n'\n + '\\ts3://<bucket>/?region=<name> for real AWS bucket\\n'\n + '\\ts3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http\\n'\n + '\\ts3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https',\n }),\n};\n\nexport const StorageLibraryURLFlag = {\n 'storage-library': Flags.string({\n description:\n 'specify \\'library\\' storage destination URL.\\n'\n + '\\tfile:/path/to/dir for directory on local FS\\n'\n + '\\ts3://<bucket>/?region=<name> for real AWS bucket\\n'\n + '\\ts3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http\\n'\n + '\\ts3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https',\n }),\n};\n\nexport const AuthEnabledFlag = {\n 'auth-enabled': Flags.boolean({\n description: 'enable authorization',\n }),\n};\n\nexport const HTPasswdFileFlag = {\n 'auth-htpasswd-file': Flags.file({\n description: 'path to .htpasswd file with Platforma users (static user DB auth source)',\n }),\n};\n\nexport const LDAPAddressFlag = {\n 'auth-ldap-server': Flags.string({\n description: 'address of LDAP server to use for auth in Platforma (auth source)',\n }),\n};\n\nexport const LDAPDefaultDNFlag = {\n 'auth-ldap-default-dn': Flags.string({\n description: 'DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com',\n }),\n};\n\nexport const AuthFlags = {\n ...AuthEnabledFlag,\n ...HTPasswdFileFlag,\n\n ...LDAPAddressFlag,\n ...LDAPDefaultDNFlag,\n};\n"],"names":["Flags"],"mappings":";;;;AAEO,MAAM,WAAW,GAAG;AACzB,IAAA,WAAW,EAAEA,UAAK,CAAC,MAAM,CAAC;AACxB,QAAA,WAAW,EAAE,eAAe;AAC5B,QAAA,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AAC3C,QAAA,QAAQ,EAAE,KAAK;KAChB,CAAC;;CAGwB;AAC1B,IAAA,IAAI,EAAEA,UAAK,CAAC,MAAM,CAAC;AACjB,QAAA,WAAW,EAAE,kBAAkB;AAC/B,QAAA,QAAQ,EAAE,KAAK;KAChB,CAAC;;AAGG,MAAM,SAAS,GAAG;AACvB,IAAA,KAAK,EAAEA,UAAK,CAAC,MAAM,CAAC;AAClB,QAAA,WAAW,EAAE,0CAA0C;KACxD,CAAC;;AAGG,MAAM,WAAW,GAAG;AACzB,IAAA,OAAO,EAAEA,UAAK,CAAC,MAAM,CAA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