@platforma-sdk/block-tools 2.6.44 → 2.6.45

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 (70) hide show
  1. package/README.md +16 -9
  2. package/bin/dev.js +4 -4
  3. package/bin/run.js +3 -3
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cli.mjs +16 -6
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/cmd/index.d.ts +8 -8
  8. package/dist/cmd/mark-stable.d.ts +1 -1
  9. package/dist/cmd/publish.d.ts +1 -1
  10. package/dist/cmd/restore-overview-from-snapshot.d.ts +1 -1
  11. package/dist/{config-DKBY0B2u.mjs → config-Cc8_zV3b.mjs} +48 -17
  12. package/dist/config-Cc8_zV3b.mjs.map +1 -0
  13. package/dist/config-Ycas5fbX.js.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +6 -4
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/registry_v1/config_schema.d.ts +7 -7
  19. package/dist/registry_v1/v1_repo_schema.d.ts +1 -1
  20. package/dist/v2/model/block_components.d.ts +19 -19
  21. package/dist/v2/model/block_description.d.ts +102 -102
  22. package/dist/v2/model/block_meta.d.ts +20 -20
  23. package/dist/v2/model/content_conversion.d.ts +2 -2
  24. package/dist/v2/registry/registry.d.ts +1 -1
  25. package/dist/v2/source_package.d.ts +1 -1
  26. package/package.json +31 -29
  27. package/src/cmd/build-meta.ts +15 -15
  28. package/src/cmd/build-model.ts +23 -26
  29. package/src/cmd/index.ts +20 -20
  30. package/src/cmd/list-overview-snapshots.ts +12 -12
  31. package/src/cmd/mark-stable.ts +30 -33
  32. package/src/cmd/pack.ts +15 -15
  33. package/src/cmd/publish.ts +46 -34
  34. package/src/cmd/refresh-registry.ts +15 -15
  35. package/src/cmd/restore-overview-from-snapshot.ts +27 -25
  36. package/src/cmd/update-deps.ts +8 -8
  37. package/src/cmd/upload-package-v1.ts +33 -33
  38. package/src/common_types.ts +1 -1
  39. package/src/io/folder_reader.test.ts +13 -13
  40. package/src/io/folder_reader.ts +18 -20
  41. package/src/io/index.ts +2 -2
  42. package/src/io/storage.test.ts +48 -48
  43. package/src/io/storage.ts +20 -15
  44. package/src/lib.ts +3 -3
  45. package/src/registry_v1/config.ts +11 -11
  46. package/src/registry_v1/config_schema.ts +5 -5
  47. package/src/registry_v1/flags.ts +4 -4
  48. package/src/registry_v1/index.ts +3 -3
  49. package/src/registry_v1/registry.test.ts +54 -54
  50. package/src/registry_v1/registry.ts +29 -25
  51. package/src/registry_v1/v1_repo_schema.ts +3 -3
  52. package/src/util.ts +6 -9
  53. package/src/v2/build_dist.test.ts +8 -9
  54. package/src/v2/build_dist.ts +10 -13
  55. package/src/v2/index.ts +4 -4
  56. package/src/v2/model/block_components.ts +5 -5
  57. package/src/v2/model/block_description.ts +12 -8
  58. package/src/v2/model/block_meta.ts +4 -5
  59. package/src/v2/model/content_conversion.ts +44 -44
  60. package/src/v2/model/index.ts +4 -4
  61. package/src/v2/registry/index.ts +3 -3
  62. package/src/v2/registry/registry.test.ts +223 -197
  63. package/src/v2/registry/registry.ts +93 -66
  64. package/src/v2/registry/registry_reader.test.ts +15 -15
  65. package/src/v2/registry/registry_reader.ts +29 -27
  66. package/src/v2/registry/schema_internal.ts +11 -10
  67. package/src/v2/registry/schema_public.ts +56 -47
  68. package/src/v2/source_package.test.ts +15 -15
  69. package/src/v2/source_package.ts +33 -26
  70. package/dist/config-DKBY0B2u.mjs.map +0 -1
@@ -1,53 +1,50 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { BlockRegistryV2, loadPackDescriptionRaw } from '../v2';
3
- import path from 'node:path';
4
- import {
5
- overrideDescriptionVersion,
6
- StableChannel,
7
- } from '@milaboratories/pl-model-middle-layer';
8
- import { storageByUrl } from '../io';
9
- import { OclifLoggerAdapter } from '@milaboratories/ts-helpers-oclif';
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { BlockRegistryV2, loadPackDescriptionRaw } from "../v2";
3
+ import path from "node:path";
4
+ import { overrideDescriptionVersion, StableChannel } from "@milaboratories/pl-model-middle-layer";
5
+ import { storageByUrl } from "../io";
6
+ import { OclifLoggerAdapter } from "@milaboratories/ts-helpers-oclif";
10
7
 
11
8
  export default class MarkStable extends Command {
12
- static description = 'Mark target block stable';
9
+ static description = "Mark target block stable";
13
10
 
14
11
  static flags = {
15
- 'modulePath': Flags.string({
16
- char: 'i',
17
- summary: 'input module path',
18
- helpValue: '<path>',
19
- default: '.',
12
+ modulePath: Flags.string({
13
+ char: "i",
14
+ summary: "input module path",
15
+ helpValue: "<path>",
16
+ default: ".",
20
17
  }),
21
18
 
22
- 'channel': Flags.string({
23
- char: 'c',
19
+ channel: Flags.string({
20
+ char: "c",
24
21
  hidden: true,
25
- summary: 'custom channel',
26
- helpValue: '<channel name>',
22
+ summary: "custom channel",
23
+ helpValue: "<channel name>",
27
24
  default: StableChannel,
28
25
  }),
29
26
 
30
- 'version-override': Flags.file({
31
- char: 'v',
32
- summary: 'override package version',
27
+ "version-override": Flags.file({
28
+ char: "v",
29
+ summary: "override package version",
33
30
  }),
34
31
 
35
- 'registry': Flags.string({
36
- char: 'r',
37
- summary: 'full address of the registry',
38
- helpValue: '<address>',
39
- env: 'PL_REGISTRY',
32
+ registry: Flags.string({
33
+ char: "r",
34
+ summary: "full address of the registry",
35
+ helpValue: "<address>",
36
+ env: "PL_REGISTRY",
40
37
  required: true,
41
38
  }),
42
39
 
43
- 'refresh': Flags.boolean({
44
- summary: 'refresh repository after adding the package',
40
+ refresh: Flags.boolean({
41
+ summary: "refresh repository after adding the package",
45
42
  default: true,
46
43
  allowNo: true,
47
- env: 'PL_REGISTRY_REFRESH',
44
+ env: "PL_REGISTRY_REFRESH",
48
45
  }),
49
46
 
50
- 'unmark': Flags.boolean({
47
+ unmark: Flags.boolean({
51
48
  summary:
52
49
  'reverses meaning of this command, flag can be used to remove "stable" flag from the package',
53
50
  default: false,
@@ -57,8 +54,8 @@ export default class MarkStable extends Command {
57
54
  public async run(): Promise<void> {
58
55
  const { flags } = await this.parse(MarkStable);
59
56
  let description = await loadPackDescriptionRaw(path.resolve(flags.modulePath));
60
- if (flags['version-override'])
61
- description = overrideDescriptionVersion(description, flags['version-override']);
57
+ if (flags["version-override"])
58
+ description = overrideDescriptionVersion(description, flags["version-override"]);
62
59
  const storage = storageByUrl(flags.registry);
63
60
  const registry = new BlockRegistryV2(storage, new OclifLoggerAdapter(this));
64
61
 
package/src/cmd/pack.ts CHANGED
@@ -1,26 +1,26 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { loadPackDescription } from '../v2/source_package';
3
- import path from 'node:path';
4
- import { buildBlockPackDist } from '../v2/build_dist';
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { loadPackDescription } from "../v2/source_package";
3
+ import path from "node:path";
4
+ import { buildBlockPackDist } from "../v2/build_dist";
5
5
 
6
6
  export default class PackBlock extends Command {
7
- static description
8
- = 'Builds block pack and outputs a block pack manifest consolidating all '
9
- + 'references assets into a single folder';
7
+ static description =
8
+ "Builds block pack and outputs a block pack manifest consolidating all " +
9
+ "references assets into a single folder";
10
10
 
11
11
  static flags = {
12
12
  modulePath: Flags.string({
13
- char: 'i',
14
- summary: 'input module path',
15
- helpValue: '<path>',
16
- default: '.',
13
+ char: "i",
14
+ summary: "input module path",
15
+ helpValue: "<path>",
16
+ default: ".",
17
17
  }),
18
18
 
19
19
  destinationPath: Flags.string({
20
- char: 'o',
21
- summary: 'output folder',
22
- helpValue: '<path>',
23
- default: './block-pack',
20
+ char: "o",
21
+ summary: "output folder",
22
+ helpValue: "<path>",
23
+ default: "./block-pack",
24
24
  }),
25
25
  };
26
26
 
@@ -1,11 +1,15 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import fs from 'node:fs';
3
- import { OclifLoggerAdapter } from '@milaboratories/ts-helpers-oclif';
4
- import { ManifestFileName } from '../v2/registry/schema_public';
5
- import { BlockPackManifest, overrideManifestVersion, StableChannel } from '@milaboratories/pl-model-middle-layer';
6
- import { storageByUrl } from '../io/storage';
7
- import { BlockRegistryV2 } from '../v2/registry/registry';
8
- import path from 'node:path';
1
+ import { Command, Flags } from "@oclif/core";
2
+ import fs from "node:fs";
3
+ import { OclifLoggerAdapter } from "@milaboratories/ts-helpers-oclif";
4
+ import { ManifestFileName } from "../v2/registry/schema_public";
5
+ import {
6
+ BlockPackManifest,
7
+ overrideManifestVersion,
8
+ StableChannel,
9
+ } from "@milaboratories/pl-model-middle-layer";
10
+ import { storageByUrl } from "../io/storage";
11
+ import { BlockRegistryV2 } from "../v2/registry/registry";
12
+ import path from "node:path";
9
13
 
10
14
  function simpleDeepMerge<T extends Record<string, unknown>>(
11
15
  target: Record<string, unknown>,
@@ -14,9 +18,12 @@ function simpleDeepMerge<T extends Record<string, unknown>>(
14
18
  const result = { ...target };
15
19
 
16
20
  for (const key in source) {
17
- if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
18
- if (result[key] && typeof result[key] === 'object' && !Array.isArray(result[key])) {
19
- result[key] = simpleDeepMerge(result[key] as Record<string, unknown>, source[key] as Record<string, unknown>);
21
+ if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
22
+ if (result[key] && typeof result[key] === "object" && !Array.isArray(result[key])) {
23
+ result[key] = simpleDeepMerge(
24
+ result[key] as Record<string, unknown>,
25
+ source[key] as Record<string, unknown>,
26
+ );
20
27
  } else {
21
28
  result[key] = source[key];
22
29
  }
@@ -29,41 +36,41 @@ function simpleDeepMerge<T extends Record<string, unknown>>(
29
36
  }
30
37
 
31
38
  export default class Publish extends Command {
32
- static description
33
- = 'Publishes the block package and refreshes the registry (for v2 block-pack schema)';
39
+ static description =
40
+ "Publishes the block package and refreshes the registry (for v2 block-pack schema)";
34
41
 
35
42
  static flags = {
36
- 'registry': Flags.string({
37
- char: 'r',
38
- summary: 'full address of the registry',
39
- helpValue: '<address>',
40
- env: 'PL_REGISTRY',
43
+ registry: Flags.string({
44
+ char: "r",
45
+ summary: "full address of the registry",
46
+ helpValue: "<address>",
47
+ env: "PL_REGISTRY",
41
48
  required: true,
42
49
  }),
43
50
 
44
- 'manifest': Flags.file({
45
- char: 'm',
46
- summary: 'manifest file path',
51
+ manifest: Flags.file({
52
+ char: "m",
53
+ summary: "manifest file path",
47
54
  exists: true,
48
55
  default: `./block-pack/${ManifestFileName}`,
49
56
  }),
50
57
 
51
- 'version-override': Flags.file({
52
- char: 'v',
53
- summary: 'override package version',
58
+ "version-override": Flags.file({
59
+ char: "v",
60
+ summary: "override package version",
54
61
  }),
55
62
 
56
- 'refresh': Flags.boolean({
57
- summary: 'refresh repository after adding the package',
63
+ refresh: Flags.boolean({
64
+ summary: "refresh repository after adding the package",
58
65
  default: true,
59
66
  allowNo: true,
60
- env: 'PL_REGISTRY_REFRESH',
67
+ env: "PL_REGISTRY_REFRESH",
61
68
  }),
62
69
 
63
- 'unstable': Flags.boolean({
64
- summary: 'do not add the published package to stable channel',
70
+ unstable: Flags.boolean({
71
+ summary: "do not add the published package to stable channel",
65
72
  default: false,
66
- env: 'PL_PUBLISH_UNSTABLE',
73
+ env: "PL_PUBLISH_UNSTABLE",
67
74
  }),
68
75
  };
69
76
 
@@ -71,16 +78,21 @@ export default class Publish extends Command {
71
78
  const { flags } = await this.parse(Publish);
72
79
 
73
80
  const manifestPath = path.resolve(flags.manifest);
74
- const rawManifest = JSON.parse(await fs.promises.readFile(manifestPath, { encoding: 'utf-8' })) as Record<string, unknown>;
81
+ const rawManifest = JSON.parse(
82
+ await fs.promises.readFile(manifestPath, { encoding: "utf-8" }),
83
+ ) as Record<string, unknown>;
75
84
  let manifest = BlockPackManifest.parse(rawManifest);
76
85
  // To keep extra fields from the manifest and keep coerced fields
77
- manifest = simpleDeepMerge(rawManifest, manifest as BlockPackManifest & Record<string, unknown>);
86
+ manifest = simpleDeepMerge(
87
+ rawManifest,
88
+ manifest as BlockPackManifest & Record<string, unknown>,
89
+ );
78
90
  const manifestRoot = path.dirname(manifestPath);
79
91
 
80
92
  this.log(`Manifest root = ${manifestRoot}`);
81
93
 
82
- if (flags['version-override'])
83
- manifest = overrideManifestVersion(manifest, flags['version-override']);
94
+ if (flags["version-override"])
95
+ manifest = overrideManifestVersion(manifest, flags["version-override"]);
84
96
 
85
97
  const storage = storageByUrl(flags.registry);
86
98
  const registry = new BlockRegistryV2(storage, new OclifLoggerAdapter(this));
@@ -1,27 +1,27 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { BlockRegistryV2 } from '../v2';
3
- import { storageByUrl } from '../io';
4
- import { OclifLoggerAdapter } from '@milaboratories/ts-helpers-oclif';
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { BlockRegistryV2 } from "../v2";
3
+ import { storageByUrl } from "../io";
4
+ import { OclifLoggerAdapter } from "@milaboratories/ts-helpers-oclif";
5
5
 
6
6
  export default class RefreshRegistry extends Command {
7
- static description = 'Refresh overview files based on published but not proecessed artefacts';
7
+ static description = "Refresh overview files based on published but not proecessed artefacts";
8
8
 
9
9
  static flags = {
10
10
  registry: Flags.string({
11
- char: 'r',
12
- summary: 'full address of the registry',
13
- helpValue: '<address>',
14
- env: 'PL_REGISTRY',
11
+ char: "r",
12
+ summary: "full address of the registry",
13
+ helpValue: "<address>",
14
+ env: "PL_REGISTRY",
15
15
  required: true,
16
16
  }),
17
17
 
18
18
  mode: Flags.string({
19
- char: 'm',
19
+ char: "m",
20
20
  summary: 'refresh mode (allowed valiues: "force", "normal", "dry-run")',
21
- helpValue: '<mode>',
22
- options: ['force', 'normal', 'dry-run'],
23
- env: 'PL_REGISTRY_REFRESH_DRY_RUN',
24
- default: 'normal',
21
+ helpValue: "<mode>",
22
+ options: ["force", "normal", "dry-run"],
23
+ env: "PL_REGISTRY_REFRESH_DRY_RUN",
24
+ default: "normal",
25
25
  }),
26
26
  };
27
27
 
@@ -29,6 +29,6 @@ export default class RefreshRegistry extends Command {
29
29
  const { flags } = await this.parse(RefreshRegistry);
30
30
  const storage = storageByUrl(flags.registry);
31
31
  const registry = new BlockRegistryV2(storage, new OclifLoggerAdapter(this));
32
- await registry.updateIfNeeded(flags.mode as 'force' | 'normal' | 'dry-run');
32
+ await registry.updateIfNeeded(flags.mode as "force" | "normal" | "dry-run");
33
33
  }
34
34
  }
@@ -1,29 +1,29 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { BlockRegistryV2 } from '../v2/registry/registry';
3
- import { storageByUrl } from '../io/storage';
4
- import { OclifLoggerAdapter } from '@milaboratories/ts-helpers-oclif';
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { BlockRegistryV2 } from "../v2/registry/registry";
3
+ import { storageByUrl } from "../io/storage";
4
+ import { OclifLoggerAdapter } from "@milaboratories/ts-helpers-oclif";
5
5
 
6
6
  export default class RestoreOverviewFromSnapshot extends Command {
7
- static description = 'Restore global overview from a snapshot';
7
+ static description = "Restore global overview from a snapshot";
8
8
 
9
9
  static flags = {
10
- 'registry': Flags.string({
11
- char: 'r',
12
- summary: 'full address of the registry',
13
- helpValue: '<address>',
14
- env: 'PL_REGISTRY',
10
+ registry: Flags.string({
11
+ char: "r",
12
+ summary: "full address of the registry",
13
+ helpValue: "<address>",
14
+ env: "PL_REGISTRY",
15
15
  required: true,
16
16
  }),
17
17
 
18
- 'snapshot': Flags.string({
19
- char: 's',
20
- summary: 'snapshot timestamp ID to restore from',
21
- helpValue: '<timestamp>',
18
+ snapshot: Flags.string({
19
+ char: "s",
20
+ summary: "snapshot timestamp ID to restore from",
21
+ helpValue: "<timestamp>",
22
22
  required: true,
23
23
  }),
24
24
 
25
- 'skip-confirmation': Flags.boolean({
26
- summary: 'skip confirmation prompt (use with caution)',
25
+ "skip-confirmation": Flags.boolean({
26
+ summary: "skip confirmation prompt (use with caution)",
27
27
  default: false,
28
28
  }),
29
29
  };
@@ -38,14 +38,16 @@ export default class RestoreOverviewFromSnapshot extends Command {
38
38
  const targetSnapshot = snapshots.find((s) => s.timestamp === flags.snapshot);
39
39
 
40
40
  if (!targetSnapshot) {
41
- this.error(`Snapshot '${flags.snapshot}' not found. Available snapshots:\n${
42
- snapshots.map((s) => ` - ${s.timestamp}`).join('\n') || ' (none)'
43
- }`);
41
+ this.error(
42
+ `Snapshot '${flags.snapshot}' not found. Available snapshots:\n${
43
+ snapshots.map((s) => ` - ${s.timestamp}`).join("\n") || " (none)"
44
+ }`,
45
+ );
44
46
  }
45
47
 
46
48
  // Confirmation prompt (unless skipped)
47
- if (!flags['skip-confirmation']) {
48
- const readline = await import('node:readline');
49
+ if (!flags["skip-confirmation"]) {
50
+ const readline = await import("node:readline");
49
51
  const rl = readline.createInterface({
50
52
  input: process.stdin,
51
53
  output: process.stdout,
@@ -53,16 +55,16 @@ export default class RestoreOverviewFromSnapshot extends Command {
53
55
 
54
56
  const answer = await new Promise<string>((resolve) => {
55
57
  rl.question(
56
- `⚠️ This will overwrite the current global overview with snapshot '${flags.snapshot}'.\n`
57
- + `Are you sure you want to continue? (y/N): `,
58
+ `⚠️ This will overwrite the current global overview with snapshot '${flags.snapshot}'.\n` +
59
+ `Are you sure you want to continue? (y/N): `,
58
60
  resolve,
59
61
  );
60
62
  });
61
63
 
62
64
  rl.close();
63
65
 
64
- if (answer.toLowerCase() !== 'y' && answer.toLowerCase() !== 'yes') {
65
- this.log('Restore cancelled.');
66
+ if (answer.toLowerCase() !== "y" && answer.toLowerCase() !== "yes") {
67
+ this.log("Restore cancelled.");
66
68
  return;
67
69
  }
68
70
  }
@@ -1,20 +1,20 @@
1
- import { Command } from '@oclif/core';
2
- import { execFileSync } from 'node:child_process';
3
- import { createRequire } from 'node:module';
1
+ import { Command } from "@oclif/core";
2
+ import { execFileSync } from "node:child_process";
3
+ import { createRequire } from "node:module";
4
4
 
5
5
  export default class UpdateDeps extends Command {
6
- static override description
7
- = 'Updates @platforma-sdk and @milaboratories packages in pnpm-workspace.yaml catalog to their latest versions from npm registry.';
6
+ static override description =
7
+ "Updates @platforma-sdk and @milaboratories packages in pnpm-workspace.yaml catalog to their latest versions from npm registry.";
8
8
 
9
- static override examples = ['<%= config.bin %> <%= command.id %>'];
9
+ static override examples = ["<%= config.bin %> <%= command.id %>"];
10
10
 
11
11
  // eslint-disable-next-line @typescript-eslint/require-await -- oclif requires async but implementation is sync
12
12
  public async run(): Promise<void> {
13
13
  const require = createRequire(import.meta.url);
14
- const updaterPath = require.resolve('@platforma-sdk/blocks-deps-updater/scripts/updater.js');
14
+ const updaterPath = require.resolve("@platforma-sdk/blocks-deps-updater/scripts/updater.js");
15
15
 
16
16
  execFileSync(process.execPath, [updaterPath], {
17
- stdio: 'inherit',
17
+ stdio: "inherit",
18
18
  cwd: process.cwd(),
19
19
  });
20
20
  }
@@ -1,62 +1,62 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { getConfig } from '../registry_v1/config';
3
- import { targetFile } from '../registry_v1/flags';
4
- import fs from 'node:fs';
5
- import YAML from 'yaml';
6
- import { PlRegPackageConfigDataShard } from '../registry_v1/config_schema';
7
- import { OclifLoggerAdapter } from '@milaboratories/ts-helpers-oclif';
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { getConfig } from "../registry_v1/config";
3
+ import { targetFile } from "../registry_v1/flags";
4
+ import fs from "node:fs";
5
+ import YAML from "yaml";
6
+ import { PlRegPackageConfigDataShard } from "../registry_v1/config_schema";
7
+ import { OclifLoggerAdapter } from "@milaboratories/ts-helpers-oclif";
8
8
 
9
9
  type BasicConfigField = keyof PlRegPackageConfigDataShard &
10
- ('registry' | 'organization' | 'package' | 'version');
11
- const BasicConfigFields: BasicConfigField[] = ['registry', 'organization', 'package', 'version'];
10
+ ("registry" | "organization" | "package" | "version");
11
+ const BasicConfigFields: BasicConfigField[] = ["registry", "organization", "package", "version"];
12
12
 
13
13
  export default class UploadPackageV1 extends Command {
14
- static description = 'Uploads V1 package and refreshes the registry';
14
+ static description = "Uploads V1 package and refreshes the registry";
15
15
 
16
16
  static flags = {
17
17
  registry: Flags.string({
18
- char: 'r',
19
- summary: 'full address of the registry or alias from .pl.reg',
20
- helpValue: '<address|alias>',
21
- env: 'PL_REGISTRY',
18
+ char: "r",
19
+ summary: "full address of the registry or alias from .pl.reg",
20
+ helpValue: "<address|alias>",
21
+ env: "PL_REGISTRY",
22
22
  }),
23
23
 
24
24
  organization: Flags.string({
25
- char: 'o',
26
- summary: 'target organisation',
27
- env: 'PL_PACKAGE_ORGANIZATION',
25
+ char: "o",
26
+ summary: "target organisation",
27
+ env: "PL_PACKAGE_ORGANIZATION",
28
28
  }),
29
29
 
30
30
  package: Flags.string({
31
- char: 'p',
32
- summary: 'target package',
33
- env: 'PL_PACKAGE_NAME',
31
+ char: "p",
32
+ summary: "target package",
33
+ env: "PL_PACKAGE_NAME",
34
34
  }),
35
35
 
36
36
  version: Flags.string({
37
- char: 'v',
38
- summary: 'target version',
39
- env: 'PL_PACKAGE_VERSION',
37
+ char: "v",
38
+ summary: "target version",
39
+ env: "PL_PACKAGE_VERSION",
40
40
  }),
41
41
 
42
42
  meta: Flags.file({
43
- char: 'm',
44
- summary: 'json file containing meta information to associate with tha package',
43
+ char: "m",
44
+ summary: "json file containing meta information to associate with tha package",
45
45
  exists: true,
46
46
  }),
47
47
 
48
48
  file: targetFile({
49
- char: 'f',
50
- summary: 'package files',
49
+ char: "f",
50
+ summary: "package files",
51
51
  multiple: true,
52
52
  default: [],
53
53
  }),
54
54
 
55
55
  refresh: Flags.boolean({
56
- summary: 'refresh repository after adding the package',
56
+ summary: "refresh repository after adding the package",
57
57
  default: true,
58
58
  allowNo: true,
59
- env: 'PL_REGISTRY_REFRESH',
59
+ env: "PL_REGISTRY_REFRESH",
60
60
  }),
61
61
  };
62
62
 
@@ -67,13 +67,13 @@ export default class UploadPackageV1 extends Command {
67
67
  for (const field of BasicConfigFields) if (flags[field]) configFromFlags[field] = flags[field];
68
68
 
69
69
  if (flags.meta) {
70
- if (flags.meta.endsWith('.json'))
70
+ if (flags.meta.endsWith(".json"))
71
71
  configFromFlags.meta = JSON.parse(
72
- await fs.promises.readFile(flags.meta, { encoding: 'utf-8' }),
72
+ await fs.promises.readFile(flags.meta, { encoding: "utf-8" }),
73
73
  ) as Record<string, unknown>;
74
- else if (flags.meta.endsWith('.yaml'))
74
+ else if (flags.meta.endsWith(".yaml"))
75
75
  configFromFlags.meta = YAML.parse(
76
- await fs.promises.readFile(flags.meta, { encoding: 'utf-8' }),
76
+ await fs.promises.readFile(flags.meta, { encoding: "utf-8" }),
77
77
  ) as Record<string, unknown>;
78
78
  }
79
79
 
@@ -1,3 +1,3 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
 
3
3
  export const PlRegAddress = z.string().regex(/^(?:s3:|file:)/);
@@ -1,21 +1,21 @@
1
- import { expect, test } from 'vitest';
2
- import { folderReaderByUrl } from './folder_reader';
1
+ import { expect, test } from "vitest";
2
+ import { folderReaderByUrl } from "./folder_reader";
3
3
 
4
- test('test fs reader', async () => {
5
- const reader = folderReaderByUrl('file:.');
6
- const content = await reader.getContentReader()('package.json');
4
+ test("test fs reader", async () => {
5
+ const reader = folderReaderByUrl("file:.");
6
+ const content = await reader.getContentReader()("package.json");
7
7
  expect(content).toBeDefined();
8
8
  expect(content.length).toBeGreaterThan(10);
9
9
  });
10
10
 
11
- test('test url reader with slash', async () => {
12
- const reader = folderReaderByUrl('https://cdn.milaboratory.com/');
13
- const content = await reader.getContentReader()('ping');
14
- expect(content?.toString('utf8')).toStrictEqual('pong');
11
+ test("test url reader with slash", async () => {
12
+ const reader = folderReaderByUrl("https://cdn.milaboratory.com/");
13
+ const content = await reader.getContentReader()("ping");
14
+ expect(content?.toString("utf8")).toStrictEqual("pong");
15
15
  });
16
16
 
17
- test('test url reader without slash', async () => {
18
- const reader = folderReaderByUrl('https://cdn.milaboratory.com');
19
- const content = await reader.getContentReader()('ping');
20
- expect(content?.toString('utf8')).toStrictEqual('pong');
17
+ test("test url reader without slash", async () => {
18
+ const reader = folderReaderByUrl("https://cdn.milaboratory.com");
19
+ const content = await reader.getContentReader()("ping");
20
+ expect(content?.toString("utf8")).toStrictEqual("pong");
21
21
  });