@ms-cloudpack/cli 0.48.2 → 0.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/lib/commands/bundle/execute.d.ts.map +1 -1
  2. package/lib/commands/bundle/execute.js +6 -2
  3. package/lib/commands/bundle/execute.js.map +1 -1
  4. package/lib/commands/bundle/index.d.ts +3 -2
  5. package/lib/commands/bundle/index.d.ts.map +1 -1
  6. package/lib/commands/bundle/index.js +15 -9
  7. package/lib/commands/bundle/index.js.map +1 -1
  8. package/lib/commands/cache/clean.d.ts +4 -1
  9. package/lib/commands/cache/clean.d.ts.map +1 -1
  10. package/lib/commands/cache/clean.js +3 -2
  11. package/lib/commands/cache/clean.js.map +1 -1
  12. package/lib/commands/cache/index.d.ts +3 -2
  13. package/lib/commands/cache/index.d.ts.map +1 -1
  14. package/lib/commands/cache/index.js +16 -12
  15. package/lib/commands/cache/index.js.map +1 -1
  16. package/lib/commands/init/execute.d.ts.map +1 -1
  17. package/lib/commands/init/execute.js +3 -2
  18. package/lib/commands/init/execute.js.map +1 -1
  19. package/lib/commands/init/index.d.ts +2 -2
  20. package/lib/commands/init/index.d.ts.map +1 -1
  21. package/lib/commands/init/index.js +14 -10
  22. package/lib/commands/init/index.js.map +1 -1
  23. package/lib/commands/start/execute.d.ts.map +1 -1
  24. package/lib/commands/start/execute.js +3 -14
  25. package/lib/commands/start/execute.js.map +1 -1
  26. package/lib/commands/start/index.d.ts +3 -2
  27. package/lib/commands/start/index.d.ts.map +1 -1
  28. package/lib/commands/start/index.js +15 -12
  29. package/lib/commands/start/index.js.map +1 -1
  30. package/lib/commands/start/types/StartOptions.d.ts +0 -2
  31. package/lib/commands/start/types/StartOptions.d.ts.map +1 -1
  32. package/lib/commands/start/types/StartOptions.js.map +1 -1
  33. package/lib/commands/sync/execute.d.ts.map +1 -1
  34. package/lib/commands/sync/execute.js +3 -3
  35. package/lib/commands/sync/execute.js.map +1 -1
  36. package/lib/commands/sync/index.d.ts +2 -2
  37. package/lib/commands/sync/index.d.ts.map +1 -1
  38. package/lib/commands/sync/index.js +13 -9
  39. package/lib/commands/sync/index.js.map +1 -1
  40. package/lib/common/createCommand.d.ts +29 -0
  41. package/lib/common/createCommand.d.ts.map +1 -0
  42. package/lib/common/createCommand.js +41 -0
  43. package/lib/common/createCommand.js.map +1 -0
  44. package/lib/common/createCommandActionFunction.d.ts +6 -11
  45. package/lib/common/createCommandActionFunction.d.ts.map +1 -1
  46. package/lib/common/createCommandActionFunction.js +62 -56
  47. package/lib/common/createCommandActionFunction.js.map +1 -1
  48. package/lib/common/createInitializeFunction.d.ts +11 -2
  49. package/lib/common/createInitializeFunction.d.ts.map +1 -1
  50. package/lib/common/createInitializeFunction.js +22 -5
  51. package/lib/common/createInitializeFunction.js.map +1 -1
  52. package/lib/index.d.ts +2 -8
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +10 -17
  55. package/lib/index.js.map +1 -1
  56. package/lib/initTelemetry.js +2 -2
  57. package/lib/initTelemetry.js.map +1 -1
  58. package/lib/setupReporting.d.ts +7 -2
  59. package/lib/setupReporting.d.ts.map +1 -1
  60. package/lib/setupReporting.js +25 -15
  61. package/lib/setupReporting.js.map +1 -1
  62. package/lib/types/CommandAction.d.ts +32 -5
  63. package/lib/types/CommandAction.d.ts.map +1 -1
  64. package/lib/types/CommandAction.js.map +1 -1
  65. package/lib/types/CommandInitFunction.d.ts +14 -0
  66. package/lib/types/CommandInitFunction.d.ts.map +1 -0
  67. package/lib/types/CommandInitFunction.js +2 -0
  68. package/lib/types/CommandInitFunction.js.map +1 -0
  69. package/lib/types/SharedOptions.d.ts +31 -0
  70. package/lib/types/SharedOptions.d.ts.map +1 -0
  71. package/lib/types/SharedOptions.js +2 -0
  72. package/lib/types/SharedOptions.js.map +1 -0
  73. package/package.json +6 -6
  74. package/lib/types/CommandFunction.d.ts +0 -4
  75. package/lib/types/CommandFunction.d.ts.map +0 -1
  76. package/lib/types/CommandFunction.js +0 -2
  77. package/lib/types/CommandFunction.js.map +0 -1
  78. package/lib/types/CreateCommandActionOptions.d.ts +0 -7
  79. package/lib/types/CreateCommandActionOptions.d.ts.map +0 -1
  80. package/lib/types/CreateCommandActionOptions.js +0 -2
  81. package/lib/types/CreateCommandActionOptions.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,CAwChD,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,CAsChD,CAAC"}
@@ -1,7 +1,11 @@
1
1
  import { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server/apis';
2
2
  import path from 'path';
3
- export const execute = async ({ options, cwd, reporter, initialize, exit, autoDispose, }) => {
4
- const { config, telemetryClient } = await initialize(cwd);
3
+ export const execute = async ({ options, reporter, initialize, exit, autoDispose }) => {
4
+ const { cwd } = options;
5
+ const { config, telemetryClient } = await initialize({
6
+ appPath: cwd,
7
+ overrideOptions: { debug: !process.env.JEST_WORKER_ID },
8
+ });
5
9
  const packagePath = cwd;
6
10
  const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;
7
11
  const [ctx] = autoDispose(await createPartialApiContext({
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],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AAC,CAAC,CAAC,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,uBAAuB","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\n\nimport { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\nimport path from 'path';\n\nexport const execute: CommandAction<BundleOptions> = async ({\n options,\n cwd,\n reporter,\n initialize,\n exit,\n autoDispose,\n}) => {\n const { config, telemetryClient } = await initialize(cwd);\n const packagePath = cwd;\n\n const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n appPath: packagePath,\n config,\n reporter,\n telemetryClient,\n items: ['packages', 'watcher', 'session', 'taskRunner', 'bus'],\n }),\n );\n\n const definition = await ctx.packages.get(packagePath);\n\n const { result } = await ensurePackageBundled({\n input: {\n name: definition?.name ?? '<unknown>',\n version: definition?.version ?? '0.0.0',\n outputPath: path.resolve(packagePath, outdir),\n bundlerType,\n disableSourceMaps,\n shouldForce: true,\n },\n ctx,\n });\n\n await exit({\n exitCode: result?.errors?.length === 0 ? 0 : 1,\n });\n};\n\n// cspell:ignore outdir\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE;IAClH,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,UAAU,CAAC;QACnD,OAAO,EAAE,GAAG;QACZ,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;KACxD,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,GAAG,CAAC;IAExB,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAEzF,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CACvB,MAAM,uBAAuB,CAAC;QAC5B,OAAO,EAAE,WAAW;QACpB,MAAM;QACN,QAAQ;QACR,eAAe;QACf,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC;KAC/D,CAAC,CACH,CAAC;IAEF,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEvD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,oBAAoB,CAAC;QAC5C,KAAK,EAAE;YACL,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;YACrC,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,OAAO;YACvC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;YAC7C,WAAW;YACX,iBAAiB;YACjB,WAAW,EAAE,IAAI;SAClB;QACD,GAAG;KACJ,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC;QACT,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,uBAAuB","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\n\nimport { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\nimport path from 'path';\n\nexport const execute: CommandAction<BundleOptions> = async ({ options, reporter, initialize, exit, autoDispose }) => {\n const { cwd } = options;\n const { config, telemetryClient } = await initialize({\n appPath: cwd,\n overrideOptions: { debug: !process.env.JEST_WORKER_ID },\n });\n\n const packagePath = cwd;\n\n const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n appPath: packagePath,\n config,\n reporter,\n telemetryClient,\n items: ['packages', 'watcher', 'session', 'taskRunner', 'bus'],\n }),\n );\n\n const definition = await ctx.packages.get(packagePath);\n\n const { result } = await ensurePackageBundled({\n input: {\n name: definition?.name ?? '<unknown>',\n version: definition?.version ?? '0.0.0',\n outputPath: path.resolve(packagePath, outdir),\n bundlerType,\n disableSourceMaps,\n shouldForce: true,\n },\n ctx,\n });\n\n await exit({\n exitCode: result?.errors?.length === 0 ? 0 : 1,\n });\n};\n\n// cspell:ignore outdir\n"]}
@@ -1,3 +1,4 @@
1
- import type { CommandFunction } from '../../types/CommandFunction.js';
2
- export declare const init: CommandFunction;
1
+ import type { CommandInitFunction } from '../../types/CommandInitFunction.js';
2
+ /** Defines the "bundle" verb. */
3
+ export declare const init: CommandInitFunction;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,eAAO,MAAM,IAAI,EAAE,eAWlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,iCAAiC;AACjC,eAAO,MAAM,IAAI,EAAE,mBAYlB,CAAC"}
@@ -1,11 +1,17 @@
1
- export const init = (command, createAction) => {
2
- command
3
- .command('bundle')
4
- .option('--bundler <name>', 'Forces use of a specific bundler.')
5
- .option('--outdir <path>', 'Path to drop the bundle output, relative to current path.')
6
- .description('Bundles a package.')
7
- .action(createAction(() => ({
8
- execute: import('./execute.js'),
9
- })));
1
+ import { Option } from 'commander';
2
+ import { createCommand } from '../../common/createCommand.js';
3
+ /** Defines the "bundle" verb. */
4
+ export const init = (program) => {
5
+ createCommand({
6
+ parent: program,
7
+ name: 'bundle',
8
+ description: 'Bundles a package.',
9
+ options: {
10
+ bundler: new Option('--bundler <name>', 'Forces use of a specific bundler.'),
11
+ outdir: new Option('--outdir <path>', 'Path to drop the bundle output, relative to current path.'),
12
+ disableSourceMaps: new Option('--disable-source-maps', 'Disables source maps.'),
13
+ },
14
+ getExecutor: () => import('./execute.js'),
15
+ });
10
16
  };
11
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;IAC7D,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,MAAM,CAAC,kBAAkB,EAAE,mCAAmC,CAAC;SAC/D,MAAM,CAAC,iBAAiB,EAAE,2DAA2D,CAAC;SACtF,WAAW,CAAC,oBAAoB,CAAC;SACjC,MAAM,CACL,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC;KAChC,CAAC,CAAC,CACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\nexport const init: CommandFunction = (command, createAction) => {\n command\n .command('bundle')\n .option('--bundler <name>', 'Forces use of a specific bundler.')\n .option('--outdir <path>', 'Path to drop the bundle output, relative to current path.')\n .description('Bundles a package.')\n .action(\n createAction(() => ({\n execute: import('./execute.js'),\n })),\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9D,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,aAAa,CAAgB;QAC3B,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE;YACP,OAAO,EAAE,IAAI,MAAM,CAAC,kBAAkB,EAAE,mCAAmC,CAAC;YAC5E,MAAM,EAAE,IAAI,MAAM,CAAC,iBAAiB,EAAE,2DAA2D,CAAC;YAClG,iBAAiB,EAAE,IAAI,MAAM,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;SAChF;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport { createCommand } from '../../common/createCommand.js';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\n\n/** Defines the \"bundle\" verb. */\nexport const init: CommandInitFunction = (program) => {\n createCommand<BundleOptions>({\n parent: program,\n name: 'bundle',\n description: 'Bundles a package.',\n options: {\n bundler: new Option('--bundler <name>', 'Forces use of a specific bundler.'),\n outdir: new Option('--outdir <path>', 'Path to drop the bundle output, relative to current path.'),\n disableSourceMaps: new Option('--disable-source-maps', 'Disables source maps.'),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
@@ -1,4 +1,7 @@
1
1
  import type { CommandAction } from '../../types/CommandAction.js';
2
+ interface CleanOptions {
3
+ }
2
4
  /** Clear the Cloudpack cache. */
3
- export declare const execute: CommandAction<undefined>;
5
+ export declare const execute: CommandAction<CleanOptions>;
6
+ export {};
4
7
  //# sourceMappingURL=clean.d.ts.map
@@ -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,iCAAiC;AACjC,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,SAAS,CAqB5C,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,CAsB/C,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { getCachePath } from '@ms-cloudpack/api-server';
2
2
  import fsPromises from 'fs/promises';
3
3
  /** Clear the Cloudpack cache. */
4
- export const execute = async ({ cwd, initialize, exit }) => {
5
- await initialize(cwd);
4
+ export const execute = async ({ options, initialize, exit }) => {
5
+ const { cwd } = options;
6
+ await initialize({ appPath: cwd });
6
7
  const cachePath = getCachePath();
7
8
  const cacheDescription = `the Cloudpack cache (${cachePath})`;
8
9
  let message;
@@ -1 +1 @@
1
- {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,UAAU,MAAM,aAAa,CAAC;AAGrC,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAA6B,KAAK,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;IACnF,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;IAEtB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,wBAAwB,SAAS,GAAG,CAAC;IAC9D,IAAI,OAAe,CAAC;IACpB,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,IAAI;QACF,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;KACnB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,GAAG,mBAAmB,gBAAgB,KAAM,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;QAClF,SAAS,GAAG,IAAI,CAAC;KAClB;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/api-server';\nimport fsPromises from 'fs/promises';\nimport type { CommandAction } from '../../types/CommandAction.js';\n\n/** Clear the Cloudpack cache. */\nexport const execute: CommandAction<undefined> = async ({ cwd, initialize, exit }) => {\n await initialize(cwd);\n\n const cachePath = getCachePath();\n const cacheDescription = `the Cloudpack cache (${cachePath})`;\n let message: string;\n let hasErrors = false;\n\n try {\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,0BAA0B,CAAC;AACxD,OAAO,UAAU,MAAM,aAAa,CAAC;AAKrC,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAgC,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;IAC1F,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxB,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,wBAAwB,SAAS,GAAG,CAAC;IAC9D,IAAI,OAAe,CAAC;IACpB,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,IAAI;QACF,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;KACnB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,GAAG,mBAAmB,gBAAgB,KAAM,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;QAClF,SAAS,GAAG,IAAI,CAAC;KAClB;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/api-server';\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 ({ options, initialize, exit }) => {\n const { cwd } = options;\n await initialize({ appPath: cwd });\n\n const cachePath = getCachePath();\n const cacheDescription = `the Cloudpack cache (${cachePath})`;\n let message: string;\n let hasErrors = false;\n\n try {\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,3 +1,4 @@
1
- import type { CommandFunction } from '../../types/CommandFunction.js';
2
- export declare const init: CommandFunction;
1
+ import type { CommandInitFunction } from '../../types/CommandInitFunction.js';
2
+ /** Defines the "cache" verb. */
3
+ export declare const init: CommandInitFunction;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,eAAO,MAAM,IAAI,EAAE,eAelB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAelB,CAAC"}
@@ -1,14 +1,18 @@
1
- export const init = (command, createAction) => {
2
- const cacheCommand = command
3
- .command('cache')
4
- .description('Operations related to the Cloudpack cache (requires a sub-command).')
5
- .usage('<command>');
6
- cacheCommand
7
- .command('clean')
8
- .description('Clears the Cloudpack cache.')
9
- .alias('clear')
10
- .action(createAction(() => ({
11
- execute: import('./clean.js'),
12
- })));
1
+ import { createCommand } from '../../common/createCommand.js';
2
+ /** Defines the "cache" verb. */
3
+ export const init = (program) => {
4
+ const command = createCommand({
5
+ parent: program,
6
+ name: 'cache',
7
+ description: 'Operations related to the Cloudpack cache (requires a sub-command).',
8
+ });
9
+ command.usage('<command>');
10
+ const cacheCleanCommand = createCommand({
11
+ parent: command,
12
+ name: 'clean',
13
+ description: 'Clears the Cloudpack cache.',
14
+ getExecutor: () => import('./clean.js'),
15
+ });
16
+ cacheCleanCommand.alias('clear');
13
17
  };
14
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;IAC7D,MAAM,YAAY,GAAG,OAAO;SACzB,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,qEAAqE,CAAC;SAClF,KAAK,CAAC,WAAW,CAAC,CAAC;IAEtB,YAAY;SACT,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,6BAA6B,CAAC;SAC1C,KAAK,CAAC,OAAO,CAAC;SACd,MAAM,CACL,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC;KAC9B,CAAC,CAAC,CACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\nexport const init: CommandFunction = (command, createAction) => {\n const cacheCommand = command\n .command('cache')\n .description('Operations related to the Cloudpack cache (requires a sub-command).')\n .usage('<command>');\n\n cacheCommand\n .command('clean')\n .description('Clears the Cloudpack cache.')\n .alias('clear')\n .action(\n createAction(() => ({\n execute: import('./clean.js'),\n })),\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,gCAAgC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,OAAO,GAAG,aAAa,CAAC;QAC5B,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,qEAAqE;KACnF,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE3B,MAAM,iBAAiB,GAAG,aAAa,CAAC;QACtC,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;KACxC,CAAC,CAAC;IACH,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC","sourcesContent":["import { createCommand } from '../../common/createCommand.js';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\n\n/** Defines the \"cache\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const command = createCommand({\n parent: program,\n name: 'cache',\n description: 'Operations related to the Cloudpack cache (requires a sub-command).',\n });\n command.usage('<command>');\n\n const cacheCleanCommand = createCommand({\n parent: command,\n name: 'clean',\n description: 'Clears the Cloudpack cache.',\n getExecutor: () => import('./clean.js'),\n });\n cacheCleanCommand.alias('clear');\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/init/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIlE,wFAAwF;AACxF,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,WAAW,CAmB9C,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/init/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIlE,wFAAwF;AACxF,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,WAAW,CAa9C,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { init } from './init.js';
2
2
  import { formatInitSummary } from './formatInitSummary.js';
3
3
  /** Given the path, updates the Cloudpack config with overrides and project settings. */
4
- export const execute = async ({ options, cwd, initialize, reporter, exit, autoDispose, }) => {
5
- const { config, telemetryClient } = await initialize(cwd);
4
+ export const execute = async ({ options, initialize, reporter, exit, autoDispose }) => {
5
+ const { cwd } = options;
6
+ const { config, telemetryClient } = await initialize({ appPath: cwd });
6
7
  const summary = await init({ options, appPath: cwd, config, reporter, autoDispose, telemetryClient });
7
8
  const message = formatInitSummary(summary, options);
8
9
  const hasErrors = summary.totalErrors > 0;
@@ -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;AAE3D,wFAAwF;AACxF,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,EAAE,EACxD,OAAO,EACP,GAAG,EACH,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;IAE1D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,CAAC;IAEtG,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;IAE1C,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 type { InitOptions } from './types/InitOptions.js';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { init } from './init.js';\nimport { formatInitSummary } from './formatInitSummary.js';\n\n/** Given the path, updates the Cloudpack config with overrides and project settings. */\nexport const execute: CommandAction<InitOptions> = async ({\n options,\n cwd,\n initialize,\n reporter,\n exit,\n autoDispose,\n}) => {\n const { config, telemetryClient } = await initialize(cwd);\n\n const summary = await init({ options, appPath: cwd, config, reporter, autoDispose, telemetryClient });\n\n const message = formatInitSummary(summary, options);\n const hasErrors = summary.totalErrors > 0;\n\n await exit({\n exitCode: hasErrors ? 1 : 0,\n message,\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;AAE3D,wFAAwF;AACxF,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE;IAChH,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEvE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,CAAC;IAEtG,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;IAE1C,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 type { InitOptions } from './types/InitOptions.js';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { init } from './init.js';\nimport { formatInitSummary } from './formatInitSummary.js';\n\n/** Given the path, updates the Cloudpack config with overrides and project settings. */\nexport const execute: CommandAction<InitOptions> = async ({ options, initialize, reporter, exit, autoDispose }) => {\n const { cwd } = options;\n const { config, telemetryClient } = await initialize({ appPath: cwd });\n\n const summary = await init({ options, appPath: cwd, config, reporter, autoDispose, telemetryClient });\n\n const message = formatInitSummary(summary, options);\n const hasErrors = summary.totalErrors > 0;\n\n await exit({\n exitCode: hasErrors ? 1 : 0,\n message,\n });\n};\n"]}
@@ -1,4 +1,4 @@
1
- import type { CommandFunction } from '../../types/CommandFunction.js';
1
+ import type { CommandInitFunction } from '../../types/CommandInitFunction.js';
2
2
  /** Defines the "init" verb. */
3
- export declare const init: CommandFunction;
3
+ export declare const init: CommandInitFunction;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,eAiBlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,mBAgBlB,CAAC"}
@@ -1,13 +1,17 @@
1
+ import { Option } from 'commander';
2
+ import { createCommand } from '../../common/createCommand.js';
1
3
  /** Defines the "init" verb. */
2
- export const init = (command, createAction) => {
3
- command
4
- .command('init')
5
- .description('Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.')
6
- .option('--reset', 'Ignores existing overrides when determining all entries.')
7
- .option('--check', 'Fails if any package exports are missing.')
8
- .option('--match <name><@version>', 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)')
9
- .action(createAction(() => ({
10
- execute: import('./execute.js'),
11
- })));
4
+ export const init = (program) => {
5
+ createCommand({
6
+ parent: program,
7
+ name: 'init',
8
+ description: 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',
9
+ options: {
10
+ reset: new Option('--reset', 'Ignores existing overrides when determining all entries.'),
11
+ check: new Option('--check', 'Fails if any package exports are missing.'),
12
+ match: new Option('--match <name><@version>', 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)'),
13
+ },
14
+ getExecutor: () => import('./execute.js'),
15
+ });
12
16
  };
13
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;IAC7D,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,sIAAsI,CACvI;SACA,MAAM,CAAC,SAAS,EAAE,0DAA0D,CAAC;SAC7E,MAAM,CAAC,SAAS,EAAE,2CAA2C,CAAC;SAC9D,MAAM,CACL,0BAA0B,EAC1B,4FAA4F,CAC7F;SACA,MAAM,CACL,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC;KAChC,CAAC,CAAC,CACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\n/** Defines the \"init\" verb. */\nexport const init: CommandFunction = (command, createAction) => {\n command\n .command('init')\n .description(\n 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',\n )\n .option('--reset', 'Ignores existing overrides when determining all entries.')\n .option('--check', 'Fails if any package exports are missing.')\n .option(\n '--match <name><@version>',\n 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)',\n )\n .action(\n createAction(() => ({\n execute: import('./execute.js'),\n })),\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9D,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,aAAa,CAAc;QACzB,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,sIAAsI;QACxI,OAAO,EAAE;YACP,KAAK,EAAE,IAAI,MAAM,CAAC,SAAS,EAAE,0DAA0D,CAAC;YACxF,KAAK,EAAE,IAAI,MAAM,CAAC,SAAS,EAAE,2CAA2C,CAAC;YACzE,KAAK,EAAE,IAAI,MAAM,CACf,0BAA0B,EAC1B,4FAA4F,CAC7F;SACF;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport { createCommand } from '../../common/createCommand.js';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { InitOptions } from './types/InitOptions.js';\n\n/** Defines the \"init\" verb. */\nexport const init: CommandInitFunction = (program) => {\n createCommand<InitOptions>({\n parent: program,\n name: 'init',\n description:\n 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',\n options: {\n reset: new Option('--reset', 'Ignores existing overrides when determining all entries.'),\n check: new Option('--check', 'Fails if any package exports are missing.'),\n match: new Option(\n '--match <name><@version>',\n 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)',\n ),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAiB5D,wDAAwD;AACxD,wBAAsB,WAAW,kBAKhC;AAqBD;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CA6H/C,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAgB5D,wDAAwD;AACxD,wBAAsB,WAAW,kBAKhC;AAqBD;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CAgH/C,CAAC"}
@@ -7,7 +7,6 @@ import path from 'path';
7
7
  import { fileURLToPath } from 'url';
8
8
  import { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';
9
9
  import { getStartingAppPath } from './getStartingAppPath.js';
10
- import { mergeFeatures } from './mergeFeatures.js';
11
10
  import { openBrowser } from './openBrowser.js';
12
11
  import { runPrerequisites } from '../../common/runPrerequisites.js';
13
12
  let cleanupFunctions = [];
@@ -34,23 +33,13 @@ async function createAppBundleTask(options, context) {
34
33
  /**
35
34
  * Defines the "start" verb entry point.
36
35
  */
37
- export const execute = async ({ options, cwd, initialize, reporter, autoDispose }) => {
36
+ export const execute = async ({ options, initialize, reporter, autoDispose }) => {
37
+ const { cwd } = options;
38
38
  const appPath = await getStartingAppPath(cwd, options.app);
39
- const { config, telemetryClient } = await initialize(appPath);
39
+ const { config, telemetryClient } = await initialize({ appPath });
40
40
  console.log('App path:', yellow(appPath));
41
41
  process.chdir(appPath);
42
42
  runPrerequisites(config, appPath);
43
- // Merge in any additional features from the command line.
44
- config.features = mergeFeatures({
45
- configFeatures: config.features,
46
- commandLineFeatures: options.features,
47
- });
48
- const enabledFeatureNames = Object.entries(config.features)
49
- .filter(([, value]) => value)
50
- .map(([key]) => key);
51
- if (enabledFeatureNames.length) {
52
- console.log(`Enabled features: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);
53
- }
54
43
  // Initialize package overrides.
55
44
  const packages = createPackageDefinitions({ config });
56
45
  // Make sure the package has a valid definition.
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,IAAI,gBAAgB,GAA+B,EAAE,CAAC;AAEtD,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE;QACnC,MAAM,IAAI,EAAE,CAAC;KACd;IACD,gBAAgB,GAAG,EAAE,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,mBAAmB,CAChC,OAAgC,EAChC,OAAyF;IAEzF,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,M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AAC,IAAI,CAAC,UAAU,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;aAC/C;YAAC,OAAO,GAAG,EAAE;gBACZ,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;aAC5C;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,WAAW,CAAC;QACV,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE/B,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC;IAE1B,WAAW,CAAC,OAAO,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;IAEpE,oBAAoB;IACpB,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,EAAE;QAC1B,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YAC7B,sEAAsE;YACtE,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;KAC1D;AACH,CAAC,CAAC;AAEF,wBAAwB","sourcesContent":["import type { Session } from '@ms-cloudpack/api-server';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { StartOptions } from './types/StartOptions.js';\n\nimport { createBundleRequestForPackage, createBundleTask, createSession } from '@ms-cloudpack/api-server';\nimport { createPackageDefinitions } from '@ms-cloudpack/config';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { findResolveMapEntry, resolve } from '@ms-cloudpack/package-utilities';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';\nimport { getStartingAppPath } from './getStartingAppPath.js';\nimport { mergeFeatures } from './mergeFeatures.js';\nimport { openBrowser } from './openBrowser.js';\nimport { runPrerequisites } from '../../common/runPrerequisites.js';\n\nlet cleanupFunctions: Array<() => Promise<void>> = [];\n\n/** Stop all started cloudpack instances, for testing */\nexport async function stopServers() {\n for (const func of cleanupFunctions) {\n await func();\n }\n cleanupFunctions = [];\n}\n\nasync function createAppBundleTask(\n options: { packageName: string },\n context: { session: Session; config: CloudpackConfig; packages: PackageDefinitionsCache },\n) {\n const { packageName } = options;\n const { session } = context;\n const packageEntry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${packageName} in the resolve map.`);\n }\n const bundleRequest = await createBundleRequestForPackage({ packageEntry }, context);\n\n return createBundleTask(bundleRequest);\n}\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport const execute: CommandAction<StartOptions> = async ({ options, cwd, initialize, reporter, autoDispose }) => {\n const appPath = await getStartingAppPath(cwd, options.app);\n const { config, telemetryClient } = await initialize(appPath);\n\n console.log('App path:', yellow(appPath));\n\n process.chdir(appPath);\n\n runPrerequisites(config, appPath);\n\n // Merge in any additional features from the command line.\n config.features = mergeFeatures({\n configFeatures: config.features,\n commandLineFeatures: options.features,\n });\n\n const enabledFeatureNames = Object.entries(config.features)\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n // Initialize package overrides.\n const packages = createPackageDefinitions({ config });\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // Initialize session definition.\n const session = await createSession(\n {\n appPath,\n config,\n overlayPath: await resolve('@ms-cloudpack/overlay', path.dirname(fileURLToPath(import.meta.url))),\n },\n { reporter, packages },\n );\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n telemetryClient.setSharedSpanAttribute('sessionId', session.id);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n const apiServer = await startApiServer({\n session,\n telemetryClient,\n reporter,\n packages,\n });\n\n // Kick off bundling app package as soon as api server is ready.\n void apiServer.addTask(await createAppBundleTask({ packageName: definition.name }, { session, config, packages }));\n\n // Then start bundle and app servers for hosting the app.\n const { startBundleServer } = await import('./startBundleServer.js');\n const bundleServer = await startBundleServer({ apiServer, session, reporter, packages });\n\n // Finally start the app server.\n const { startAppServer } = await import('./appServer/startAppServer.js');\n const appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n packages,\n });\n\n const cleanup = async () => {\n const servers = [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ];\n\n await Promise.all(\n servers.map(async ([name, server]) => {\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server.close();\n console.info(`Closed ${name}: ${server.url}`);\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }),\n );\n };\n\n autoDispose({\n dispose: cleanup,\n });\n\n cleanupFunctions.push(cleanup);\n\n const url = appServer.url;\n\n performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n\n // Open the browser.\n if (options.open !== false) {\n openBrowser(url).catch((err) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.warn('Error opening browser:', err?.stack || err);\n console.warn('Please open the browser manually to:', url);\n });\n } else {\n console.log('Please open the browser manually to:', url);\n }\n};\n\n// cspell:ignore Prereqs\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,IAAI,gBAAgB,GAA+B,EAAE,CAAC;AAEtD,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE;QACnC,MAAM,IAAI,EAAE,CAAC;KACd;IACD,gBAAgB,GAAG,EAAE,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,mBAAmB,CAChC,OAAgC,EAChC,OAAyF;IAEzF,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,MAAM,YAAY,GAAG,mBAAmB,CAAC;QACvC,WAAW;QACX,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,EAAE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AC,CAAC;QAC5D,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;KAC1D;AACH,CAAC,CAAC;AAEF,wBAAwB","sourcesContent":["import type { Session } from '@ms-cloudpack/api-server';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { StartOptions } from './types/StartOptions.js';\n\nimport { createBundleRequestForPackage, createBundleTask, createSession } from '@ms-cloudpack/api-server';\nimport { createPackageDefinitions } from '@ms-cloudpack/config';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { findResolveMapEntry, resolve } from '@ms-cloudpack/package-utilities';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';\nimport { getStartingAppPath } from './getStartingAppPath.js';\nimport { openBrowser } from './openBrowser.js';\nimport { runPrerequisites } from '../../common/runPrerequisites.js';\n\nlet cleanupFunctions: Array<() => Promise<void>> = [];\n\n/** Stop all started cloudpack instances, for testing */\nexport async function stopServers() {\n for (const func of cleanupFunctions) {\n await func();\n }\n cleanupFunctions = [];\n}\n\nasync function createAppBundleTask(\n options: { packageName: string },\n context: { session: Session; config: CloudpackConfig; packages: PackageDefinitionsCache },\n) {\n const { packageName } = options;\n const { session } = context;\n const packageEntry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${packageName} in the resolve map.`);\n }\n const bundleRequest = await createBundleRequestForPackage({ packageEntry }, context);\n\n return createBundleTask(bundleRequest);\n}\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport const execute: CommandAction<StartOptions> = async ({ options, initialize, reporter, autoDispose }) => {\n const { cwd } = options;\n const appPath = await getStartingAppPath(cwd, options.app);\n const { config, telemetryClient } = await initialize({ appPath });\n\n console.log('App path:', yellow(appPath));\n\n process.chdir(appPath);\n\n runPrerequisites(config, appPath);\n\n // Initialize package overrides.\n const packages = createPackageDefinitions({ config });\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // Initialize session definition.\n const session = await createSession(\n {\n appPath,\n config,\n overlayPath: await resolve('@ms-cloudpack/overlay', path.dirname(fileURLToPath(import.meta.url))),\n },\n { reporter, packages },\n );\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n telemetryClient.setSharedSpanAttribute('sessionId', session.id);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n const apiServer = await startApiServer({\n session,\n telemetryClient,\n reporter,\n packages,\n });\n\n // Kick off bundling app package as soon as api server is ready.\n void apiServer.addTask(await createAppBundleTask({ packageName: definition.name }, { session, config, packages }));\n\n // Then start bundle and app servers for hosting the app.\n const { startBundleServer } = await import('./startBundleServer.js');\n const bundleServer = await startBundleServer({ apiServer, session, reporter, packages });\n\n // Finally start the app server.\n const { startAppServer } = await import('./appServer/startAppServer.js');\n const appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n packages,\n });\n\n const cleanup = async () => {\n const servers = [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ];\n\n await Promise.all(\n servers.map(async ([name, server]) => {\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server.close();\n console.info(`Closed ${name}: ${server.url}`);\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }),\n );\n };\n\n autoDispose({\n dispose: cleanup,\n });\n\n cleanupFunctions.push(cleanup);\n\n const url = appServer.url;\n\n performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n\n // Open the browser.\n if (options.open !== false) {\n openBrowser(url).catch((err) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.warn('Error opening browser:', err?.stack || err);\n console.warn('Please open the browser manually to:', url);\n });\n } else {\n console.log('Please open the browser manually to:', url);\n }\n};\n\n// cspell:ignore Prereqs\n"]}
@@ -1,3 +1,4 @@
1
- import type { CommandFunction } from '../../types/CommandFunction.js';
2
- export declare const init: CommandFunction;
1
+ import type { CommandInitFunction } from '../../types/CommandInitFunction.js';
2
+ /** Defines the "start" verb. */
3
+ export declare const init: CommandInitFunction;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE,eAAO,MAAM,IAAI,EAAE,eAalB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAYlB,CAAC"}
@@ -1,14 +1,17 @@
1
- /* Defines the "start" verb. */
2
- export const init = (command, createAction) => {
3
- command
4
- .command('start')
5
- .description('Starts a web inner-loop from the current package folder.')
6
- .option('--log-resolve-map', 'Logs the resolve map to "resolve-map.json" for diagnostics.')
7
- .option('--features <featureName> [featureNames...]', 'Enable experimental features.')
8
- .option('--app <appPackageName>', 'Run Cloudpack targeting a specific app.')
9
- .option('--no-open', 'Do not open the browser.')
10
- .action(createAction(() => ({
11
- execute: import('./execute.js'),
12
- })));
1
+ import { Option } from 'commander';
2
+ import { createCommand } from '../../common/createCommand.js';
3
+ /** Defines the "start" verb. */
4
+ export const init = (program) => {
5
+ createCommand({
6
+ parent: program,
7
+ name: 'start',
8
+ description: 'Starts a web inner-loop from the current package folder.',
9
+ options: {
10
+ logResolveMap: new Option('--log-resolve-map', 'Logs the resolve map to "resolve-map.json" for diagnostics.'),
11
+ app: new Option('--app <appPackageName>', 'Run Cloudpack targeting a specific app.'),
12
+ open: new Option('--no-open', 'Do not open the browser.'),
13
+ },
14
+ getExecutor: () => import('./execute.js'),
15
+ });
13
16
  };
14
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;IAC7D,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,0DAA0D,CAAC;SACvE,MAAM,CAAC,mBAAmB,EAAE,6DAA6D,CAAC;SAC1F,MAAM,CAAC,4CAA4C,EAAE,+BAA+B,CAAC;SACrF,MAAM,CAAC,wBAAwB,EAAE,yCAAyC,CAAC;SAC3E,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC;SAC/C,MAAM,CACL,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC;KAChC,CAAC,CAAC,CACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\n/* Defines the \"start\" verb. */\nexport const init: CommandFunction = (command, createAction) => {\n command\n .command('start')\n .description('Starts a web inner-loop from the current package folder.')\n .option('--log-resolve-map', 'Logs the resolve map to \"resolve-map.json\" for diagnostics.')\n .option('--features <featureName> [featureNames...]', 'Enable experimental features.')\n .option('--app <appPackageName>', 'Run Cloudpack targeting a specific app.')\n .option('--no-open', 'Do not open the browser.')\n .action(\n createAction(() => ({\n execute: import('./execute.js'),\n })),\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9D,gCAAgC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,aAAa,CAAe;QAC1B,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,0DAA0D;QACvE,OAAO,EAAE;YACP,aAAa,EAAE,IAAI,MAAM,CAAC,mBAAmB,EAAE,6DAA6D,CAAC;YAC7G,GAAG,EAAE,IAAI,MAAM,CAAC,wBAAwB,EAAE,yCAAyC,CAAC;YACpF,IAAI,EAAE,IAAI,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC;SAC1D;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport { createCommand } from '../../common/createCommand.js';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { StartOptions } from './types/StartOptions.js';\n\n/** Defines the \"start\" verb. */\nexport const init: CommandInitFunction = (program) => {\n createCommand<StartOptions>({\n parent: program,\n name: 'start',\n description: 'Starts a web inner-loop from the current package folder.',\n options: {\n logResolveMap: new Option('--log-resolve-map', 'Logs the resolve map to \"resolve-map.json\" for diagnostics.'),\n app: new Option('--app <appPackageName>', 'Run Cloudpack targeting a specific app.'),\n open: new Option('--no-open', 'Do not open the browser.'),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
@@ -1,7 +1,5 @@
1
1
  export interface StartOptions {
2
2
  logResolveMap?: boolean;
3
- sourcemap?: boolean;
4
- features?: string[];
5
3
  app?: string;
6
4
  /** Whether to open the browser (default true) */
7
5
  open?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"StartOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
1
+ {"version":3,"file":"StartOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"StartOptions.js","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface StartOptions {\n logResolveMap?: boolean;\n sourcemap?: boolean;\n features?: string[];\n app?: string;\n /** Whether to open the browser (default true) */\n open?: boolean;\n}\n"]}
1
+ {"version":3,"file":"StartOptions.js","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface StartOptions {\n logResolveMap?: boolean;\n app?: string;\n /** Whether to open the browser (default true) */\n open?: boolean;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAKlE,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,WAAW,CA4C9C,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAKlE,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,WAAW,CAsC9C,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { isCIBuild } from '../../utilities/isCIBuild.js';
2
2
  import { createPartialApiContext, syncDownload, syncUpload } from '@ms-cloudpack/api-server/apis';
3
3
  import { runPrerequisites } from '../../common/runPrerequisites.js';
4
- export const execute = async ({ options, cwd, reporter, initialize, exit, autoDispose, }) => {
5
- const { config, telemetryClient } = await initialize(cwd);
6
- const { nonInteractiveLogin, upload } = options;
4
+ export const execute = async ({ options, reporter, initialize, exit, autoDispose }) => {
5
+ const { cwd, nonInteractiveLogin, upload } = options;
6
+ const { config, telemetryClient } = await initialize({ appPath: cwd });
7
7
  const remoteCacheConfig = config.remoteCache;
8
8
  if (!remoteCacheConfig) {
9
9
  console.warn('Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file to use this feature.');
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/sync/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,EAAE,EACxD,OAAO,EACP,GAAG,EACH,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1D,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChD,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC;IAC7C,IAAI,CAAC,iBAAiB,EAAE;QACtB,OAAO,CAAC,IAAI,CACV,gHAAgH,CACjH,CAAC;QACF,OAAO;KACR;IAED,MAAM,KAAK,GAAG;QACZ,kBAAkB,EAAE,CAAC,CAAC,SAAS,EAAE,IAAI,mBAAmB,CAAC;KAC1D,CAAC;IAEF,MAAM,iBAAiB,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC9E,IAAI,MAAM,EAAE;QACV,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAE9B,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CACvB,MAAM,uBAAuB,CAAC;YAC5B,GAAG,iBAAiB;YACpB,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC;SAC/D,CAAC,CACH,CAAC;QACF,MAAM,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;KAClC;SAAM;QACL,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CACvB,MAAM,uBAAuB,CAAC;YAC5B,GAAG,iBAAiB;YACpB,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;SAC/B,CAAC,CACH,CAAC;QACF,MAAM,YAAY,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;KACpC;IAED,MAAM,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import type { SyncOptions } from './types/SyncOptions.js';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { isCIBuild } from '../../utilities/isCIBuild.js';\nimport { createPartialApiContext, syncDownload, syncUpload } from '@ms-cloudpack/api-server/apis';\nimport { runPrerequisites } from '../../common/runPrerequisites.js';\n\nexport const execute: CommandAction<SyncOptions> = async ({\n options,\n cwd,\n reporter,\n initialize,\n exit,\n autoDispose,\n}) => {\n const { config, telemetryClient } = await initialize(cwd);\n const { nonInteractiveLogin, upload } = options;\n const remoteCacheConfig = config.remoteCache;\n if (!remoteCacheConfig) {\n console.warn(\n 'Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file to use this feature.',\n );\n return;\n }\n\n const input = {\n isInteractiveLogin: !(isCIBuild() || nonInteractiveLogin),\n };\n\n const apiContextOptions = { appPath: cwd, config, reporter, telemetryClient };\n if (upload) {\n runPrerequisites(config, cwd);\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n ...apiContextOptions,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session'],\n }),\n );\n await syncUpload({ input, ctx });\n } else {\n const [ctx] = autoDispose(\n await createPartialApiContext({\n ...apiContextOptions,\n items: ['packages', 'session'],\n }),\n );\n await syncDownload({ input, ctx });\n }\n\n await exit({ exitCode: 0 });\n};\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/sync/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE;IAChH,MAAM,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACrD,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEvE,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC;IAC7C,IAAI,CAAC,iBAAiB,EAAE;QACtB,OAAO,CAAC,IAAI,CACV,gHAAgH,CACjH,CAAC;QACF,OAAO;KACR;IAED,MAAM,KAAK,GAAG;QACZ,kBAAkB,EAAE,CAAC,CAAC,SAAS,EAAE,IAAI,mBAAmB,CAAC;KAC1D,CAAC;IAEF,MAAM,iBAAiB,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC9E,IAAI,MAAM,EAAE;QACV,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAE9B,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CACvB,MAAM,uBAAuB,CAAC;YAC5B,GAAG,iBAAiB;YACpB,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC;SAC/D,CAAC,CACH,CAAC;QACF,MAAM,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;KAClC;SAAM;QACL,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CACvB,MAAM,uBAAuB,CAAC;YAC5B,GAAG,iBAAiB;YACpB,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;SAC/B,CAAC,CACH,CAAC;QACF,MAAM,YAAY,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;KACpC;IAED,MAAM,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import type { SyncOptions } from './types/SyncOptions.js';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { isCIBuild } from '../../utilities/isCIBuild.js';\nimport { createPartialApiContext, syncDownload, syncUpload } from '@ms-cloudpack/api-server/apis';\nimport { runPrerequisites } from '../../common/runPrerequisites.js';\n\nexport const execute: CommandAction<SyncOptions> = async ({ options, reporter, initialize, exit, autoDispose }) => {\n const { cwd, nonInteractiveLogin, upload } = options;\n const { config, telemetryClient } = await initialize({ appPath: cwd });\n\n const remoteCacheConfig = config.remoteCache;\n if (!remoteCacheConfig) {\n console.warn(\n 'Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file to use this feature.',\n );\n return;\n }\n\n const input = {\n isInteractiveLogin: !(isCIBuild() || nonInteractiveLogin),\n };\n\n const apiContextOptions = { appPath: cwd, config, reporter, telemetryClient };\n if (upload) {\n runPrerequisites(config, cwd);\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n ...apiContextOptions,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session'],\n }),\n );\n await syncUpload({ input, ctx });\n } else {\n const [ctx] = autoDispose(\n await createPartialApiContext({\n ...apiContextOptions,\n items: ['packages', 'session'],\n }),\n );\n await syncDownload({ input, ctx });\n }\n\n await exit({ exitCode: 0 });\n};\n"]}
@@ -1,4 +1,4 @@
1
- import type { CommandFunction } from '../../types/CommandFunction.js';
1
+ import type { CommandInitFunction } from '../../types/CommandInitFunction.js';
2
2
  /** Defines the "sync" verb. */
3
- export declare const init: CommandFunction;
3
+ export declare const init: CommandInitFunction;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,eAalB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,mBAelB,CAAC"}
@@ -1,12 +1,16 @@
1
+ import { Option } from 'commander';
2
+ import { createCommand } from '../../common/createCommand.js';
1
3
  /** Defines the "sync" verb. */
2
- export const init = (command, createAction) => {
3
- command
4
- .command('sync')
5
- .description('Syncs the packages from/to the remote cache. If the package is not in the local cache, it will be downloaded.')
6
- .option('--upload', 'Uploads the packages to the remote cache.')
7
- .option('--non-interactive-login', 'Disables interactive login prompts for authentication.')
8
- .action(createAction(() => ({
9
- execute: import('./execute.js'),
10
- })));
4
+ export const init = (program) => {
5
+ createCommand({
6
+ parent: program,
7
+ name: 'sync',
8
+ description: 'Syncs the packages from/to the remote cache. If the package is not in the local cache, it will be downloaded.',
9
+ options: {
10
+ upload: new Option('--upload', 'Uploads the packages to the remote cache.'),
11
+ nonInteractiveLogin: new Option('--non-interactive-login', 'Disables interactive login prompts for authentication.'),
12
+ },
13
+ getExecutor: () => import('./execute.js'),
14
+ });
11
15
  };
12
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;IAC7D,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,+GAA+G,CAChH;SACA,MAAM,CAAC,UAAU,EAAE,2CAA2C,CAAC;SAC/D,MAAM,CAAC,yBAAyB,EAAE,wDAAwD,CAAC;SAC3F,MAAM,CACL,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC;KAChC,CAAC,CAAC,CACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\n/** Defines the \"sync\" verb. */\nexport const init: CommandFunction = (command, createAction) => {\n command\n .command('sync')\n .description(\n 'Syncs the packages from/to the remote cache. If the package is not in the local cache, it will be downloaded.',\n )\n .option('--upload', 'Uploads the packages to the remote cache.')\n .option('--non-interactive-login', 'Disables interactive login prompts for authentication.')\n .action(\n createAction(() => ({\n execute: import('./execute.js'),\n })),\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9D,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,aAAa,CAAc;QACzB,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,+GAA+G;QACjH,OAAO,EAAE;YACP,MAAM,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,2CAA2C,CAAC;YAC3E,mBAAmB,EAAE,IAAI,MAAM,CAC7B,yBAAyB,EACzB,wDAAwD,CACzD;SACF;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport { createCommand } from '../../common/createCommand.js';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { SyncOptions } from './types/SyncOptions.js';\n\n/** Defines the \"sync\" verb. */\nexport const init: CommandInitFunction = (program) => {\n createCommand<SyncOptions>({\n parent: program,\n name: 'sync',\n description:\n 'Syncs the packages from/to the remote cache. If the package is not in the local cache, it will be downloaded.',\n options: {\n upload: new Option('--upload', 'Uploads the packages to the remote cache.'),\n nonInteractiveLogin: new Option(\n '--non-interactive-login',\n 'Disables interactive login prompts for authentication.',\n ),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
@@ -0,0 +1,29 @@
1
+ import { Option, Command } from 'commander';
2
+ import type { CommandActionModule } from '../types/CommandAction.js';
3
+ /**
4
+ * Options for creating a command.
5
+ * This helps enforce that all commands have a description and shared options.
6
+ *
7
+ * `TOptions` should be the command-specific options (if any), e.g. `StartOptions`.
8
+ */
9
+ interface CreateCommandOptions<TOptions extends object> {
10
+ /** Parent of this command: usually the program, or could be a sub-command for sub-sub-commands */
11
+ parent: Command;
12
+ /** Command name */
13
+ name: string;
14
+ /** Command description */
15
+ description: string;
16
+ /** Options specific to this command. The record ensures that all options are available in the CLI. */
17
+ options?: Record<keyof TOptions, Option>;
18
+ /** Function returning an async import of the command's `src/commands/<name>/execute.ts` module */
19
+ getExecutor?: () => Promise<CommandActionModule<TOptions>>;
20
+ }
21
+ /**
22
+ * Create a command, ensuring that it has an option for each common option, as well as each key of
23
+ * TOptions if `params.options` is provided.
24
+ * @param params Usually an object with command options, or just a name for the root command.
25
+ * @returns The created command, for any further modifications.
26
+ */
27
+ export declare function createCommand<TOptions extends object>(params: string | CreateCommandOptions<TOptions>): Command;
28
+ export {};
29
+ //# sourceMappingURL=createCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCommand.d.ts","sourceRoot":"","sources":["../../src/common/createCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIrE;;;;;GAKG;AACH,UAAU,oBAAoB,CAAC,QAAQ,SAAS,MAAM;IACpD,kGAAkG;IAClG,MAAM,EAAE,OAAO,CAAC;IAChB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,sGAAsG;IACtG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzC,kGAAkG;IAClG,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC5D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,WAkCrG"}