@ms-cloudpack/cli 0.72.11 → 0.72.13

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 (59) hide show
  1. package/lib/commands/bundle/execute.d.ts.map +1 -1
  2. package/lib/commands/bundle/execute.js +6 -7
  3. package/lib/commands/bundle/execute.js.map +1 -1
  4. package/lib/commands/cache/clean.d.ts.map +1 -1
  5. package/lib/commands/cache/clean.js +6 -11
  6. package/lib/commands/cache/clean.js.map +1 -1
  7. package/lib/commands/config/delete.js +4 -4
  8. package/lib/commands/config/delete.js.map +1 -1
  9. package/lib/commands/config/get.js +5 -5
  10. package/lib/commands/config/get.js.map +1 -1
  11. package/lib/commands/config/list.js +5 -5
  12. package/lib/commands/config/list.js.map +1 -1
  13. package/lib/commands/config/set.js +4 -4
  14. package/lib/commands/config/set.js.map +1 -1
  15. package/lib/commands/info/lockFile/execute.d.ts.map +1 -1
  16. package/lib/commands/info/lockFile/execute.js +10 -14
  17. package/lib/commands/info/lockFile/execute.js.map +1 -1
  18. package/lib/commands/info/nonSemverDeps/execute.d.ts.map +1 -1
  19. package/lib/commands/info/nonSemverDeps/execute.js +8 -10
  20. package/lib/commands/info/nonSemverDeps/execute.js.map +1 -1
  21. package/lib/commands/init/execute.js +4 -4
  22. package/lib/commands/init/execute.js.map +1 -1
  23. package/lib/commands/link/execute.d.ts.map +1 -1
  24. package/lib/commands/link/execute.js +8 -4
  25. package/lib/commands/link/execute.js.map +1 -1
  26. package/lib/commands/link/getSessionToLink.d.ts +5 -4
  27. package/lib/commands/link/getSessionToLink.d.ts.map +1 -1
  28. package/lib/commands/link/getSessionToLink.js +36 -20
  29. package/lib/commands/link/getSessionToLink.js.map +1 -1
  30. package/lib/commands/setup/execute.js +2 -2
  31. package/lib/commands/setup/execute.js.map +1 -1
  32. package/lib/commands/start/execute.d.ts.map +1 -1
  33. package/lib/commands/start/execute.js +23 -17
  34. package/lib/commands/start/execute.js.map +1 -1
  35. package/lib/commands/sync/execute.d.ts.map +1 -1
  36. package/lib/commands/sync/execute.js +12 -13
  37. package/lib/commands/sync/execute.js.map +1 -1
  38. package/lib/commands/unlink/execute.d.ts.map +1 -1
  39. package/lib/commands/unlink/execute.js +8 -4
  40. package/lib/commands/unlink/execute.js.map +1 -1
  41. package/lib/types/CommandAction.d.ts +6 -8
  42. package/lib/types/CommandAction.d.ts.map +1 -1
  43. package/lib/types/CommandAction.js.map +1 -1
  44. package/lib/utilities/CommandExecutor.d.ts +6 -4
  45. package/lib/utilities/CommandExecutor.d.ts.map +1 -1
  46. package/lib/utilities/CommandExecutor.js +42 -30
  47. package/lib/utilities/CommandExecutor.js.map +1 -1
  48. package/lib/utilities/parseMatch.d.ts.map +1 -1
  49. package/lib/utilities/parseMatch.js +5 -0
  50. package/lib/utilities/parseMatch.js.map +1 -1
  51. package/package.json +13 -13
  52. package/lib/commands/link/getSessionFromUser.d.ts +0 -9
  53. package/lib/commands/link/getSessionFromUser.d.ts.map +0 -1
  54. package/lib/commands/link/getSessionFromUser.js +0 -26
  55. package/lib/commands/link/getSessionFromUser.js.map +0 -1
  56. package/lib/utilities/stopServers.d.ts +0 -13
  57. package/lib/utilities/stopServers.d.ts.map +0 -1
  58. package/lib/utilities/stopServers.js +0 -18
  59. package/lib/utilities/stopServers.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,CAiFhD,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,CAgFhD,CAAC"}
@@ -3,7 +3,7 @@ import { plural, red, yellow } from '@ms-cloudpack/task-reporter';
3
3
  import path from 'path';
4
4
  import { getFilteredPackages } from '../../utilities/getFilteredPackages.js';
5
5
  export const execute = async (params) => {
6
- const { cwd: appPath, options, reporter, initialize, exit, autoDispose } = params;
6
+ const { cwd: appPath, options, reporter, initialize, autoDispose } = params;
7
7
  const apiContextOptions = await initialize({
8
8
  appPath,
9
9
  configOptions: {
@@ -20,11 +20,10 @@ export const execute = async (params) => {
20
20
  }));
21
21
  const pathsToBundle = options.match ? getFilteredPackages(ctx.session.resolveMap, options.match) : [appPath];
22
22
  if (!pathsToBundle.length) {
23
- await exit({
23
+ return {
24
24
  message: 'No matching packages found to bundle.',
25
25
  exitCode: 1,
26
- });
27
- return;
26
+ };
28
27
  }
29
28
  // Show completed bundle tasks so the user knows what's happening.
30
29
  reporter.setOptions({ ...reporter.getOptions(), showCompleted: true });
@@ -66,9 +65,9 @@ export const execute = async (params) => {
66
65
  ]
67
66
  .filter(Boolean)
68
67
  .join(', ');
69
- await exit({
68
+ return {
70
69
  message: `Bundling ${status}\n`,
71
- exitCode: errorPackagesCount ? 1 : 0,
72
- });
70
+ hasErrors: !!errorPackagesCount,
71
+ };
73
72
  };
74
73
  //# sourceMappingURL=execute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7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zE,iBAAiB,IAAI,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,mCAAmC,CAAC,CAAC;QAC3F,oBAAoB,IAAI,MAAM,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;KAC5E;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,MAAM,IAAI,CAAC;QACT,OAAO,EAAE,YAAY,MAAM,IAAI;QAC/B,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACrC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server';\nimport { plural, red, yellow } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\nimport { getFilteredPackages } from '../../utilities/getFilteredPackages.js';\n\nexport const execute: CommandAction<BundleOptions> = async (params) => {\n const { cwd: appPath, options, reporter, initialize, exit, autoDispose } = params;\n const apiContextOptions = await initialize({\n appPath,\n configOptions: {\n mode: options.mode,\n // Handle --bundler by passing it as a universal package override, which will be appended\n // to any user-provided packageSettings so that it takes precedence.\n extraPackageSettings: options.bundler ? [{ match: '*', bundler: options.bundler }] : undefined,\n },\n });\n\n console.log('Bundle mode:', yellow(options.mode));\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n ...apiContextOptions,\n items: ['packages', 'watcher', 'session', 'taskRunner', 'bus', 'packageImportPaths', 'packageHashes'],\n }),\n );\n\n const pathsToBundle = options.match ? getFilteredPackages(ctx.session.resolveMap, options.match) : [appPath];\n\n if (!pathsToBundle.length) {\n await exit({\n message: 'No matching packages found to bundle.',\n exitCode: 1,\n });\n return;\n }\n\n // Show completed bundle tasks so the user knows what's happening.\n reporter.setOptions({ ...reporter.getOptions(), showCompleted: true });\n\n let warnPackagesCount = 0;\n let errorPackagesCount = 0;\n let successPackagesCount = 0;\n\n for (const packagePath of pathsToBundle) {\n // If outdir is set, resolve relative to the package/app path.\n // Otherwise, use the default path under the cloudpack cache to stay consistent with init and start,\n // and to avoid potentially messing with the package's original output.\n const outputPath = options.outdir ? path.resolve(packagePath, options.outdir) : undefined;\n\n const definition = await ctx.packages.get(packagePath);\n\n const { result } = await ensurePackageBundled({\n input: {\n name: definition.name,\n version: definition.version,\n outputPath,\n disableSourceMaps: options.disableSourceMaps,\n shouldForce: true,\n isIncremental: false,\n },\n ctx,\n });\n\n console.log('Output:', result.outputPath, '\\n');\n\n if (result.errors?.length) {\n errorPackagesCount++;\n } else if (result.warnings?.length) {\n warnPackagesCount++;\n } else {\n successPackagesCount++;\n }\n }\n\n const status = [\n errorPackagesCount && red(plural(errorPackagesCount, 'package$s failed')),\n warnPackagesCount && yellow(plural(warnPackagesCount, 'package$s succeeded with warnings')),\n successPackagesCount && plural(successPackagesCount, 'package$s succeeded'),\n ]\n .filter(Boolean)\n .join(', ');\n\n await exit({\n message: `Bundling ${status}\\n`,\n exitCode: errorPackagesCount ? 1 : 0,\n });\n};\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,MAAM,EAAE,EAAE;IACpE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAC5E,MAAM,iBAAiB,GAAG,MAAM,UAAU,CAAC;QACzC,OAAO;QACP,aAA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AAC,CAAC,kBAAkB;KAChC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server';\nimport { plural, red, yellow } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\nimport { getFilteredPackages } from '../../utilities/getFilteredPackages.js';\n\nexport const execute: CommandAction<BundleOptions> = async (params) => {\n const { cwd: appPath, options, reporter, initialize, autoDispose } = params;\n const apiContextOptions = await initialize({\n appPath,\n configOptions: {\n mode: options.mode,\n // Handle --bundler by passing it as a universal package override, which will be appended\n // to any user-provided packageSettings so that it takes precedence.\n extraPackageSettings: options.bundler ? [{ match: '*', bundler: options.bundler }] : undefined,\n },\n });\n\n console.log('Bundle mode:', yellow(options.mode));\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n ...apiContextOptions,\n items: ['packages', 'watcher', 'session', 'taskRunner', 'bus', 'packageImportPaths', 'packageHashes'],\n }),\n );\n\n const pathsToBundle = options.match ? getFilteredPackages(ctx.session.resolveMap, options.match) : [appPath];\n\n if (!pathsToBundle.length) {\n return {\n message: 'No matching packages found to bundle.',\n exitCode: 1,\n };\n }\n\n // Show completed bundle tasks so the user knows what's happening.\n reporter.setOptions({ ...reporter.getOptions(), showCompleted: true });\n\n let warnPackagesCount = 0;\n let errorPackagesCount = 0;\n let successPackagesCount = 0;\n\n for (const packagePath of pathsToBundle) {\n // If outdir is set, resolve relative to the package/app path.\n // Otherwise, use the default path under the cloudpack cache to stay consistent with init and start,\n // and to avoid potentially messing with the package's original output.\n const outputPath = options.outdir ? path.resolve(packagePath, options.outdir) : undefined;\n\n const definition = await ctx.packages.get(packagePath);\n\n const { result } = await ensurePackageBundled({\n input: {\n name: definition.name,\n version: definition.version,\n outputPath,\n disableSourceMaps: options.disableSourceMaps,\n shouldForce: true,\n isIncremental: false,\n },\n ctx,\n });\n\n console.log('Output:', result.outputPath, '\\n');\n\n if (result.errors?.length) {\n errorPackagesCount++;\n } else if (result.warnings?.length) {\n warnPackagesCount++;\n } else {\n successPackagesCount++;\n }\n }\n\n const status = [\n errorPackagesCount && red(plural(errorPackagesCount, 'package$s failed')),\n warnPackagesCount && yellow(plural(warnPackagesCount, 'package$s succeeded with warnings')),\n successPackagesCount && plural(successPackagesCount, 'package$s succeeded'),\n ]\n .filter(Boolean)\n .join(', ');\n\n return {\n message: `Bundling ${status}\\n`,\n hasErrors: !!errorPackagesCount,\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,UAAU,YAAY;CAAG;AAEzB,iCAAiC;AACjC,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CAwB/C,CAAC"}
1
+ {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,UAAU,YAAY;CAAG;AAEzB,iCAAiC;AACjC,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CAkB/C,CAAC"}
@@ -2,25 +2,20 @@ import { getCachePath } from '@ms-cloudpack/config';
2
2
  import fsPromises from 'fs/promises';
3
3
  /** Clear the Cloudpack cache. */
4
4
  export const execute = async (params) => {
5
- const { cwd, initialize, exit, options } = params;
5
+ const { cwd, initialize, options } = params;
6
6
  await initialize({ appPath: cwd });
7
7
  const cachePath = await getCachePath(options.cachePath);
8
8
  const cacheDescription = `the Cloudpack cache (${cachePath})`;
9
- let message;
10
- let hasErrors = false;
11
9
  try {
12
10
  // NOTE: if the method used here changes, be sure to update what cache.e2e.test.ts spies on
13
11
  await fsPromises.rm(cachePath, { recursive: true, force: true });
14
- message = `Successfully cleared ${cacheDescription}`;
15
- hasErrors = false;
12
+ return { message: `Successfully cleared ${cacheDescription}` };
16
13
  }
17
14
  catch (err) {
18
- message = `Failed to clear ${cacheDescription}: ${err.message || err}`;
19
- hasErrors = true;
15
+ return {
16
+ message: `Failed to clear ${cacheDescription}: ${err.message || err}`,
17
+ hasErrors: true,
18
+ };
20
19
  }
21
- await exit({
22
- exitCode: hasErrors ? 1 : 0,
23
- message,
24
- });
25
20
  };
26
21
  //# sourceMappingURL=clean.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,UAAU,MAAM,aAAa,CAAC;AAKrC,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAgC,KAAK,EAAE,MAAM,EAAE,EAAE;IACnE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAElD,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,wBAAwB,SAAS,GAAG,CAAC;IAC9D,IAAI,OAAe,CAAC;IACpB,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,IAAI,CAAC;QACH,2FAA2F;QAC3F,MAAM,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,OAAO,GAAG,wBAAwB,gBAAgB,EAAE,CAAC;QACrD,SAAS,GAAG,KAAK,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,mBAAmB,gBAAgB,KAAM,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;QAClF,SAAS,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,CAAC;QACT,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO;KACR,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { getCachePath } from '@ms-cloudpack/config';\nimport fsPromises from 'fs/promises';\nimport type { CommandAction } from '../../types/CommandAction.js';\n\ninterface CleanOptions {}\n\n/** Clear the Cloudpack cache. */\nexport const execute: CommandAction<CleanOptions> = async (params) => {\n const { cwd, initialize, exit, options } = params;\n\n await initialize({ appPath: cwd });\n\n const cachePath = await getCachePath(options.cachePath);\n const cacheDescription = `the Cloudpack cache (${cachePath})`;\n let message: string;\n let hasErrors = false;\n\n try {\n // NOTE: if the method used here changes, be sure to update what cache.e2e.test.ts spies on\n await fsPromises.rm(cachePath, { recursive: true, force: true });\n message = `Successfully cleared ${cacheDescription}`;\n hasErrors = false;\n } catch (err) {\n message = `Failed to clear ${cacheDescription}: ${(err as Error).message || err}`;\n hasErrors = true;\n }\n\n await exit({\n exitCode: hasErrors ? 1 : 0,\n message,\n });\n};\n"]}
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,UAAU,MAAM,aAAa,CAAC;AAKrC,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAgC,KAAK,EAAE,MAAM,EAAE,EAAE;IACnE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE5C,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,wBAAwB,SAAS,GAAG,CAAC;IAE9D,IAAI,CAAC;QACH,2FAA2F;QAC3F,MAAM,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,OAAO,EAAE,OAAO,EAAE,wBAAwB,gBAAgB,EAAE,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,mBAAmB,gBAAgB,KAAM,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;YAChF,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { getCachePath } from '@ms-cloudpack/config';\nimport fsPromises from 'fs/promises';\nimport type { CommandAction } from '../../types/CommandAction.js';\n\ninterface CleanOptions {}\n\n/** Clear the Cloudpack cache. */\nexport const execute: CommandAction<CleanOptions> = async (params) => {\n const { cwd, initialize, options } = params;\n\n await initialize({ appPath: cwd });\n\n const cachePath = await getCachePath(options.cachePath);\n const cacheDescription = `the Cloudpack cache (${cachePath})`;\n\n try {\n // NOTE: if the method used here changes, be sure to update what cache.e2e.test.ts spies on\n await fsPromises.rm(cachePath, { recursive: true, force: true });\n return { message: `Successfully cleared ${cacheDescription}` };\n } catch (err) {\n return {\n message: `Failed to clear ${cacheDescription}: ${(err as Error).message || err}`,\n hasErrors: true,\n };\n }\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import { updateUserPreference } from '@ms-cloudpack/config';
2
2
  /** Delete a Cloudpack user preference value. */
3
3
  export const execute = async (params) => {
4
- const { cwd, args, initialize, exit } = params;
4
+ const { cwd, args, initialize } = params;
5
5
  const key = args[0];
6
6
  await initialize({ appPath: cwd });
7
7
  try {
@@ -10,13 +10,13 @@ export const execute = async (params) => {
10
10
  await updateUserPreference({ key, deleteValue: true });
11
11
  // Following the pattern of other tools, we don't output anything on success,
12
12
  // or if the key was valid but didn't exist.
13
- await exit({ message: '' });
13
+ return { message: '' };
14
14
  }
15
15
  catch (err) {
16
- await exit({
16
+ return {
17
17
  hasErrors: true,
18
18
  message: `Failed to delete "${key}": ${err.message || err}`,
19
- });
19
+ };
20
20
  }
21
21
  };
22
22
  //# sourceMappingURL=delete.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/config/delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAQ5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,MAAM,EAAE,EAAE;IACpE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA0B,CAAC;IAE7C,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,qFAAqF;QACrF,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,6EAA6E;QAC7E,4CAA4C;QAC5C,MAAM,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,CAAC;YACT,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,qBAAqB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACvE,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { UserPreferences } from '@ms-cloudpack/common-types';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { updateUserPreference } from '@ms-cloudpack/config';\n\nexport interface DeleteOptions {}\n\nexport interface DeleteArguments {\n key: string;\n}\n\n/** Delete a Cloudpack user preference value. */\nexport const execute: CommandAction<DeleteOptions> = async (params) => {\n const { cwd, args, initialize, exit } = params;\n const key = args[0] as keyof UserPreferences;\n\n await initialize({ appPath: cwd });\n\n try {\n // Commander should have validated the key based on the given choices, and the update\n // function will also validate its input.\n await updateUserPreference({ key, deleteValue: true });\n // Following the pattern of other tools, we don't output anything on success,\n // or if the key was valid but didn't exist.\n await exit({ message: '' });\n } catch (err) {\n await exit({\n hasErrors: true,\n message: `Failed to delete \"${key}\": ${(err as Error).message || err}`,\n });\n }\n};\n"]}
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/config/delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAQ5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,MAAM,EAAE,EAAE;IACpE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACzC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA0B,CAAC;IAE7C,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,qFAAqF;QACrF,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,6EAA6E;QAC7E,4CAA4C;QAC5C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,qBAAqB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACvE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { UserPreferences } from '@ms-cloudpack/common-types';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { updateUserPreference } from '@ms-cloudpack/config';\n\nexport interface DeleteOptions {}\n\nexport interface DeleteArguments {\n key: string;\n}\n\n/** Delete a Cloudpack user preference value. */\nexport const execute: CommandAction<DeleteOptions> = async (params) => {\n const { cwd, args, initialize } = params;\n const key = args[0] as keyof UserPreferences;\n\n await initialize({ appPath: cwd });\n\n try {\n // Commander should have validated the key based on the given choices, and the update\n // function will also validate its input.\n await updateUserPreference({ key, deleteValue: true });\n // Following the pattern of other tools, we don't output anything on success,\n // or if the key was valid but didn't exist.\n return { message: '' };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to delete \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import { allUserPreferences, readUserPreferences } from '@ms-cloudpack/config';
2
2
  /** Get a Cloudpack user preference value. */
3
3
  export const execute = async (params) => {
4
- const { cwd, args, initialize, exit } = params;
4
+ const { cwd, args, initialize } = params;
5
5
  // Commander should have validated the key based on the given choices.
6
6
  const key = args[0];
7
7
  await initialize({ appPath: cwd });
@@ -10,15 +10,15 @@ export const execute = async (params) => {
10
10
  throw new Error(`Invalid key name`);
11
11
  }
12
12
  const userPreferences = await readUserPreferences();
13
- await exit({
13
+ return {
14
14
  message: `${userPreferences[key] || ''}`,
15
- });
15
+ };
16
16
  }
17
17
  catch (err) {
18
- await exit({
18
+ return {
19
19
  hasErrors: true,
20
20
  message: `Failed to get "${key}": ${err.message || err}`,
21
- });
21
+ };
22
22
  }
23
23
  };
24
24
  //# sourceMappingURL=get.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/config/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAQ/E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAA8B,KAAK,EAAE,MAAM,EAAE,EAAE;IACjE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC/C,sEAAsE;IACtE,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA0B,CAAC;IAE7C,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACpD,MAAM,IAAI,CAAC;YACT,OAAO,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;SACzC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,CAAC;YACT,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,kBAAkB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACpE,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { UserPreferences } from '@ms-cloudpack/common-types';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { allUserPreferences, readUserPreferences } from '@ms-cloudpack/config';\n\nexport interface GetOptions {}\n\nexport interface GetArguments {\n key: string;\n}\n\n/** Get a Cloudpack user preference value. */\nexport const execute: CommandAction<GetOptions> = async (params) => {\n const { cwd, args, initialize, exit } = params;\n // Commander should have validated the key based on the given choices.\n const key = args[0] as keyof UserPreferences;\n\n await initialize({ appPath: cwd });\n\n try {\n if (!allUserPreferences[key]) {\n throw new Error(`Invalid key name`);\n }\n\n const userPreferences = await readUserPreferences();\n await exit({\n message: `${userPreferences[key] || ''}`,\n });\n } catch (err) {\n await exit({\n hasErrors: true,\n message: `Failed to get \"${key}\": ${(err as Error).message || err}`,\n });\n }\n};\n"]}
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/config/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAQ/E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAA8B,KAAK,EAAE,MAAM,EAAE,EAAE;IACjE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACzC,sEAAsE;IACtE,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA0B,CAAC;IAE7C,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACpD,OAAO;YACL,OAAO,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;SACzC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,kBAAkB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACpE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { UserPreferences } from '@ms-cloudpack/common-types';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { allUserPreferences, readUserPreferences } from '@ms-cloudpack/config';\n\nexport interface GetOptions {}\n\nexport interface GetArguments {\n key: string;\n}\n\n/** Get a Cloudpack user preference value. */\nexport const execute: CommandAction<GetOptions> = async (params) => {\n const { cwd, args, initialize } = params;\n // Commander should have validated the key based on the given choices.\n const key = args[0] as keyof UserPreferences;\n\n await initialize({ appPath: cwd });\n\n try {\n if (!allUserPreferences[key]) {\n throw new Error(`Invalid key name`);\n }\n\n const userPreferences = await readUserPreferences();\n return {\n message: `${userPreferences[key] || ''}`,\n };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to get \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
@@ -1,21 +1,21 @@
1
1
  import { readUserPreferences } from '@ms-cloudpack/config';
2
2
  /** List Cloudpack user preferences. */
3
3
  export const execute = async (params) => {
4
- const { cwd, initialize, exit } = params;
4
+ const { cwd, initialize } = params;
5
5
  await initialize({ appPath: cwd });
6
6
  try {
7
7
  const userPreferences = await readUserPreferences();
8
- await exit({
8
+ return {
9
9
  message: Object.entries(userPreferences)
10
10
  .map(([key, value]) => `${key}: ${value}`)
11
11
  .join('\n'),
12
- });
12
+ };
13
13
  }
14
14
  catch (err) {
15
- await exit({
15
+ return {
16
16
  hasErrors: true,
17
17
  message: `Failed to list preferences: ${err.message || err}`,
18
- });
18
+ };
19
19
  }
20
20
  };
21
21
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/config/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAI3D,uCAAuC;AACvC,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,EAAE,MAAM,EAAE,EAAE;IAClE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACzC,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACpD,MAAM,IAAI,CAAC;YACT,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;iBACrC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;iBACzC,IAAI,CAAC,IAAI,CAAC;SACd,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,CAAC;YACT,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,+BAAgC,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACxE,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport { readUserPreferences } from '@ms-cloudpack/config';\n\nexport interface ListOptions {}\n\n/** List Cloudpack user preferences. */\nexport const execute: CommandAction<ListOptions> = async (params) => {\n const { cwd, initialize, exit } = params;\n await initialize({ appPath: cwd });\n\n try {\n const userPreferences = await readUserPreferences();\n await exit({\n message: Object.entries(userPreferences)\n .map(([key, value]) => `${key}: ${value}`)\n .join('\\n'),\n });\n } catch (err) {\n await exit({\n hasErrors: true,\n message: `Failed to list preferences: ${(err as Error).message || err}`,\n });\n }\n};\n"]}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/config/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAI3D,uCAAuC;AACvC,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,EAAE,MAAM,EAAE,EAAE;IAClE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACpD,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;iBACrC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;iBACzC,IAAI,CAAC,IAAI,CAAC;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,+BAAgC,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACxE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport { readUserPreferences } from '@ms-cloudpack/config';\n\nexport interface ListOptions {}\n\n/** List Cloudpack user preferences. */\nexport const execute: CommandAction<ListOptions> = async (params) => {\n const { cwd, initialize } = params;\n await initialize({ appPath: cwd });\n\n try {\n const userPreferences = await readUserPreferences();\n return {\n message: Object.entries(userPreferences)\n .map(([key, value]) => `${key}: ${value}`)\n .join('\\n'),\n };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to list preferences: ${(err as Error).message || err}`,\n };\n }\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import { updateUserPreference } from '@ms-cloudpack/config';
2
2
  /** Delete a Cloudpack user preference value. */
3
3
  export const execute = async (params) => {
4
- const { cwd, args, initialize, exit } = params;
4
+ const { cwd, args, initialize } = params;
5
5
  const [key, newValue] = args;
6
6
  await initialize({ appPath: cwd });
7
7
  try {
@@ -9,13 +9,13 @@ export const execute = async (params) => {
9
9
  // function will also validate its input.
10
10
  await updateUserPreference({ key: key, newValue });
11
11
  // Following the pattern of other tools, we don't output anything on success.
12
- await exit({ message: '' });
12
+ return { message: '' };
13
13
  }
14
14
  catch (err) {
15
- await exit({
15
+ return {
16
16
  hasErrors: true,
17
17
  message: `Failed to set "${key}": ${err.message || err}`,
18
- });
18
+ };
19
19
  }
20
20
  };
21
21
  //# sourceMappingURL=set.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/config/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAW5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,OAAO,GAA8B,KAAK,EAAE,MAAM,EAAE,EAAE;IACjE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;IAE7B,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,qFAAqF;QACrF,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,EAAE,GAAG,EAAE,GAA4B,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5E,6EAA6E;QAC7E,MAAM,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,CAAC;YACT,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,kBAAkB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACpE,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { updateUserPreference } from '@ms-cloudpack/config';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { UserPreferences } from '@ms-cloudpack/common-types';\n\nexport interface SetOptions {}\n\nexport interface SetArguments {\n key: string;\n value: string;\n}\n\n/** Delete a Cloudpack user preference value. */\nexport const execute: CommandAction<SetOptions> = async (params) => {\n const { cwd, args, initialize, exit } = params;\n const [key, newValue] = args;\n\n await initialize({ appPath: cwd });\n\n try {\n // Commander should have validated the key based on the given choices, and the update\n // function will also validate its input.\n await updateUserPreference({ key: key as keyof UserPreferences, newValue });\n // Following the pattern of other tools, we don't output anything on success.\n await exit({ message: '' });\n } catch (err) {\n await exit({\n hasErrors: true,\n message: `Failed to set \"${key}\": ${(err as Error).message || err}`,\n });\n }\n};\n"]}
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/config/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAW5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,OAAO,GAA8B,KAAK,EAAE,MAAM,EAAE,EAAE;IACjE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACzC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;IAE7B,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,qFAAqF;QACrF,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,EAAE,GAAG,EAAE,GAA4B,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5E,6EAA6E;QAC7E,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,kBAAkB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACpE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { updateUserPreference } from '@ms-cloudpack/config';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { UserPreferences } from '@ms-cloudpack/common-types';\n\nexport interface SetOptions {}\n\nexport interface SetArguments {\n key: string;\n value: string;\n}\n\n/** Delete a Cloudpack user preference value. */\nexport const execute: CommandAction<SetOptions> = async (params) => {\n const { cwd, args, initialize } = params;\n const [key, newValue] = args;\n\n await initialize({ appPath: cwd });\n\n try {\n // Commander should have validated the key based on the given choices, and the update\n // function will also validate its input.\n await updateUserPreference({ key: key as keyof UserPreferences, newValue });\n // Following the pattern of other tools, we don't output anything on success.\n return { message: '' };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to set \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/commands/info/lockFile/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAKrE,UAAU,eAAe;CAAG;AAE5B,6CAA6C;AAC7C,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,eAAe,CAyBlD,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/commands/info/lockFile/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAKrE,UAAU,eAAe;CAAG;AAE5B,6CAA6C;AAC7C,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,eAAe,CAqBlD,CAAC"}
@@ -3,28 +3,24 @@ import { readYarnLock } from './readYarnLock.js';
3
3
  import { processYarnLock } from './processYarnLock.js';
4
4
  /** Executor for the "info lock-file" verb */
5
5
  export const execute = async (params) => {
6
- const { cwd, initialize, exit } = params;
6
+ const { cwd, initialize } = params;
7
7
  await initialize({ appPath: cwd });
8
- let message;
9
- let success = false;
10
8
  try {
11
9
  // This returns either the lock file contents or an error message
12
10
  const lockResult = await readYarnLock(cwd);
13
11
  if (typeof lockResult === 'string') {
14
- message = lockResult;
15
- }
16
- else {
17
- const resolvedVersions = processYarnLock(lockResult);
18
- message = checkResolvedVersions(resolvedVersions);
19
- success = true;
12
+ return { message: lockResult, hasErrors: true };
20
13
  }
14
+ const resolvedVersions = processYarnLock(lockResult);
15
+ return {
16
+ message: checkResolvedVersions(resolvedVersions),
17
+ };
21
18
  }
22
19
  catch (err) {
23
- message = `Error getting info from lockfile: ${err.stack || err}`;
20
+ return {
21
+ message: `Error getting info from lockfile: ${err.stack || err}`,
22
+ hasErrors: true,
23
+ };
24
24
  }
25
- await exit({
26
- exitCode: success ? 0 : 1,
27
- message,
28
- });
29
25
  };
30
26
  //# sourceMappingURL=execute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/info/lockFile/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAmC,KAAK,EAAE,MAAM,EAAE,EAAE;IACtE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACzC,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,OAAe,CAAC;IACpB,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO,GAAG,UAAU,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,MAAM,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;YACrD,OAAO,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;YAClD,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,qCAAsC,GAAa,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;IAC/E,CAAC;IAED,MAAM,IAAI,CAAC;QACT,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO;KACR,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../../types/CommandAction.js';\nimport { checkResolvedVersions } from './checkResolvedVersions.js';\nimport { readYarnLock } from './readYarnLock.js';\nimport { processYarnLock } from './processYarnLock.js';\n\ninterface LockFileOptions {}\n\n/** Executor for the \"info lock-file\" verb */\nexport const execute: CommandAction<LockFileOptions> = async (params) => {\n const { cwd, initialize, exit } = params;\n await initialize({ appPath: cwd });\n\n let message: string;\n let success = false;\n\n try {\n // This returns either the lock file contents or an error message\n const lockResult = await readYarnLock(cwd);\n if (typeof lockResult === 'string') {\n message = lockResult;\n } else {\n const resolvedVersions = processYarnLock(lockResult);\n message = checkResolvedVersions(resolvedVersions);\n success = true;\n }\n } catch (err) {\n message = `Error getting info from lockfile: ${(err as Error).stack || err}`;\n }\n\n await exit({\n exitCode: success ? 0 : 1,\n message,\n });\n};\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/info/lockFile/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAmC,KAAK,EAAE,MAAM,EAAE,EAAE;IACtE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAClD,CAAC;QAED,MAAM,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO;YACL,OAAO,EAAE,qBAAqB,CAAC,gBAAgB,CAAC;SACjD,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,qCAAsC,GAAa,CAAC,KAAK,IAAI,GAAG,EAAE;YAC3E,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../../types/CommandAction.js';\nimport { checkResolvedVersions } from './checkResolvedVersions.js';\nimport { readYarnLock } from './readYarnLock.js';\nimport { processYarnLock } from './processYarnLock.js';\n\ninterface LockFileOptions {}\n\n/** Executor for the \"info lock-file\" verb */\nexport const execute: CommandAction<LockFileOptions> = async (params) => {\n const { cwd, initialize } = params;\n await initialize({ appPath: cwd });\n\n try {\n // This returns either the lock file contents or an error message\n const lockResult = await readYarnLock(cwd);\n if (typeof lockResult === 'string') {\n return { message: lockResult, hasErrors: true };\n }\n\n const resolvedVersions = processYarnLock(lockResult);\n return {\n message: checkResolvedVersions(resolvedVersions),\n };\n } catch (err) {\n return {\n message: `Error getting info from lockfile: ${(err as Error).stack || err}`,\n hasErrors: true,\n };\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/commands/info/nonSemverDeps/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGrE,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,mDAAmD;AACnD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAkBvD,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/commands/info/nonSemverDeps/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGrE,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,mDAAmD;AACnD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAcvD,CAAC"}
@@ -1,20 +1,18 @@
1
1
  import { getNonSemverDeps } from './getNonSemverDeps.js';
2
2
  /** Executor for the "info non-semver-deps" verb */
3
3
  export const execute = async (params) => {
4
- const { options, cwd, initialize, exit } = params;
4
+ const { options, cwd, initialize } = params;
5
5
  await initialize({ appPath: cwd });
6
- let message;
7
- let success = false;
8
6
  try {
9
- message = await getNonSemverDeps({ ...options, cwd });
10
- success = true;
7
+ return {
8
+ message: await getNonSemverDeps({ ...options, cwd }),
9
+ };
11
10
  }
12
11
  catch (err) {
13
- message = `Error attempting to get non-semver deps: ${err.stack || err}`;
12
+ return {
13
+ message: `Error attempting to get non-semver deps: ${err.stack || err}`,
14
+ hasErrors: true,
15
+ };
14
16
  }
15
- await exit({
16
- exitCode: success ? 0 : 1,
17
- message,
18
- });
19
17
  };
20
18
  //# sourceMappingURL=execute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/info/nonSemverDeps/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,mDAAmD;AACnD,MAAM,CAAC,MAAM,OAAO,GAAwC,KAAK,EAAE,MAAM,EAAE,EAAE;IAC3E,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAClD,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,OAAe,CAAC;IACpB,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,gBAAgB,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;QACtD,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,4CAA6C,GAAa,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;IACtF,CAAC;IAED,MAAM,IAAI,CAAC;QACT,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO;KACR,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../../types/CommandAction.js';\nimport { getNonSemverDeps } from './getNonSemverDeps.js';\n\nexport interface NonSemverDepsOptions {\n /** Only get production deps */\n prod?: boolean;\n}\n\n/** Executor for the \"info non-semver-deps\" verb */\nexport const execute: CommandAction<NonSemverDepsOptions> = async (params) => {\n const { options, cwd, initialize, exit } = params;\n await initialize({ appPath: cwd });\n\n let message: string;\n let success = false;\n\n try {\n message = await getNonSemverDeps({ ...options, cwd });\n success = true;\n } catch (err) {\n message = `Error attempting to get non-semver deps: ${(err as Error).stack || err}`;\n }\n\n await exit({\n exitCode: success ? 0 : 1,\n message,\n });\n};\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/info/nonSemverDeps/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,mDAAmD;AACnD,MAAM,CAAC,MAAM,OAAO,GAAwC,KAAK,EAAE,MAAM,EAAE,EAAE;IAC3E,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC5C,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,OAAO;YACL,OAAO,EAAE,MAAM,gBAAgB,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,CAAC;SACrD,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,4CAA6C,GAAa,CAAC,KAAK,IAAI,GAAG,EAAE;YAClF,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../../types/CommandAction.js';\nimport { getNonSemverDeps } from './getNonSemverDeps.js';\n\nexport interface NonSemverDepsOptions {\n /** Only get production deps */\n prod?: boolean;\n}\n\n/** Executor for the \"info non-semver-deps\" verb */\nexport const execute: CommandAction<NonSemverDepsOptions> = async (params) => {\n const { options, cwd, initialize } = params;\n await initialize({ appPath: cwd });\n\n try {\n return {\n message: await getNonSemverDeps({ ...options, cwd }),\n };\n } catch (err) {\n return {\n message: `Error attempting to get non-semver deps: ${(err as Error).stack || err}`,\n hasErrors: true,\n };\n }\n};\n"]}
@@ -4,7 +4,7 @@ import { findCloudpackAppPaths } from '../../utilities/findCloudpackAppPaths.js'
4
4
  import { InitSummaryData } from './InitSummaryData.js';
5
5
  /** Given the path, updates the Cloudpack config with overrides and project settings. */
6
6
  export const execute = async (params) => {
7
- const { options, cwd, initialize, exit, autoDispose, setInterruptMessageHandler } = params;
7
+ const { options, cwd, initialize, autoDispose, setInterruptMessageHandler } = params;
8
8
  const appPaths = findCloudpackAppPaths(cwd);
9
9
  // `findCloudpackAppPaths` will only return an array of paths in which cloudpack.config.json was found.
10
10
  // To ensure initialize can be run even if no cloudpack.config.json was found, we use the cwd directory as a fallback.
@@ -16,9 +16,9 @@ export const execute = async (params) => {
16
16
  isInterrupted: true,
17
17
  }));
18
18
  const summaries = await init({ appSummaries, options, contexts, autoDispose });
19
- await exit({
20
- exitCode: summaries.some((summary) => summary.failed) ? 1 : 0,
19
+ return {
20
+ hasErrors: summaries.some((summary) => summary.failed),
21
21
  message: formatInitSummary({ summaries, options }),
22
- });
22
+ };
23
23
  };
24
24
  //# sourceMappingURL=execute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/init/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,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AE,OAAO,EAAE,CAAC;KACnD,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { InitOptions } from './types/InitOptions.js';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { init } from './init.js';\nimport { formatInitSummary } from './formatInitSummary.js';\nimport { findCloudpackAppPaths } from '../../utilities/findCloudpackAppPaths.js';\nimport { InitSummaryData } from './InitSummaryData.js';\n\n/** Given the path, updates the Cloudpack config with overrides and project settings. */\nexport const execute: CommandAction<InitOptions> = async (params) => {\n const { options, cwd, initialize, exit, autoDispose, setInterruptMessageHandler } = params;\n\n const appPaths = findCloudpackAppPaths(cwd);\n\n // `findCloudpackAppPaths` will only return an array of paths in which cloudpack.config.json was found.\n // To ensure initialize can be run even if no cloudpack.config.json was found, we use the cwd directory as a fallback.\n const contexts = await initialize({ appPaths: appPaths.length > 0 ? appPaths : [cwd] });\n\n const appSummaries = Object.fromEntries(\n contexts.map((context) => [context.appPath, new InitSummaryData(context.appPath)]),\n );\n\n setInterruptMessageHandler(() =>\n formatInitSummary({\n summaries: Object.values(appSummaries).map((s) => s.summarize(options)),\n options,\n isInterrupted: true,\n }),\n );\n\n const summaries = await init({ appSummaries, options, contexts, autoDispose });\n\n await exit({\n exitCode: summaries.some((summary) => summary.failed) ? 1 : 0,\n message: formatInitSummary({ summaries, options }),\n });\n};\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/init/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,wFAAwF;AACxF,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,EAAE,MAAM,EAAE,EAAE;IAClE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,0BAA0B,EAAE,GAAG,MAAM,CAAC;IAErF,MAAM,QAAQ,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAE5C,uGAAuG;IACvG,sHAAsH;IACtH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAExF,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CACrC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CACnF,CAAC;IAEF,0BAA0B,CAAC,GAAG,EAAE,CAC9B,iBAAiB,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACvE,OAAO;QACP,aAAa,EAAE,IAAI;KACpB,CAAC,CACH,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;IAE/E,OAAO;QACL,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;QACtD,OAAO,EAAE,iBAAiB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;KACnD,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { InitOptions } from './types/InitOptions.js';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { init } from './init.js';\nimport { formatInitSummary } from './formatInitSummary.js';\nimport { findCloudpackAppPaths } from '../../utilities/findCloudpackAppPaths.js';\nimport { InitSummaryData } from './InitSummaryData.js';\n\n/** Given the path, updates the Cloudpack config with overrides and project settings. */\nexport const execute: CommandAction<InitOptions> = async (params) => {\n const { options, cwd, initialize, autoDispose, setInterruptMessageHandler } = params;\n\n const appPaths = findCloudpackAppPaths(cwd);\n\n // `findCloudpackAppPaths` will only return an array of paths in which cloudpack.config.json was found.\n // To ensure initialize can be run even if no cloudpack.config.json was found, we use the cwd directory as a fallback.\n const contexts = await initialize({ appPaths: appPaths.length > 0 ? appPaths : [cwd] });\n\n const appSummaries = Object.fromEntries(\n contexts.map((context) => [context.appPath, new InitSummaryData(context.appPath)]),\n );\n\n setInterruptMessageHandler(() =>\n formatInitSummary({\n summaries: Object.values(appSummaries).map((s) => s.summarize(options)),\n options,\n isInterrupted: true,\n }),\n );\n\n const summaries = await init({ appSummaries, options, contexts, autoDispose });\n\n return {\n hasErrors: summaries.some((summary) => summary.failed),\n message: formatInitSummary({ summaries, options }),\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/link/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAO1D;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,WAAW,CAuD9C,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/link/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAO1D;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,WAAW,CA2D9C,CAAC"}
@@ -8,7 +8,7 @@ import path from 'path';
8
8
  */
9
9
  export const execute = async (params) => {
10
10
  // Use the current directory as the default package path.
11
- const { options, cwd: appPath, reporter, initialize, exit } = params;
11
+ const { options, cwd: appPath, reporter, initialize } = params;
12
12
  const { ignore: ignoredPackages, all: includeAll, ignoreResolutions, resolveStrategy, logResolveMap, cachePath, } = options;
13
13
  await initialize({ appPath });
14
14
  console.debug('Linking packages...');
@@ -16,7 +16,11 @@ export const execute = async (params) => {
16
16
  console.debug('Ignored packages:', ignoredPackages?.join(', ') || 'none');
17
17
  console.debug('Apply host resolutions:', !ignoreResolutions);
18
18
  console.debug('Resolve strategy:', resolveStrategy);
19
- const session = await getSessionToLink({ reporter, exit, cachePath });
19
+ const sessionResult = await getSessionToLink({ reporter, cachePath });
20
+ if (!sessionResult.session) {
21
+ return sessionResult;
22
+ }
23
+ const { session } = sessionResult;
20
24
  const client = await createCloudpackClient({ url: session.urls.apiServer, reporter });
21
25
  const includeMessage = includeAll ? ' including all internal paths' : '';
22
26
  const message = `Linking paths for ${session.projectName} at "${appPath}"${includeMessage}`;
@@ -35,7 +39,7 @@ export const execute = async (params) => {
35
39
  if (linkedPaths.find((p) => p.path === appPath) === undefined) {
36
40
  // Close down with an error.
37
41
  task.complete({ status: 'fail', message: `Failed to link paths.`, forceShow: true });
38
- await exit({ exitCode: 1, message: 'Failed to link paths.' });
42
+ return { hasErrors: true, message: 'Failed to link paths.' };
39
43
  }
40
44
  if (logResolveMap) {
41
45
  // Write the linked resolve map to disk.
@@ -44,6 +48,6 @@ export const execute = async (params) => {
44
48
  // Close down successfully.
45
49
  task.complete({ status: 'complete', message: `Linked paths`, forceShow: true });
46
50
  const linkSummary = formatLinkSummary({ session, resolveMap, linkedPaths, resolveStrategy });
47
- await exit({ exitCode: 0, message: linkSummary });
51
+ return { message: linkSummary };
48
52
  };
49
53
  //# sourceMappingURL=execute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/link/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAA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IAE7F,MAAM,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport type { LinkOptions } from './types/LinkOptions.js';\nimport { getSessionToLink } from './getSessionToLink.js';\nimport { createCloudpackClient } from '@ms-cloudpack/api-server';\nimport { formatLinkSummary } from './formatLinkSummary.js';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport path from 'path';\n\n/**\n * Defines the \"link\" verb entry point.\n */\nexport const execute: CommandAction<LinkOptions> = async (params) => {\n // Use the current directory as the default package path.\n const { options, cwd: appPath, reporter, initialize, exit } = params;\n const {\n ignore: ignoredPackages,\n all: includeAll,\n ignoreResolutions,\n resolveStrategy,\n logResolveMap,\n cachePath,\n } = options;\n\n await initialize({ appPath });\n\n console.debug('Linking packages...');\n console.debug('Include all:', !!includeAll);\n console.debug('Ignored packages:', ignoredPackages?.join(', ') || 'none');\n console.debug('Apply host resolutions:', !ignoreResolutions);\n console.debug('Resolve strategy:', resolveStrategy);\n\n const session = await getSessionToLink({ reporter, exit, cachePath });\n const client = await createCloudpackClient({ url: session.urls.apiServer, reporter });\n\n const includeMessage = includeAll ? ' including all internal paths' : '';\n const message = `Linking paths for ${session.projectName} at \"${appPath}\"${includeMessage}`;\n const task = reporter.addTask(message);\n\n // Send request to api server to link paths.\n const { resolveMap, linkedPaths } = await client.linkPath.query({\n linkedPath: {\n path: appPath,\n ignoredPackages,\n includeAll,\n ignoreResolutions,\n resolveStrategy,\n },\n });\n await client.close();\n\n if (linkedPaths.find((p) => p.path === appPath) === undefined) {\n // Close down with an error.\n task.complete({ status: 'fail', message: `Failed to link paths.`, forceShow: true });\n await exit({ exitCode: 1, message: 'Failed to link paths.' });\n }\n\n if (logResolveMap) {\n // Write the linked resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map-linked.json'), resolveMap);\n }\n\n // Close down successfully.\n task.complete({ status: 'complete', message: `Linked paths`, forceShow: true });\n const linkSummary = formatLinkSummary({ session, resolveMap, linkedPaths, resolveStrategy });\n\n await exit({ exitCode: 0, message: linkSummary });\n};\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/link/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,EAAE,MAAM,EAAE,EAAE;IAClE,yDAAyD;IACzD,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC/D,MAAM,EACJ,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,UAAU,EACf,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,SAAS,GACV,GAAG,OAAO,CAAC;IAEZ,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAE9B,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC;IAC1E,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC,iBAAiB,CAAC,CAAC;IAC7D,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IAEpD,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,EA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AAC,IAAI,CAAC,OAAO,EAAE,yBAAyB,CAAC,EAAE,UAAU,CAAC,CAAC;IAC7E,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChF,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,CAAC;IAE7F,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport type { LinkOptions } from './types/LinkOptions.js';\nimport { getSessionToLink } from './getSessionToLink.js';\nimport { createCloudpackClient } from '@ms-cloudpack/api-server';\nimport { formatLinkSummary } from './formatLinkSummary.js';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport path from 'path';\n\n/**\n * Defines the \"link\" verb entry point.\n */\nexport const execute: CommandAction<LinkOptions> = async (params) => {\n // Use the current directory as the default package path.\n const { options, cwd: appPath, reporter, initialize } = params;\n const {\n ignore: ignoredPackages,\n all: includeAll,\n ignoreResolutions,\n resolveStrategy,\n logResolveMap,\n cachePath,\n } = options;\n\n await initialize({ appPath });\n\n console.debug('Linking packages...');\n console.debug('Include all:', !!includeAll);\n console.debug('Ignored packages:', ignoredPackages?.join(', ') || 'none');\n console.debug('Apply host resolutions:', !ignoreResolutions);\n console.debug('Resolve strategy:', resolveStrategy);\n\n const sessionResult = await getSessionToLink({ reporter, cachePath });\n if (!sessionResult.session) {\n return sessionResult;\n }\n const { session } = sessionResult;\n const client = await createCloudpackClient({ url: session.urls.apiServer, reporter });\n\n const includeMessage = includeAll ? ' including all internal paths' : '';\n const message = `Linking paths for ${session.projectName} at \"${appPath}\"${includeMessage}`;\n const task = reporter.addTask(message);\n\n // Send request to api server to link paths.\n const { resolveMap, linkedPaths } = await client.linkPath.query({\n linkedPath: {\n path: appPath,\n ignoredPackages,\n includeAll,\n ignoreResolutions,\n resolveStrategy,\n },\n });\n await client.close();\n\n if (linkedPaths.find((p) => p.path === appPath) === undefined) {\n // Close down with an error.\n task.complete({ status: 'fail', message: `Failed to link paths.`, forceShow: true });\n return { hasErrors: true, message: 'Failed to link paths.' };\n }\n\n if (logResolveMap) {\n // Write the linked resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map-linked.json'), resolveMap);\n }\n\n // Close down successfully.\n task.complete({ status: 'complete', message: `Linked paths`, forceShow: true });\n const linkSummary = formatLinkSummary({ session, resolveMap, linkedPaths, resolveStrategy });\n\n return { message: linkSummary };\n};\n"]}
@@ -1,6 +1,6 @@
1
- import type { CommandActionParams } from '../../types/CommandAction.js';
2
- import type { TaskReporter } from '@ms-cloudpack/task-reporter';
3
1
  import type { Session } from '@ms-cloudpack/api-server';
2
+ import type { TaskReporter } from '@ms-cloudpack/task-reporter';
3
+ import type { CommandExitParams } from '../../types/CommandAction.js';
4
4
  type SessionWithRequiredApiServer = Session & {
5
5
  urls: {
6
6
  apiServer: string;
@@ -12,9 +12,10 @@ type SessionWithRequiredApiServer = Session & {
12
12
  */
13
13
  export declare function getSessionToLink(options: {
14
14
  reporter: TaskReporter;
15
- exit: CommandActionParams<object>['exit'];
16
15
  /** Cache path from CLI options */
17
16
  cachePath: string | undefined;
18
- }): Promise<SessionWithRequiredApiServer>;
17
+ }): Promise<CommandExitParams & {
18
+ session?: SessionWithRequiredApiServer;
19
+ }>;
19
20
  export {};
20
21
  //# sourceMappingURL=getSessionToLink.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSessionToLink.d.ts","sourceRoot":"","sources":["../../../src/commands/link/getSessionToLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGxD,KAAK,4BAA4B,GAAG,OAAO,GAAG;IAAE,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAE9E;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1C,kCAAkC;IAClC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAwCxC"}
1
+ {"version":3,"file":"getSessionToLink.d.ts","sourceRoot":"","sources":["../../../src/commands/link/getSessionToLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE,KAAK,4BAA4B,GAAG,OAAO,GAAG;IAAE,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAE9E;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,QAAQ,EAAE,YAAY,CAAC;IACvB,kCAAkC;IAClC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,GAAG,OAAO,CAAC,iBAAiB,GAAG;IAAE,OAAO,CAAC,EAAE,4BAA4B,CAAA;CAAE,CAAC,CAwD1E"}
@@ -1,40 +1,56 @@
1
- import { getActiveSessions } from './getActiveSessions.js';
2
- import { getSessionFromUser } from './getSessionFromUser.js';
3
1
  import { getCachePath } from '@ms-cloudpack/config';
2
+ import prompts from 'prompts';
3
+ import { getActiveSessions } from './getActiveSessions.js';
4
4
  /**
5
5
  * Get a single active session to link packages.
6
6
  * The session must have an API server URL.
7
7
  */
8
8
  export async function getSessionToLink(options) {
9
- const { reporter, exit } = options;
9
+ const { reporter } = options;
10
10
  // Find the list of running sessions.
11
11
  const cachePath = await getCachePath(options.cachePath);
12
12
  const runningSessions = await getActiveSessions({ reporter, cachePath });
13
13
  if (runningSessions.length === 0) {
14
- await exit({
15
- exitCode: 1,
14
+ return {
15
+ hasErrors: true,
16
16
  message: 'No running sessions found. Please start a session using `cloudpack start` first.',
17
- });
17
+ };
18
18
  }
19
19
  console.debug(`Running sessions: ${runningSessions.map((session) => session.id).join(', ')}`);
20
- const runningSessionsMap = new Map(runningSessions.map((session) => [
21
- session.id,
22
- {
23
- title: session.projectName,
24
- description: session.config.appPath + ' ' + session.id,
25
- value: session,
26
- },
27
- ]));
28
20
  // Select a session to link packages.
29
- const session = await getSessionFromUser(runningSessionsMap);
21
+ let session;
22
+ if (runningSessions.length === 1) {
23
+ // Only one session, so use it automatically.
24
+ session = runningSessions[0];
25
+ }
26
+ else {
27
+ // Prompt the user to select a session.
28
+ const response = await prompts({
29
+ type: 'select',
30
+ name: 'value',
31
+ message: 'Select the app you want to link',
32
+ choices: runningSessions
33
+ .map((s) => ({
34
+ title: s.projectName,
35
+ description: s.config.appPath + ' ' + s.id,
36
+ value: s,
37
+ }))
38
+ .sort((s1, s2) => s1.title.localeCompare(s2.title)),
39
+ });
40
+ // value will be undefined if the user presses Ctrl+C
41
+ session = response.value;
42
+ }
43
+ if (!session) {
44
+ return { message: 'Aborting...' };
45
+ }
30
46
  console.debug('Selected session:', session.id);
31
47
  if (!session.urls.apiServer) {
32
48
  // We should never get here, but just in case.
33
- await exit({
34
- exitCode: 1,
35
- message: 'The selected session does not have an API server URL.',
36
- });
49
+ return { hasErrors: true, message: 'The selected session does not have an API server URL.' };
37
50
  }
38
- return session;
51
+ return {
52
+ session: session,
53
+ message: '', // required by the type but not used
54
+ };
39
55
  }
40
56
  //# sourceMappingURL=getSessionToLink.js.map